mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
新增+修复+优化
+ 新增子网代理页面 表格查看代理情况 + 修复子网代理启动联机被覆盖的bug + 优化部分代码逻辑
This commit is contained in:
@@ -9,9 +9,8 @@
|
|||||||
import { warn, debug, trace, info, error } from "@tauri-apps/plugin-log";
|
import { warn, debug, trace, info, error } from "@tauri-apps/plugin-log";
|
||||||
function forwardConsole(fnName: "log" | "debug" | "info" | "warn" | "error", logger: (message: string) => Promise<void>) {
|
function forwardConsole(fnName: "log" | "debug" | "info" | "warn" | "error", logger: (message: string) => Promise<void>) {
|
||||||
const original = console[fnName];
|
const original = console[fnName];
|
||||||
console[fnName] = (message) => {
|
console[fnName] = message => {
|
||||||
original(message);
|
original(message);
|
||||||
if (import.meta.env.PROD) {
|
|
||||||
try {
|
try {
|
||||||
if (typeof message === "string") {
|
if (typeof message === "string") {
|
||||||
logger(message);
|
logger(message);
|
||||||
@@ -21,14 +20,15 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger(`${message}`);
|
logger(`${message}`);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (import.meta.env.PROD) {
|
||||||
forwardConsole("log", info);
|
forwardConsole("log", info);
|
||||||
forwardConsole("debug", debug);
|
forwardConsole("debug", debug);
|
||||||
forwardConsole("info", info);
|
forwardConsole("info", info);
|
||||||
forwardConsole("warn", warn);
|
forwardConsole("warn", warn);
|
||||||
forwardConsole("error", error);
|
forwardConsole("error", error);
|
||||||
|
}
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
// console.log(mainStore.theme)
|
// console.log(mainStore.theme)
|
||||||
|
|||||||
+97
-3
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-full flex flex-col gap-[10px]">
|
<div class="flex h-full flex-col gap-[10px]">
|
||||||
<ElRadioGroup v-model="mainStore.cidrEnable">
|
<ElRadioGroup
|
||||||
|
:disabled="!data.isSwitchEnable"
|
||||||
|
v-model="mainStore.cidrEnable"
|
||||||
|
>
|
||||||
<ElRadioButton :value="true">开启</ElRadioButton>
|
<ElRadioButton :value="true">开启</ElRadioButton>
|
||||||
<ElRadioButton :value="false">关闭</ElRadioButton>
|
<ElRadioButton :value="false">关闭</ElRadioButton>
|
||||||
</ElRadioGroup>
|
</ElRadioGroup>
|
||||||
@@ -9,16 +12,107 @@
|
|||||||
placeholder="例如: 192.168.1.0/24 一行一个"
|
placeholder="例如: 192.168.1.0/24 一行一个"
|
||||||
v-model="mainStore.config.proxyNetworks"
|
v-model="mainStore.config.proxyNetworks"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="30"
|
:rows="5"
|
||||||
resize="none"
|
resize="none"
|
||||||
></ElInput>
|
></ElInput>
|
||||||
|
<ElTable
|
||||||
|
stripe
|
||||||
|
border
|
||||||
|
empty-text="暂无数据"
|
||||||
|
:data="data.route"
|
||||||
|
class="mt-[5px]"
|
||||||
|
>
|
||||||
|
<ElTableColumn
|
||||||
|
sortable
|
||||||
|
width="140"
|
||||||
|
label="主机名"
|
||||||
|
prop="hostname"
|
||||||
|
></ElTableColumn>
|
||||||
|
<ElTableColumn
|
||||||
|
width="120"
|
||||||
|
sortable
|
||||||
|
label="虚拟网IP"
|
||||||
|
prop="ipv4"
|
||||||
|
></ElTableColumn>
|
||||||
|
<ElTableColumn
|
||||||
|
sortable
|
||||||
|
label="被代理的子网"
|
||||||
|
prop="proxy_cidrs"
|
||||||
|
></ElTableColumn>
|
||||||
|
</ElTable>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { dataSubscribe } from "@/composables/windows";
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
||||||
|
import { ATJ, parseCliInfo } from "@/utils";
|
||||||
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
|
|
||||||
|
const data = reactive<{ [key: string]: any }>({
|
||||||
|
route: [],
|
||||||
|
isStart: false,
|
||||||
|
isSwitchEnable: false,
|
||||||
|
isRunning: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const listenOutput = async () => {
|
||||||
|
data.isRunning = true;
|
||||||
|
const [error, member] = await ATJ(invoke<string>("get_route_by_cli"));
|
||||||
|
data.isRunning = false;
|
||||||
|
// if(!member) return;
|
||||||
|
if (error) {
|
||||||
|
data.route = [];
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (member === "_EasytierGameCliFailedToConnect_") {
|
||||||
|
data.route = [];
|
||||||
|
await listenOutput();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const routeInfo = parseCliInfo(member);
|
||||||
|
routeInfo.forEach(value => {
|
||||||
|
if (value.cost === "Local") {
|
||||||
|
value.cost = "本机";
|
||||||
|
}
|
||||||
|
if (value.ipv4 && value.ipv4.includes("/")) {
|
||||||
|
value.ipv4 = value.ipv4.split("/")[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
data.route = routeInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
const listenStart = async () => {
|
||||||
|
const unListen = await listen<boolean>("route", async event => {
|
||||||
|
data.isStart = event.payload;
|
||||||
|
if (data.isStart) {
|
||||||
|
data.isSwitchEnable = false;
|
||||||
|
if (mainStore.cidrEnable && !data.isRunning) {
|
||||||
|
await listenOutput();
|
||||||
|
} else {
|
||||||
|
data.route = [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data.isSwitchEnable = true;
|
||||||
|
data.route = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return unListen;
|
||||||
|
};
|
||||||
|
|
||||||
|
let unlistenStart: UnlistenFn | null = null;
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
unlistenStart = await listenStart();
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
unlistenStart && unlistenStart();
|
||||||
|
});
|
||||||
|
|
||||||
dataSubscribe(async (...a) => {
|
dataSubscribe(async (...a) => {
|
||||||
return { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } };
|
return { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } };
|
||||||
});
|
});
|
||||||
|
|||||||
+37
-17
@@ -518,11 +518,11 @@
|
|||||||
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { getCurrentWindow, type Window } from "@tauri-apps/api/window";
|
||||||
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||||
import etWindows from "@/composables/windows";
|
import etWindows from "@/composables/windows";
|
||||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||||
import { readDir, exists, mkdir, BaseDirectory, readTextFile } from "@tauri-apps/plugin-fs";
|
import { readDir, exists, mkdir, BaseDirectory, readTextFile, readFile } from "@tauri-apps/plugin-fs";
|
||||||
import { updateConfigJson } from "~/composables/configJson";
|
import { updateConfigJson } from "~/composables/configJson";
|
||||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { sortedUniq, uniq } from "lodash-es";
|
import { sortedUniq, uniq } from "lodash-es";
|
||||||
@@ -648,6 +648,18 @@
|
|||||||
mainStore.basePeers = uniq([mainStore.config.serverUrl, ...mainStore.basePeers]);
|
mainStore.basePeers = uniq([mainStore.config.serverUrl, ...mainStore.basePeers]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 手动触发持久化数据
|
||||||
|
const persist = async (appWindow: Window) => {
|
||||||
|
try {
|
||||||
|
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
||||||
|
mainStore.$persist();
|
||||||
|
}catch(err) {
|
||||||
|
console.error(err);
|
||||||
|
ElMessage.error("手动持久数据失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const listenObj: { [key: string]: any } = {
|
const listenObj: { [key: string]: any } = {
|
||||||
unListenOutPut: null,
|
unListenOutPut: null,
|
||||||
unListenThreadId: null,
|
unListenThreadId: null,
|
||||||
@@ -742,7 +754,6 @@
|
|||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
const unListen = await listen("config", event => {
|
const unListen = await listen("config", event => {
|
||||||
const ipv4 = config.ipv4;
|
const ipv4 = config.ipv4;
|
||||||
console.log(event.payload)
|
|
||||||
mainStore.$patch(event.payload as any);
|
mainStore.$patch(event.payload as any);
|
||||||
config.ipv4 = ipv4;
|
config.ipv4 = ipv4;
|
||||||
if(mainStore.config.enablePreventSleep) {
|
if(mainStore.config.enablePreventSleep) {
|
||||||
@@ -750,10 +761,10 @@
|
|||||||
}else {
|
}else {
|
||||||
stopPreventSleep();
|
stopPreventSleep();
|
||||||
}
|
}
|
||||||
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
persist(appWindow);
|
||||||
});
|
});
|
||||||
const unListen2 = mainStore.$subscribe(() => {
|
const unListen2 = mainStore.$subscribe(() => {
|
||||||
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
persist(appWindow);
|
||||||
})
|
})
|
||||||
this.unListenConfigStart = [unListen, unListen2];
|
this.unListenConfigStart = [unListen, unListen2];
|
||||||
},
|
},
|
||||||
@@ -894,9 +905,11 @@
|
|||||||
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||||
const isExists = await exists(path, { baseDir: BaseDirectory.Resource });
|
const isExists = await exists(path, { baseDir: BaseDirectory.Resource });
|
||||||
if (isExists) {
|
if (isExists) {
|
||||||
const guiJsonStr = await readTextFile(path, { baseDir: BaseDirectory.Resource });
|
const guiJsonStrUint8 = await readFile(path, { baseDir: BaseDirectory.Resource });
|
||||||
if (guiJsonStr) {
|
if (guiJsonStrUint8) {
|
||||||
try {
|
try {
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
const guiJsonStr = decoder.decode(guiJsonStrUint8);
|
||||||
const regex = /^(\s*\/\/.*)/gm;
|
const regex = /^(\s*\/\/.*)/gm;
|
||||||
const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
|
const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
|
||||||
const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
||||||
@@ -926,7 +939,7 @@
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
ElMessage.error(`config.json格式错误`);
|
ElMessage.error(`config.json格式或编码错误`);
|
||||||
} finally {
|
} finally {
|
||||||
mainStore.$patch({
|
mainStore.$patch({
|
||||||
createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
|
createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
|
||||||
@@ -975,6 +988,7 @@
|
|||||||
|
|
||||||
let logsTimer: NodeJS.Timeout | null = null;
|
let logsTimer: NodeJS.Timeout | null = null;
|
||||||
let serverLogsTimer: NodeJS.Timeout | null = null;
|
let serverLogsTimer: NodeJS.Timeout | null = null;
|
||||||
|
let cidrTimer : NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await initGuiJson();
|
await initGuiJson();
|
||||||
@@ -1003,6 +1017,7 @@
|
|||||||
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
||||||
logsTimer && clearInterval(logsTimer);
|
logsTimer && clearInterval(logsTimer);
|
||||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||||
|
cidrTimer && clearInterval(cidrTimer);
|
||||||
stopPreventSleep();
|
stopPreventSleep();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1084,13 +1099,13 @@
|
|||||||
args.push("-l", config.port);
|
args.push("-l", config.port);
|
||||||
}
|
}
|
||||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
if (mainStore.cidrEnable && config.proxyNetworks) {
|
||||||
// console.error(config.proxyNetworks);
|
let formatProxyNetworks = config.proxyNetworks.split("\n");
|
||||||
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
|
const newformatProxyNetworks = formatProxyNetworks
|
||||||
const formatProxyNetworks = config.proxyNetworks
|
.map(el => el.trim())
|
||||||
.split("\n")
|
.filter(cidr => {
|
||||||
.map(item => item.trim())
|
return /^\d+\.\d+\.\d+\.\d+\/\d+$/g.test(cidr);
|
||||||
.filter(item => item && reg.test(item));
|
});
|
||||||
args.push("--proxy-networks", ...formatProxyNetworks);
|
args.push("--proxy-networks", ...newformatProxyNetworks);
|
||||||
config.proxyNetworks = formatProxyNetworks.join("\n");
|
config.proxyNetworks = formatProxyNetworks.join("\n");
|
||||||
}
|
}
|
||||||
if (config.disableEncryption) {
|
if (config.disableEncryption) {
|
||||||
@@ -1168,10 +1183,10 @@
|
|||||||
data.startLoading = true;
|
data.startLoading = true;
|
||||||
await unListenAll();
|
await unListenAll();
|
||||||
await listenObj.listenOutput();
|
await listenObj.listenOutput();
|
||||||
|
|
||||||
await invoke("run_command", {
|
await invoke("run_command", {
|
||||||
args
|
args
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1335,8 +1350,13 @@
|
|||||||
},
|
},
|
||||||
(_, appWindow) => {
|
(_, appWindow) => {
|
||||||
data.cidrVisible = true;
|
data.cidrVisible = true;
|
||||||
|
cidrTimer && clearInterval(cidrTimer);
|
||||||
|
cidrTimer = setInterval(() => {
|
||||||
|
appWindow.emitTo({ kind: "WebviewWindow", label: "cidr" }, "route", data.isStart);
|
||||||
|
}, 1000);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
cidrTimer && clearInterval(cidrTimer);
|
||||||
data.cidrVisible = false;
|
data.cidrVisible = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const listenStart = async () => {
|
const listenStart = async () => {
|
||||||
const unListen = await listen("logs", event => {
|
const unListen = await listen<string>("logs", event => {
|
||||||
data.log = (event.payload as string) || "";
|
data.log = event.payload || "";
|
||||||
});
|
});
|
||||||
return unListen;
|
return unListen;
|
||||||
};
|
};
|
||||||
|
|||||||
+18
-9
@@ -1,7 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="overflow-auto h-full">
|
<div class="h-full overflow-auto">
|
||||||
<div class="w-[1200px]">
|
<div class="w-[1200px]">
|
||||||
<ElText size="small" v-if="!data.member || data.member.length <= 0">{{ "等待成员信息中..." }}</ElText>
|
<ElText
|
||||||
|
size="small"
|
||||||
|
v-if="!data.member || data.member.length <= 0"
|
||||||
|
>
|
||||||
|
{{ "等待成员信息中..." }}
|
||||||
|
</ElText>
|
||||||
<ElTable
|
<ElTable
|
||||||
stripe
|
stripe
|
||||||
border
|
border
|
||||||
@@ -15,7 +20,11 @@
|
|||||||
prop="hostname"
|
prop="hostname"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ (row.hostname || "").toLowerCase().includes('publicserver') ? (row.hostname || "").replace("PublicServer", "服务器") : (row.hostname || "-") }}
|
{{
|
||||||
|
(row.hostname || "").toLowerCase().includes("publicserver")
|
||||||
|
? (row.hostname || "").replace("PublicServer", "服务器")
|
||||||
|
: row.hostname || "-"
|
||||||
|
}}
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
@@ -96,7 +105,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { ATJ, parsePeerInfo } from "@/utils";
|
import { ATJ, parseCliInfo } from "@/utils";
|
||||||
import { ElConfirmDanger } from "~/utils/element";
|
import { ElConfirmDanger } from "~/utils/element";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
// enum NatType {
|
// enum NatType {
|
||||||
@@ -126,7 +135,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
|
|||||||
};
|
};
|
||||||
type natKyes = keyof typeof natMaps;
|
type natKyes = keyof typeof natMaps;
|
||||||
|
|
||||||
const data = reactive<{ member: {hostname: string, cost: string, ipv4: string, lat_msg: string, loss_rate: string, nat_type: string}[] }>({
|
const data = reactive<{ member: { hostname: string; cost: string; ipv4: string; lat_msg: string; loss_rate: string; nat_type: string }[] }>({
|
||||||
member: []
|
member: []
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -139,8 +148,8 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
|
|||||||
["nat_type", "NAT类型"],
|
["nat_type", "NAT类型"],
|
||||||
["version", "版本"],
|
["version", "版本"],
|
||||||
["tunnel_proto", "隧道协议"],
|
["tunnel_proto", "隧道协议"],
|
||||||
['rx_bytes', '接收'],
|
["rx_bytes", "接收"],
|
||||||
['tx_bytes', '传输']
|
["tx_bytes", "传输"]
|
||||||
];
|
];
|
||||||
|
|
||||||
let timer: NodeJS.Timeout | null = null;
|
let timer: NodeJS.Timeout | null = null;
|
||||||
@@ -167,7 +176,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const peerInfo = parsePeerInfo(member);
|
const peerInfo = parseCliInfo(member);
|
||||||
peerInfo.forEach(value => {
|
peerInfo.forEach(value => {
|
||||||
if (value.cost === "Local") {
|
if (value.cost === "Local") {
|
||||||
value.cost = "本机";
|
value.cost = "本机";
|
||||||
@@ -191,7 +200,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
|
|||||||
const stopTimer = () => {
|
const stopTimer = () => {
|
||||||
timer && clearTimeout(timer);
|
timer && clearTimeout(timer);
|
||||||
timer = null;
|
timer = null;
|
||||||
}
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await listenOutput();
|
await listenOutput();
|
||||||
|
|||||||
@@ -221,6 +221,32 @@ async fn get_members_by_cli() -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
async fn get_route_by_cli() -> String {
|
||||||
|
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
|
||||||
|
match tokioCommand::new(&cli_path)
|
||||||
|
.arg("route")
|
||||||
|
.creation_flags(0x08000000)
|
||||||
|
.output()
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(output) => {
|
||||||
|
if output.status.success() {
|
||||||
|
let output_str = String::from_utf8_lossy(&output.stdout);
|
||||||
|
return output_str.trim().to_string();
|
||||||
|
} else {
|
||||||
|
let output_str = String::from_utf8_lossy(&output.stderr);
|
||||||
|
log::error!("{}", output_str.trim().to_string());
|
||||||
|
return "_EasytierGameCliFailedToConnect_".to_string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_e) => {
|
||||||
|
log::error!("get route list error");
|
||||||
|
return "".to_string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command(rename_all = "snake_case")]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
async fn download_easytier_zip(download_url: String, file_name: String) {
|
async fn download_easytier_zip(download_url: String, file_name: String) {
|
||||||
let cache_dir_path = get_tool_exe_path("\\easytier\\cache");
|
let cache_dir_path = get_tool_exe_path("\\easytier\\cache");
|
||||||
@@ -685,6 +711,7 @@ pub fn run() {
|
|||||||
fetch_game_releases,
|
fetch_game_releases,
|
||||||
download_easytier_zip,
|
download_easytier_zip,
|
||||||
get_members_by_cli,
|
get_members_by_cli,
|
||||||
|
get_route_by_cli,
|
||||||
search_pid_by_pname,
|
search_pid_by_pname,
|
||||||
get_exe_directory,
|
get_exe_directory,
|
||||||
spawn_autostart,
|
spawn_autostart,
|
||||||
|
|||||||
+5
-3
@@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from "pinia";
|
import { acceptHMRUpdate, defineStore } from "pinia";
|
||||||
export default defineStore("main", {
|
const store = defineStore("main", {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
config: {
|
config: {
|
||||||
@@ -35,7 +35,7 @@ export default defineStore("main", {
|
|||||||
customProtocol: "tcp", //自定义默认协议
|
customProtocol: "tcp", //自定义默认协议
|
||||||
enableNetCardMetric: false, //启用网卡自定义跃点
|
enableNetCardMetric: false, //启用网卡自定义跃点
|
||||||
netCardMetricValue: 1, //自定义网卡跃点值
|
netCardMetricValue: 1, //自定义网卡跃点值
|
||||||
enablePreventSleep: false, //组织系统休眠
|
enablePreventSleep: false //组织系统休眠
|
||||||
},
|
},
|
||||||
serverConfig: {
|
serverConfig: {
|
||||||
enableWhiteList: true, // 是否启用白名单
|
enableWhiteList: true, // 是否启用白名单
|
||||||
@@ -115,3 +115,5 @@ export default defineStore("main", {
|
|||||||
// omit: ["winipBcPid", "winipBcStart"]
|
// omit: ["winipBcPid", "winipBcStart"]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (import.meta.hot) import.meta.hot.accept(acceptHMRUpdate(store, import.meta.hot));
|
||||||
|
export default store;
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ export const stopPreventSleep = () => {
|
|||||||
_prevent_timer = null;
|
_prevent_timer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parsePeerInfo = (content: string) => {
|
export const parseCliInfo = (content: string) => {
|
||||||
if(!content) return [];
|
if(!content) return [];
|
||||||
// 将表格字符串分割成行
|
// 将表格字符串分割成行
|
||||||
const lines = content.split("\n");
|
const lines = content.split("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user