mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2026-09-25 11:36:54 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
777ec9b982 | ||
|
|
167002691c | ||
|
|
434014f690 | ||
|
|
0d0901de94 | ||
|
|
18f6c54a4f | ||
|
|
ad0f252dfd | ||
|
|
6bf4d54361 | ||
|
|
8f2c800380 | ||
|
|
8b2ce406d8 | ||
|
|
10dde939cb | ||
|
|
84460409ed | ||
|
|
60faa01769 | ||
|
|
26f3f6fb36 | ||
|
|
494087820a | ||
|
|
87f4d98518 | ||
|
|
30a2c3430b | ||
|
|
aab8175ce3 | ||
|
|
136ce06c33 | ||
|
|
bdeda8bebd | ||
|
|
3ee09f7d60 | ||
|
|
7853d3b2f5 | ||
|
|
aacf47b6f5 | ||
|
|
d9b01fc754 | ||
|
|
844fba8462 | ||
|
|
6bfe3860a8 | ||
|
|
a0b4071c49 | ||
|
|
8e9bb114d6 | ||
|
|
fb8e127198 | ||
|
|
3cd19ae42a |
@@ -1,12 +1,12 @@
|
|||||||
pnpm run build
|
pnpm run build
|
||||||
@REM rustup default nightly
|
rustup default nightly
|
||||||
@REM rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
|
@REM rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x86
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x86
|
||||||
@REM pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
|
pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
|
||||||
rustup default stable
|
rustup default stable
|
||||||
pnpm tauri build
|
pnpm tauri build
|
||||||
pnpm run release
|
pnpm run release
|
||||||
@REM pnpm run release-win7
|
pnpm run release-win7
|
||||||
@@ -2,7 +2,21 @@ import { BaseDirectory, writeTextFile } from "@tauri-apps/plugin-fs";
|
|||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { uniq, intersection, isNil } from "lodash-es";
|
import { uniq, intersection, isNil } from "lodash-es";
|
||||||
export const updateConfigJson = async (configJsonSeverUrl: Array<string> | string | null | undefined) => {
|
import { bounce } from "~/utils";
|
||||||
|
|
||||||
|
const b = bounce(600);
|
||||||
|
export type ConfigServerUrlType = Array<string> | string | null | undefined | null;
|
||||||
|
|
||||||
|
export const updateConfigJsonBounce = (configJsonSeverUrl?: ConfigServerUrlType) => {
|
||||||
|
b(async () => {
|
||||||
|
const mainStore = useMainStore();
|
||||||
|
if (mainStore.createConfigInEasytier) {
|
||||||
|
await updateConfigJson(configJsonSeverUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType) => {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||||
if (isNil(configJsonSeverUrl)) {
|
if (isNil(configJsonSeverUrl)) {
|
||||||
@@ -20,6 +34,13 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
|
|||||||
enableCustomListener,
|
enableCustomListener,
|
||||||
customListenerData,
|
customListenerData,
|
||||||
bindDeviceEnable,
|
bindDeviceEnable,
|
||||||
|
acceptDNS,
|
||||||
|
enablePortForward,
|
||||||
|
portForwardData,
|
||||||
|
tcpWhitelist,
|
||||||
|
udpWhitelist,
|
||||||
|
tcpWhitelistEnable,
|
||||||
|
udpWhitelistEnable,
|
||||||
...otherConfig
|
...otherConfig
|
||||||
} = mainStore.config;
|
} = mainStore.config;
|
||||||
let writeServerUrl: Array<string> | string = serverUrl;
|
let writeServerUrl: Array<string> | string = serverUrl;
|
||||||
|
|||||||
+44
-44
@@ -6,55 +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;
|
||||||
mainStore.$patch({
|
// mainStore.$patch({
|
||||||
winipBcStart: !!(mainStore.winipBcPid && mainStore.winipBcPid > 0)
|
// winipBcStart: !!(mainStore.winipBcPid && mainStore.winipBcPid > 0)
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
await getWinIpBroadcastPid();
|
// await getWinIpBroadcastPid();
|
||||||
if (mainStore.winipBcPid) {
|
// if (mainStore.winipBcPid) {
|
||||||
mainStore.$patch({
|
// mainStore.$patch({
|
||||||
winIpBcAutoStart: true
|
// winIpBcAutoStart: true
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
ElMessage.error(`WinipBc失败`);
|
// ElMessage.error(`WinipBc失败`);
|
||||||
}
|
// }
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
ElMessage.error(`WinipBc失败`);
|
// ElMessage.error(`WinipBc失败`);
|
||||||
console.error(err);
|
// console.error(err);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
// await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||||
await getWinIpBroadcastPid();
|
// await getWinIpBroadcastPid();
|
||||||
if (mainStore.winipBcPid <= 0) {
|
// if (mainStore.winipBcPid <= 0) {
|
||||||
mainStore.$patch({
|
// mainStore.$patch({
|
||||||
winIpBcAutoStart: false
|
// 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();
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,5 +20,17 @@ export const getServerArgs = () => {
|
|||||||
if (!whiteList && mainStore.serverConfig.enableWhiteList) {
|
if (!whiteList && mainStore.serverConfig.enableWhiteList) {
|
||||||
args.push("--relay-network-whitelist");
|
args.push("--relay-network-whitelist");
|
||||||
}
|
}
|
||||||
|
if (mainStore.serverConfig.privateMode) {
|
||||||
|
args.push("--private-mode", "true");
|
||||||
|
}
|
||||||
|
const networkName = mainStore.serverConfig.privateNetworkName.trim();
|
||||||
|
if (networkName) {
|
||||||
|
args.push("--network-name", networkName);
|
||||||
|
}
|
||||||
|
const networkSecret = mainStore.serverConfig.privateNetworkPassword.trim();
|
||||||
|
if (networkSecret) {
|
||||||
|
args.push("--network-secret", networkSecret);
|
||||||
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
|
|||||||
+15
-4
@@ -22,7 +22,7 @@ async function toggleVisibility() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function useTray(init: boolean = false, beforExit: Function, handleConnection: Function) {
|
export async function useTray(init: boolean = false, beforExit: Function, handleConnection: Function, handleReconnect: Function) {
|
||||||
let tray;
|
let tray;
|
||||||
try {
|
try {
|
||||||
tray = await TrayIcon.getById(DEFAULT_TRAY_NAME);
|
tray = await TrayIcon.getById(DEFAULT_TRAY_NAME);
|
||||||
@@ -31,7 +31,7 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
|
|||||||
tooltip: `EasyTierGame\n${pkg.version}`,
|
tooltip: `EasyTierGame\n${pkg.version}`,
|
||||||
title: `EasyTierGame\n${pkg.version}`,
|
title: `EasyTierGame\n${pkg.version}`,
|
||||||
id: DEFAULT_TRAY_NAME,
|
id: DEFAULT_TRAY_NAME,
|
||||||
menu: await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }),
|
menu: await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection, handleReconnect) }),
|
||||||
action: async e => {
|
action: async e => {
|
||||||
toggleVisibility();
|
toggleVisibility();
|
||||||
}
|
}
|
||||||
@@ -45,16 +45,17 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
|
|||||||
if (init) {
|
if (init) {
|
||||||
tray.setTooltip(`EasyTierGame\n${pkg.version}`);
|
tray.setTooltip(`EasyTierGame\n${pkg.version}`);
|
||||||
tray.setShowMenuOnLeftClick(false);
|
tray.setShowMenuOnLeftClick(false);
|
||||||
tray.setMenu(await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }));
|
tray.setMenu(await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection, handleReconnect) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return tray;
|
return tray;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateMenuItem(beforExit: Function, handleConnection: Function) {
|
export async function generateMenuItem(beforExit: Function, handleConnection: Function, handleReconnect: Function) {
|
||||||
return [
|
return [
|
||||||
await MenuItemShow("显示 / 隐藏"),
|
await MenuItemShow("显示 / 隐藏"),
|
||||||
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
|
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
|
||||||
|
await MenuItemReconnect("重新联机", handleReconnect),
|
||||||
await MenuItemTheme(),
|
await MenuItemTheme(),
|
||||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||||
await MenuItemPublicPeers(),
|
await MenuItemPublicPeers(),
|
||||||
@@ -63,6 +64,16 @@ export async function generateMenuItem(beforExit: Function, handleConnection: Fu
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function MenuItemReconnect(text: string, handleReconnect: Function) {
|
||||||
|
return await MenuItem.new({
|
||||||
|
id: "reconnect",
|
||||||
|
text,
|
||||||
|
action: async () => {
|
||||||
|
await handleReconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function MenuItemExit(text: string, beforExit: Function) {
|
export async function MenuItemExit(text: string, beforExit: Function) {
|
||||||
return await MenuItem.new({
|
return await MenuItem.new({
|
||||||
id: "quit",
|
id: "quit",
|
||||||
|
|||||||
+23
-18
@@ -1,17 +1,14 @@
|
|||||||
import { type UnlistenFn } from "@tauri-apps/api/event";
|
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, PhysicalSize } 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 useMainStore from "@/stores/index";
|
||||||
import { onBeforeUnmount } from "vue";
|
import { onBeforeUnmount } from "vue";
|
||||||
|
import { updateConfigJsonBounce, type ConfigServerUrlType } from "./configJson";
|
||||||
|
|
||||||
const _listenersMaps: { [key: string]: [UnlistenFn | null] } = {};
|
const _listenersMaps: { [key: string]: [UnlistenFn | null] } = {};
|
||||||
|
|
||||||
const dealCloseListener = async (
|
const dealCloseListener = async (dialog: WebviewWindow, label: string, beforeCloseFunc?: () => void | null) => {
|
||||||
dialog: WebviewWindow,
|
|
||||||
label: string,
|
|
||||||
beforeCloseFunc?: () => void | null
|
|
||||||
) => {
|
|
||||||
const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null];
|
const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null];
|
||||||
let [unListenlogClose] = unlistenFnList;
|
let [unListenlogClose] = unlistenFnList;
|
||||||
|
|
||||||
@@ -20,7 +17,7 @@ const dealCloseListener = async (
|
|||||||
unListenlogClose = await dialog.onCloseRequested(async () => {
|
unListenlogClose = await dialog.onCloseRequested(async () => {
|
||||||
beforeCloseFunc && (await beforeCloseFunc());
|
beforeCloseFunc && (await beforeCloseFunc());
|
||||||
unListenlogClose && (await unListenlogClose());
|
unListenlogClose && (await unListenlogClose());
|
||||||
console.log("close")
|
console.log("close");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
export default async (
|
export default async (
|
||||||
@@ -44,20 +41,24 @@ export default async (
|
|||||||
};
|
};
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
if (appWindow) {
|
if (appWindow) {
|
||||||
const appSize = await appWindow.outerSize();
|
|
||||||
const factor = await appWindow.scaleFactor();
|
|
||||||
const appPosition = await appWindow.outerPosition();
|
|
||||||
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;
|
if (defaultOpts.x == 0 && defaultOpts.y == 0) {
|
||||||
defaultOpts.y = logicalPosition.y;
|
const logicalAppSize = {
|
||||||
|
width: 340,
|
||||||
|
height: 305
|
||||||
|
}
|
||||||
|
const factor = await appWindow.scaleFactor();
|
||||||
|
const appPosition = await appWindow.outerPosition();
|
||||||
|
const logicalPosition = new PhysicalPosition(appPosition.x + Math.ceil((logicalAppSize.width + 5) * factor), appPosition.y).toLogical(factor);
|
||||||
|
defaultOpts.x = logicalPosition.x;
|
||||||
|
defaultOpts.y = logicalPosition.y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
||||||
await dealCloseListener(dialog, label, beforeCloseFunc);
|
await dealCloseListener(dialog, label, beforeCloseFunc);
|
||||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
|
||||||
await dialog.show();
|
await dialog.show();
|
||||||
|
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||||
} else {
|
} else {
|
||||||
const visible = await dialog.isVisible();
|
const visible = await dialog.isVisible();
|
||||||
if (visible) {
|
if (visible) {
|
||||||
@@ -65,20 +66,23 @@ export default async (
|
|||||||
} else {
|
} else {
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
await dealCloseListener(dialog, label, beforeCloseFunc);
|
await dealCloseListener(dialog, label, beforeCloseFunc);
|
||||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
|
||||||
await dialog.show();
|
await dialog.show();
|
||||||
|
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dataSubscribe = async (cb?: (...args: any) => any) => {
|
export const dataSubscribe = async (cb?: any, getconfigServerUrl?: () => ConfigServerUrlType) => {
|
||||||
if (!cb) return;
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const abort = new AbortController();
|
const abort = new AbortController();
|
||||||
|
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
"storage",
|
"storage",
|
||||||
async () => {
|
async () => {
|
||||||
|
// console.log("触发", {dhcp:mainStore.config.dhcp, c: mainStore.createConfigInEasytier})
|
||||||
mainStore.$hydrate();
|
mainStore.$hydrate();
|
||||||
|
const configServerUrl = getconfigServerUrl && getconfigServerUrl instanceof Function ? getconfigServerUrl() : null;
|
||||||
|
updateConfigJsonBounce(configServerUrl);
|
||||||
if (cb && cb instanceof Function) {
|
if (cb && cb instanceof Function) {
|
||||||
await cb();
|
await cb();
|
||||||
}
|
}
|
||||||
@@ -88,6 +92,7 @@ export const dataSubscribe = async (cb?: (...args: any) => any) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
console.log("取消监听");
|
||||||
abort?.abort();
|
abort?.abort();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-1
@@ -6,7 +6,8 @@
|
|||||||
//屏蔽右键菜单
|
//屏蔽右键菜单
|
||||||
document.addEventListener("contextmenu", (e: MouseEvent) => {
|
document.addEventListener("contextmenu", (e: MouseEvent) => {
|
||||||
const el = (e.target as HTMLElement);
|
const el = (e.target as HTMLElement);
|
||||||
if (import.meta.env.PROD && !el.classList.contains("el-input__inner") && !el.classList.contains("el-textarea__inner")) { // 所有输入框不禁用右键
|
if (import.meta.env.PROD && !el.classList.contains("el-input__inner") && !el.classList.contains("el-textarea__inner")
|
||||||
|
&& !el.classList.contains("allow-contextmenu")) { // 所有输入框不禁用右键
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+22
-19
@@ -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.4.4",
|
"version": "1.4.8",
|
||||||
"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",
|
||||||
@@ -12,30 +12,33 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"@element-plus/nuxt": "^1.1.1",
|
"@element-plus/nuxt": "1.1.4",
|
||||||
"@nuxtjs/tailwindcss": "6.13.2",
|
"@nuxtjs/tailwindcss": "6.13.2",
|
||||||
"@pinia/nuxt": "0.11.0",
|
"@pinia/nuxt": "0.11.1",
|
||||||
"@tauri-apps/api": "2.5.0",
|
"@tauri-apps/api": "2.7.0",
|
||||||
"@tauri-apps/cli": "2.5.0",
|
"@tauri-apps/cli": "2.7.1",
|
||||||
"@tauri-apps/plugin-cli": "^2.2.0",
|
"@tauri-apps/plugin-cli": "2.4.0",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.2.2",
|
"@tauri-apps/plugin-clipboard-manager": "2.3.0",
|
||||||
"@tauri-apps/plugin-dialog": "2.2.1",
|
"@tauri-apps/plugin-dialog": "2.3.1",
|
||||||
"@tauri-apps/plugin-fs": "2.2.1",
|
"@tauri-apps/plugin-fs": "2.4.1",
|
||||||
"@tauri-apps/plugin-log": "2.3.1",
|
"@tauri-apps/plugin-log": "2.6.0",
|
||||||
"@tauri-apps/plugin-shell": "2.2.1",
|
"@tauri-apps/plugin-shell": "2.3.0",
|
||||||
"@tauri-apps/plugin-window-state": "2.2.2",
|
"@tauri-apps/plugin-window-state": "2.4.0",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@vitejs/plugin-vue-jsx": "4.1.2",
|
"@vitejs/plugin-vue-jsx": "5.0.1",
|
||||||
"@vueuse/core": "12.7.0",
|
"@vueuse/core": "12.7.0",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"element-plus": "2.9.7",
|
"element-plus": "2.10.7",
|
||||||
"less": "4.2.1",
|
"less": "4.2.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"nuxt": "3.16.2",
|
"nuxt": "3.18.1",
|
||||||
"pinia": "3.0.2",
|
"pinia": "3.0.3",
|
||||||
"pinia-plugin-persistedstate": "^4.2.0",
|
"pinia-plugin-persistedstate": "4.4.1",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
"prettier": "3.5.2",
|
"prettier": "3.6.2",
|
||||||
"prettier-plugin-tailwindcss": "0.6.11"
|
"prettier-plugin-tailwindcss": "0.6.14"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"is-ip": "^5.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+137
-50
@@ -44,22 +44,70 @@
|
|||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||||
<ElCheckbox v-model="mainStore.config.enableKcpProxy">启用KCP代理</ElCheckbox>
|
<ElCheckbox
|
||||||
<ElTooltip content="将TCP流量转为KCP流量,降低传输延迟,提升传输速度">
|
@change="handleKcpProxyChange"
|
||||||
|
v-model="mainStore.config.enableKcpProxy"
|
||||||
|
>
|
||||||
|
启用KCP代理
|
||||||
|
</ElCheckbox>
|
||||||
|
<ElTooltip content="(不可与QUIC代理同时开启)将TCP流量转为KCP流量,降低传输延迟,提升传输速度">
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
<CoreVersionWarning version="2.2.0" />
|
<CoreVersionWarning version="2.2.0" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||||
<ElCheckbox v-model="mainStore.config.disableKcpInput">禁用KCP输入</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.disableKcpInput">禁用KCP输入</ElCheckbox>
|
||||||
<ElTooltip content="禁用KCP入站流量,其他开启KCP代理的节点无法连接到本节点">
|
<ElTooltip content="不允许其他节点使用 KCP 代理 TCP 流到此节点。开启 KCP 代理的节点访问此节点时,依然使用原始 TCP 连接">
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
<CoreVersionWarning version="2.2.0" />
|
<CoreVersionWarning version="2.2.0" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||||
|
<ElCheckbox
|
||||||
|
@change="handleQuicProxyChange"
|
||||||
|
v-model="mainStore.config.enableQuicProxy"
|
||||||
|
>
|
||||||
|
启用QUIC代理
|
||||||
|
</ElCheckbox>
|
||||||
|
<ElTooltip content="(不可与KCP代理同时开启)使用 QUIC 代理 TCP 流,提高在 UDP 丢包网络上的延迟和吞吐量">
|
||||||
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
|
</ElTooltip>
|
||||||
|
<CoreVersionWarning version="2.3.2" />
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.disableQuicInput">禁用QUIC输入</ElCheckbox>
|
||||||
|
<ElTooltip content="不允许其他节点使用 QUIC 代理 TCP 流到此节点。开启 QUIC 代理的节点访问此节点时,依然使用原始 TCP 连接">
|
||||||
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
|
</ElTooltip>
|
||||||
|
<CoreVersionWarning version="2.3.2" />
|
||||||
|
</div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
||||||
|
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.acceptDNS">魔法DNS</ElCheckbox>
|
||||||
|
<ElTooltip content="您可以使用域名访问其他节点,例如:<hostname>.et.net。魔法DNS将修改您的系统DNS设置,请谨慎启用">
|
||||||
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
|
</ElTooltip>
|
||||||
|
<CoreVersionWarning version="2.3.0" />
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.privateMode">启用私有模式</ElCheckbox>
|
||||||
|
<ElTooltip content="启用后,不允许使用了与本网络不同的房间名和密码的节点通过本节点进行握手或中转">
|
||||||
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
|
</ElTooltip>
|
||||||
|
<CoreVersionWarning version="2.3.1" />
|
||||||
|
</div>
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
|
<div class="flex w-full flex-nowrap items-center gap-[5px] mb-[3px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.tcpWhitelistEnable">TCP端口白名单</ElCheckbox>
|
||||||
|
<ElInput class="flex-1" v-model="mainStore.config.tcpWhitelist" placeholder="支持单个端口(80)和范围(8000-9000)" />
|
||||||
|
<CoreVersionWarning version="2.4.2" />
|
||||||
|
</div>
|
||||||
|
<div class="flex w-full flex-nowrap items-center gap-[5px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.udpWhitelistEnable">UDP端口白名单</ElCheckbox>
|
||||||
|
<ElInput class="flex-1" v-model="mainStore.config.udpWhitelist" placeholder="支持单个端口(53)和范围(5000-6000)" />
|
||||||
|
<CoreVersionWarning version="2.4.2" />
|
||||||
|
</div>
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||||
<ElTooltip content="无法联机时,可以尝试开启这个选项">
|
<ElTooltip content="无法联机时,可以尝试开启这个选项">
|
||||||
@@ -103,6 +151,7 @@
|
|||||||
class="!mb-0"
|
class="!mb-0"
|
||||||
v-model="listenerDialogData.visible"
|
v-model="listenerDialogData.visible"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
|
:close-on-click-modal="false"
|
||||||
title="自定义监听地址"
|
title="自定义监听地址"
|
||||||
>
|
>
|
||||||
<ElInput
|
<ElInput
|
||||||
@@ -124,28 +173,65 @@
|
|||||||
</template>
|
</template>
|
||||||
</ElDialog>
|
</ElDialog>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
<ElCheckbox
|
<ElCheckbox v-model="mainStore.config.enablePortForward">端口转发</ElCheckbox>
|
||||||
:disabled="mainStore.config.disbleListenner"
|
<ElTooltip
|
||||||
:model-value="mainStore.config.enableCustomListenerV6"
|
:disabled="mainStore.config.enablePortForward"
|
||||||
@change="handleCustomListenerV6Change"
|
content="请先开启端口转发功能"
|
||||||
>
|
>
|
||||||
自定义IPV6监听地址
|
<ElButton
|
||||||
</ElCheckbox>
|
|
||||||
<div class="w-[200px]">
|
|
||||||
<ElInput
|
|
||||||
:disabled="mainStore.config.disbleListenner || mainStore.config.enableCustomListenerV6"
|
|
||||||
size="small"
|
size="small"
|
||||||
:maxlength="100"
|
:disabled="!mainStore.config.enablePortForward"
|
||||||
v-model="mainStore.config.customListenerV6Data"
|
@click="handlePortForwardDialog"
|
||||||
placeholder="请输入自定义IPV6监听地址"
|
>
|
||||||
/>
|
配置
|
||||||
</div>
|
</ElButton>
|
||||||
<ElTooltip content="例如:tcp://[::]:11010,如果未设置,将在随机UDP端口上监听(内核版本2.2.3之后,ipv6监听被移除并合并到'自定义监听')">
|
</ElTooltip>
|
||||||
|
<ElTooltip
|
||||||
|
content="将本地端口转发到虚拟网络中的远程端口.如:udp://0.0.0.0:12345/10.126.126.1:23456,表示将本地UDP端口12345转发到虚拟网络中的10.126.126.1:23456.可以指定多个"
|
||||||
|
>
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
<CoreVersionWarning version="2.1.0" />
|
<CoreVersionWarning version="2.3.0" />
|
||||||
</div> -->
|
<ElDialog
|
||||||
|
width="95%"
|
||||||
|
top="5px"
|
||||||
|
append-to-body
|
||||||
|
:z-index="10"
|
||||||
|
class="!mb-0"
|
||||||
|
v-model="portForwardDialogData.visible"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
title="端口转发配置"
|
||||||
|
>
|
||||||
|
<div class="mb-4">
|
||||||
|
<ElText
|
||||||
|
size="small"
|
||||||
|
type="info"
|
||||||
|
>
|
||||||
|
<div>• 每行一个转发规则</div>
|
||||||
|
<div>• 格式:协议://本地地址:本地端口/目标地址:目标端口</div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span class="mr-auto">• 例如:udp://0.0.0.0:12345/10.126.126.1:23456</span>
|
||||||
|
<ElButton
|
||||||
|
size="default"
|
||||||
|
type="primary"
|
||||||
|
@click.stop="handleFinishInputPortForward"
|
||||||
|
>
|
||||||
|
填写完毕
|
||||||
|
</ElButton>
|
||||||
|
</div>
|
||||||
|
</ElText>
|
||||||
|
</div>
|
||||||
|
<ElInput
|
||||||
|
type="textarea"
|
||||||
|
:rows="10"
|
||||||
|
placeholder="请输入端口转发规则,每行一个 例如: udp://0.0.0.0:12345/10.126.126.1:23456 tcp://0.0.0.0:8080/192.168.1.100:80"
|
||||||
|
v-model="mainStore.config.portForwardData"
|
||||||
|
></ElInput>
|
||||||
|
<!-- -->
|
||||||
|
</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>
|
||||||
@@ -193,25 +279,9 @@
|
|||||||
|
|
||||||
<div class="flex items-center gap-[5px]">
|
<div class="flex items-center gap-[5px]">
|
||||||
<div><ElCheckbox v-model="mainStore.config.bindDeviceEnable">绑定物理网卡</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.bindDeviceEnable">绑定物理网卡</ElCheckbox></div>
|
||||||
<!-- <div class="flex items-center gap-[5px]"> -->
|
|
||||||
<!-- <ElSelect
|
|
||||||
placeholder="选择设备"
|
|
||||||
v-model="mainStore.config.bindDevice"
|
|
||||||
filterable
|
|
||||||
no-data-text="暂无网卡设备数据,请刷新"
|
|
||||||
>
|
|
||||||
<ElOption
|
|
||||||
v-for="guid in guids"
|
|
||||||
:key="guid[0]"
|
|
||||||
:label="guid[1]"
|
|
||||||
:value="guid[0]"
|
|
||||||
></ElOption>
|
|
||||||
</ElSelect> -->
|
|
||||||
<!-- <ElButton @click="getGuids">刷新</ElButton> -->
|
|
||||||
<ElTooltip content="将连接器的套接字绑定到物理设备以避免路由问题。比如子网代理网段与某节点的网段冲突,绑定物理设备后可以与该节点正常通信">
|
<ElTooltip content="将连接器的套接字绑定到物理设备以避免路由问题。比如子网代理网段与某节点的网段冲突,绑定物理设备后可以与该节点正常通信">
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
<!-- </div> -->
|
|
||||||
<CoreVersionWarning version="2.2.3" />
|
<CoreVersionWarning version="2.2.3" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -304,6 +374,15 @@
|
|||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const portForwardDialogData = reactive<{ [key: string]: any }>({
|
||||||
|
visible: false,
|
||||||
|
loading: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const handlePortForwardDialog = () => {
|
||||||
|
portForwardDialogData.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
const handleListenerDialog = () => {
|
const handleListenerDialog = () => {
|
||||||
listenerDialogData.visible = true;
|
listenerDialogData.visible = true;
|
||||||
};
|
};
|
||||||
@@ -312,19 +391,9 @@
|
|||||||
listenerDialogData.visible = false;
|
listenerDialogData.visible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const handleCustomListenerV6Change = async (value: boolean) => {
|
const handleFinishInputPortForward = async () => {
|
||||||
// if (value) {
|
portForwardDialogData.visible = false;
|
||||||
// const [error, _] = await ElConfirmDanger("内核版本2.2.3之后,ipv6监听被移除并合并到'自定义监听',请谨慎使用", "警告", {
|
};
|
||||||
// confirmButtonText: "继续使用",
|
|
||||||
// cancelButtonText: "取消"
|
|
||||||
// });
|
|
||||||
// if (!error) {
|
|
||||||
// mainStore.config.enableCustomListenerV6 = value;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// mainStore.config.enableCustomListenerV6 = value;
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const data = ["trace", "debug", "info", "warn", "error", "off"];
|
const data = ["trace", "debug", "info", "warn", "error", "off"];
|
||||||
@@ -353,6 +422,24 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleKcpProxyChange = () => {
|
||||||
|
if (mainStore.config.enableKcpProxy) {
|
||||||
|
if (mainStore.config.enableQuicProxy) {
|
||||||
|
ElMessage.warning("KCP代理和QUIC代理不能同时开启");
|
||||||
|
}
|
||||||
|
mainStore.config.enableQuicProxy = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleQuicProxyChange = () => {
|
||||||
|
if (mainStore.config.enableQuicProxy) {
|
||||||
|
if (mainStore.config.enableKcpProxy) {
|
||||||
|
ElMessage.warning("KCP代理和QUIC代理不能同时开启");
|
||||||
|
}
|
||||||
|
mainStore.config.enableKcpProxy = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 为bind_device功能增加改方法
|
// 为bind_device功能增加改方法
|
||||||
const getGuids = async () => {
|
const getGuids = async () => {
|
||||||
const guidsValue = await invoke<string[][]>("get_network_adapter_guids");
|
const guidsValue = await invoke<string[][]>("get_network_adapter_guids");
|
||||||
|
|||||||
+2
-1
@@ -113,9 +113,10 @@
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
unlistenStart = await listenStart();
|
unlistenStart = await listenStart();
|
||||||
dataSubscribe();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dataSubscribe();
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
unlistenStart && unlistenStart();
|
unlistenStart && unlistenStart();
|
||||||
});
|
});
|
||||||
|
|||||||
+341
-150
@@ -2,7 +2,7 @@
|
|||||||
<ElForm
|
<ElForm
|
||||||
size="small"
|
size="small"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
:model="config"
|
:model="mainStore.config"
|
||||||
>
|
>
|
||||||
<ElFormItem
|
<ElFormItem
|
||||||
label="服务器"
|
label="服务器"
|
||||||
@@ -70,18 +70,18 @@
|
|||||||
filterable
|
filterable
|
||||||
placeholder="请选择服务器地址"
|
placeholder="请选择服务器地址"
|
||||||
default-first-option
|
default-first-option
|
||||||
v-model="config.serverUrl"
|
v-model="mainStore.config.serverUrl"
|
||||||
no-data-text="无服务器地址"
|
no-data-text="无服务器地址"
|
||||||
@change="handleServerUrlChange"
|
@change="handleServerUrlChange"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<div :class="config.protocol && config.protocol.length > 1 ? 'w-[120px]' : 'w-[80px]'">
|
<div :class="mainStore.config.protocol && mainStore.config.protocol.length > 1 ? 'w-[120px]' : 'w-[80px]'">
|
||||||
<ElSelect
|
<ElSelect
|
||||||
placeholder="协议"
|
placeholder="协议"
|
||||||
multiple
|
multiple
|
||||||
collapse-tags
|
collapse-tags
|
||||||
@click.stop
|
@click.stop
|
||||||
v-model="config.protocol"
|
v-model="mainStore.config.protocol"
|
||||||
@change="handleServerUrlChange"
|
@change="handleServerUrlChange"
|
||||||
>
|
>
|
||||||
<ElOption
|
<ElOption
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<ElLink
|
<ElLink
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
:underline="false"
|
underline="never"
|
||||||
@click.stop="open(publicPeersLink)"
|
@click.stop="open(publicPeersLink)"
|
||||||
>
|
>
|
||||||
其他公共服务器
|
其他公共服务器
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
<ElInput
|
<ElInput
|
||||||
maxlength="100"
|
maxlength="100"
|
||||||
placeholder="请输入房间名"
|
placeholder="请输入房间名"
|
||||||
v-model="config.networkName"
|
v-model="mainStore.config.networkName"
|
||||||
></ElInput>
|
></ElInput>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
</div>
|
</div>
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
show-password
|
show-password
|
||||||
maxlength="100"
|
maxlength="100"
|
||||||
placeholder="请输入房间密码"
|
placeholder="请输入房间密码"
|
||||||
v-model="config.networkPassword"
|
v-model="mainStore.config.networkPassword"
|
||||||
type="password"
|
type="password"
|
||||||
></ElInput>
|
></ElInput>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
<ElInput
|
<ElInput
|
||||||
maxlength="100"
|
maxlength="100"
|
||||||
placeholder="例如: Player1"
|
placeholder="例如: Player1"
|
||||||
v-model="config.hostname"
|
v-model="mainStore.config.hostname"
|
||||||
></ElInput>
|
></ElInput>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem
|
<ElFormItem
|
||||||
@@ -206,23 +206,40 @@
|
|||||||
label="局域网IP"
|
label="局域网IP"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex h-[20px] items-center gap-[3px]">
|
<div class="flex h-[22px] items-center gap-[3px]">
|
||||||
虚拟网IP
|
<div class="mr-[8px]">IP</div>
|
||||||
|
<ElSwitch
|
||||||
|
v-model="mainStore.config.dhcp"
|
||||||
|
inline-prompt
|
||||||
|
inactive-text="固定V4"
|
||||||
|
active-text="动态V4"
|
||||||
|
size="small"
|
||||||
|
></ElSwitch>
|
||||||
|
<ElTooltip>
|
||||||
|
<template #content>
|
||||||
|
<div>选填V6地址,可与IPv4一起使用以进行双栈操作</div>
|
||||||
|
<div>----------------------------------------</div>
|
||||||
|
<div>当前V6地址: {{ mainStore.config.ipv6 || "-" }}</div>
|
||||||
|
</template>
|
||||||
|
<ElButton
|
||||||
|
text
|
||||||
|
size="small"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="handleDealIpv6"
|
||||||
|
:type="mainStore.config.ipv6 ? 'success' : 'info'"
|
||||||
|
>
|
||||||
|
V6
|
||||||
|
</ElButton>
|
||||||
|
</ElTooltip>
|
||||||
|
<ElDivider direction="vertical" />
|
||||||
<ElButton
|
<ElButton
|
||||||
@click.stop="handleCopyIp"
|
@click.stop="handleCopyIp"
|
||||||
type="primary"
|
type="primary"
|
||||||
text
|
text
|
||||||
size="small"
|
size="small"
|
||||||
title="复制IP"
|
title="复制V4"
|
||||||
:icon="CopyDocument"
|
:icon="CopyDocument"
|
||||||
></ElButton>
|
></ElButton>
|
||||||
<ElSwitch
|
|
||||||
v-model="config.dhcp"
|
|
||||||
inline-prompt
|
|
||||||
inactive-text="固定IP"
|
|
||||||
active-text="动态获取"
|
|
||||||
size="small"
|
|
||||||
></ElSwitch>
|
|
||||||
<!-- <ElTooltip content="对应命令行参数 --ipv4">
|
<!-- <ElTooltip content="对应命令行参数 --ipv4">
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
</ElTooltip> -->
|
</ElTooltip> -->
|
||||||
@@ -230,21 +247,21 @@
|
|||||||
</template>
|
</template>
|
||||||
<ElInput
|
<ElInput
|
||||||
maxlength="100"
|
maxlength="100"
|
||||||
:readonly="config.dhcp"
|
:readonly="mainStore.config.dhcp"
|
||||||
:placeholder="data.isStart && config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
:placeholder="data.isStart && mainStore.config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
||||||
v-model="config.ipv4"
|
v-model="mainStore.config.ipv4"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<ElTooltip
|
<ElTooltip
|
||||||
class="!text-[10px]"
|
class="!text-[10px]"
|
||||||
placement="top-end"
|
placement="top-end"
|
||||||
:content="config.dhcp ? '动态获取无法手动填写' : '固定IP可以手动填写'"
|
:content="mainStore.config.dhcp ? '动态获取无法手动填写' : '固定IP可以手动填写'"
|
||||||
>
|
>
|
||||||
<ElTag
|
<ElTag
|
||||||
size="small"
|
size="small"
|
||||||
:type="config.dhcp ? 'info' : 'success'"
|
:type="mainStore.config.dhcp ? 'info' : 'success'"
|
||||||
>
|
>
|
||||||
{{ config.dhcp ? "只读" : "可填" }}
|
{{ mainStore.config.dhcp ? "只读" : "可填" }}
|
||||||
</ElTag>
|
</ElTag>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
</template>
|
</template>
|
||||||
@@ -272,21 +289,6 @@
|
|||||||
{{ !data.isStart ? "启动联机" : "停止联机" }}
|
{{ !data.isStart ? "启动联机" : "停止联机" }}
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<ElDropdownMenu>
|
<ElDropdownMenu>
|
||||||
<ElDropdownItem
|
|
||||||
command="import_config"
|
|
||||||
:icon="Link"
|
|
||||||
>
|
|
||||||
导入联机配置
|
|
||||||
</ElDropdownItem>
|
|
||||||
<ElDropdownItem
|
|
||||||
command="share_config"
|
|
||||||
:icon="Share"
|
|
||||||
>
|
|
||||||
分享联机配置
|
|
||||||
</ElDropdownItem>
|
|
||||||
<ElDropdownItem disabled>
|
|
||||||
<ElDivider class="!m-0 !h-[2px]" />
|
|
||||||
</ElDropdownItem>
|
|
||||||
<ElDropdownItem
|
<ElDropdownItem
|
||||||
:icon="SetUp"
|
:icon="SetUp"
|
||||||
command="create_server"
|
command="create_server"
|
||||||
@@ -328,6 +330,27 @@
|
|||||||
>
|
>
|
||||||
本地游戏列表
|
本地游戏列表
|
||||||
</ElDropdownItem>
|
</ElDropdownItem>
|
||||||
|
<ElDropdownItem disabled>
|
||||||
|
<ElDivider class="!m-0 !h-[2px]" />
|
||||||
|
</ElDropdownItem>
|
||||||
|
<ElDropdownItem
|
||||||
|
command="import_config"
|
||||||
|
:icon="Link"
|
||||||
|
>
|
||||||
|
导入联机配置
|
||||||
|
</ElDropdownItem>
|
||||||
|
<ElDropdownItem
|
||||||
|
command="share_config"
|
||||||
|
:icon="Share"
|
||||||
|
>
|
||||||
|
分享联机配置
|
||||||
|
</ElDropdownItem>
|
||||||
|
<ElDropdownItem
|
||||||
|
command="reconnect"
|
||||||
|
:icon="RefreshRight"
|
||||||
|
>
|
||||||
|
重新联机
|
||||||
|
</ElDropdownItem>
|
||||||
</ElDropdownMenu>
|
</ElDropdownMenu>
|
||||||
</template>
|
</template>
|
||||||
</ElDropdown>
|
</ElDropdown>
|
||||||
@@ -363,7 +386,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
<ElCheckbox
|
<ElCheckbox
|
||||||
v-model="config.disbleP2p"
|
v-model="mainStore.config.disbleP2p"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
强制中转
|
强制中转
|
||||||
@@ -374,7 +397,7 @@
|
|||||||
>
|
>
|
||||||
<ElCheckbox
|
<ElCheckbox
|
||||||
@change="handleAutoStartByTask"
|
@change="handleAutoStartByTask"
|
||||||
:model-value="config.autoStart"
|
:model-value="mainStore.config.autoStart"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
开机自启
|
开机自启
|
||||||
@@ -419,7 +442,7 @@
|
|||||||
<ElLink
|
<ElLink
|
||||||
class="ml-[8px] truncate pb-[2px] !text-[9px]"
|
class="ml-[8px] truncate pb-[2px] !text-[9px]"
|
||||||
type="info"
|
type="info"
|
||||||
:underline="false"
|
underline="never"
|
||||||
@click="open('https://github.com/EasyTier/EasytierGame')"
|
@click="open('https://github.com/EasyTier/EasytierGame')"
|
||||||
>
|
>
|
||||||
EasytierGame主页
|
EasytierGame主页
|
||||||
@@ -692,6 +715,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</ElDialog>
|
</ElDialog>
|
||||||
|
<ElDialog
|
||||||
|
width="95%"
|
||||||
|
top="30px"
|
||||||
|
append-to-body
|
||||||
|
:z-index="10"
|
||||||
|
class="!mb-0"
|
||||||
|
title="IPV6地址填写"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:show-close="false"
|
||||||
|
v-model="ipv6InputDialog.visible"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
v-model="mainStore.config.ipv6"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入IPV6地址"
|
||||||
|
></ElInput>
|
||||||
|
<template #footer>
|
||||||
|
<div class="text-right">
|
||||||
|
<ElButton
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleValidateIpv6"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</ElButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
@@ -720,17 +772,18 @@
|
|||||||
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { ElMessage, ElMessageBox, ElTooltip } from "element-plus";
|
import { ElMessage, ElMessageBox, ElTooltip } from "element-plus";
|
||||||
import { getCurrentWindow, type Window } from "@tauri-apps/api/window";
|
import { getCurrentWindow, PhysicalSize, type Window } from "@tauri-apps/api/window";
|
||||||
import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||||
import etWindows, { dataSubscribe } from "@/composables/windows";
|
import etWindows, { dataSubscribe } 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, readFile, writeFile, remove as removeFile } from "@tauri-apps/plugin-fs";
|
import { readDir, exists, mkdir, BaseDirectory, readTextFile, readFile, writeFile, remove as removeFile, stat } from "@tauri-apps/plugin-fs";
|
||||||
import { updateConfigJson } from "~/composables/configJson";
|
import { updateConfigJson, updateConfigJsonBounce } 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, supportProtocols, preventSleep, stopPreventSleep, ATJ, copyText, isValidWindowsFileName } from "~/utils";
|
import { addQQGroup, supportProtocols, preventSleep, stopPreventSleep, ATJ, copyText, isValidWindowsFileName } from "~/utils";
|
||||||
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
||||||
import { getServerArgs } from "@/composables/server";
|
import { getServerArgs } from "@/composables/server";
|
||||||
|
import { isIPv6 } from "is-ip";
|
||||||
|
|
||||||
let is_close = false;
|
let is_close = false;
|
||||||
const publicPeersLink = import.meta.env.VITE_PUBLIC_PEERS_URL;
|
const publicPeersLink = import.meta.env.VITE_PUBLIC_PEERS_URL;
|
||||||
@@ -746,12 +799,14 @@
|
|||||||
async () => {
|
async () => {
|
||||||
await handleConnection();
|
await handleConnection();
|
||||||
return data.isStart;
|
return data.isStart;
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
await handleReconnect();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const config = mainStore.config;
|
|
||||||
// console.error(config);
|
|
||||||
const protocols = supportProtocols();
|
const protocols = supportProtocols();
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
//easytierGame有没有新版
|
//easytierGame有没有新版
|
||||||
@@ -815,12 +870,54 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ipv6InputDialog = reactive<{ visible: boolean; [key: string]: any }>({
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDealIpv6 = async () => {
|
||||||
|
ipv6InputDialog.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleValidateIpv6 = () => {
|
||||||
|
mainStore.config.ipv6 = mainStore.config.ipv6?.trim() || "";
|
||||||
|
if (mainStore.config.ipv6 && !isIPv6(mainStore.config.ipv6)) {
|
||||||
|
ElMessage.error("请输入正确的IPV6地址");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ipv6InputDialog.visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
const handleCopyIp = async () => {
|
const handleCopyIp = async () => {
|
||||||
if (!config.ipv4?.trim()) return;
|
const v6 = mainStore.config.ipv6?.trim();
|
||||||
if (data.isStart || !config.dhcp) {
|
const v4 = mainStore.config.ipv4?.trim();
|
||||||
await copyText(mainStore.config.ipv4);
|
if (v6) {
|
||||||
|
const [err] = await ElConfirmPrimary("检测到您填写了IPV6地址,是否复制IPV6地址?", "提示", {
|
||||||
|
confirmButtonText: "复制IPV6",
|
||||||
|
cancelButtonText: "复制IPV4"
|
||||||
|
});
|
||||||
|
if (!err) {
|
||||||
|
await copyText(v6);
|
||||||
|
} else {
|
||||||
|
if (!v4) {
|
||||||
|
ElMessage.error("没有IPV4地址,无法复制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.isStart || !mainStore.config.dhcp) {
|
||||||
|
await copyText(v4);
|
||||||
|
} else {
|
||||||
|
await copyText(v4, "复制成功,联机后IP可能会变化");
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await copyText(mainStore.config.ipv4, "复制成功,联机后IP可能会变化");
|
if (!v4) {
|
||||||
|
ElMessage.error("没有IPV4地址,无法复制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.isStart || !mainStore.config.dhcp) {
|
||||||
|
await copyText(v4);
|
||||||
|
} else {
|
||||||
|
await copyText(v4, "复制成功,联机后IP可能会变化");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -842,8 +939,8 @@
|
|||||||
const newBasePeers = [...mainStore.basePeers];
|
const newBasePeers = [...mainStore.basePeers];
|
||||||
const idx = newBasePeers.indexOf(url);
|
const idx = newBasePeers.indexOf(url);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
if (config.serverUrl === url) {
|
if (mainStore.config.serverUrl === url) {
|
||||||
config.serverUrl = "";
|
mainStore.config.serverUrl = "";
|
||||||
}
|
}
|
||||||
newBasePeers.splice(idx, 1);
|
newBasePeers.splice(idx, 1);
|
||||||
}
|
}
|
||||||
@@ -856,7 +953,7 @@
|
|||||||
const handleServerUrlChange = () => {
|
const handleServerUrlChange = () => {
|
||||||
let inputProtocols: string | null = null;
|
let inputProtocols: string | null = null;
|
||||||
for (const p of protocols) {
|
for (const p of protocols) {
|
||||||
if (config.serverUrl.toLowerCase().startsWith(`${p}://`)) {
|
if (mainStore.config.serverUrl.toLowerCase().startsWith(`${p}://`)) {
|
||||||
inputProtocols = p;
|
inputProtocols = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1086,8 +1183,8 @@
|
|||||||
const list = await invoke<string[][][]>("fetch_easytier_list");
|
const list = await invoke<string[][][]>("fetch_easytier_list");
|
||||||
data.releaseList = [
|
data.releaseList = [
|
||||||
...list.flat().filter(el => {
|
...list.flat().filter(el => {
|
||||||
// console.log(el, el[0], el[2]);
|
// console.log(el, el[0], el[2], el[3]); // el[3] 是prerelease bool值
|
||||||
return el && el[0] && el[2] && !el[2].includes("gui");
|
return el && el[0] && el[2] && !el[2].includes("gui") && (el[3] != "true" || !el[3]);
|
||||||
})
|
})
|
||||||
] as any;
|
] as any;
|
||||||
coreManagementData.loading = false;
|
coreManagementData.loading = false;
|
||||||
@@ -1096,9 +1193,9 @@
|
|||||||
|
|
||||||
const handleAutoStartByTask = async () => {
|
const handleAutoStartByTask = async () => {
|
||||||
if (import.meta.env.DEV) return ElMessage.warning("开发环境不支持开机自启");
|
if (import.meta.env.DEV) return ElMessage.warning("开发环境不支持开机自启");
|
||||||
await invoke("spawn_autostart", { enabled: !config.autoStart });
|
await invoke("spawn_autostart", { enabled: !mainStore.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;
|
||||||
config.autoStart = is_enable_by_task;
|
mainStore.config.autoStart = is_enable_by_task;
|
||||||
};
|
};
|
||||||
|
|
||||||
const compatibleInitAutoStart = async () => {
|
const compatibleInitAutoStart = async () => {
|
||||||
@@ -1111,37 +1208,35 @@
|
|||||||
await invoke("spawn_autostart", { enabled: true });
|
await invoke("spawn_autostart", { enabled: true });
|
||||||
}
|
}
|
||||||
is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||||
config.autoStart = is_enable_by_task;
|
mainStore.config.autoStart = is_enable_by_task;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
await invoke("spawn_autostart", { enabled: false });
|
await invoke("spawn_autostart", { enabled: false });
|
||||||
const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||||
config.autoStart = is_enable_by_task;
|
mainStore.config.autoStart = is_enable_by_task;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const compatibleIpv6Listener = async () => {
|
// const compatibleIpv6Listener = async () => {
|
||||||
// ipv6监听在后续版本合并到customListenner里了,这里做兼容处理
|
// // ipv6监听在后续版本合并到customListenner里了,这里做兼容处理,去掉IPV6监听
|
||||||
if (config.enableCustomListenerV6 && config.customListenerV6Data) {
|
// const customListenerV4 = mainStore.config.customListenerData
|
||||||
const customListener = config.customListenerV6Data.trim();
|
// .trim()
|
||||||
if (customListener) {
|
// .split("\n")
|
||||||
const customListenerV4 = config.customListenerData
|
// .map(el => el.trim())
|
||||||
.trim()
|
// .filter(el => el);
|
||||||
.split("\n")
|
// const udpv6 = customListenerV4.indexOf("udp://[::]:11010")
|
||||||
.map(el => el.trim())
|
// const tcpv6 = customListenerV4.indexOf("tcp://[::]:11010")
|
||||||
.filter(el => el);
|
// if (udpv6 != -1) {
|
||||||
if (!customListenerV4.includes(customListener)) {
|
// customListenerV4.splice(udpv6, 1);
|
||||||
config.customListenerData += `\n${customListener}`;
|
// }
|
||||||
}
|
// if (tcpv6 != -1) {
|
||||||
}
|
// customListenerV4.splice(tcpv6, 1);
|
||||||
}
|
// }
|
||||||
if (config.enableCustomListenerV6) {
|
// mainStore.config.customListenerData = customListenerV4.join("\n");
|
||||||
config.enableCustomListenerV6 = false;
|
// };
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const initConnectAfterStart = async () => {
|
const initConnectAfterStart = async () => {
|
||||||
if (config.connectAfterStart && data.coreVersion) {
|
if (mainStore.config.connectAfterStart && data.coreVersion) {
|
||||||
await reset();
|
await reset();
|
||||||
await handleConnection();
|
await handleConnection();
|
||||||
}
|
}
|
||||||
@@ -1175,6 +1270,10 @@
|
|||||||
saveServerUrl = mainStore.basePeers.length > 0 ? mainStore.basePeers[0] || "" : "";
|
saveServerUrl = mainStore.basePeers.length > 0 ? mainStore.basePeers[0] || "" : "";
|
||||||
}
|
}
|
||||||
data.configJsonSeverUrl = guiJson.serverUrl;
|
data.configJsonSeverUrl = guiJson.serverUrl;
|
||||||
|
if (guiJson.enableKcpProxy && guiJson.enableQuicProxy) {
|
||||||
|
// 如果同时开启kcp代理和quic代理,则禁用quic代理
|
||||||
|
guiJson.enableQuicProxy = false;
|
||||||
|
}
|
||||||
mainStore.$patch({
|
mainStore.$patch({
|
||||||
config: {
|
config: {
|
||||||
...mainStore.config,
|
...mainStore.config,
|
||||||
@@ -1225,19 +1324,29 @@
|
|||||||
await appWindow.show();
|
await appWindow.show();
|
||||||
await appWindow.setFocus();
|
await appWindow.setFocus();
|
||||||
}
|
}
|
||||||
|
const appWindow = getCurrentWindow();
|
||||||
|
const logicalAppSize = {
|
||||||
|
width: 340,
|
||||||
|
height: 305
|
||||||
|
};
|
||||||
|
const scaleFactor = await appWindow.scaleFactor();
|
||||||
|
const size = new PhysicalSize(Math.ceil(logicalAppSize.width * scaleFactor), Math.ceil(logicalAppSize.height * scaleFactor));
|
||||||
|
appWindow.setSize(size);
|
||||||
|
appWindow.onScaleChanged(({ payload: { scaleFactor } }) => {
|
||||||
|
console.log("scaleFactor", scaleFactor);
|
||||||
|
appWindow.setSize(new PhysicalSize(Math.ceil(logicalAppSize.width * scaleFactor), Math.ceil(logicalAppSize.height * scaleFactor)));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
let cidrTimer: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
const b = bounce(600);
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await initGuiJson();
|
await initGuiJson();
|
||||||
await compatibleInitAutoStart();
|
await compatibleInitAutoStart();
|
||||||
// await initAutoStart();
|
// await initAutoStart();
|
||||||
await initStartWinIpBroadcast();
|
// await initStartWinIpBroadcast(); // 对于三层tun而言,winipbroadcast没有作用,先禁用
|
||||||
await compatibleIpv6Listener();
|
|
||||||
await getCoreVersion();
|
await getCoreVersion();
|
||||||
await listenObj.listenThreadId();
|
await listenObj.listenThreadId();
|
||||||
await listenObj.listenServerThreadId();
|
await listenObj.listenServerThreadId();
|
||||||
@@ -1248,15 +1357,21 @@
|
|||||||
initPreventSleep();
|
initPreventSleep();
|
||||||
mountedShow(); // 不需要await
|
mountedShow(); // 不需要await
|
||||||
closePrevent();
|
closePrevent();
|
||||||
dataSubscribe(async () => {
|
if (import.meta.env.PROD) {
|
||||||
if (mainStore.createConfigInEasytier) {
|
getReleaseList();
|
||||||
b(async () => {
|
checkNewVersion();
|
||||||
await updateConfigJson(data.configJsonSeverUrl);
|
}
|
||||||
});
|
await storageDialog();
|
||||||
}
|
});
|
||||||
});
|
|
||||||
getReleaseList();
|
// storageEventEmitter.addEventListener("localStorageChange", () => {
|
||||||
checkNewVersion();
|
// if(mainStore.createConfigInEasytier) {
|
||||||
|
// updateConfigJsonBounce(data.configJsonSeverUrl)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
dataSubscribe(null, () => {
|
||||||
|
return data.configJsonSeverUrl;
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
@@ -1267,6 +1382,7 @@
|
|||||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||||
cidrTimer && clearInterval(cidrTimer);
|
cidrTimer && clearInterval(cidrTimer);
|
||||||
stopPreventSleep();
|
stopPreventSleep();
|
||||||
|
// unListenStorage && unListenStorage();
|
||||||
});
|
});
|
||||||
|
|
||||||
const getArgs = async () => {
|
const getArgs = async () => {
|
||||||
@@ -1299,42 +1415,42 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.dhcp) {
|
if (mainStore.config.dhcp) {
|
||||||
args.push("-d");
|
args.push("-d");
|
||||||
}
|
}
|
||||||
if (config.hostname) {
|
if (mainStore.config.hostname) {
|
||||||
args.push("--hostname", config.hostname);
|
args.push("--hostname", mainStore.config.hostname);
|
||||||
}
|
}
|
||||||
if (config.networkName) {
|
if (mainStore.config.networkName) {
|
||||||
args.push("--network-name", config.networkName);
|
args.push("--network-name", mainStore.config.networkName);
|
||||||
}
|
}
|
||||||
if (config.networkPassword) {
|
if (mainStore.config.networkPassword) {
|
||||||
args.push("--network-secret", config.networkPassword);
|
args.push("--network-secret", mainStore.config.networkPassword);
|
||||||
}
|
}
|
||||||
if (config.ipv4) {
|
if (mainStore.config.ipv4) {
|
||||||
args.push("--ipv4", config.ipv4.trim());
|
args.push("--ipv4", mainStore.config.ipv4.trim());
|
||||||
}
|
}
|
||||||
if (config.serverUrl) {
|
if (mainStore.config.serverUrl) {
|
||||||
const formatUrl = config.serverUrl.replace(/\\/g, "/");
|
const formatUrl = mainStore.config.serverUrl.replace(/\\/g, "/");
|
||||||
args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
args.push("--peers", ...mainStore.config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
||||||
}
|
}
|
||||||
if (config.enableCustomProtocol) {
|
if (mainStore.config.enableCustomProtocol) {
|
||||||
const includes = config.protocol.includes(config.customProtocol);
|
const includes = mainStore.config.protocol.includes(mainStore.config.customProtocol);
|
||||||
if (includes) {
|
if (includes) {
|
||||||
args.push("--default-protocol", config.customProtocol);
|
args.push("--default-protocol", mainStore.config.customProtocol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.disbleP2p) {
|
if (mainStore.config.disbleP2p) {
|
||||||
args.push("--disable-p2p");
|
args.push("--disable-p2p");
|
||||||
}
|
}
|
||||||
if (config.disableIpv6) {
|
if (mainStore.config.disableIpv6) {
|
||||||
args.push("--disable-ipv6");
|
args.push("--disable-ipv6");
|
||||||
}
|
}
|
||||||
if (config.disbleListenner) {
|
if (mainStore.config.disbleListenner) {
|
||||||
args.push("--no-listener");
|
args.push("--no-listener");
|
||||||
}
|
}
|
||||||
if (!config.disbleListenner && config.enableCustomListener && config.customListenerData) {
|
if (!mainStore.config.disbleListenner && mainStore.config.enableCustomListener && mainStore.config.customListenerData) {
|
||||||
const customListener = config.customListenerData
|
const customListener = mainStore.config.customListenerData
|
||||||
.trim()
|
.trim()
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map(el => el.trim())
|
.map(el => el.trim())
|
||||||
@@ -1343,14 +1459,12 @@
|
|||||||
args.push("-l", ...customListener);
|
args.push("-l", ...customListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!config.disbleListenner && config.enableCustomListenerV6 && config.customListenerV6Data) {
|
|
||||||
args.push("--ipv6-listener", config.customListenerV6Data);
|
if (!mainStore.config.disbleListenner && !mainStore.config.enableCustomListener && mainStore.config.port) {
|
||||||
|
args.push("-l", mainStore.config.port);
|
||||||
}
|
}
|
||||||
if (!config.disbleListenner && !config.enableCustomListener && config.port) {
|
if (mainStore.cidrEnable && mainStore.config.proxyNetworks) {
|
||||||
args.push("-l", config.port);
|
let formatProxyNetworks = mainStore.config.proxyNetworks.trim().split("\n");
|
||||||
}
|
|
||||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
|
||||||
let formatProxyNetworks = config.proxyNetworks.trim().split("\n");
|
|
||||||
const newformatProxyNetworks = formatProxyNetworks
|
const newformatProxyNetworks = formatProxyNetworks
|
||||||
.map(el => el.trim())
|
.map(el => el.trim())
|
||||||
.filter(cidr => {
|
.filter(cidr => {
|
||||||
@@ -1359,61 +1473,93 @@
|
|||||||
if (newformatProxyNetworks.length > 0) {
|
if (newformatProxyNetworks.length > 0) {
|
||||||
args.push("--proxy-networks", ...newformatProxyNetworks);
|
args.push("--proxy-networks", ...newformatProxyNetworks);
|
||||||
}
|
}
|
||||||
config.proxyNetworks = formatProxyNetworks.join("\n");
|
mainStore.config.proxyNetworks = formatProxyNetworks.join("\n");
|
||||||
}
|
}
|
||||||
if (config.disableEncryption) {
|
if (mainStore.config.disableEncryption) {
|
||||||
args.push("--disable-encryption");
|
args.push("--disable-encryption");
|
||||||
}
|
}
|
||||||
if (config.multiThread) {
|
if (mainStore.config.multiThread) {
|
||||||
args.push("--multi-thread");
|
args.push("--multi-thread");
|
||||||
}
|
}
|
||||||
if (config.enablExitNode) {
|
if (mainStore.config.enablExitNode) {
|
||||||
args.push("--enable-exit-node");
|
args.push("--enable-exit-node");
|
||||||
}
|
}
|
||||||
if (config.noTun) {
|
if (mainStore.config.noTun) {
|
||||||
args.push("--no-tun");
|
args.push("--no-tun");
|
||||||
}
|
}
|
||||||
if (config.latencyfirst) {
|
if (mainStore.config.latencyfirst) {
|
||||||
args.push("--latency-first");
|
args.push("--latency-first");
|
||||||
}
|
}
|
||||||
if (config.useSmoltcp) {
|
if (mainStore.config.useSmoltcp) {
|
||||||
args.push("--use-smoltcp");
|
args.push("--use-smoltcp");
|
||||||
}
|
}
|
||||||
if (config.disableUdpHolePunching) {
|
if (mainStore.config.disableUdpHolePunching) {
|
||||||
args.push("--disable-udp-hole-punching");
|
args.push("--disable-udp-hole-punching");
|
||||||
}
|
}
|
||||||
if (config.relayAllPeerrpc) {
|
if (mainStore.config.relayAllPeerrpc) {
|
||||||
args.push("--relay-all-peer-rpc");
|
args.push("--relay-all-peer-rpc");
|
||||||
}
|
}
|
||||||
if (config.saveErrorLog) {
|
if (mainStore.config.saveErrorLog) {
|
||||||
args.push("--file-log-level", config.logLevel, "--file-log-dir", import.meta.env.VITE_LOG_PATH);
|
args.push("--file-log-level", mainStore.config.logLevel, "--file-log-dir", import.meta.env.VITE_LOG_PATH);
|
||||||
}
|
}
|
||||||
if (config.devName && config.devNameValue) {
|
if (mainStore.config.devName && mainStore.config.devNameValue) {
|
||||||
args.push("--dev-name", config.devNameValue);
|
args.push("--dev-name", mainStore.config.devNameValue);
|
||||||
}
|
}
|
||||||
if (config.compression && config.compression != "none") {
|
if (mainStore.config.compression && mainStore.config.compression != "none") {
|
||||||
args.push("--compression", config.compression);
|
args.push("--compression", mainStore.config.compression);
|
||||||
}
|
}
|
||||||
if (config.enableKcpProxy) {
|
if (mainStore.config.enableKcpProxy) {
|
||||||
args.push("--enable-kcp-proxy");
|
args.push("--enable-kcp-proxy", "true");
|
||||||
}
|
}
|
||||||
if (config.disableKcpInput) {
|
if (mainStore.config.disableKcpInput) {
|
||||||
args.push("--disable-kcp-input");
|
args.push("--disable-kcp-input", "true");
|
||||||
}
|
}
|
||||||
if (config.bindDeviceEnable) {
|
if (mainStore.config.enableQuicProxy) {
|
||||||
|
args.push("--enable-quic-proxy", "true");
|
||||||
|
}
|
||||||
|
if (mainStore.config.disableQuicInput) {
|
||||||
|
args.push("--disable-quic-input", "true");
|
||||||
|
}
|
||||||
|
if (mainStore.config.bindDeviceEnable) {
|
||||||
args.push("--bind-device", "true");
|
args.push("--bind-device", "true");
|
||||||
}
|
}
|
||||||
if (mainStore.proxyForwardBySystem) {
|
if (mainStore.proxyForwardBySystem) {
|
||||||
args.push("--proxy-forward-by-system");
|
args.push("--proxy-forward-by-system");
|
||||||
}
|
}
|
||||||
|
if (mainStore.config.acceptDNS) {
|
||||||
|
args.push("--accept-dns", "true");
|
||||||
|
}
|
||||||
|
if (mainStore.config.enablePortForward) {
|
||||||
|
let formatPortForward = mainStore.config.portForwardData.trim().split("\n");
|
||||||
|
const newformatPortForward = formatPortForward.map(el => el.trim()).filter(el => el);
|
||||||
|
if (newformatPortForward.length > 0) {
|
||||||
|
newformatPortForward.map(el => {
|
||||||
|
args.push("--port-forward", el);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mainStore.config.privateMode) {
|
||||||
|
args.push("--private-mode", "true");
|
||||||
|
}
|
||||||
|
if (mainStore.config.ipv6 && !mainStore.config.disableIpv6) {
|
||||||
|
args.push("--ipv6", mainStore.config.ipv6.trim());
|
||||||
|
}
|
||||||
|
const tcpWhitelist = mainStore.config.tcpWhitelist.trim();
|
||||||
|
if (mainStore.config.tcpWhitelistEnable && tcpWhitelist) {
|
||||||
|
args.push("--tcp-whitelist", tcpWhitelist);
|
||||||
|
}
|
||||||
|
const udpWhitelist = mainStore.config.udpWhitelist.trim();
|
||||||
|
if (mainStore.config.udpWhitelistEnable && udpWhitelist) {
|
||||||
|
args.push("--udp-whitelist", udpWhitelist);
|
||||||
|
}
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
|
|
||||||
const reset = async () => {
|
const reset = async () => {
|
||||||
data.isStart = false;
|
data.isStart = false;
|
||||||
data.isSuccessGetIp = false;
|
data.isSuccessGetIp = false;
|
||||||
if (config.dhcp) {
|
if (mainStore.config.dhcp) {
|
||||||
config.ipv4 = "";
|
mainStore.config.ipv4 = "";
|
||||||
}
|
}
|
||||||
const memberDialog = await getAllWebviewWindows();
|
const memberDialog = await getAllWebviewWindows();
|
||||||
const memberDialogs = memberDialog.filter(item => item.label === "member");
|
const memberDialogs = memberDialog.filter(item => item.label === "member");
|
||||||
@@ -1500,8 +1646,6 @@
|
|||||||
port,
|
port,
|
||||||
enableCustomListener,
|
enableCustomListener,
|
||||||
customListenerData,
|
customListenerData,
|
||||||
enableCustomListenerV6,
|
|
||||||
customListenerV6Data,
|
|
||||||
devName,
|
devName,
|
||||||
devNameValue,
|
devNameValue,
|
||||||
enableNetCardMetric,
|
enableNetCardMetric,
|
||||||
@@ -1514,7 +1658,10 @@
|
|||||||
compression,
|
compression,
|
||||||
enablePreventSleep,
|
enablePreventSleep,
|
||||||
enableKcpProxy,
|
enableKcpProxy,
|
||||||
disableKcpInput
|
disableKcpInput,
|
||||||
|
enableQuicProxy,
|
||||||
|
disableQuicInput,
|
||||||
|
privateMode
|
||||||
} = mainStore.config;
|
} = mainStore.config;
|
||||||
const WT = btoa(
|
const WT = btoa(
|
||||||
encodeURIComponent(
|
encodeURIComponent(
|
||||||
@@ -1533,8 +1680,6 @@
|
|||||||
port,
|
port,
|
||||||
enableCustomListener,
|
enableCustomListener,
|
||||||
customListenerData,
|
customListenerData,
|
||||||
enableCustomListenerV6,
|
|
||||||
customListenerV6Data,
|
|
||||||
devName,
|
devName,
|
||||||
devNameValue,
|
devNameValue,
|
||||||
enableNetCardMetric,
|
enableNetCardMetric,
|
||||||
@@ -1547,7 +1692,10 @@
|
|||||||
compression,
|
compression,
|
||||||
enablePreventSleep,
|
enablePreventSleep,
|
||||||
enableKcpProxy,
|
enableKcpProxy,
|
||||||
disableKcpInput
|
disableKcpInput,
|
||||||
|
enableQuicProxy,
|
||||||
|
disableQuicInput,
|
||||||
|
privateMode
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -1666,6 +1814,25 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command === "reconnect") {
|
||||||
|
handleReconnect();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleReconnect = async () => {
|
||||||
|
if (data.isStart) {
|
||||||
|
ElMessage.info({
|
||||||
|
message: "正在重新联机...",
|
||||||
|
duration: 2200
|
||||||
|
});
|
||||||
|
await handleConnection();
|
||||||
|
setTimeout(() => {
|
||||||
|
handleConnection();
|
||||||
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
handleConnection();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteAdminConfig = async () => {
|
const handleDeleteAdminConfig = async () => {
|
||||||
@@ -1718,7 +1885,7 @@
|
|||||||
});
|
});
|
||||||
if (!err) {
|
if (!err) {
|
||||||
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
|
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
|
||||||
payload.config.serverUrl = payload?.config?.serverUrl?.trim() || config.serverUrl;
|
payload.config.serverUrl = payload?.config?.serverUrl?.trim() || mainStore.config.serverUrl;
|
||||||
mainStore.$patch({
|
mainStore.$patch({
|
||||||
config: {
|
config: {
|
||||||
...mainStore.config,
|
...mainStore.config,
|
||||||
@@ -1727,7 +1894,7 @@
|
|||||||
});
|
});
|
||||||
ElMessage.success("导入成功");
|
ElMessage.success("导入成功");
|
||||||
importConfigData.visible = false;
|
importConfigData.visible = false;
|
||||||
mainStore.basePeers = uniq([config.serverUrl, ...mainStore.basePeers].filter(el => el.trim()));
|
mainStore.basePeers = uniq([mainStore.config.serverUrl, ...mainStore.basePeers].filter(el => el.trim()));
|
||||||
} else {
|
} else {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if (err !== "cancel") {
|
if (err !== "cancel") {
|
||||||
@@ -1902,4 +2069,28 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const storageDialog = async () => {
|
||||||
|
await etWindows(
|
||||||
|
"storage-listener",
|
||||||
|
{
|
||||||
|
title: "存储监听",
|
||||||
|
minWidth: 0,
|
||||||
|
minHeight: 0,
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
x: 9999,
|
||||||
|
y: 9999,
|
||||||
|
resizable: false,
|
||||||
|
transparent: true,
|
||||||
|
hiddenTitle: true,
|
||||||
|
alwaysOnBottom: true,
|
||||||
|
visible: false,
|
||||||
|
url: "#/storage-listener"
|
||||||
|
},
|
||||||
|
dialog => {
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+120
-8
@@ -1,27 +1,139 @@
|
|||||||
<template>
|
<template>
|
||||||
<ElInput
|
<!-- <ElInput
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="17"
|
:rows="17"
|
||||||
v-model="data.log"
|
v-model="data.originLog"
|
||||||
resize="none"
|
resize="none"
|
||||||
readonly
|
readonly
|
||||||
placeholder="等待日志中,请先'启动联机'..."
|
placeholder="等待日志中,请先'启动联机'..."
|
||||||
/>
|
/> -->
|
||||||
|
<div
|
||||||
|
ref="logRef"
|
||||||
|
@scroll="handleScroll"
|
||||||
|
class="overflow-auto"
|
||||||
|
>
|
||||||
|
<div v-if="!data.log || data.log.length <= 0" class="p-[5px]">
|
||||||
|
<ElText type="info">等待日志中,请先'启动联机'...</ElText>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
v-for="item in data.log"
|
||||||
|
:key="item.id"
|
||||||
|
class="p-[5px]"
|
||||||
|
>
|
||||||
|
<div class="group/item flex items-center justify-start leading-[26px]">
|
||||||
|
<ElText
|
||||||
|
:closable="false"
|
||||||
|
:type="item.type"
|
||||||
|
>
|
||||||
|
{{ item.text }}
|
||||||
|
<ElTooltip
|
||||||
|
placement="right"
|
||||||
|
content="复制"
|
||||||
|
>
|
||||||
|
<ElButton
|
||||||
|
class="ml-[3px] !hidden w-fit group-hover/item:!inline-flex"
|
||||||
|
@click.stop="handleCopyLog(item.text)"
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
circle
|
||||||
|
plain
|
||||||
|
:icon="CopyDocument"
|
||||||
|
></ElButton>
|
||||||
|
</ElTooltip>
|
||||||
|
</ElText>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ElAffix
|
||||||
|
v-if="data.originLog"
|
||||||
|
class="w-full"
|
||||||
|
position="bottom"
|
||||||
|
:offset="10"
|
||||||
|
>
|
||||||
|
<div class="bg-(var(--el-color-primary)) mr-[10px] flex items-center justify-end">
|
||||||
|
<ElTooltip
|
||||||
|
content="复制全部"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<ElButton
|
||||||
|
@click.stop="handleCopyLog(data.originLog)"
|
||||||
|
type="info"
|
||||||
|
size="large"
|
||||||
|
circle
|
||||||
|
:icon="CopyDocument"
|
||||||
|
></ElButton>
|
||||||
|
</ElTooltip>
|
||||||
|
</div>
|
||||||
|
</ElAffix>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { CopyDocument } from "@element-plus/icons-vue";
|
||||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
import { reactive, onMounted, onBeforeUnmount, useTemplateRef, nextTick } from "vue";
|
||||||
const data = reactive({
|
import { copyText } from "~/utils";
|
||||||
log: ""
|
type LogItem = { id: string; text: string; type: "danger" | "info" | "warning" | "primary" };
|
||||||
|
const data = reactive<{ log: LogItem[]; originLog: string; autoScrollToBottom: boolean }>({
|
||||||
|
log: [],
|
||||||
|
originLog: "", // 原始日志
|
||||||
|
autoScrollToBottom: true // 是否允许自动滚动到底部
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logEl = useTemplateRef<HTMLDivElement>("logRef");
|
||||||
|
|
||||||
|
const scrollToBottom = () => {
|
||||||
|
if (data.autoScrollToBottom) {
|
||||||
|
logEl.value?.scrollTo({
|
||||||
|
top: logEl.value?.scrollHeight,
|
||||||
|
behavior: "smooth"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleScroll = () => {
|
||||||
|
if (logEl.value) {
|
||||||
|
const autoScrollToBottom = logEl.value.scrollTop + logEl.value.clientHeight >= logEl.value.scrollHeight;
|
||||||
|
data.autoScrollToBottom = autoScrollToBottom;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const listenStart = async () => {
|
const listenStart = async () => {
|
||||||
const unListen = await listen<string>("logs", event => {
|
const unListen = await listen<string>("logs", async event => {
|
||||||
data.log = event.payload || "";
|
const payload = event.payload || "";
|
||||||
|
if (data.originLog === payload) return;
|
||||||
|
data.originLog = payload;
|
||||||
|
data.log = payload
|
||||||
|
.split("\n")
|
||||||
|
.filter(text => text.trim())
|
||||||
|
.map((text, idx) => {
|
||||||
|
const toLowerCaseText = text.toLocaleLowerCase();
|
||||||
|
return {
|
||||||
|
id: `${text}-${idx}`,
|
||||||
|
text,
|
||||||
|
type:
|
||||||
|
toLowerCaseText.includes("error") ||
|
||||||
|
toLowerCaseText.includes("fail") ||
|
||||||
|
toLowerCaseText.includes("failed") ||
|
||||||
|
toLowerCaseText.includes("exception") ||
|
||||||
|
toLowerCaseText.includes("err")
|
||||||
|
? "danger"
|
||||||
|
: toLowerCaseText.includes("warn")
|
||||||
|
? "warning"
|
||||||
|
: toLowerCaseText.includes("new peer connection")
|
||||||
|
? "primary"
|
||||||
|
: "info"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
await nextTick();
|
||||||
|
scrollToBottom();
|
||||||
});
|
});
|
||||||
return unListen;
|
return unListen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCopyLog = async (text: string) => {
|
||||||
|
await copyText(text, "复制记录成功");
|
||||||
|
};
|
||||||
|
|
||||||
let unlistenStart: UnlistenFn | null = null;
|
let unlistenStart: UnlistenFn | null = null;
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
unlistenStart = await listenStart();
|
unlistenStart = await listenStart();
|
||||||
|
|||||||
+149
-1
@@ -48,15 +48,19 @@
|
|||||||
width="120"
|
width="120"
|
||||||
prop="ipv4"
|
prop="ipv4"
|
||||||
label="虚拟网IP"
|
label="虚拟网IP"
|
||||||
|
:sort-method="sortIpv4"
|
||||||
|
:sort-orders="['ascending', 'descending', null]"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
prop="lat_ms"
|
prop="lat_ms"
|
||||||
width="100"
|
width="100"
|
||||||
label="延迟/ms"
|
label="延迟/ms"
|
||||||
|
:sort-method="sortLatMs"
|
||||||
|
:sort-orders="['ascending', 'descending', null]"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.lat_ms && !isNaN(Number(row.lat_ms)) ? Number(row.lat_ms).toFixed(0) : row.lat_ms || "-" }}
|
{{ formatLatency(row.lat_ms) }}
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
@@ -96,11 +100,15 @@
|
|||||||
width="90"
|
width="90"
|
||||||
prop="rx_bytes"
|
prop="rx_bytes"
|
||||||
label="接收"
|
label="接收"
|
||||||
|
:sort-method="sortBytes"
|
||||||
|
:sort-orders="['ascending', 'descending', null]"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
sortable
|
sortable
|
||||||
prop="tx_bytes"
|
prop="tx_bytes"
|
||||||
label="传输"
|
label="传输"
|
||||||
|
:sort-method="(a, b) => sortBytes(a, b, 'tx_bytes')"
|
||||||
|
:sort-orders="['ascending', 'descending', null]"
|
||||||
></ElTableColumn>
|
></ElTableColumn>
|
||||||
</ElTable>
|
</ElTable>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,6 +152,146 @@
|
|||||||
member: []
|
member: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 延迟排序函数
|
||||||
|
const sortLatMs = (a: any, b: any): number => {
|
||||||
|
const getLatencyValue = (row: any): number => {
|
||||||
|
const latMs = row.lat_ms;
|
||||||
|
|
||||||
|
if (latMs === null || latMs === undefined || latMs === "") {
|
||||||
|
return Infinity;
|
||||||
|
}
|
||||||
|
|
||||||
|
const num = Number(latMs);
|
||||||
|
if (isNaN(num) || num < 0) {
|
||||||
|
return Infinity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.floor(num);
|
||||||
|
};
|
||||||
|
|
||||||
|
const valueA = getLatencyValue(a);
|
||||||
|
const valueB = getLatencyValue(b);
|
||||||
|
|
||||||
|
if (valueA === Infinity && valueB === Infinity) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return valueA - valueB;
|
||||||
|
};
|
||||||
|
|
||||||
|
// IP地址排序函数
|
||||||
|
const sortIpv4 = (a: any, b: any): number => {
|
||||||
|
const ipToNumber = (ip: string): number => {
|
||||||
|
if (!ip || ip === "-" || ip === "") {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理可能包含端口号或子网掩码的情况
|
||||||
|
const cleanIp = ip.split("/")[0].split(":")[0];
|
||||||
|
const parts = cleanIp.split(".");
|
||||||
|
|
||||||
|
if (parts.length !== 4) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const nums = parts.map(part => {
|
||||||
|
const num = parseInt(part, 10);
|
||||||
|
return isNaN(num) || num < 0 || num > 255 ? 0 : num;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 将IP地址转换为32位数字进行比较
|
||||||
|
return (nums[0] << 24) + (nums[1] << 16) + (nums[2] << 8) + nums[3];
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const numA = ipToNumber(a.ipv4);
|
||||||
|
const numB = ipToNumber(b.ipv4);
|
||||||
|
|
||||||
|
return numA - numB;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 字节数据排序函数
|
||||||
|
const sortBytes = (a: any, b: any, field: string = 'rx_bytes'): number => {
|
||||||
|
const parseBytes = (bytesStr: string): number => {
|
||||||
|
if (!bytesStr || bytesStr === "-" || bytesStr === "") {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 统一转换为小写并去除空格
|
||||||
|
const cleanStr = bytesStr.toLowerCase().trim();
|
||||||
|
|
||||||
|
// 使用正则表达式匹配数字和单位
|
||||||
|
const match = cleanStr.match(/^(\d+(?:\.\d+)?)\s*([a-z]*)$/);
|
||||||
|
if (!match) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = parseFloat(match[1]);
|
||||||
|
const unit = match[2];
|
||||||
|
|
||||||
|
if (isNaN(value)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据单位转换为字节数
|
||||||
|
switch (unit) {
|
||||||
|
case 'b':
|
||||||
|
case 'byte':
|
||||||
|
case 'bytes':
|
||||||
|
case '':
|
||||||
|
return value;
|
||||||
|
case 'k':
|
||||||
|
case 'kb':
|
||||||
|
case 'kib':
|
||||||
|
return value * 1024;
|
||||||
|
case 'm':
|
||||||
|
case 'mb':
|
||||||
|
case 'mib':
|
||||||
|
return value * 1024 * 1024;
|
||||||
|
case 'g':
|
||||||
|
case 'gb':
|
||||||
|
case 'gib':
|
||||||
|
return value * 1024 * 1024 * 1024;
|
||||||
|
case 't':
|
||||||
|
case 'tb':
|
||||||
|
case 'tib':
|
||||||
|
return value * 1024 * 1024 * 1024 * 1024;
|
||||||
|
case 'p':
|
||||||
|
case 'pb':
|
||||||
|
case 'pib':
|
||||||
|
return value * 1024 * 1024 * 1024 * 1024 * 1024;
|
||||||
|
default:
|
||||||
|
return value; // 未知单位当作字节处理
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const bytesA = parseBytes(a[field]);
|
||||||
|
const bytesB = parseBytes(b[field]);
|
||||||
|
|
||||||
|
return bytesA - bytesB;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 格式化延迟显示
|
||||||
|
const formatLatency = (latMs: any): string => {
|
||||||
|
if (latMs === null || latMs === undefined || latMs === "") {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
const num = Number(latMs);
|
||||||
|
if (isNaN(num)) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
return num.toFixed(0);
|
||||||
|
};
|
||||||
|
|
||||||
const _showTableHeader = [
|
const _showTableHeader = [
|
||||||
["hostname", "主机名"],
|
["hostname", "主机名"],
|
||||||
["cost", "路由"],
|
["cost", "路由"],
|
||||||
|
|||||||
+91
-7
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-[10px] h-full">
|
<div class="flex h-full flex-col gap-[10px]">
|
||||||
<ElForm
|
<ElForm
|
||||||
size="small"
|
size="small"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<ElFormItem
|
<ElFormItem
|
||||||
label="白名单"
|
label="白名单"
|
||||||
prop="ServerWhiteList"
|
prop="ServerWhiteList"
|
||||||
class="full-label full-content overflow-hidden !flex flex-col h-full !mb-[0]"
|
class="full-label full-content !mb-[0] !flex h-full flex-col overflow-hidden"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
@@ -27,6 +27,17 @@
|
|||||||
>
|
>
|
||||||
<ElCheckbox v-model="mainStore.serverConfig.autoStart">自动启动</ElCheckbox>
|
<ElCheckbox v-model="mainStore.serverConfig.autoStart">自动启动</ElCheckbox>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
|
<ElTooltip
|
||||||
|
placement="top"
|
||||||
|
content="启用后,不允许使用了与本网络不同的房间名和密码的节点通过本节点进行握手或中转"
|
||||||
|
>
|
||||||
|
<ElCheckbox
|
||||||
|
@click.stop="handlePrivateModeClick"
|
||||||
|
:model-value="mainStore.serverConfig.privateMode"
|
||||||
|
>
|
||||||
|
私有模式
|
||||||
|
</ElCheckbox>
|
||||||
|
</ElTooltip>
|
||||||
<ElTooltip
|
<ElTooltip
|
||||||
placement="top"
|
placement="top"
|
||||||
content="帮助其他虚拟网建立P2P链接"
|
content="帮助其他虚拟网建立P2P链接"
|
||||||
@@ -36,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="h-full w-full flex flex-col overflow-hidden">
|
<div class="flex h-full w-full flex-col overflow-hidden">
|
||||||
<div class="flex-1 overflow-auto">
|
<div class="flex-1 overflow-auto">
|
||||||
<ElInput
|
<ElInput
|
||||||
:disabled="!mainStore.serverConfig.enableWhiteList"
|
:disabled="!mainStore.serverConfig.enableWhiteList"
|
||||||
@@ -70,6 +81,58 @@
|
|||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ElDialog
|
||||||
|
v-model="privateModeDialogData.visible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
title="私有模式"
|
||||||
|
:show-close="false"
|
||||||
|
width="300px"
|
||||||
|
>
|
||||||
|
<ElAlert
|
||||||
|
type="primary"
|
||||||
|
:closable="false"
|
||||||
|
>
|
||||||
|
建议为服务器设置一个房间名和密码
|
||||||
|
</ElAlert>
|
||||||
|
<div class="h-[15px]"></div>
|
||||||
|
<ElForm
|
||||||
|
:model="mainStore.serverConfig"
|
||||||
|
label-position="top"
|
||||||
|
>
|
||||||
|
<ElFormItem
|
||||||
|
label="房间名"
|
||||||
|
prop="privateNetworkName"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
clearable
|
||||||
|
placeholder="请输入房间名 (默认为default)"
|
||||||
|
v-model="mainStore.serverConfig.privateNetworkName"
|
||||||
|
></ElInput>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem
|
||||||
|
label="密码"
|
||||||
|
prop="privateNetworkPassword"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
clearable
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
placeholder="请输入密码 (可选)"
|
||||||
|
v-model="mainStore.serverConfig.privateNetworkPassword"
|
||||||
|
></ElInput>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton
|
||||||
|
type="primary"
|
||||||
|
@click="handlePrivateModeDialogConfirm"
|
||||||
|
>
|
||||||
|
继续启用
|
||||||
|
</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
|
||||||
<ElInput
|
<ElInput
|
||||||
placeholder="服务器日志"
|
placeholder="服务器日志"
|
||||||
:model-value="data.log"
|
:model-value="data.log"
|
||||||
@@ -81,13 +144,14 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
import { reactive, onMounted, onBeforeUnmount, useTemplateRef, nextTick } from "vue";
|
||||||
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";
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
|
import { ElMessage, type FormInstance } from "element-plus";
|
||||||
|
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
log: "",
|
log: "",
|
||||||
@@ -119,10 +183,30 @@
|
|||||||
|
|
||||||
const hanldeClickStart = async () => {
|
const hanldeClickStart = async () => {
|
||||||
data.loading = true;
|
data.loading = true;
|
||||||
const args = getServerArgs();
|
const args = getServerArgs();
|
||||||
await appWindow.emitTo("main", "startStopServer", { args });
|
await appWindow.emitTo("main", "startStopServer", { args });
|
||||||
};
|
};
|
||||||
|
|
||||||
dataSubscribe();
|
// const privateModeDialogFormEl = useTemplateRef<FormInstance>("privateModeDialogFormRef");
|
||||||
|
|
||||||
|
const privateModeDialogData = reactive({
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const handlePrivateModeClick = async () => {
|
||||||
|
if (mainStore.serverConfig.privateMode) {
|
||||||
|
mainStore.serverConfig.privateMode = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
privateModeDialogData.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrivateModeDialogConfirm = async () => {
|
||||||
|
privateModeDialogData.visible = false;
|
||||||
|
mainStore.serverConfig.privateMode = true;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
dataSubscribe();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<template></template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { dataSubscribe } from "~/composables/windows";
|
||||||
|
|
||||||
|
dataSubscribe();
|
||||||
|
</script>
|
||||||
+33
-20
@@ -10,7 +10,7 @@
|
|||||||
name="netcard"
|
name="netcard"
|
||||||
class="flex h-full flex-col"
|
class="flex h-full flex-col"
|
||||||
>
|
>
|
||||||
<div>
|
<!-- <div>
|
||||||
<div>
|
<div>
|
||||||
<ElTooltip
|
<ElTooltip
|
||||||
content="找不到游戏房间时,就开启它后再尝试搜索房间(默认开启)
|
content="找不到游戏房间时,就开启它后再尝试搜索房间(默认开启)
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<ElLink
|
<ElLink
|
||||||
class="mr-[10px] !text-[15px]"
|
class="mr-[10px] !text-[15px]"
|
||||||
type="info"
|
type="info"
|
||||||
:underline="false"
|
underline="never"
|
||||||
@click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')"
|
@click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')"
|
||||||
>
|
>
|
||||||
WinIPBroadcast
|
WinIPBroadcast
|
||||||
@@ -39,13 +39,13 @@
|
|||||||
active-text="已开启"
|
active-text="已开启"
|
||||||
inactive-text="已关闭"
|
inactive-text="已关闭"
|
||||||
></ElSwitch>
|
></ElSwitch>
|
||||||
</div>
|
</div> -->
|
||||||
<div>
|
<div>
|
||||||
<ElTooltip
|
<ElTooltip
|
||||||
content="使用ForceBindIP启动应用 (强制绑定IP或者网卡),如果还没有启动联机,请先启动联机,联机成功后,点击刷新获取easytier生成的网卡"
|
content="使用ForceBindIP启动应用 (强制绑定IP或者网卡),如果还没有启动联机,请先启动联机,联机成功后,点击刷新获取easytier生成的网卡"
|
||||||
>
|
>
|
||||||
<ElText>
|
<ElText>
|
||||||
方案2
|
方案1
|
||||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||||
</ElText>
|
</ElText>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<ElLink
|
<ElLink
|
||||||
class="!text-[15px]"
|
class="!text-[15px]"
|
||||||
type="info"
|
type="info"
|
||||||
:underline="false"
|
underline="never"
|
||||||
@click="open('https://r1ch.net/projects/forcebindip')"
|
@click="open('https://r1ch.net/projects/forcebindip')"
|
||||||
>
|
>
|
||||||
ForceBindIP
|
ForceBindIP
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<ElTooltip content="设置网卡的跃点,提升网卡优先级,尝试将您联机使用的网卡跃点设置为最小,请先查询网卡信息">
|
<ElTooltip content="设置网卡的跃点,提升网卡优先级,尝试将您联机使用的网卡跃点设置为最小,请先查询网卡信息">
|
||||||
<ElText>
|
<ElText>
|
||||||
方案3
|
方案2
|
||||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||||
</ElText>
|
</ElText>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
@@ -198,16 +198,10 @@
|
|||||||
<ElButton
|
<ElButton
|
||||||
type="warning"
|
type="warning"
|
||||||
size="small"
|
size="small"
|
||||||
|
@click.stop="handleCloseAllFireWall"
|
||||||
>
|
>
|
||||||
一键关闭防火墙
|
一键关闭防火墙
|
||||||
</ElButton>
|
</ElButton>
|
||||||
<ElButton
|
|
||||||
@click="handleCustomFireWall"
|
|
||||||
type="danger"
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
自定义防火墙策略
|
|
||||||
</ElButton>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-[10px]">
|
<div class="mb-[10px]">
|
||||||
<ElText class="!mx-[10px]">域防火墙</ElText>
|
<ElText class="!mx-[10px]">域防火墙</ElText>
|
||||||
@@ -251,10 +245,17 @@
|
|||||||
<ElButton
|
<ElButton
|
||||||
size="small"
|
size="small"
|
||||||
:disabled="data.isPing"
|
:disabled="data.isPing"
|
||||||
@click="handleTestPing"
|
@click="handleTestPing('v4')"
|
||||||
>
|
>
|
||||||
Ping一下
|
Ping一下
|
||||||
</ElButton>
|
</ElButton>
|
||||||
|
<!-- <ElButton
|
||||||
|
size="small"
|
||||||
|
:disabled="data.isPing"
|
||||||
|
@click="handleTestPing('v6')"
|
||||||
|
>
|
||||||
|
Ping一下(v6)
|
||||||
|
</ElButton> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-[5px] flex-1 overflow-auto">
|
<div class="mt-[5px] flex-1 overflow-auto">
|
||||||
<ElInput
|
<ElInput
|
||||||
@@ -305,8 +306,18 @@
|
|||||||
forceBindStart: false
|
forceBindStart: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCustomFireWall = async () => {
|
|
||||||
await open("wf.msc");
|
const handleCloseAllFireWall = async () => {
|
||||||
|
try {
|
||||||
|
const output = await Command.create("netsh", ["advfirewall", "set", "allprofiles", "state", "off"], {
|
||||||
|
encoding: "gb2312"
|
||||||
|
}).execute();
|
||||||
|
ElMessage.success("关闭成功");
|
||||||
|
await initFirewall();
|
||||||
|
} catch (err) {
|
||||||
|
ElMessage.error(`关闭失败${err}`);
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTabsChange = async (tabPaneName: TabPaneName) => {
|
const handleTabsChange = async (tabPaneName: TabPaneName) => {
|
||||||
@@ -341,14 +352,15 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTestPing = async () => {
|
const handleTestPing = async (type: 'v4' | 'v6' = 'v4') => {
|
||||||
// const is = isValidIP(data.pingIp);
|
// const is = isValidIP(data.pingIp);
|
||||||
if (data.pingIp) {
|
if (data.pingIp) {
|
||||||
data.pingLog = "";
|
data.pingLog = "";
|
||||||
data.isPing = true;
|
data.isPing = true;
|
||||||
|
const args = type === 'v4' ? ["-n", "1", data.pingIp] : ["-6", '-n', "1", data.pingIp]
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < data.pingNum; i++) {
|
for (let i = 0; i < data.pingNum; i++) {
|
||||||
const output = await Command.create("ping", ["-n", "1", data.pingIp], {
|
const output = await Command.create("ping", args, {
|
||||||
encoding: "gb2312"
|
encoding: "gb2312"
|
||||||
}).execute();
|
}).execute();
|
||||||
if (output.stdout) {
|
if (output.stdout) {
|
||||||
@@ -490,8 +502,9 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
data.pingIp = mainStore.config.ipv4;
|
data.pingIp = mainStore.config.ipv4;
|
||||||
initStartWinIpBroadcast();
|
// initStartWinIpBroadcast();
|
||||||
getGuids();
|
getGuids();
|
||||||
dataSubscribe();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dataSubscribe();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Generated
+4275
-1976
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
# Generated by Cargo
|
# Generated by Cargo
|
||||||
# will have compiled files and executables
|
# will have compiled files and executables
|
||||||
/target/
|
target/
|
||||||
/gen/schemas
|
gen/schemas
|
||||||
/easytier/logs
|
./easytier/logs
|
||||||
/easytier/logs/*.*
|
easytier/logs
|
||||||
Generated
+1215
-1387
File diff suppressed because it is too large
Load Diff
+14
-14
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.4.4"
|
version = "1.4.8"
|
||||||
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"
|
||||||
@@ -18,7 +18,7 @@ name = "app_lib"
|
|||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.2.0", features = [] }
|
tauri-build = { version = "2.3.1", features = [] }
|
||||||
# prost-build = "0.13.2"
|
# prost-build = "0.13.2"
|
||||||
|
|
||||||
[target.x86_64-pc-windows-msvc.build-dependencies]
|
[target.x86_64-pc-windows-msvc.build-dependencies]
|
||||||
@@ -28,34 +28,34 @@ thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = f
|
|||||||
serde_json = "1.0.137"
|
serde_json = "1.0.137"
|
||||||
serde = { version = "1.0.217", features = ["derive"] }
|
serde = { version = "1.0.217", features = ["derive"] }
|
||||||
log = "0.4.26"
|
log = "0.4.26"
|
||||||
tauri = { version = "2.5.0", features = [ "protocol-asset",
|
tauri = { version = "2.7.0", features = [ "protocol-asset",
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
"image-png",
|
"image-png",
|
||||||
"image-ico"
|
"image-ico"
|
||||||
] }
|
] }
|
||||||
|
|
||||||
tauri-plugin-log = "2.3.1"
|
tauri-plugin-log = "2.6.0"
|
||||||
tauri-plugin-shell = "2.2.1"
|
tauri-plugin-shell = "2.3.0"
|
||||||
reqwest = { version = "0.12.12", features = ["json"] }
|
reqwest = { version = "0.12.12", features = ["json"] }
|
||||||
zip = "2.2.3"
|
zip = "2.2.3"
|
||||||
sysinfo = '0.33.1'
|
sysinfo = '0.33.1'
|
||||||
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"
|
||||||
tauri-plugin-fs = "2.2.1"
|
tauri-plugin-fs = "2.4.1"
|
||||||
tauri-plugin-clipboard-manager = "2.2.2"
|
tauri-plugin-clipboard-manager = "2.3.0"
|
||||||
rand = "0.9.0"
|
rand = "0.9.0"
|
||||||
tokio = { version = "1.43.0", features = ["process"] }
|
tokio = { version = "1.45.1", features = ["process"] }
|
||||||
tauri-plugin-dialog = "2.2.1"
|
tauri-plugin-dialog = "2.3.1"
|
||||||
# prost = "0.13"
|
# prost = "0.13"
|
||||||
# prost-types = "0.13"
|
# prost-types = "0.13"
|
||||||
hashbrown = "0.15.2"
|
hashbrown = "0.15.2"
|
||||||
# futures-util = "0.3"
|
# futures-util = "0.3"
|
||||||
|
|
||||||
[dependencies.windows]
|
[dependencies.windows]
|
||||||
version = "0.58.0"
|
version = "0.61.3"
|
||||||
features = ["Win32_System_TaskScheduler", "Win32_System_Com", "Win32_System_Power", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"]
|
features = ["Win32_System_TaskScheduler", "Win32_System_Com", "Win32_System_Power", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"]
|
||||||
|
|
||||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||||
tauri-plugin-cli = "2.2.0"
|
tauri-plugin-cli = "2.4.0"
|
||||||
tauri-plugin-single-instance = "2.2.3"
|
tauri-plugin-single-instance = "2.3.2"
|
||||||
tauri-plugin-window-state = "2.2.2"
|
tauri-plugin-window-state = "2.4.0"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "../gen/schemas/desktop-schema.json",
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
"identifier": "default",
|
"identifier": "default",
|
||||||
"description": "enables the default permissions",
|
"description": "enables the default permissions",
|
||||||
"windows": ["main", "log", "member", "cidr", "advance", "tool", "server", "gameList"],
|
"windows": ["main", "log", "member", "cidr", "advance", "tool", "server", "gameList", "storage-listener"],
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"core:default",
|
"core:default",
|
||||||
"core:window:allow-minimize",
|
"core:window:allow-minimize",
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
"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",
|
||||||
|
"core:window:allow-set-size",
|
||||||
{
|
{
|
||||||
"identifier": "shell:allow-spawn",
|
"identifier": "shell:allow-spawn",
|
||||||
"allow": [
|
"allow": [
|
||||||
|
|||||||
@@ -9,16 +9,13 @@
|
|||||||
"enableCustomListener": true,
|
"enableCustomListener": true,
|
||||||
"customListenerData": [
|
"customListenerData": [
|
||||||
"tcp://0.0.0.0:11010",
|
"tcp://0.0.0.0:11010",
|
||||||
"udp://0.0.0.0:11010",
|
"udp://0.0.0.0:11010"
|
||||||
"tcp://[::]:11010"
|
|
||||||
],
|
],
|
||||||
"networkName": "", //房间名
|
"networkName": "", //房间名
|
||||||
"networkPassword": "", //房间密码
|
"networkPassword": "", //房间密码
|
||||||
"hostname": "", //主机名
|
"hostname": "", //主机名
|
||||||
"ipv4": "", // 虚拟IP地址
|
"ipv4": "", // 虚拟IP地址
|
||||||
"disableIpv6": false, // 禁用ipv6
|
"disableIpv6": false, // 禁用ipv6
|
||||||
"enableCustomListenerV6": true, // 启用ipv6监听
|
|
||||||
"customListenerV6Data": "udp://[::]:11010", // ipv6监听地址
|
|
||||||
"disbleListenner": false, // 禁用监听
|
"disbleListenner": false, // 禁用监听
|
||||||
"disableEncryption": false, // 禁用加密
|
"disableEncryption": false, // 禁用加密
|
||||||
"enablExitNode": false, // 启用出口节点
|
"enablExitNode": false, // 启用出口节点
|
||||||
@@ -35,6 +32,9 @@
|
|||||||
"netCardMetricValue": 1, // 网卡跃点
|
"netCardMetricValue": 1, // 网卡跃点
|
||||||
"enablePreventSleep": false, // 启用防止睡眠
|
"enablePreventSleep": false, // 启用防止睡眠
|
||||||
"compression": "none", // 压缩算法
|
"compression": "none", // 压缩算法
|
||||||
"enableKcpProxy": true, // 启用kcp代理
|
"enableKcpProxy": true, // 启用kcp代理,就不能启用quic代理
|
||||||
"disableKcpInput": false // 禁用kcp输入
|
"disableKcpInput": false, // 禁用kcp输入
|
||||||
|
"enableQuicProxy": false, // 启用quic代理,就不能启用kcp代理
|
||||||
|
"disableQuicInput": false, // 禁用quic输入
|
||||||
|
"privateMode": false // 启用私有模式
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
+127
-39
@@ -1,7 +1,3 @@
|
|||||||
use planif::enums::TaskCreationFlags;
|
|
||||||
use planif::schedule::TaskScheduler as planIfTaskScheduler;
|
|
||||||
use planif::schedule_builder::{Action, ScheduleBuilder};
|
|
||||||
use planif::settings::{Duration, LogonType, PrincipalSettings, RunLevel};
|
|
||||||
use reqwest::{Client, Error};
|
use reqwest::{Client, Error};
|
||||||
// use futures_util::StreamExt;
|
// use futures_util::StreamExt;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -17,7 +13,8 @@ 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 windows::core::{BSTR, VARIANT};
|
use windows::Win32::System::Variant::VARIANT;
|
||||||
|
use windows::core::{Interface, BSTR};
|
||||||
use windows::Win32::Foundation::VARIANT_BOOL;
|
use windows::Win32::Foundation::VARIANT_BOOL;
|
||||||
use windows::Win32::NetworkManagement::IpHelper::{
|
use windows::Win32::NetworkManagement::IpHelper::{
|
||||||
GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH,
|
GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH,
|
||||||
@@ -326,7 +323,11 @@ async fn get_route_by_cli() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command(rename_all = "snake_case")]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
async fn download_easytier_zip(app_handle: tauri::AppHandle ,download_url: String, file_name: String) {
|
async fn download_easytier_zip(
|
||||||
|
app_handle: tauri::AppHandle,
|
||||||
|
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");
|
||||||
let cache_file_name = format!("{}\\{}", cache_dir_path, file_name);
|
let cache_file_name = format!("{}\\{}", cache_dir_path, file_name);
|
||||||
let cache_file_name_path = path::Path::new(&cache_file_name);
|
let cache_file_name_path = path::Path::new(&cache_file_name);
|
||||||
@@ -359,14 +360,18 @@ async fn download_easytier_zip(app_handle: tauri::AppHandle ,download_url: Strin
|
|||||||
while let Some(item) = response.chunk().await.unwrap() {
|
while let Some(item) = response.chunk().await.unwrap() {
|
||||||
match file.write_all(&item) {
|
match file.write_all(&item) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
app_handle.emit("download_core_progress", [item.len() as u64, context_size]).expect("error to emit download_core_progress");
|
app_handle
|
||||||
},Err(why) => {
|
.emit("download_core_progress", [item.len() as u64, context_size])
|
||||||
|
.expect("error to emit download_core_progress");
|
||||||
|
}
|
||||||
|
Err(why) => {
|
||||||
log::error!("error to write file: {}", why);
|
log::error!("error to write file: {}", why);
|
||||||
app_handle.emit("download_core_progress_error", why.to_string()).expect("error to emit download_core_progress_error");
|
app_handle
|
||||||
return
|
.emit("download_core_progress_error", why.to_string())
|
||||||
|
.expect("error to emit download_core_progress_error");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
println!("下载完成");
|
println!("下载完成");
|
||||||
unzip(path);
|
unzip(path);
|
||||||
@@ -516,18 +521,19 @@ fn stop_command(child_id: u32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command(rename_all = "snake_case")]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
async fn fetch_easytier_list() -> Vec<Vec<[String; 3]>> {
|
async fn fetch_easytier_list() -> Vec<Vec<[String; 4]>> {
|
||||||
// 获取release列表
|
// 获取release列表
|
||||||
if let Ok(release) = fetch_releases().await {
|
if let Ok(release) = fetch_releases().await {
|
||||||
let mut release_list = Vec::new();
|
let mut release_list: Vec<Vec<[String; 4]>> = Vec::new();
|
||||||
for re in release {
|
for re in release {
|
||||||
let mut assets_list = Vec::new();
|
let mut assets_list: Vec<[String; 4]> = Vec::new();
|
||||||
for asset in re.assets {
|
for asset in re.assets {
|
||||||
if asset.name.contains("windows-x86_64") {
|
if asset.name.contains("windows-x86_64") {
|
||||||
assets_list.push([
|
assets_list.push([
|
||||||
re.tag_name.clone(),
|
re.tag_name.clone(),
|
||||||
asset.name.clone(),
|
asset.name.clone(),
|
||||||
asset.browser_download_url.clone(),
|
asset.browser_download_url.clone(),
|
||||||
|
re.prerelease.to_string(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -656,6 +662,50 @@ fn autostart_is_enabled() -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增辅助函数
|
||||||
|
fn ensure_task_folder_and_cleanup(
|
||||||
|
task_service: &ITaskService,
|
||||||
|
folder_path: &BSTR,
|
||||||
|
task_name: &BSTR,
|
||||||
|
) -> Result<ITaskFolder, Box<dyn std::error::Error>> {
|
||||||
|
unsafe {
|
||||||
|
let root = BSTR::from("\\");
|
||||||
|
let root_folder: ITaskFolder = task_service.GetFolder(&root)?;
|
||||||
|
|
||||||
|
match task_service.GetFolder(folder_path) {
|
||||||
|
Ok(existing_folder) => {
|
||||||
|
println!("任务文件夹已存在: {}", folder_path);
|
||||||
|
|
||||||
|
// 检查并清理现有任务
|
||||||
|
if let Ok(_existing_task) = existing_folder.GetTask(task_name) {
|
||||||
|
println!("发现同名任务: {},准备删除", task_name);
|
||||||
|
match existing_folder.DeleteTask(task_name, 0) {
|
||||||
|
Ok(_) => println!("成功删除现有任务"),
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("删除现有任务失败: {}", e);
|
||||||
|
// 继续执行,尝试覆盖
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(existing_folder)
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
println!("创建新的任务文件夹: {}", folder_path);
|
||||||
|
match root_folder.CreateFolder(folder_path, &VARIANT::default()) {
|
||||||
|
Ok(new_folder) => {
|
||||||
|
println!("成功创建任务文件夹");
|
||||||
|
Ok(new_folder)
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("创建任务文件夹失败: {}", e);
|
||||||
|
Err(e.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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>> {
|
||||||
@@ -690,33 +740,71 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
|||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let ts = planIfTaskScheduler::new()?;
|
unsafe {
|
||||||
let com = ts.get_com();
|
let task_service: ITaskService = CoCreateInstance(&TaskScheduler, None, CLSCTX_ALL)?;
|
||||||
let sb = ScheduleBuilder::new(&com).unwrap();
|
task_service.Connect(
|
||||||
|
&VARIANT::default(),
|
||||||
|
&VARIANT::default(),
|
||||||
|
&VARIANT::default(),
|
||||||
|
&VARIANT::default(),
|
||||||
|
)?;
|
||||||
|
|
||||||
let exe = std::env::current_exe()?;
|
let folder_path = BSTR::from("\\easytierGame");
|
||||||
let exe = exe.to_str().unwrap();
|
let task_name = BSTR::from("auto start");
|
||||||
|
|
||||||
let settings = PrincipalSettings {
|
let task_definition = task_service.NewTask(0)?;
|
||||||
display_name: "".to_string(),
|
|
||||||
group_id: None,
|
// 设置任务信息
|
||||||
id: "".to_string(),
|
let registration_info = task_definition.RegistrationInfo()?;
|
||||||
logon_type: LogonType::InteractiveToken,
|
registration_info.SetDescription(&BSTR::from("EasytierGame auto start task"))?;
|
||||||
run_level: RunLevel::Highest,
|
registration_info.SetAuthor(&BSTR::from("EasytierGame"))?;
|
||||||
user_id: Some(whoami::username()),
|
|
||||||
};
|
// 改为用户登录触发
|
||||||
sb.create_logon()
|
let triggers = task_definition.Triggers()?;
|
||||||
.author("heixiansen")?
|
let trigger = triggers.Create(TASK_TRIGGER_LOGON)?;
|
||||||
.trigger("trigger", enabled)?
|
let logon_trigger: ILogonTrigger = trigger.cast()?;
|
||||||
.action(Action::new("auto start", exe, "", &TASKAUTOSTART_ARG))?
|
logon_trigger.SetEnabled(VARIANT_BOOL::from(true))?;
|
||||||
.in_folder("easytierGame")?
|
|
||||||
.principal(settings)?
|
// 设置动作
|
||||||
.delay(Duration {
|
let actions = task_definition.Actions()?;
|
||||||
seconds: Some(6),
|
let action = actions.Create(TASK_ACTION_EXEC)?;
|
||||||
..Default::default()
|
let exec_action: IExecAction = action.cast()?;
|
||||||
})?
|
let exe = std::env::current_exe()?;
|
||||||
.build()?
|
let exe_path: &str = exe.to_str().unwrap();
|
||||||
.register("auto start", TaskCreationFlags::CreateOrUpdate as i32)?;
|
exec_action.SetPath(&BSTR::from(exe_path))?;
|
||||||
|
exec_action.SetArguments(&BSTR::from("--task-auto-start"))?;
|
||||||
|
|
||||||
|
// 使用当前用户运行
|
||||||
|
let principal = task_definition.Principal()?;
|
||||||
|
principal.SetUserId(&BSTR::from(whoami::username().as_str()))?;
|
||||||
|
principal.SetLogonType(TASK_LOGON_INTERACTIVE_TOKEN)?;
|
||||||
|
principal.SetRunLevel(TASK_RUNLEVEL_HIGHEST)?;
|
||||||
|
|
||||||
|
// 设置任务设置
|
||||||
|
let settings = task_definition.Settings()?;
|
||||||
|
settings.SetEnabled(VARIANT_BOOL::from(true))?;
|
||||||
|
settings.SetCompatibility(TASK_COMPATIBILITY_V2)?; // Windows 7
|
||||||
|
settings.SetStartWhenAvailable(VARIANT_BOOL::from(true))?;
|
||||||
|
// settings.SetHidden(VARIANT_BOOL::from(true))?; // 注释掉让任务可见
|
||||||
|
settings.SetExecutionTimeLimit(&BSTR::from("PT0S"))?;
|
||||||
|
settings.SetDisallowStartIfOnBatteries(VARIANT_BOOL(0))?; // 允许在电池供电时启动
|
||||||
|
|
||||||
|
// 获取文件夹并注册任务
|
||||||
|
let task_folder =
|
||||||
|
ensure_task_folder_and_cleanup(&task_service, &folder_path, &task_name)?;
|
||||||
|
|
||||||
|
let _auto_task = task_folder.RegisterTaskDefinition(
|
||||||
|
&task_name,
|
||||||
|
&task_definition,
|
||||||
|
TASK_CREATE_OR_UPDATE.0,
|
||||||
|
&VARIANT::default(),
|
||||||
|
&VARIANT::default(),
|
||||||
|
TASK_LOGON_INTERACTIVE_TOKEN,
|
||||||
|
&VARIANT::default(),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.4.4",
|
"version": "1.4.8",
|
||||||
"identifier": "com.tauri.easytier-game",
|
"identifier": "com.tauri.easytier-game",
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
@@ -12,14 +12,14 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "easytier-game 1.4.4",
|
"title": "easytier-game 1.4.8",
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"minWidth": 340,
|
"minWidth": 340,
|
||||||
"width": 340,
|
"width": 340,
|
||||||
"height": 305,
|
"height": 305,
|
||||||
"minHeight": 305,
|
"minHeight": 305,
|
||||||
"maxHeight": 305,
|
"maxHeight": 405,
|
||||||
"maxWidth": 360,
|
"maxWidth": 460,
|
||||||
"resizable": true,
|
"resizable": true,
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
"decorations": true,
|
"decorations": true,
|
||||||
|
|||||||
+38
-6
@@ -1,4 +1,7 @@
|
|||||||
import { acceptHMRUpdate, defineStore } from "pinia";
|
import { acceptHMRUpdate, defineStore } from "pinia";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const store = defineStore("main", {
|
const store = defineStore("main", {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
@@ -9,15 +12,18 @@ const store = defineStore("main", {
|
|||||||
networkPassword: "",
|
networkPassword: "",
|
||||||
hostname: "",
|
hostname: "",
|
||||||
ipv4: "",
|
ipv4: "",
|
||||||
|
ipv6:"",
|
||||||
|
tcpWhitelistEnable: false, // tcp端口白名单
|
||||||
|
udpWhitelistEnable: false, // udp端口白名单
|
||||||
|
tcpWhitelist: "", // tcp端口白名单
|
||||||
|
udpWhitelist: "", // udp端口白名单
|
||||||
proxyNetworks: "", // 子网代理
|
proxyNetworks: "", // 子网代理
|
||||||
autoStart: false, // 是否自动启动
|
autoStart: false, // 是否自动启动
|
||||||
connectAfterStart: false, //软件打开后,是否自动连接
|
connectAfterStart: false, //软件打开后,是否自动连接
|
||||||
disableIpv6: false, // 是否禁用IPv6
|
disableIpv6: false, // 是否禁用IPv6
|
||||||
port: "11010", // 监听端口号
|
port: "11010", // 监听端口号
|
||||||
enableCustomListener: true, // 是否自定义监听
|
enableCustomListener: true, // 是否自定义监听
|
||||||
enableCustomListenerV6: true, // 是否自定义IPV6监听
|
customListenerData: "tcp://0.0.0.0:11010\nudp://0.0.0.0:11010", // 自定义监听地址
|
||||||
customListenerV6Data: "udp://[::]:11010", //自定义ipv6监
|
|
||||||
customListenerData: "tcp://0.0.0.0:11010\nudp://0.0.0.0:11010\ntcp://[::]:11010", // 自定义监听地址
|
|
||||||
disbleListenner: false, // 是否禁用监听
|
disbleListenner: false, // 是否禁用监听
|
||||||
disableEncryption: false, // 是否禁用加密
|
disableEncryption: false, // 是否禁用加密
|
||||||
multiThread: false, //使用多线程
|
multiThread: false, //使用多线程
|
||||||
@@ -41,7 +47,14 @@ const store = defineStore("main", {
|
|||||||
compression: "none", //加密算法
|
compression: "none", //加密算法
|
||||||
enableKcpProxy: true, //启用kcp代理 默认开启
|
enableKcpProxy: true, //启用kcp代理 默认开启
|
||||||
disableKcpInput: false, //禁用kcp输入
|
disableKcpInput: false, //禁用kcp输入
|
||||||
|
enableQuicProxy: false, //启用quic代理 默认开启
|
||||||
|
disableQuicInput: false, //禁用quic输入
|
||||||
bindDeviceEnable: false, //是否绑定设备
|
bindDeviceEnable: false, //是否绑定设备
|
||||||
|
acceptDNS: false, //魔法dns
|
||||||
|
privateMode: false, //是否启用私有模式
|
||||||
|
|
||||||
|
enablePortForward: false, //是否启用端口转发
|
||||||
|
portForwardData: "", //端口转发数据
|
||||||
},
|
},
|
||||||
serverConfig: {
|
serverConfig: {
|
||||||
enableWhiteList: true, // 是否启用白名单
|
enableWhiteList: true, // 是否启用白名单
|
||||||
@@ -49,7 +62,10 @@ const store = defineStore("main", {
|
|||||||
serverWhiteList: "", // 服务器流量转发白名单
|
serverWhiteList: "", // 服务器流量转发白名单
|
||||||
// enableListener: true, // 是否启用监听
|
// enableListener: true, // 是否启用监听
|
||||||
autoStart: false, //随软件自启
|
autoStart: false, //随软件自启
|
||||||
port: "11010" // 服务器端口
|
port: "11010", // 服务器端口
|
||||||
|
privateMode: false, //是否启用私有模式
|
||||||
|
privateNetworkName: "", // 私有模式房间名
|
||||||
|
privateNetworkPassword: "", // 私有模式密码
|
||||||
},
|
},
|
||||||
cidrEnable: false,
|
cidrEnable: false,
|
||||||
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
|
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
|
||||||
@@ -83,6 +99,7 @@ const store = defineStore("main", {
|
|||||||
"config.networkPassword",
|
"config.networkPassword",
|
||||||
"config.hostname",
|
"config.hostname",
|
||||||
"config.ipv4",
|
"config.ipv4",
|
||||||
|
"config.ipv6",
|
||||||
"config.proxyNetworks",
|
"config.proxyNetworks",
|
||||||
"config.autoStart",
|
"config.autoStart",
|
||||||
"config.connectAfterStart",
|
"config.connectAfterStart",
|
||||||
@@ -104,12 +121,17 @@ const store = defineStore("main", {
|
|||||||
"config.enableNetCardMetric",
|
"config.enableNetCardMetric",
|
||||||
"config.netCardMetricValue",
|
"config.netCardMetricValue",
|
||||||
"config.port",
|
"config.port",
|
||||||
|
"config.tcpWhitelist",
|
||||||
|
"config.udpWhitelist",
|
||||||
|
"config.tcpWhitelistEnable",
|
||||||
|
"config.udpWhitelistEnable",
|
||||||
|
|
||||||
|
"config.enablePortForward",
|
||||||
|
"config.portForwardData",
|
||||||
|
|
||||||
"config.disbleListenner",
|
"config.disbleListenner",
|
||||||
"config.enableCustomListener",
|
"config.enableCustomListener",
|
||||||
"config.customListenerData",
|
"config.customListenerData",
|
||||||
"config.enableCustomListenerV6",
|
|
||||||
"config.customListenerV6Data",
|
|
||||||
|
|
||||||
"config.enableCustomProtocol",
|
"config.enableCustomProtocol",
|
||||||
"config.customProtocol",
|
"config.customProtocol",
|
||||||
@@ -118,15 +140,25 @@ const store = defineStore("main", {
|
|||||||
|
|
||||||
"config.enableKcpProxy",
|
"config.enableKcpProxy",
|
||||||
"config.disableKcpInput",
|
"config.disableKcpInput",
|
||||||
|
"config.enableQuicProxy",
|
||||||
|
"config.disableQuicInput",
|
||||||
|
|
||||||
|
|
||||||
"config.bindDeviceEnable",
|
"config.bindDeviceEnable",
|
||||||
|
|
||||||
|
"config.acceptDNS",
|
||||||
|
|
||||||
|
"config.privateMode",
|
||||||
|
|
||||||
"serverConfig.autoStart",
|
"serverConfig.autoStart",
|
||||||
// 'serverConfig.enableListener',
|
// 'serverConfig.enableListener',
|
||||||
"serverConfig.enableWhiteList",
|
"serverConfig.enableWhiteList",
|
||||||
"serverConfig.relayAllPeerrpc",
|
"serverConfig.relayAllPeerrpc",
|
||||||
"serverConfig.serverWhiteList",
|
"serverConfig.serverWhiteList",
|
||||||
"serverConfig.port",
|
"serverConfig.port",
|
||||||
|
"serverConfig.privateMode",
|
||||||
|
"serverConfig.privateNetworkName",
|
||||||
|
"serverConfig.privateNetworkPassword",
|
||||||
|
|
||||||
"cidrEnable",
|
"cidrEnable",
|
||||||
"proxyForwardBySystem",
|
"proxyForwardBySystem",
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const _supportProtocols = ["tcp", "udp", "ws", "wss", "quic"];
|
const _supportProtocols = ["tcp", "udp", "ws", "wss"];
|
||||||
|
|
||||||
export const supportProtocols = () => {
|
export const supportProtocols = () => {
|
||||||
return _supportProtocols.slice();
|
return _supportProtocols.slice();
|
||||||
|
|||||||
Reference in New Issue
Block a user