mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d6e93d796 | ||
|
|
0253d95597 | ||
|
|
a2be6ebe86 | ||
|
|
b94d5de463 | ||
|
|
e8b82007c2 | ||
|
|
5d11f39855 | ||
|
|
5875b30c34 |
+23
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["prettier-plugin-tailwindcss"],
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"htmlWhitespaceSensitivity": "ignore",
|
||||||
|
"insertPragma": false,
|
||||||
|
"singleAttributePerLine": true,
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"jsxBracketSameLine": false,
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"printWidth": 150,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"requirePragma": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": false,
|
||||||
|
"tabWidth": 4,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"useTabs": true,
|
||||||
|
"embeddedLanguageFormatting": "auto",
|
||||||
|
"vueIndentScriptAndStyle": true
|
||||||
|
}
|
||||||
@@ -46,4 +46,8 @@ html.dark body {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table {
|
||||||
|
font-size: 12px!important;
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,10 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
|
|||||||
saveErrorLog,
|
saveErrorLog,
|
||||||
logLevel,
|
logLevel,
|
||||||
serverUrl,
|
serverUrl,
|
||||||
|
port,
|
||||||
|
enableCustomListener,
|
||||||
|
enablePreventSleep,
|
||||||
|
customListenerData,
|
||||||
...otherConfig
|
...otherConfig
|
||||||
} = mainStore.config;
|
} = mainStore.config;
|
||||||
let writeServerUrl: Array<string> | string = serverUrl;
|
let writeServerUrl: Array<string> | string = serverUrl;
|
||||||
|
|||||||
+46
-42
@@ -6,51 +6,55 @@ import { BaseDirectory } from "@tauri-apps/api/path";
|
|||||||
import { exists } from "@tauri-apps/plugin-fs";
|
import { exists } from "@tauri-apps/plugin-fs";
|
||||||
|
|
||||||
const getWinIpBroadcastPid = async () => {
|
const getWinIpBroadcastPid = async () => {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
||||||
mainStore.winipBcPid = (pid as number) || 0;
|
mainStore.winipBcPid = (pid as number) || 0;
|
||||||
if (mainStore.winipBcPid && mainStore.winipBcPid > 0) {
|
mainStore.$patch({
|
||||||
mainStore.winipBcStart = true;
|
winipBcStart: !!(mainStore.winipBcPid && mainStore.winipBcPid > 0)
|
||||||
} else {
|
});
|
||||||
mainStore.winipBcStart = false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const handleWinipBcStart = async () => {
|
export const handleWinipBcStart = async () => {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
if (!mainStore.winipBcStart) {
|
if (!mainStore.winipBcStart) {
|
||||||
try {
|
try {
|
||||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||||
const isExists = await exists("easytier/tool/WinIPBroadcast.exe", { baseDir: BaseDirectory.Resource });
|
const isExists = await exists("easytier/tool/WinIPBroadcast.exe", { baseDir: BaseDirectory.Resource });
|
||||||
if(!isExists) {
|
if (!isExists) {
|
||||||
ElMessage.error(`WinipBc不存在`);
|
ElMessage.error(`WinipBc不存在`);
|
||||||
console.error(`WinipBc不存在`);
|
console.error(`WinipBc不存在`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
||||||
mainStore.winipBcPid = child.pid || 0;
|
mainStore.winipBcPid = child.pid || 0;
|
||||||
if (mainStore.winipBcPid) {
|
await getWinIpBroadcastPid();
|
||||||
mainStore.winipBcStart = true;
|
if (mainStore.winipBcPid) {
|
||||||
mainStore.winIpBcAutoStart = true;
|
mainStore.$patch({
|
||||||
} else {
|
winIpBcAutoStart: true
|
||||||
ElMessage.error(`WinipBc失败`);
|
});
|
||||||
}
|
} else {
|
||||||
} catch (err) {
|
ElMessage.error(`WinipBc失败`);
|
||||||
ElMessage.error(`WinipBc失败`);
|
}
|
||||||
console.error(err);
|
} catch (err) {
|
||||||
}
|
ElMessage.error(`WinipBc失败`);
|
||||||
} else {
|
console.error(err);
|
||||||
mainStore.winIpBcAutoStart = false;
|
}
|
||||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
} else {
|
||||||
await getWinIpBroadcastPid();
|
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||||
}
|
await getWinIpBroadcastPid();
|
||||||
|
if (mainStore.winipBcPid <= 0) {
|
||||||
|
mainStore.$patch({
|
||||||
|
winIpBcAutoStart: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initStartWinIpBroadcast = async () => {
|
export const initStartWinIpBroadcast = async () => {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
await getWinIpBroadcastPid();
|
await getWinIpBroadcastPid();
|
||||||
// console.error(mainStore.winipBcStart, mainStore.winIpBcAutoStart)
|
// console.error(mainStore.winipBcStart, mainStore.winIpBcAutoStart)
|
||||||
if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) {
|
if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) {
|
||||||
await handleWinipBcStart();
|
await handleWinipBcStart();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ export const getServerArgs = () => {
|
|||||||
.split("\n")
|
.split("\n")
|
||||||
.map(el => el.trim())
|
.map(el => el.trim())
|
||||||
.filter(el => el)
|
.filter(el => el)
|
||||||
.join(" ");
|
|
||||||
if (whiteList && mainStore.serverConfig.enableWhiteList) {
|
if (whiteList && mainStore.serverConfig.enableWhiteList) {
|
||||||
args.push("--relay-network-whitelist", whiteList);
|
args.push("--relay-network-whitelist", ...whiteList);
|
||||||
}
|
}
|
||||||
if (!whiteList && mainStore.serverConfig.enableWhiteList) {
|
if (!whiteList && mainStore.serverConfig.enableWhiteList) {
|
||||||
args.push("--relay-network-whitelist");
|
args.push("--relay-network-whitelist");
|
||||||
|
|||||||
+36
-6
@@ -2,17 +2,22 @@ import { type UnlistenFn } from "@tauri-apps/api/event";
|
|||||||
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window, currentMonitor } from "@tauri-apps/api/window";
|
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window, currentMonitor } from "@tauri-apps/api/window";
|
||||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||||
import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
|
import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
|
||||||
|
import useMainStore from "@/stores/index";
|
||||||
|
import { onBeforeUnmount } from "vue";
|
||||||
|
|
||||||
|
const _listenersMaps: { [key: string]: [UnlistenFn | null, UnlistenFn | null] } = {};
|
||||||
|
|
||||||
export default async (
|
export default async (
|
||||||
label: WebviewLabel,
|
label: WebviewLabel,
|
||||||
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
||||||
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
|
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
|
||||||
beforeCloseFunc?: () => void | null
|
beforeCloseFunc?: () => void | null
|
||||||
) => {
|
) => {
|
||||||
let unListenlogClose: UnlistenFn | null = null;
|
const unlistenFnList: [UnlistenFn | null, UnlistenFn | null] = _listenersMaps[label] || [null, null];
|
||||||
let unlistenLogCreated: UnlistenFn | null = null;
|
let [unlistenLogCreated, unListenlogClose] = unlistenFnList;
|
||||||
let dialog = await WebviewWindow.getByLabel(label);
|
let dialog = await WebviewWindow.getByLabel(label);
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
let defaultOpts: {[key:string]: any, parent: Window | undefined} = {
|
let defaultOpts: { [key: string]: any; parent: Window | undefined } = {
|
||||||
parent: undefined,
|
parent: undefined,
|
||||||
closable: true,
|
closable: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
@@ -25,17 +30,16 @@ export default async (
|
|||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
if (appWindow) {
|
if (appWindow) {
|
||||||
const appSize = await appWindow.outerSize();
|
const appSize = await appWindow.outerSize();
|
||||||
// const monitor = await currentMonitor();
|
|
||||||
// console.error(monitor)
|
|
||||||
const factor = await appWindow.scaleFactor();
|
const factor = await appWindow.scaleFactor();
|
||||||
const appPosition = await appWindow.outerPosition();
|
const appPosition = await appWindow.outerPosition();
|
||||||
// console.error((appPosition.x + appSize.width) / 1.25);
|
|
||||||
const logicalPosition = new PhysicalPosition(appPosition.x + appSize.width, appPosition.y).toLogical(factor);
|
const logicalPosition = new PhysicalPosition(appPosition.x + appSize.width, appPosition.y).toLogical(factor);
|
||||||
defaultOpts.parent = appWindow;
|
defaultOpts.parent = appWindow;
|
||||||
// console.error(logicalPosition);
|
// console.error(logicalPosition);
|
||||||
defaultOpts.x = logicalPosition.x;
|
defaultOpts.x = logicalPosition.x;
|
||||||
defaultOpts.y = logicalPosition.y;
|
defaultOpts.y = logicalPosition.y;
|
||||||
}
|
}
|
||||||
|
unlistenLogCreated && (await (unlistenLogCreated as Function)());
|
||||||
|
unListenlogClose && (await unListenlogClose());
|
||||||
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
||||||
unlistenLogCreated = await dialog.listen("tauri://webview-created", async () => {
|
unlistenLogCreated = await dialog.listen("tauri://webview-created", async () => {
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
@@ -43,10 +47,14 @@ export default async (
|
|||||||
await dialog.show();
|
await dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
unlistenFnList[0] = unlistenLogCreated;
|
||||||
unListenlogClose = await dialog.onCloseRequested(async () => {
|
unListenlogClose = await dialog.onCloseRequested(async () => {
|
||||||
beforeCloseFunc && (await beforeCloseFunc());
|
beforeCloseFunc && (await beforeCloseFunc());
|
||||||
unListenlogClose && (await unListenlogClose());
|
unListenlogClose && (await unListenlogClose());
|
||||||
|
unlistenLogCreated && (await (unlistenLogCreated as Function)());
|
||||||
});
|
});
|
||||||
|
unlistenFnList[1] = unlistenLogCreated;
|
||||||
|
_listenersMaps[label] = unlistenFnList;
|
||||||
} else {
|
} else {
|
||||||
const visible = await dialog.isVisible();
|
const visible = await dialog.isVisible();
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -55,3 +63,25 @@ export default async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const dataSubscribe = async (cb?: (...args: any) => any) => {
|
||||||
|
if (!cb) return;
|
||||||
|
const mainStore = useMainStore();
|
||||||
|
const currentWindow = getCurrentWindow();
|
||||||
|
let removeSubscribe = mainStore.$subscribe(async (...args) => {
|
||||||
|
const emitData = await cb(args);
|
||||||
|
await currentWindow.emitTo({ kind: "Window", label: "main" }, "config", emitData);
|
||||||
|
});
|
||||||
|
const unlisten = currentWindow.listen<any>("global-main-store", event => {
|
||||||
|
removeSubscribe && removeSubscribe();
|
||||||
|
mainStore.$patch({ ...event.payload.store }); // 更新全局状态
|
||||||
|
removeSubscribe = mainStore.$subscribe(async (...args) => {
|
||||||
|
const emitData = await cb(args);
|
||||||
|
await currentWindow.emitTo({ kind: "Window", label: "main" }, "config", emitData);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
onBeforeUnmount(async () => {
|
||||||
|
unlisten && (await unlisten)();
|
||||||
|
removeSubscribe && removeSubscribe();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
+3
-2
@@ -3,7 +3,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"author": "leizi97",
|
"author": "leizi97",
|
||||||
"description": "A simple network initiator based on Easytier",
|
"description": "A simple network initiator based on Easytier",
|
||||||
"version": "1.2.8",
|
"version": "1.3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||||
"build": "nuxt generate --dotenv env/.env.prod",
|
"build": "nuxt generate --dotenv env/.env.prod",
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
"@pinia/nuxt": "0.8.0",
|
"@pinia/nuxt": "0.8.0",
|
||||||
"@tauri-apps/api": "^2.1.1",
|
"@tauri-apps/api": "^2.1.1",
|
||||||
"@tauri-apps/cli": "^2.1.0",
|
"@tauri-apps/cli": "^2.1.0",
|
||||||
"@tauri-apps/plugin-autostart": "~2",
|
|
||||||
"@tauri-apps/plugin-cli": "^2.0.0",
|
"@tauri-apps/plugin-cli": "^2.0.0",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
|
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
|
||||||
"@tauri-apps/plugin-fs": "~2",
|
"@tauri-apps/plugin-fs": "~2",
|
||||||
@@ -35,6 +34,8 @@
|
|||||||
"pinia": "^2.2.6",
|
"pinia": "^2.2.6",
|
||||||
"pinia-plugin-persistedstate": "^4.1.3",
|
"pinia-plugin-persistedstate": "^4.1.3",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
|
"prettier": "^3.4.1",
|
||||||
|
"prettier-plugin-tailwindcss": "^0.6.9",
|
||||||
"typescript": "^5.6.3",
|
"typescript": "^5.6.3",
|
||||||
"vue-clipboard3": "^2.0.0"
|
"vue-clipboard3": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+115
-12
@@ -1,7 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-full overflow-auto flex flex-col items-start px-[25px]">
|
<div class="h-full overflow-auto flex flex-col items-start px-[25px]">
|
||||||
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox></div>
|
<div class="flex items-center gap-[15px] flex-nowrap">
|
||||||
|
<div class="flex items-center gap-[5px] flex-nowrap">
|
||||||
|
<ElCheckbox v-model="mainStore.config.enableCustonProtocol">自定义联机时使用的默认协议</ElCheckbox>
|
||||||
|
<ElTooltip content="如果没有支持该协议的节点地址,程序会自动处理,请放心使用">
|
||||||
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
|
</ElTooltip>
|
||||||
|
</div>
|
||||||
|
<div class="w-[80px]">
|
||||||
|
<ElSelect
|
||||||
|
size="small"
|
||||||
|
v-model="mainStore.config.customProtocol"
|
||||||
|
placeholder="请选择协议"
|
||||||
|
class="ml-[5px]"
|
||||||
|
>
|
||||||
|
<ElOption
|
||||||
|
v-for="item in protocols"
|
||||||
|
:key="item"
|
||||||
|
:label="`${item}`"
|
||||||
|
:value="item"
|
||||||
|
></ElOption>
|
||||||
|
</ElSelect>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="flex items-center gap-[15px] flex-nowrap">
|
<div class="flex items-center gap-[15px] flex-nowrap">
|
||||||
<ElCheckbox v-model="mainStore.config.saveErrorLog">输出日志到本地</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.saveErrorLog">输出日志到本地</ElCheckbox>
|
||||||
<div class="w-[140px]">
|
<div class="w-[140px]">
|
||||||
@@ -36,7 +58,72 @@
|
|||||||
打开config.json目录
|
打开config.json目录
|
||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
|
<div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止休眠</ElCheckbox></div>
|
||||||
|
<ElDivider />
|
||||||
|
<div class="flex items-center gap-[10px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||||
|
<ElTooltip content="无法联机时,可以尝试开启这个选项">
|
||||||
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
|
</ElTooltip>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-[10px]">
|
||||||
|
<ElText
|
||||||
|
class="flex-shrink-0"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
监听端口
|
||||||
|
</ElText>
|
||||||
|
<ElInput
|
||||||
|
:disabled="mainStore.config.disbleListenner || mainStore.config.enableCustomListener"
|
||||||
|
size="small"
|
||||||
|
:maxlength="10"
|
||||||
|
v-model="mainStore.config.port"
|
||||||
|
placeholder="请输入端口号"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-[10px]">
|
||||||
|
<ElCheckbox
|
||||||
|
:disabled="mainStore.config.disbleListenner"
|
||||||
|
v-model="mainStore.config.enableCustomListener"
|
||||||
|
>
|
||||||
|
自定义监听地址
|
||||||
|
</ElCheckbox>
|
||||||
|
<ElButton
|
||||||
|
size="small"
|
||||||
|
:disabled="mainStore.config.disbleListenner"
|
||||||
|
@click="handleListenerDialog"
|
||||||
|
>
|
||||||
|
填写
|
||||||
|
</ElButton>
|
||||||
|
<ElDialog
|
||||||
|
width="95%"
|
||||||
|
top="10px"
|
||||||
|
append-to-body
|
||||||
|
:z-index="10"
|
||||||
|
class="!mb-0"
|
||||||
|
v-model="listenerDialogData.visible"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
title="自定义监听地址"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
type="textarea"
|
||||||
|
:rows="8"
|
||||||
|
placeholder="请输入监听地址一行一个"
|
||||||
|
v-model="mainStore.config.customListenerData"
|
||||||
|
></ElInput>
|
||||||
|
<template #footer>
|
||||||
|
<div class="text-right">
|
||||||
|
<ElButton
|
||||||
|
size="default"
|
||||||
|
@click="handleFinishInputListener"
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</ElButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
</div>
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
|
||||||
@@ -76,12 +163,12 @@
|
|||||||
|
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密,默认为启用,必须与对等节点相同</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.multiThread">启用多线程运行</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.multiThread">启用多线程运行</ElCheckbox></div>
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
|
|
||||||
<div><ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式,将尝试使用最低延迟路径转发流量,默认使用最短路径</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式,将尝试使用最低延迟路径转发流量</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
||||||
<div>
|
<div>
|
||||||
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">转发所有对等节点的RPC数据包,即使对等节点不在转发网络白名单内</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">转发所有对等节点的RPC数据包,即使对等节点不在转发网络白名单内</ElCheckbox>
|
||||||
@@ -91,14 +178,30 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { QuestionFilled } from "@element-plus/icons-vue";
|
import { QuestionFilled } from "@element-plus/icons-vue";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
||||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||||
import { Command } from "@tauri-apps/plugin-shell";
|
import { Command } from "@tauri-apps/plugin-shell";
|
||||||
import { exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
import { exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
|
import { reactive } from "vue";
|
||||||
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
|
import { supportProtocols } from "~/utils";
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
|
const protocols = supportProtocols();
|
||||||
|
const listenerDialogData = reactive<{ [key: string]: any }>({
|
||||||
|
visible: false,
|
||||||
|
loading: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleListenerDialog = () => {
|
||||||
|
listenerDialogData.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFinishInputListener = async () => {
|
||||||
|
listenerDialogData.visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const appWindow = getCurrentWindow();
|
|
||||||
const data = ["trace", "debug", "info", "warn", "error", "off"];
|
const data = ["trace", "debug", "info", "warn", "error", "off"];
|
||||||
const openLogDir = async () => {
|
const openLogDir = async () => {
|
||||||
const resourceDir = await getResourceDir();
|
const resourceDir = await getResourceDir();
|
||||||
@@ -122,11 +225,11 @@
|
|||||||
ElMessage.error("config.json的目录不存在");
|
ElMessage.error("config.json的目录不存在");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mainStore.$subscribe(async (...a) => {
|
|
||||||
// console.error("subscribe", a);
|
dataSubscribe(async (...a) => {
|
||||||
await appWindow.emitTo("main", "config", { config: { ...mainStore.config }, createConfigInEasytier: mainStore.createConfigInEasytier });
|
return {
|
||||||
// if(mainStore.createConfigInEasytier) {
|
config: { ...mainStore.config },
|
||||||
// updateConfigJson();
|
createConfigInEasytier: mainStore.createConfigInEasytier
|
||||||
// }
|
};
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+5
-5
@@ -10,16 +10,16 @@
|
|||||||
v-model="mainStore.config.proxyNetworks"
|
v-model="mainStore.config.proxyNetworks"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="30"
|
:rows="30"
|
||||||
resize="none"></ElInput>
|
resize="none"
|
||||||
|
></ElInput>
|
||||||
</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 { getCurrentWindow } from "@tauri-apps/api/window";
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const appWindow = getCurrentWindow();
|
dataSubscribe(async (...a) => {
|
||||||
mainStore.$subscribe((...a) => {
|
return { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } };
|
||||||
appWindow.emitTo("main", "config", { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } });
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+106
-81
@@ -10,7 +10,7 @@
|
|||||||
class="full-label"
|
class="full-label"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center flex-nowrap gap-[0_5px]">
|
<div class="flex flex-nowrap items-center gap-[0_5px]">
|
||||||
<div>服务器</div>
|
<div>服务器</div>
|
||||||
<span>-</span>
|
<span>-</span>
|
||||||
<ElTag
|
<ElTag
|
||||||
@@ -82,11 +82,12 @@
|
|||||||
:label="item"
|
:label="item"
|
||||||
:value="item"
|
:value="item"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-[20px] overflow-hidden flex-nowrap max-w-[calc(100vw-62px)]">
|
<div class="flex max-w-[calc(100vw-62px)] flex-nowrap items-center gap-[20px] overflow-hidden">
|
||||||
<ElTooltip :content="item">
|
<ElTooltip v-if="item && item.length > 30" placement="top" :content="item || '-'">
|
||||||
<p class="truncate">{{ item }}</p>
|
<p class="truncate">{{ item }}</p>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
<div class="flex-shrink-0 ml-auto">
|
<p v-else class="truncate">{{ item }}</p>
|
||||||
|
<div class="ml-auto flex-shrink-0">
|
||||||
<ElButton
|
<ElButton
|
||||||
@click.stop="handleDeleteServerUrl(item)"
|
@click.stop="handleDeleteServerUrl(item)"
|
||||||
round
|
round
|
||||||
@@ -98,7 +99,7 @@
|
|||||||
</ElOption>
|
</ElOption>
|
||||||
</ElSelect>
|
</ElSelect>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<div class="flex flex-wrap gap-[0_10px] items-center">
|
<div class="flex flex-wrap items-center gap-[0_10px]">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<ElFormItem label="网络名">
|
<ElFormItem label="网络名">
|
||||||
<template #label>
|
<template #label>
|
||||||
@@ -157,7 +158,7 @@
|
|||||||
label="局域网IP"
|
label="局域网IP"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center h-[20px]">
|
<div class="flex h-[20px] items-center">
|
||||||
虚拟网IP
|
虚拟网IP
|
||||||
<ElTooltip content="对应命令行参数 --ipv4">
|
<ElTooltip content="对应命令行参数 --ipv4">
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
@@ -181,7 +182,7 @@
|
|||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
</div>
|
</div>
|
||||||
</ElForm>
|
</ElForm>
|
||||||
<div class="flex items-start mt-auto">
|
<div class="mt-auto flex items-start">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<ElDropdown
|
<ElDropdown
|
||||||
@@ -209,13 +210,20 @@
|
|||||||
分享联机相关配置
|
分享联机相关配置
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
<ElDropdownItem disabled>
|
<ElDropdownItem disabled>
|
||||||
<ElDivider class="!h-[2px] !m-0" />
|
<ElDivider class="!m-0 !h-[2px]" />
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
<ElDropdownItem
|
<ElDropdownItem
|
||||||
:icon="SetUp"
|
:icon="SetUp"
|
||||||
command="create_server"
|
command="create_server"
|
||||||
>
|
>
|
||||||
自建服务器<ElTag size="small" class="ml-[5px]" :type="listenObj.server_thread_id.value ? 'success' : 'info'">{{ listenObj.server_thread_id.value ? "运行中" : "未运行" }}</ElTag>
|
自建服务器
|
||||||
|
<ElTag
|
||||||
|
size="small"
|
||||||
|
class="ml-[5px]"
|
||||||
|
:type="listenObj.server_thread_id.value ? 'success' : 'info'"
|
||||||
|
>
|
||||||
|
{{ listenObj.server_thread_id.value ? "运行中" : "未运行" }}
|
||||||
|
</ElTag>
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
<ElDropdownItem
|
<ElDropdownItem
|
||||||
:icon="Tools"
|
:icon="Tools"
|
||||||
@@ -303,7 +311,7 @@
|
|||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
<ElLink
|
<ElLink
|
||||||
class="!text-[9px] pb-[2px] ml-[8px] truncate"
|
class="ml-[8px] truncate pb-[2px] !text-[9px]"
|
||||||
type="info"
|
type="info"
|
||||||
:underline="false"
|
:underline="false"
|
||||||
@click="open('https://github.com/EasyTier/EasytierGame')"
|
@click="open('https://github.com/EasyTier/EasytierGame')"
|
||||||
@@ -336,7 +344,11 @@
|
|||||||
刷新
|
刷新
|
||||||
</ElButton>
|
</ElButton>
|
||||||
<ElTooltip content="打开内核缓存目录">
|
<ElTooltip content="打开内核缓存目录">
|
||||||
<ElButton :icon="Folder" size="small" @click="handleOpenCache"></ElButton>
|
<ElButton
|
||||||
|
:icon="Folder"
|
||||||
|
size="small"
|
||||||
|
@click="handleOpenCache"
|
||||||
|
></ElButton>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
</div>
|
</div>
|
||||||
<ElSelect
|
<ElSelect
|
||||||
@@ -354,7 +366,7 @@
|
|||||||
{{ release ? release[0] : "" }}
|
{{ release ? release[0] : "" }}
|
||||||
</ElOption>
|
</ElOption>
|
||||||
</ElSelect>
|
</ElSelect>
|
||||||
<div class="pb-[5px] mt-[10px]">
|
<div class="mt-[10px] pb-[5px]">
|
||||||
<ElTooltip content="不使用出国软件也能告诉下载github Release包的地址,可自行搜索替换使用">
|
<ElTooltip content="不使用出国软件也能告诉下载github Release包的地址,可自行搜索替换使用">
|
||||||
<ElText>github下载加速地址</ElText>
|
<ElText>github下载加速地址</ElText>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
@@ -456,6 +468,7 @@
|
|||||||
v-model="mainStore.configPath"
|
v-model="mainStore.configPath"
|
||||||
no-data-text="目录没有配置文件"
|
no-data-text="目录没有配置文件"
|
||||||
placeholder="选择配置文件"
|
placeholder="选择配置文件"
|
||||||
|
filterable
|
||||||
>
|
>
|
||||||
<ElOption
|
<ElOption
|
||||||
v-for="item in configStart.list"
|
v-for="item in configStart.list"
|
||||||
@@ -482,22 +495,35 @@
|
|||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
import { open, Command } from "@tauri-apps/plugin-shell";
|
import { open, Command } from "@tauri-apps/plugin-shell";
|
||||||
import { QuestionFilled, Delete, List, UserFilled, Setting, Share, RefreshRight, Link, Tools, MagicStick, SetUp, Folder } from "@element-plus/icons-vue";
|
import {
|
||||||
|
QuestionFilled,
|
||||||
|
Delete,
|
||||||
|
List,
|
||||||
|
UserFilled,
|
||||||
|
Setting,
|
||||||
|
Share,
|
||||||
|
RefreshRight,
|
||||||
|
Link,
|
||||||
|
Tools,
|
||||||
|
MagicStick,
|
||||||
|
SetUp,
|
||||||
|
Folder
|
||||||
|
} from "@element-plus/icons-vue";
|
||||||
import { reactive, onBeforeUnmount, onMounted, ref } from "vue";
|
import { reactive, onBeforeUnmount, onMounted, ref } from "vue";
|
||||||
import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray";
|
import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray";
|
||||||
|
import { getMatches } from "@tauri-apps/plugin-cli";
|
||||||
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 } from "@tauri-apps/api/window";
|
||||||
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
||||||
import etWindows from "@/composables/windows";
|
import etWindows from "@/composables/windows";
|
||||||
import * as tauriAutoStart from "@tauri-apps/plugin-autostart";
|
|
||||||
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 } 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";
|
||||||
import { bounce, addQQGroup } from "~/utils";
|
import { bounce, addQQGroup, supportProtocols, preventSleep, stopPreventSleep } from "~/utils";
|
||||||
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
||||||
import { getServerArgs } from "@/composables/server";
|
import { getServerArgs } from "@/composables/server";
|
||||||
|
|
||||||
@@ -520,7 +546,7 @@
|
|||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const config = mainStore.config;
|
const config = mainStore.config;
|
||||||
// console.error(config);
|
// console.error(config);
|
||||||
const protocols = ["tcp", "udp", "ws", "wss", "quic"];
|
const protocols = supportProtocols();
|
||||||
const data = reactive<{ [key: string]: any; releaseList: Array<Array<string>> }>({
|
const data = reactive<{ [key: string]: any; releaseList: Array<Array<string>> }>({
|
||||||
logVisible: false,
|
logVisible: false,
|
||||||
cidrVisible: false,
|
cidrVisible: false,
|
||||||
@@ -586,7 +612,7 @@
|
|||||||
}
|
}
|
||||||
// console.error(configPath);
|
// console.error(configPath);
|
||||||
await Command.create("explorer", [configPath]).execute();
|
await Command.create("explorer", [configPath]).execute();
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleDeleteServerUrl = (url: string) => {
|
const handleDeleteServerUrl = (url: string) => {
|
||||||
const newBasePeers = [...mainStore.basePeers];
|
const newBasePeers = [...mainStore.basePeers];
|
||||||
@@ -636,9 +662,15 @@
|
|||||||
data.startLoading = false;
|
data.startLoading = false;
|
||||||
let ipv4 = /dhcp ip changed. old: None, new: Some\((\d+\.\d+\.\d+\.\d+).*\)/g.exec(event.payload as string)?.[1];
|
let ipv4 = /dhcp ip changed. old: None, new: Some\((\d+\.\d+\.\d+\.\d+).*\)/g.exec(event.payload as string)?.[1];
|
||||||
let devName = /tun device ready. dev: (.*)/g.exec(event.payload as string)?.[1];
|
let devName = /tun device ready. dev: (.*)/g.exec(event.payload as string)?.[1];
|
||||||
if (event.payload.includes("peer connection removed")) {
|
if (mainStore.configStartEnable || mainStore.config.dhcp) {
|
||||||
data.isSuccessGetIp = false;
|
let configIpv4 = /ipv4\s.*=\s.*[\'\"](\d+\.\d+\.\d+\.\d+).*[\'\"]/g.exec(event.payload as string)?.[1];
|
||||||
|
if (configIpv4) {
|
||||||
|
mainStore.config.ipv4 = configIpv4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// if (event.payload.includes("peer connection removed")) {
|
||||||
|
// data.isSuccessGetIp = false;
|
||||||
|
// }
|
||||||
if (event.payload.includes("new peer connection added") && !data.isSuccessGetIp) {
|
if (event.payload.includes("new peer connection added") && !data.isSuccessGetIp) {
|
||||||
await setTrayRunState(tray, true);
|
await setTrayRunState(tray, true);
|
||||||
data.isSuccessGetIp = true;
|
data.isSuccessGetIp = true;
|
||||||
@@ -703,13 +735,22 @@
|
|||||||
this.unListenServerThreadId = unListen;
|
this.unListenServerThreadId = unListen;
|
||||||
},
|
},
|
||||||
async listenConfigStart() {
|
async listenConfigStart() {
|
||||||
|
const appWindow = getCurrentWindow();
|
||||||
const unListen = await listen("config", event => {
|
const unListen = await listen("config", event => {
|
||||||
// console.error("config", event.payload);
|
|
||||||
const ipv4 = config.ipv4;
|
const ipv4 = config.ipv4;
|
||||||
mainStore.$patch(event.payload as any);
|
mainStore.$patch(event.payload as any);
|
||||||
config.ipv4 = ipv4;
|
config.ipv4 = ipv4;
|
||||||
|
if(mainStore.config.enablePreventSleep) {
|
||||||
|
preventSleep();
|
||||||
|
}else {
|
||||||
|
stopPreventSleep();
|
||||||
|
}
|
||||||
|
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
||||||
});
|
});
|
||||||
this.unListenConfigStart = unListen;
|
const unListen2 = mainStore.$subscribe(() => {
|
||||||
|
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
||||||
|
})
|
||||||
|
this.unListenConfigStart = [unListen, unListen2];
|
||||||
},
|
},
|
||||||
async listenStartStopServer() {
|
async listenStartStopServer() {
|
||||||
const unListen = await listen<{ args: Array<string> }>("startStopServer", async event => {
|
const unListen = await listen<{ args: Array<string> }>("startStopServer", async event => {
|
||||||
@@ -813,42 +854,6 @@
|
|||||||
// console.log(data.releaseList);
|
// console.log(data.releaseList);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAutoStart = async () => {
|
|
||||||
let is_enable = await tauriAutoStart.isEnabled();
|
|
||||||
if (!config.autoStart && !is_enable) {
|
|
||||||
try {
|
|
||||||
await tauriAutoStart.enable();
|
|
||||||
} catch (err) {
|
|
||||||
ElMessage.error(`开机自启失败`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
await tauriAutoStart.disable();
|
|
||||||
} catch (err) {
|
|
||||||
// ElMessage.error(`取消自启失败`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
is_enable = await tauriAutoStart.isEnabled();
|
|
||||||
if (!is_enable) {
|
|
||||||
config.autoStart = false;
|
|
||||||
} else {
|
|
||||||
config.autoStart = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const initAutoStart = async () => {
|
|
||||||
try {
|
|
||||||
const is_enable = await tauriAutoStart.isEnabled();
|
|
||||||
if (!is_enable) {
|
|
||||||
config.autoStart = false;
|
|
||||||
} else {
|
|
||||||
config.autoStart = true;
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
config.autoStart = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAutoStartByTask = async () => {
|
const handleAutoStartByTask = async () => {
|
||||||
await invoke("spawn_autostart", { enabled: !config.autoStart });
|
await invoke("spawn_autostart", { enabled: !config.autoStart });
|
||||||
const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||||
@@ -857,11 +862,6 @@
|
|||||||
|
|
||||||
const compatibleInitAutoStart = async () => {
|
const compatibleInitAutoStart = async () => {
|
||||||
try {
|
try {
|
||||||
const is_enable = await tauriAutoStart.isEnabled();
|
|
||||||
if (is_enable) {
|
|
||||||
await invoke("spawn_autostart", { enabled: true });
|
|
||||||
await tauriAutoStart.disable();
|
|
||||||
}
|
|
||||||
let is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
let is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||||
if (is_enable_by_task) {
|
if (is_enable_by_task) {
|
||||||
// 每次打开Exe重新加载一次开机自启,因为可能路径变了
|
// 每次打开Exe重新加载一次开机自启,因为可能路径变了
|
||||||
@@ -953,6 +953,21 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initPreventSleep = async () => {
|
||||||
|
if (mainStore.config.enablePreventSleep) {
|
||||||
|
preventSleep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mountedShow = async () => {
|
||||||
|
const args = await getMatches();
|
||||||
|
if (!args.args?.["task-auto-start"]?.value) {
|
||||||
|
const appWindow = getCurrentWindow();
|
||||||
|
await appWindow.show();
|
||||||
|
await appWindow.setFocus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let logsTimer: NodeJS.Timeout | null = null;
|
let logsTimer: NodeJS.Timeout | null = null;
|
||||||
let serverLogsTimer: NodeJS.Timeout | null = null;
|
let serverLogsTimer: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
@@ -969,16 +984,20 @@
|
|||||||
await initConfigDir();
|
await initConfigDir();
|
||||||
await initAutoStartServer();
|
await initAutoStartServer();
|
||||||
await initConnectAfterStart();
|
await initConnectAfterStart();
|
||||||
|
initPreventSleep();
|
||||||
|
mountedShow(); // 不需要await
|
||||||
closePrevent();
|
closePrevent();
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
unListenAll();
|
unListenAll();
|
||||||
listenObj.unListenReleaseList && listenObj.unListenReleaseList();
|
listenObj.unListenReleaseList && listenObj.unListenReleaseList();
|
||||||
listenObj.unListenConfigStart && listenObj.unListenConfigStart();
|
listenObj.unListenConfigStart && listenObj.unListenConfigStart[0]();
|
||||||
|
listenObj.unListenConfigStart && listenObj.unListenConfigStart[1]();
|
||||||
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
||||||
logsTimer && clearInterval(logsTimer);
|
logsTimer && clearInterval(logsTimer);
|
||||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||||
|
stopPreventSleep();
|
||||||
});
|
});
|
||||||
|
|
||||||
const getArgs = async () => {
|
const getArgs = async () => {
|
||||||
@@ -1030,6 +1049,12 @@
|
|||||||
const formatUrl = config.serverUrl.replace(/\\/g, "/");
|
const formatUrl = config.serverUrl.replace(/\\/g, "/");
|
||||||
args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
||||||
}
|
}
|
||||||
|
if (config.enableCustonProtocol) {
|
||||||
|
const includes = config.protocol.includes(config.customProtocol);
|
||||||
|
if (includes) {
|
||||||
|
args.push("--default-protocol", config.customProtocol);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (config.disbleP2p) {
|
if (config.disbleP2p) {
|
||||||
args.push("--disable-p2p");
|
args.push("--disable-p2p");
|
||||||
}
|
}
|
||||||
@@ -1039,6 +1064,19 @@
|
|||||||
if (config.disbleListenner) {
|
if (config.disbleListenner) {
|
||||||
args.push("--no-listener");
|
args.push("--no-listener");
|
||||||
}
|
}
|
||||||
|
if (!config.disbleListenner && config.enableCustomListener && config.customListenerData) {
|
||||||
|
const customListener = config.customListenerData
|
||||||
|
.trim()
|
||||||
|
.split("\n")
|
||||||
|
.map(el => el.trim())
|
||||||
|
.filter(el => el);
|
||||||
|
if (customListener.length > 0) {
|
||||||
|
args.push("-l", ...customListener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!config.disbleListenner && !config.enableCustomListener && config.port) {
|
||||||
|
args.push("-l", config.port);
|
||||||
|
}
|
||||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
if (mainStore.cidrEnable && config.proxyNetworks) {
|
||||||
// console.error(config.proxyNetworks);
|
// console.error(config.proxyNetworks);
|
||||||
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
|
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
|
||||||
@@ -1182,22 +1220,6 @@
|
|||||||
}
|
}
|
||||||
if (command === "create_server") {
|
if (command === "create_server") {
|
||||||
await handleShowServerDialog();
|
await handleShowServerDialog();
|
||||||
// if (data.isStart) {
|
|
||||||
// const [error] = await ElConfirmDanger("切换会停止{action},是否继续?", "提示", {
|
|
||||||
// action: "`联机/服务`",
|
|
||||||
// confirmButtonText: "继续",
|
|
||||||
// cancelButtonText: "取消"
|
|
||||||
// });
|
|
||||||
// if (!error) await reset();
|
|
||||||
// }
|
|
||||||
// mainStore.enableCreateServer = !mainStore.enableCreateServer;
|
|
||||||
// if (mainStore.config.relayAllPeerrpc && !mainStore.enableCreateServer) {
|
|
||||||
// const [error] = await ElConfirmPrimary("是否关闭RPC流量转发?", "提示", {
|
|
||||||
// confirmButtonText: "关闭",
|
|
||||||
// cancelButtonText: "取消"
|
|
||||||
// });
|
|
||||||
// if (!error) mainStore.config.relayAllPeerrpc = false;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1285,7 +1307,7 @@
|
|||||||
data.logVisible = true;
|
data.logVisible = true;
|
||||||
logsTimer && clearInterval(logsTimer);
|
logsTimer && clearInterval(logsTimer);
|
||||||
logsTimer = setInterval(() => {
|
logsTimer = setInterval(() => {
|
||||||
appWindow.emitTo("log", "logs", data.log);
|
appWindow.emitTo({ kind: "WebviewWindow", label: "log" }, "logs", data.log);
|
||||||
}, 650);
|
}, 650);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
@@ -1368,7 +1390,10 @@
|
|||||||
data.serverVisible = true;
|
data.serverVisible = true;
|
||||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||||
serverLogsTimer = setInterval(() => {
|
serverLogsTimer = setInterval(() => {
|
||||||
appWindow.emitTo("server", "server_logs", { log: data.serverLog, threadId: listenObj.server_thread_id.value });
|
appWindow.emitTo({ kind: "WebviewWindow", label: "server" }, "server_logs", {
|
||||||
|
log: data.serverLog,
|
||||||
|
threadId: listenObj.server_thread_id.value
|
||||||
|
});
|
||||||
}, 650);
|
}, 650);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
+9
-6
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="overflow-auto h-full">
|
<div class="overflow-auto h-full">
|
||||||
<div class="w-[1200px]">
|
<div class="w-[1200px]">
|
||||||
<span v-if="!data.member || data.member.length <= 0">{{ "等待成员信息中..." }}</span>
|
<ElText size="small" v-if="!data.member || data.member.length <= 0">{{ "等待成员信息中..." }}</ElText>
|
||||||
<ElTable
|
<ElTable
|
||||||
stripe
|
stripe
|
||||||
border
|
border
|
||||||
@@ -22,10 +22,11 @@
|
|||||||
sortable
|
sortable
|
||||||
width="90"
|
width="90"
|
||||||
prop="cost"
|
prop="cost"
|
||||||
label="路由"
|
label="方式"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<ElTag
|
<ElTag
|
||||||
|
size="small"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:type="row.cost == 'p2p' ? 'success' : 'info'"
|
:type="row.cost == 'p2p' ? 'success' : 'info'"
|
||||||
>
|
>
|
||||||
@@ -42,12 +43,12 @@
|
|||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
prop="lat_ms"
|
prop="lat_ms"
|
||||||
width="130"
|
width="100"
|
||||||
label="延迟/ms"
|
label="延迟/ms"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
width="120"
|
width="100"
|
||||||
prop="loss_rate"
|
prop="loss_rate"
|
||||||
label="丢包率"
|
label="丢包率"
|
||||||
>
|
>
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
width="120"
|
width="110"
|
||||||
label="NAT类型"
|
label="NAT类型"
|
||||||
prop="nat_type"
|
prop="nat_type"
|
||||||
>
|
>
|
||||||
@@ -67,17 +68,19 @@
|
|||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
width="120"
|
width="122"
|
||||||
prop="version"
|
prop="version"
|
||||||
label="版本"
|
label="版本"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
|
width="100"
|
||||||
prop="tunnel_proto"
|
prop="tunnel_proto"
|
||||||
label="隧道协议"
|
label="隧道协议"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
|
width="90"
|
||||||
prop="rx_bytes"
|
prop="rx_bytes"
|
||||||
label="接收"
|
label="接收"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
|
|||||||
+4
-2
@@ -85,6 +85,7 @@
|
|||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||||
import { getServerArgs } from "@/composables/server";
|
import { getServerArgs } from "@/composables/server";
|
||||||
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
|
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
@@ -122,7 +123,8 @@
|
|||||||
await appWindow.emitTo("main", "startStopServer", { args });
|
await appWindow.emitTo("main", "startStopServer", { args });
|
||||||
};
|
};
|
||||||
|
|
||||||
mainStore.$subscribe(async (...a) => {
|
dataSubscribe(async (...a) => {
|
||||||
await appWindow.emitTo("main", "config", { serverConfig: { ...mainStore.serverConfig }});
|
return { serverConfig: { ...mainStore.serverConfig }};
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+11
-8
@@ -181,8 +181,8 @@
|
|||||||
import { onMounted, reactive } from "vue";
|
import { onMounted, reactive } from "vue";
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { handleWinipBcStart, initStartWinIpBroadcast } from "@/composables/netcard";
|
import { handleWinipBcStart, initStartWinIpBroadcast } from "@/composables/netcard";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
||||||
import { isValidIP } from "~/utils";
|
import { isValidIP } from "~/utils";
|
||||||
|
import { dataSubscribe } from "~/composables/windows";
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@@ -253,18 +253,18 @@
|
|||||||
if (output.stderr) {
|
if (output.stderr) {
|
||||||
data.pingLog += `${i + 1}error - ${output.stderr}`;
|
data.pingLog += `${i + 1}error - ${output.stderr}`;
|
||||||
}
|
}
|
||||||
if(i != data.pingNum - 1) {
|
if (i != data.pingNum - 1) {
|
||||||
await awaitTime(1000);
|
await awaitTime(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.pingLog += '完毕'
|
data.pingLog += "完毕";
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ElMessage.error("Ping发生错误");
|
ElMessage.error("Ping发生错误");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
} finally {
|
} finally {
|
||||||
data.isPing = false;
|
data.isPing = false;
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
ElMessage.error("请输入正确的IP");
|
ElMessage.error("请输入正确的IP");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -328,10 +328,13 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const appWindow = getCurrentWindow();
|
dataSubscribe(async (...a) => {
|
||||||
mainStore.$subscribe((...a) => {
|
return {
|
||||||
// console.error("subscribe", a);
|
winIpBcAutoStart: mainStore.winIpBcAutoStart,
|
||||||
appWindow.emitTo("main", "config", { winIpBcAutoStart: mainStore.winIpBcAutoStart, config: { ...mainStore.config } });
|
winipBcStart: mainStore.winipBcStart,
|
||||||
|
winipBcPid: mainStore.winipBcPid,
|
||||||
|
config: { ...mainStore.config }
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
Generated
+72
-10
@@ -26,9 +26,6 @@ importers:
|
|||||||
'@tauri-apps/cli':
|
'@tauri-apps/cli':
|
||||||
specifier: ^2.1.0
|
specifier: ^2.1.0
|
||||||
version: 2.1.0
|
version: 2.1.0
|
||||||
'@tauri-apps/plugin-autostart':
|
|
||||||
specifier: ~2
|
|
||||||
version: 2.0.0
|
|
||||||
'@tauri-apps/plugin-cli':
|
'@tauri-apps/plugin-cli':
|
||||||
specifier: ^2.0.0
|
specifier: ^2.0.0
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
@@ -83,6 +80,12 @@ importers:
|
|||||||
postcss:
|
postcss:
|
||||||
specifier: ^8.4.38
|
specifier: ^8.4.38
|
||||||
version: 8.4.49
|
version: 8.4.49
|
||||||
|
prettier:
|
||||||
|
specifier: ^3.4.1
|
||||||
|
version: 3.4.1
|
||||||
|
prettier-plugin-tailwindcss:
|
||||||
|
specifier: ^0.6.9
|
||||||
|
version: 0.6.9(prettier@3.4.1)
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.6.3
|
specifier: ^5.6.3
|
||||||
version: 5.6.3
|
version: 5.6.3
|
||||||
@@ -1147,9 +1150,6 @@ packages:
|
|||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@tauri-apps/plugin-autostart@2.0.0':
|
|
||||||
resolution: {integrity: sha512-NEwOQWVasZ8RczXkMLNJokRDujneuMH/UFA5t84DLkbNZUmiD3G7HZWhgSd1YQ0BFU9h9w+h2B/py3y6bzWg4Q==}
|
|
||||||
|
|
||||||
'@tauri-apps/plugin-cli@2.0.0':
|
'@tauri-apps/plugin-cli@2.0.0':
|
||||||
resolution: {integrity: sha512-glQmlL1IiCGEa1FHYa/PTPSeYhfu56omLRgHXWlJECDt6DbJyRuJWVgtkQfUxtqnVdYnnU+DGIGeiInoEqtjLw==}
|
resolution: {integrity: sha512-glQmlL1IiCGEa1FHYa/PTPSeYhfu56omLRgHXWlJECDt6DbJyRuJWVgtkQfUxtqnVdYnnU+DGIGeiInoEqtjLw==}
|
||||||
|
|
||||||
@@ -3131,6 +3131,66 @@ packages:
|
|||||||
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
|
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
|
prettier-plugin-tailwindcss@0.6.9:
|
||||||
|
resolution: {integrity: sha512-r0i3uhaZAXYP0At5xGfJH876W3HHGHDp+LCRUJrs57PBeQ6mYHMwr25KH8NPX44F2yGTvdnH7OqCshlQx183Eg==}
|
||||||
|
engines: {node: '>=14.21.3'}
|
||||||
|
peerDependencies:
|
||||||
|
'@ianvs/prettier-plugin-sort-imports': '*'
|
||||||
|
'@prettier/plugin-pug': '*'
|
||||||
|
'@shopify/prettier-plugin-liquid': '*'
|
||||||
|
'@trivago/prettier-plugin-sort-imports': '*'
|
||||||
|
'@zackad/prettier-plugin-twig-melody': '*'
|
||||||
|
prettier: ^3.0
|
||||||
|
prettier-plugin-astro: '*'
|
||||||
|
prettier-plugin-css-order: '*'
|
||||||
|
prettier-plugin-import-sort: '*'
|
||||||
|
prettier-plugin-jsdoc: '*'
|
||||||
|
prettier-plugin-marko: '*'
|
||||||
|
prettier-plugin-multiline-arrays: '*'
|
||||||
|
prettier-plugin-organize-attributes: '*'
|
||||||
|
prettier-plugin-organize-imports: '*'
|
||||||
|
prettier-plugin-sort-imports: '*'
|
||||||
|
prettier-plugin-style-order: '*'
|
||||||
|
prettier-plugin-svelte: '*'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@ianvs/prettier-plugin-sort-imports':
|
||||||
|
optional: true
|
||||||
|
'@prettier/plugin-pug':
|
||||||
|
optional: true
|
||||||
|
'@shopify/prettier-plugin-liquid':
|
||||||
|
optional: true
|
||||||
|
'@trivago/prettier-plugin-sort-imports':
|
||||||
|
optional: true
|
||||||
|
'@zackad/prettier-plugin-twig-melody':
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-astro:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-css-order:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-import-sort:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-jsdoc:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-marko:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-multiline-arrays:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-organize-attributes:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-organize-imports:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-sort-imports:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-style-order:
|
||||||
|
optional: true
|
||||||
|
prettier-plugin-svelte:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
prettier@3.4.1:
|
||||||
|
resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
pretty-bytes@6.1.1:
|
pretty-bytes@6.1.1:
|
||||||
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
||||||
engines: {node: ^14.13.1 || >=16.0.0}
|
engines: {node: ^14.13.1 || >=16.0.0}
|
||||||
@@ -4991,10 +5051,6 @@ snapshots:
|
|||||||
'@tauri-apps/cli-win32-ia32-msvc': 2.1.0
|
'@tauri-apps/cli-win32-ia32-msvc': 2.1.0
|
||||||
'@tauri-apps/cli-win32-x64-msvc': 2.1.0
|
'@tauri-apps/cli-win32-x64-msvc': 2.1.0
|
||||||
|
|
||||||
'@tauri-apps/plugin-autostart@2.0.0':
|
|
||||||
dependencies:
|
|
||||||
'@tauri-apps/api': 2.1.1
|
|
||||||
|
|
||||||
'@tauri-apps/plugin-cli@2.0.0':
|
'@tauri-apps/plugin-cli@2.0.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tauri-apps/api': 2.1.1
|
'@tauri-apps/api': 2.1.1
|
||||||
@@ -7267,6 +7323,12 @@ snapshots:
|
|||||||
picocolors: 1.1.1
|
picocolors: 1.1.1
|
||||||
source-map-js: 1.2.1
|
source-map-js: 1.2.1
|
||||||
|
|
||||||
|
prettier-plugin-tailwindcss@0.6.9(prettier@3.4.1):
|
||||||
|
dependencies:
|
||||||
|
prettier: 3.4.1
|
||||||
|
|
||||||
|
prettier@3.4.1: {}
|
||||||
|
|
||||||
pretty-bytes@6.1.1: {}
|
pretty-bytes@6.1.1: {}
|
||||||
|
|
||||||
process-nextick-args@2.0.1: {}
|
process-nextick-args@2.0.1: {}
|
||||||
|
|||||||
Generated
+104
-50
@@ -95,6 +95,55 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.92"
|
version = "1.0.92"
|
||||||
@@ -306,17 +355,6 @@ version = "1.1.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "auto-launch"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"
|
|
||||||
dependencies = [
|
|
||||||
"dirs 4.0.0",
|
|
||||||
"thiserror 1.0.64",
|
|
||||||
"winreg 0.10.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
@@ -692,6 +730,33 @@ dependencies = [
|
|||||||
"inout",
|
"inout",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.5.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.5.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "0.7.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clipboard-win"
|
name = "clipboard-win"
|
||||||
version = "5.4.0"
|
version = "5.4.0"
|
||||||
@@ -731,6 +796,12 @@ dependencies = [
|
|||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.7"
|
||||||
@@ -1057,33 +1128,13 @@ dependencies = [
|
|||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dirs"
|
|
||||||
version = "4.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
|
||||||
dependencies = [
|
|
||||||
"dirs-sys 0.3.7",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dirs"
|
name = "dirs"
|
||||||
version = "5.0.1"
|
version = "5.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs-sys 0.4.1",
|
"dirs-sys",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dirs-sys"
|
|
||||||
version = "0.3.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"redox_users",
|
|
||||||
"winapi",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1176,7 +1227,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.2.8"
|
version = "1.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"planif",
|
"planif",
|
||||||
@@ -1186,7 +1237,7 @@ dependencies = [
|
|||||||
"sysinfo",
|
"sysinfo",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-build",
|
"tauri-build",
|
||||||
"tauri-plugin-autostart",
|
"tauri-plugin-cli",
|
||||||
"tauri-plugin-clipboard-manager",
|
"tauri-plugin-clipboard-manager",
|
||||||
"tauri-plugin-fs",
|
"tauri-plugin-fs",
|
||||||
"tauri-plugin-log",
|
"tauri-plugin-log",
|
||||||
@@ -1216,7 +1267,7 @@ dependencies = [
|
|||||||
"rustc_version",
|
"rustc_version",
|
||||||
"toml 0.8.2",
|
"toml 0.8.2",
|
||||||
"vswhom",
|
"vswhom",
|
||||||
"winreg 0.52.0",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2165,6 +2216,12 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
@@ -4313,7 +4370,7 @@ checksum = "e545de0a2dfe296fa67db208266cd397c5a55ae782da77973ef4c4fac90e9f2c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
"dirs 5.0.1",
|
"dirs",
|
||||||
"dunce",
|
"dunce",
|
||||||
"embed_plist",
|
"embed_plist",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -4364,7 +4421,7 @@ checksum = "7bd2a4bcfaf5fb9f4be72520eefcb61ae565038f8ccba2a497d8c28f463b8c01"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cargo_toml",
|
"cargo_toml",
|
||||||
"dirs 5.0.1",
|
"dirs",
|
||||||
"glob",
|
"glob",
|
||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"json-patch",
|
"json-patch",
|
||||||
@@ -4437,12 +4494,12 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-plugin-autostart"
|
name = "tauri-plugin-cli"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bba6bb936e0fd0a58ed958b49e2e423dd40949c9d9425cc991be996959e3838e"
|
checksum = "2bccd4692b56822a60874542c7655546c8e7aed3c2e2926166e1498e595bd2a2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"auto-launch",
|
"clap",
|
||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -4935,7 +4992,7 @@ checksum = "533fc2d4105e0e3d96ce1c71f2d308c9fbbe2ef9c587cab63dd627ab5bde218f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"core-graphics 0.24.0",
|
"core-graphics 0.24.0",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dirs 5.0.1",
|
"dirs",
|
||||||
"libappindicator",
|
"libappindicator",
|
||||||
"muda",
|
"muda",
|
||||||
"objc2",
|
"objc2",
|
||||||
@@ -5087,6 +5144,12 @@ version = "0.1.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3"
|
checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.10.0"
|
version = "1.10.0"
|
||||||
@@ -5788,15 +5851,6 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winreg"
|
|
||||||
version = "0.10.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winreg"
|
name = "winreg"
|
||||||
version = "0.52.0"
|
version = "0.52.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.2.8"
|
version = "1.3.0"
|
||||||
homepage = "https://github.com/EasyTier/EasyTier"
|
homepage = "https://github.com/EasyTier/EasyTier"
|
||||||
repository = "https://github.com/EasyTier/EasytierGame"
|
repository = "https://github.com/EasyTier/EasytierGame"
|
||||||
description = "A simple network initiator based on Easytier"
|
description = "A simple network initiator based on Easytier"
|
||||||
@@ -34,7 +34,7 @@ tauri = { version = "2.1.1", features = [
|
|||||||
tauri-plugin-log = "2.0.2"
|
tauri-plugin-log = "2.0.2"
|
||||||
tauri-plugin-shell = "2.0.2"
|
tauri-plugin-shell = "2.0.2"
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
zip = "2.2.0"
|
zip = "2.2"
|
||||||
sysinfo = '0.32.0'
|
sysinfo = '0.32.0'
|
||||||
planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
|
planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
|
||||||
whoami = "1.5.2"
|
whoami = "1.5.2"
|
||||||
@@ -44,11 +44,12 @@ tokio = { version = "1.41.1", features = ["process"] }
|
|||||||
# prost = "0.13"
|
# prost = "0.13"
|
||||||
# prost-types = "0.13"
|
# prost-types = "0.13"
|
||||||
|
|
||||||
|
|
||||||
[dependencies.windows]
|
[dependencies.windows]
|
||||||
version = "0.58.0"
|
version = "0.58.0"
|
||||||
features = ["Win32_System_TaskScheduler"]
|
features = ["Win32_System_TaskScheduler", "Win32_System_Power"]
|
||||||
|
|
||||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||||
tauri-plugin-autostart = "2.0.1"
|
tauri-plugin-cli = "2"
|
||||||
tauri-plugin-single-instance = "2.0.1"
|
tauri-plugin-single-instance = "2.0.1"
|
||||||
tauri-plugin-window-state = "2"
|
tauri-plugin-window-state = "2"
|
||||||
|
|||||||
@@ -30,10 +30,6 @@
|
|||||||
"core:webview:allow-webview-show",
|
"core:webview:allow-webview-show",
|
||||||
"core:webview:allow-webview-hide",
|
"core:webview:allow-webview-hide",
|
||||||
"core:webview:allow-webview-close",
|
"core:webview:allow-webview-close",
|
||||||
"autostart:default",
|
|
||||||
"autostart:allow-enable",
|
|
||||||
"autostart:allow-disable",
|
|
||||||
"autostart:allow-is-enabled",
|
|
||||||
"core:tray:allow-get-by-id",
|
"core:tray:allow-get-by-id",
|
||||||
"core:tray:allow-set-icon",
|
"core:tray:allow-set-icon",
|
||||||
"core:tray:allow-new",
|
"core:tray:allow-new",
|
||||||
@@ -97,6 +93,10 @@
|
|||||||
"window-state:allow-save-window-state",
|
"window-state:allow-save-window-state",
|
||||||
"window-state:allow-restore-state",
|
"window-state:allow-restore-state",
|
||||||
|
|
||||||
|
|
||||||
|
"cli:default",
|
||||||
|
"cli:allow-cli-matches",
|
||||||
|
|
||||||
"log:default",
|
"log:default",
|
||||||
"log:allow-log"
|
"log:allow-log"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
"dhcp": false, // 动态分配IP
|
"dhcp": false, // 动态分配IP
|
||||||
"devName": false, // 是否启用自定义网卡名
|
"devName": false, // 是否启用自定义网卡名
|
||||||
"devNameValue": "", // 网卡名(启用devName之后才生效)
|
"devNameValue": "", // 网卡名(启用devName之后才生效)
|
||||||
|
"enableCustonProtocol": false, // 是否启用自定义协议
|
||||||
|
"customProtocol": "tcp", // 自定义协议类型
|
||||||
"enableNetCardMetric": false, // 自定义easytier每次生成的网卡跃点
|
"enableNetCardMetric": false, // 自定义easytier每次生成的网卡跃点
|
||||||
"netCardMetricValue": 1 // 网卡跃点数量(1-9999)
|
"netCardMetricValue": 1 // 网卡跃点数量(1-9999)
|
||||||
}
|
}
|
||||||
+39
-17
@@ -15,14 +15,36 @@ use sysinfo::System;
|
|||||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||||
use tauri::Emitter;
|
use tauri::Emitter;
|
||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
use tauri_plugin_autostart::MacosLauncher;
|
|
||||||
use windows::core::{BSTR, VARIANT};
|
use windows::core::{BSTR, VARIANT};
|
||||||
use windows::Win32::Foundation::VARIANT_BOOL;
|
use windows::Win32::Foundation::VARIANT_BOOL;
|
||||||
use windows::Win32::System::Com::*;
|
use windows::Win32::System::Com::*;
|
||||||
use windows::Win32::System::TaskScheduler::*;
|
use windows::Win32::System::TaskScheduler::*;
|
||||||
|
|
||||||
|
use windows::Win32::System::Power::SetThreadExecutionState;
|
||||||
|
use windows::Win32::System::Power::ES_CONTINUOUS;
|
||||||
|
use windows::Win32::System::Power::ES_SYSTEM_REQUIRED;
|
||||||
|
use windows::Win32::System::Power::EXECUTION_STATE;
|
||||||
|
|
||||||
use tokio::process::Command as tokioCommand;
|
use tokio::process::Command as tokioCommand;
|
||||||
|
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
fn prevent_sleep() -> bool {
|
||||||
|
unsafe {
|
||||||
|
let result = SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
||||||
|
result != EXECUTION_STATE(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
fn allow_sleep() -> bool {
|
||||||
|
unsafe {
|
||||||
|
let result = SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
|
result != EXECUTION_STATE(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 定义GitHub Release的结构体
|
// 定义GitHub Release的结构体
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Release {
|
pub struct Release {
|
||||||
@@ -138,13 +160,14 @@ async fn get_members_by_cli() -> String {
|
|||||||
.arg("peer")
|
.arg("peer")
|
||||||
.arg("list")
|
.arg("list")
|
||||||
.creation_flags(0x08000000)
|
.creation_flags(0x08000000)
|
||||||
.output().await
|
.output()
|
||||||
|
.await
|
||||||
{
|
{
|
||||||
Ok(output) => {
|
Ok(output) => {
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
let output_str = String::from_utf8_lossy(&output.stdout);
|
||||||
return output_str.trim().to_string();
|
return output_str.trim().to_string();
|
||||||
}else {
|
} else {
|
||||||
let output_str = String::from_utf8_lossy(&output.stderr);
|
let output_str = String::from_utf8_lossy(&output.stderr);
|
||||||
log::error!("{}", output_str.trim().to_string());
|
log::error!("{}", output_str.trim().to_string());
|
||||||
return "_EasytierGameCliFailedToConnect_".to_string();
|
return "_EasytierGameCliFailedToConnect_".to_string();
|
||||||
@@ -153,7 +176,7 @@ async fn get_members_by_cli() -> String {
|
|||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
log::error!("get member list error");
|
log::error!("get member list error");
|
||||||
return "".to_string();
|
return "".to_string();
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +505,7 @@ fn autostart_is_enabled() -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const AUTOSTART_ARG: &str = "--autostart";
|
// pub const AUTOSTART_ARG: &str = "--autostart";
|
||||||
pub const TASKAUTOSTART_ARG: &str = "--task-auto-start";
|
pub const TASKAUTOSTART_ARG: &str = "--task-auto-start";
|
||||||
fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||||
if !enabled {
|
if !enabled {
|
||||||
@@ -550,10 +573,11 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
|||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
// 获取命令行参数
|
// 获取命令行参数
|
||||||
let args: Vec<String> = std::env::args().collect();
|
let _args: Vec<String> = std::env::args().collect();
|
||||||
|
|
||||||
let context = tauri::generate_context!();
|
let context = tauri::generate_context!();
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_cli::init())
|
||||||
.plugin(
|
.plugin(
|
||||||
tauri_plugin_window_state::Builder::new()
|
tauri_plugin_window_state::Builder::new()
|
||||||
.with_state_flags(tauri_plugin_window_state::StateFlags::SIZE)
|
.with_state_flags(tauri_plugin_window_state::StateFlags::SIZE)
|
||||||
@@ -561,10 +585,6 @@ pub fn run() {
|
|||||||
)
|
)
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
.plugin(tauri_plugin_autostart::init(
|
|
||||||
MacosLauncher::LaunchAgent,
|
|
||||||
Some(vec![AUTOSTART_ARG]),
|
|
||||||
))
|
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||||
let _ = app
|
let _ = app
|
||||||
@@ -574,7 +594,7 @@ pub fn run() {
|
|||||||
.expect("failed to set focus");
|
.expect("failed to set focus");
|
||||||
}))
|
}))
|
||||||
.setup(move |app| {
|
.setup(move |app| {
|
||||||
let args = args.clone();
|
// let args = args.clone();
|
||||||
// if cfg!(debug_assertions) {
|
// if cfg!(debug_assertions) {
|
||||||
let log_path = get_tool_exe_path(String::from("\\easytier\\guiLogs"));
|
let log_path = get_tool_exe_path(String::from("\\easytier\\guiLogs"));
|
||||||
app.handle().plugin(
|
app.handle().plugin(
|
||||||
@@ -611,11 +631,11 @@ pub fn run() {
|
|||||||
.build(app)?;
|
.build(app)?;
|
||||||
|
|
||||||
// 开机自启隐藏到托盘或者显示主窗口
|
// 开机自启隐藏到托盘或者显示主窗口
|
||||||
if !args.contains(&String::from(TASKAUTOSTART_ARG)) {
|
// if !args.contains(&String::from(TASKAUTOSTART_ARG)) {
|
||||||
let main_window = app.get_webview_window("main").unwrap();
|
// let main_window = app.get_webview_window("main").unwrap();
|
||||||
main_window.show().expect("failed to show window");
|
// main_window.show().expect("failed to show window");
|
||||||
main_window.set_focus().expect("failed to set focus");
|
// main_window.set_focus().expect("failed to set focus");
|
||||||
}
|
// }
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
@@ -629,7 +649,9 @@ pub fn run() {
|
|||||||
search_pid_by_pname,
|
search_pid_by_pname,
|
||||||
get_exe_directory,
|
get_exe_directory,
|
||||||
spawn_autostart,
|
spawn_autostart,
|
||||||
autostart_is_enabled
|
autostart_is_enabled,
|
||||||
|
prevent_sleep,
|
||||||
|
allow_sleep
|
||||||
])
|
])
|
||||||
.run(context)
|
.run(context)
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||||
"productName": "easytier-game",
|
"productName": "easytier-game",
|
||||||
"version": "1.2.8",
|
"version": "1.3.0",
|
||||||
"identifier": "com.tauri.easytier-game",
|
"identifier": "com.tauri.easytier-game",
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "easytier-game 1.2.8",
|
"title": "easytier-game 1.3.0",
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"minWidth": 340,
|
"minWidth": 340,
|
||||||
"width": 340,
|
"width": 340,
|
||||||
@@ -34,7 +34,17 @@
|
|||||||
"csp": null
|
"csp": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"plugins": {},
|
"plugins": {
|
||||||
|
"cli": {
|
||||||
|
"description": "easytier game CLI Plugin",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"name": "task-auto-start",
|
||||||
|
"description": "easytier game autostart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": false,
|
"active": false,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
|
|||||||
+19
-10
@@ -13,6 +13,9 @@ export default defineStore("main", {
|
|||||||
autoStart: false, // 是否自动启动
|
autoStart: false, // 是否自动启动
|
||||||
connectAfterStart: false, //软件打开后,是否自动连接
|
connectAfterStart: false, //软件打开后,是否自动连接
|
||||||
disableIpv6: false, // 是否禁用IPv6
|
disableIpv6: false, // 是否禁用IPv6
|
||||||
|
port: "11010", // 监听端口号
|
||||||
|
enableCustomListener: false, // 是否自定义监听
|
||||||
|
customListenerData: "", // 自定义监听地址
|
||||||
disbleListenner: false, // 是否禁用监听
|
disbleListenner: false, // 是否禁用监听
|
||||||
disableEncryption: true, // 是否禁用加密
|
disableEncryption: true, // 是否禁用加密
|
||||||
multiThread: false, //使用多线程
|
multiThread: false, //使用多线程
|
||||||
@@ -28,8 +31,11 @@ export default defineStore("main", {
|
|||||||
logLevel: "error", //日志等级
|
logLevel: "error", //日志等级
|
||||||
devName: false, //自定义网卡名
|
devName: false, //自定义网卡名
|
||||||
devNameValue: "", //自定义网卡名
|
devNameValue: "", //自定义网卡名
|
||||||
|
enableCustonProtocol: false, //自定义默认协议
|
||||||
|
customProtocol: "tcp", //自定义默认协议
|
||||||
enableNetCardMetric: false, //启用网卡自定义跃点
|
enableNetCardMetric: false, //启用网卡自定义跃点
|
||||||
netCardMetricValue: 1 //自定义网卡跃点值
|
netCardMetricValue: 1, //自定义网卡跃点值
|
||||||
|
enablePreventSleep: false, //组织系统休眠
|
||||||
},
|
},
|
||||||
serverConfig: {
|
serverConfig: {
|
||||||
enableWhiteList: true, // 是否启用白名单
|
enableWhiteList: true, // 是否启用白名单
|
||||||
@@ -37,7 +43,7 @@ export default defineStore("main", {
|
|||||||
serverWhiteList: "", // 服务器流量转发白名单
|
serverWhiteList: "", // 服务器流量转发白名单
|
||||||
// enableListener: true, // 是否启用监听
|
// enableListener: true, // 是否启用监听
|
||||||
autoStart: false, //随软件自启
|
autoStart: false, //随软件自启
|
||||||
port: "11010", // 服务器端口
|
port: "11010" // 服务器端口
|
||||||
},
|
},
|
||||||
cidrEnable: false,
|
cidrEnable: false,
|
||||||
basePeers: ["public.easytier.top:11010"],
|
basePeers: ["public.easytier.top:11010"],
|
||||||
@@ -48,7 +54,6 @@ export default defineStore("main", {
|
|||||||
createConfigInEasytier: false, //在easytier目录生成config.json文件吗
|
createConfigInEasytier: false, //在easytier目录生成config.json文件吗
|
||||||
githubFastUrl: "https://ghproxy.cc/",
|
githubFastUrl: "https://ghproxy.cc/",
|
||||||
|
|
||||||
|
|
||||||
winipBcPid: 0,
|
winipBcPid: 0,
|
||||||
winipBcStart: false
|
winipBcStart: false
|
||||||
};
|
};
|
||||||
@@ -83,14 +88,18 @@ export default defineStore("main", {
|
|||||||
"config.devNameValue",
|
"config.devNameValue",
|
||||||
"config.enableNetCardMetric",
|
"config.enableNetCardMetric",
|
||||||
"config.netCardMetricValue",
|
"config.netCardMetricValue",
|
||||||
|
"config.port",
|
||||||
|
"config.enableCustomListener",
|
||||||
|
"config.customListenerData",
|
||||||
|
"config.enableCustonProtocol",
|
||||||
|
"config.customProtocol",
|
||||||
|
|
||||||
"serverConfig.autoStart",
|
"serverConfig.autoStart",
|
||||||
// 'serverConfig.enableListener',
|
// 'serverConfig.enableListener',
|
||||||
'serverConfig.enableWhiteList',
|
"serverConfig.enableWhiteList",
|
||||||
'serverConfig.relayAllPeerrpc',
|
"serverConfig.relayAllPeerrpc",
|
||||||
'serverConfig.serverWhiteList',
|
"serverConfig.serverWhiteList",
|
||||||
'serverConfig.port',
|
"serverConfig.port",
|
||||||
|
|
||||||
|
|
||||||
"cidrEnable",
|
"cidrEnable",
|
||||||
"basePeers",
|
"basePeers",
|
||||||
@@ -99,8 +108,8 @@ export default defineStore("main", {
|
|||||||
"configPath",
|
"configPath",
|
||||||
"winIpBcAutoStart",
|
"winIpBcAutoStart",
|
||||||
"createConfigInEasytier",
|
"createConfigInEasytier",
|
||||||
"githubFastUrl",
|
"githubFastUrl"
|
||||||
],
|
]
|
||||||
// // 除了这些,其他都要存下来
|
// // 除了这些,其他都要存下来
|
||||||
// omit: ["winipBcPid", "winipBcStart"]
|
// omit: ["winipBcPid", "winipBcStart"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { open } from "@tauri-apps/plugin-shell";
|
import { open } from "@tauri-apps/plugin-shell";
|
||||||
export const ENV = import.meta.env;
|
export const ENV = import.meta.env;
|
||||||
|
|
||||||
@@ -64,6 +65,27 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _supportProtocols = ["tcp", "udp", "ws", "wss", "quic"];
|
||||||
|
|
||||||
|
export const supportProtocols = () => {
|
||||||
|
return _supportProtocols.slice();
|
||||||
|
}
|
||||||
|
|
||||||
|
let _prevent_timer: NodeJS.Timeout| null = null;
|
||||||
|
let _prevent_timer_count = 30; // 秒
|
||||||
|
export const preventSleep = () => {
|
||||||
|
_prevent_timer && clearInterval(_prevent_timer);
|
||||||
|
_prevent_timer = setInterval(async () => {
|
||||||
|
const result = await invoke('prevent_sleep');
|
||||||
|
// console.log(`trigger prevent sleep ${result}`);
|
||||||
|
}, _prevent_timer_count * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const stopPreventSleep = () => {
|
||||||
|
_prevent_timer && clearInterval(_prevent_timer);
|
||||||
|
_prevent_timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
export const parsePeerInfo = (content: string) => {
|
export const parsePeerInfo = (content: string) => {
|
||||||
if(!content) return [];
|
if(!content) return [];
|
||||||
// 将表格字符串分割成行
|
// 将表格字符串分割成行
|
||||||
|
|||||||
Reference in New Issue
Block a user