mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2026-09-20 11:22:37 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bfe3860a8 | ||
|
|
a0b4071c49 | ||
|
|
8e9bb114d6 | ||
|
|
fb8e127198 | ||
|
|
3cd19ae42a | ||
|
|
5be1a681ca | ||
|
|
29464179f5 | ||
|
|
88f06fbeba | ||
|
|
ced035dc36 | ||
|
|
feea75dcb6 | ||
|
|
229fd31de6 | ||
|
|
db3acd0c32 |
@@ -1,12 +1,12 @@
|
||||
pnpm run build
|
||||
rustup default nightly
|
||||
rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
|
||||
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
|
||||
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
|
||||
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
|
||||
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x86
|
||||
pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
|
||||
@REM rustup default nightly
|
||||
@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\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\x86
|
||||
@REM pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
|
||||
rustup default stable
|
||||
pnpm tauri build
|
||||
pnpm run release
|
||||
pnpm run release-win7
|
||||
@REM pnpm run release-win7
|
||||
+25
-11
@@ -2,7 +2,21 @@ import { BaseDirectory, writeTextFile } from "@tauri-apps/plugin-fs";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { ElMessage } from "element-plus";
|
||||
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 path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||
if (isNil(configJsonSeverUrl)) {
|
||||
@@ -14,23 +28,19 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
|
||||
const {
|
||||
proxyNetworks,
|
||||
autoStart,
|
||||
relayAllPeerrpc,
|
||||
connectAfterStart,
|
||||
multiThread,
|
||||
enablExitNode,
|
||||
useSmoltcp,
|
||||
saveErrorLog,
|
||||
logLevel,
|
||||
serverUrl,
|
||||
port,
|
||||
enableCustomListener,
|
||||
enablePreventSleep,
|
||||
customListenerData,
|
||||
customListenerV6Data,
|
||||
enableCustomListenerV6,
|
||||
bindDeviceEnable,
|
||||
acceptDNS,
|
||||
enablePortForward,
|
||||
portForwardData,
|
||||
...otherConfig
|
||||
} = mainStore.config;
|
||||
let writeServerUrl: Array<string> | string = serverUrl;
|
||||
let writeCustomListenerData: Array<string> = (customListenerData || "").split("\n");
|
||||
if (isArray) {
|
||||
writeServerUrl = intersection(
|
||||
uniq([serverUrl, ...configJsonSeverUrl]).filter(boolean => boolean),
|
||||
@@ -43,7 +53,11 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
|
||||
mainStore.basePeers
|
||||
).join(",");
|
||||
}
|
||||
await writeTextFile(path, JSON.stringify({ serverUrl: writeServerUrl, ...otherConfig }, null, 4), { baseDir: BaseDirectory.Resource });
|
||||
await writeTextFile(
|
||||
path,
|
||||
JSON.stringify({ serverUrl: writeServerUrl, enableCustomListener, customListenerData: writeCustomListenerData, ...otherConfig }, null, 4),
|
||||
{ baseDir: BaseDirectory.Resource }
|
||||
);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
ElMessage.error(`更新config.json失败`);
|
||||
|
||||
+37
-38
@@ -8,6 +8,7 @@ import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
// import { ElConfirmPrimary } from "~/utils/element";
|
||||
import { open } from "@tauri-apps/plugin-shell";
|
||||
import { computed } from "vue";
|
||||
|
||||
const DEFAULT_TRAY_NAME = "main";
|
||||
|
||||
@@ -30,13 +31,10 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
|
||||
tooltip: `EasyTierGame\n${pkg.version}`,
|
||||
title: `EasyTierGame\n${pkg.version}`,
|
||||
id: DEFAULT_TRAY_NAME,
|
||||
menu: await Menu.new({
|
||||
id: "main",
|
||||
items: await generateMenuItem(beforExit, handleConnection),
|
||||
}),
|
||||
action: async (e) => {
|
||||
menu: await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }),
|
||||
action: async e => {
|
||||
toggleVisibility();
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -47,18 +45,13 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
|
||||
if (init) {
|
||||
tray.setTooltip(`EasyTierGame\n${pkg.version}`);
|
||||
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) }));
|
||||
}
|
||||
|
||||
return tray;
|
||||
}
|
||||
|
||||
export async function generateMenuItem(beforExit: Function, handleConnection:Function) {
|
||||
export async function generateMenuItem(beforExit: Function, handleConnection: Function) {
|
||||
return [
|
||||
await MenuItemShow("显示 / 隐藏"),
|
||||
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
|
||||
@@ -66,7 +59,7 @@ export async function generateMenuItem(beforExit: Function, handleConnection:Fun
|
||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||
await MenuItemPublicPeers(),
|
||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||
await MenuItemExit("退出", beforExit),
|
||||
await MenuItemExit("退出", beforExit)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -79,18 +72,17 @@ export async function MenuItemExit(text: string, beforExit: Function) {
|
||||
await beforExit();
|
||||
}
|
||||
await getCurrentWindow().close();
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function MenuItemPublicPeers() {
|
||||
|
||||
return await MenuItem.new({
|
||||
id: "publicPeers",
|
||||
text: "公共节点",
|
||||
action: async () => {
|
||||
await open(import.meta.env.VITE_PUBLIC_PEERS_URL)
|
||||
},
|
||||
await open(import.meta.env.VITE_PUBLIC_PEERS_URL);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,17 +92,17 @@ export async function MenuItemShow(text: string) {
|
||||
text,
|
||||
action: async () => {
|
||||
await toggleVisibility();
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function MenuItemExchangeConnection(text: string, handleConnection:Function) {
|
||||
const menutItem = await MenuItem.new({
|
||||
export async function MenuItemExchangeConnection(text: string, handleConnection: Function) {
|
||||
const menutItem = await MenuItem.new({
|
||||
id: "exchangeConnection",
|
||||
text,
|
||||
action: async () => {
|
||||
const isStart = await handleConnection();
|
||||
},
|
||||
}
|
||||
});
|
||||
return menutItem;
|
||||
}
|
||||
@@ -121,12 +113,10 @@ export async function MenuItemTheme() {
|
||||
text: "主题切换",
|
||||
action: async () => {
|
||||
const mainStore = useMainStore();
|
||||
mainStore.$patch({
|
||||
theme: !mainStore.theme
|
||||
});
|
||||
mainStore.$patch({ theme: !mainStore.theme });
|
||||
// mainStore.$persist();
|
||||
await setTheme(mainStore.theme);
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,18 +149,27 @@ export async function setTrayTooltip(tray: TrayIcon | null, tooltip?: string | n
|
||||
}
|
||||
}
|
||||
|
||||
const versionWeight = (version: string) => {
|
||||
version = version ? version.trim() : "";
|
||||
const [major = "0", minor = "0", patch = "0"] = version.split(".");
|
||||
return parseInt(major) * 10000 + parseInt(minor) * 100 + parseInt(patch);
|
||||
};
|
||||
|
||||
const versionDifference = (current: string, latest: string) => {
|
||||
const currentVersion = versionWeight(current);
|
||||
const latestVersion = versionWeight(latest);
|
||||
return currentVersion - latestVersion;
|
||||
};
|
||||
|
||||
export const checkNewVersion = async () => {
|
||||
const mainStore = useMainStore();
|
||||
// if(mainStore.latestTagName && mainStore.latestTagName == pkg.version) return;
|
||||
if (hasNewVersion.value) return;
|
||||
let [tagName, downloadUrl] = await invoke<string[]>("fetch_game_releases");
|
||||
if(tagName && pkg.version !== tagName) {
|
||||
return true; //有新版
|
||||
// const [err] = await ElConfirmPrimary("有新版本是否下载?", "发现新版本", {
|
||||
// confirmButtonText: "下载",
|
||||
// cancelButtonText: "取消",
|
||||
// })
|
||||
// if(!err) {
|
||||
// open(downloadUrl);
|
||||
// }
|
||||
}
|
||||
return false; //没有新版
|
||||
}
|
||||
mainStore.latestTagName = tagName;
|
||||
};
|
||||
|
||||
export const hasNewVersion = computed<boolean>(() => {
|
||||
const mainStore = useMainStore();
|
||||
return !!mainStore.latestTagName && versionDifference(pkg.version, mainStore.latestTagName) < 0 ;
|
||||
});
|
||||
|
||||
+50
-37
@@ -4,17 +4,29 @@ import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { onBeforeUnmount } from "vue";
|
||||
import { updateConfigJsonBounce, type ConfigServerUrlType } from "./configJson";
|
||||
|
||||
const _listenersMaps: { [key: string]: [UnlistenFn | null, UnlistenFn | null] } = {};
|
||||
const _listenersMaps: { [key: string]: [UnlistenFn | null] } = {};
|
||||
|
||||
const dealCloseListener = async (dialog: WebviewWindow, label: string, beforeCloseFunc?: () => void | null) => {
|
||||
const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null];
|
||||
let [unListenlogClose] = unlistenFnList;
|
||||
|
||||
unListenlogClose && (await unListenlogClose());
|
||||
|
||||
unListenlogClose = await dialog.onCloseRequested(async () => {
|
||||
beforeCloseFunc && (await beforeCloseFunc());
|
||||
unListenlogClose && (await unListenlogClose());
|
||||
console.log("close");
|
||||
});
|
||||
};
|
||||
export default async (
|
||||
label: WebviewLabel,
|
||||
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
||||
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
|
||||
beforeCloseFunc?: () => void | null
|
||||
) => {
|
||||
const unlistenFnList: [UnlistenFn | null, UnlistenFn | null] = _listenersMaps[label] || [null, null];
|
||||
let [unlistenLogCreated, unListenlogClose] = unlistenFnList;
|
||||
const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null];
|
||||
let dialog = await WebviewWindow.getByLabel(label);
|
||||
if (!dialog) {
|
||||
let defaultOpts: { [key: string]: any; parent: Window | undefined } = {
|
||||
@@ -29,54 +41,55 @@ export default async (
|
||||
};
|
||||
const appWindow = getCurrentWindow();
|
||||
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;
|
||||
// console.error(logicalPosition);
|
||||
defaultOpts.x = logicalPosition.x;
|
||||
defaultOpts.y = logicalPosition.y;
|
||||
}
|
||||
unlistenLogCreated && (await (unlistenLogCreated as Function)());
|
||||
unListenlogClose && (await unListenlogClose());
|
||||
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
||||
unlistenLogCreated = await dialog.listen("tauri://webview-created", async () => {
|
||||
if (dialog) {
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
if (defaultOpts.x == 0 && defaultOpts.y == 0) {
|
||||
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.x = logicalPosition.x;
|
||||
defaultOpts.y = logicalPosition.y;
|
||||
}
|
||||
});
|
||||
unlistenFnList[0] = unlistenLogCreated;
|
||||
unListenlogClose = await dialog.onCloseRequested(async () => {
|
||||
beforeCloseFunc && (await beforeCloseFunc());
|
||||
unListenlogClose && (await unListenlogClose());
|
||||
unlistenLogCreated && (await (unlistenLogCreated as Function)());
|
||||
});
|
||||
unlistenFnList[1] = unlistenLogCreated;
|
||||
_listenersMaps[label] = unlistenFnList;
|
||||
}
|
||||
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
||||
await dealCloseListener(dialog, label, beforeCloseFunc);
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
} else {
|
||||
const visible = await dialog.isVisible();
|
||||
if (visible) {
|
||||
await dialog.close();
|
||||
unlistenLogCreated && (await (unlistenLogCreated as Function)());
|
||||
} else {
|
||||
const appWindow = getCurrentWindow();
|
||||
await dealCloseListener(dialog, label, beforeCloseFunc);
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const dataSubscribe = async (cb?: (...args: any) => any) => {
|
||||
if (!cb) return;
|
||||
export const dataSubscribe = async (cb?: any, getconfigServerUrl?: () => ConfigServerUrlType) => {
|
||||
const mainStore = useMainStore();
|
||||
const abort = new AbortController();
|
||||
window.addEventListener("storage", async () => {
|
||||
mainStore.$hydrate();
|
||||
if (cb && cb instanceof Function) {
|
||||
await cb();
|
||||
|
||||
window.addEventListener(
|
||||
"storage",
|
||||
async () => {
|
||||
// console.log("触发", {dhcp:mainStore.config.dhcp, c: mainStore.createConfigInEasytier})
|
||||
mainStore.$hydrate();
|
||||
const configServerUrl = getconfigServerUrl && getconfigServerUrl instanceof Function ? getconfigServerUrl() : null;
|
||||
updateConfigJsonBounce(configServerUrl);
|
||||
if (cb && cb instanceof Function) {
|
||||
await cb();
|
||||
}
|
||||
},
|
||||
{
|
||||
signal: abort.signal
|
||||
}
|
||||
}, {
|
||||
signal: abort.signal
|
||||
})
|
||||
);
|
||||
onBeforeUnmount(() => {
|
||||
console.log("取消监听");
|
||||
abort?.abort();
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
+93
-93
@@ -3,107 +3,107 @@ import path from "path";
|
||||
import vueJSX from "@vitejs/plugin-vue-jsx";
|
||||
|
||||
export default defineNuxtConfig({
|
||||
ssr: false,
|
||||
ssr: false,
|
||||
|
||||
devServer: {
|
||||
port: 5000
|
||||
},
|
||||
|
||||
telemetry: false,
|
||||
devServer: {
|
||||
port: 5000
|
||||
},
|
||||
|
||||
imports: {
|
||||
autoImport: false
|
||||
},
|
||||
telemetry: false,
|
||||
|
||||
css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"],
|
||||
modules: [
|
||||
"@element-plus/nuxt",
|
||||
"@pinia/nuxt",
|
||||
[
|
||||
"pinia-plugin-persistedstate/nuxt",
|
||||
{
|
||||
key: "__glj_persisted_%id",
|
||||
storage: "localStorage"
|
||||
}
|
||||
],
|
||||
"@nuxtjs/tailwindcss"
|
||||
],
|
||||
imports: {
|
||||
autoImport: false
|
||||
},
|
||||
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./")
|
||||
},
|
||||
css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"],
|
||||
modules: [
|
||||
"@element-plus/nuxt",
|
||||
"@pinia/nuxt",
|
||||
[
|
||||
"pinia-plugin-persistedstate/nuxt",
|
||||
{
|
||||
key: "__glj_persisted_%id",
|
||||
storage: "localStorage"
|
||||
}
|
||||
],
|
||||
"@nuxtjs/tailwindcss"
|
||||
],
|
||||
|
||||
experimental: {
|
||||
payloadExtraction: false
|
||||
},
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./")
|
||||
},
|
||||
|
||||
devtools: {
|
||||
enabled: false
|
||||
},
|
||||
experimental: {
|
||||
payloadExtraction: false
|
||||
},
|
||||
|
||||
router: {
|
||||
options: {
|
||||
hashMode: true
|
||||
}
|
||||
},
|
||||
devtools: {
|
||||
enabled: false
|
||||
},
|
||||
|
||||
vite: {
|
||||
plugins: [vueJSX({})],
|
||||
envDir: "env",
|
||||
optimizeDeps: {
|
||||
// include: [...optimizeDepsElementPlusIncludes]
|
||||
},
|
||||
// prevent vite from obscuring rust errors
|
||||
clearScreen: false,
|
||||
// Tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
strictPort: true
|
||||
},
|
||||
// to access the Tauri environment variables set by the CLI with information about the current target
|
||||
envPrefix: ["VITE_", "TAURI_"],
|
||||
build: {
|
||||
// minify: "esbuild",
|
||||
chunkSizeWarningLimit: 1500,
|
||||
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
|
||||
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
|
||||
// don't minify for debug builds
|
||||
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
|
||||
// 为调试构建生成源代码映射 (sourcemap)
|
||||
sourcemap: !!process.env.TAURI_DEBUG
|
||||
},
|
||||
esbuild: {
|
||||
// pure: ["console.log"],
|
||||
drop: ["debugger"]
|
||||
}
|
||||
},
|
||||
router: {
|
||||
options: {
|
||||
hashMode: true
|
||||
}
|
||||
},
|
||||
|
||||
postcss: {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {}
|
||||
}
|
||||
},
|
||||
vite: {
|
||||
plugins: [vueJSX({})],
|
||||
envDir: "env",
|
||||
optimizeDeps: {
|
||||
// include: [...optimizeDepsElementPlusIncludes]
|
||||
},
|
||||
// prevent vite from obscuring rust errors
|
||||
clearScreen: false,
|
||||
// Tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
strictPort: true
|
||||
},
|
||||
// to access the Tauri environment variables set by the CLI with information about the current target
|
||||
envPrefix: ["VITE_", "TAURI_"],
|
||||
build: {
|
||||
// minify: "esbuild",
|
||||
chunkSizeWarningLimit: 1500,
|
||||
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
|
||||
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
|
||||
// don't minify for debug builds
|
||||
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
|
||||
// 为调试构建生成源代码映射 (sourcemap)
|
||||
sourcemap: !!process.env.TAURI_DEBUG
|
||||
},
|
||||
esbuild: {
|
||||
// pure: ["console.log"],
|
||||
drop: ["debugger"]
|
||||
}
|
||||
},
|
||||
|
||||
app: {
|
||||
rootId: "__easytier",
|
||||
cdnURL: "./",
|
||||
buildAssetsDir: "__easytier/",
|
||||
head: {
|
||||
meta: [
|
||||
{
|
||||
name: "viewport",
|
||||
content: "width=device-width, initial-scale=1"
|
||||
},
|
||||
{
|
||||
charset: "utf-8"
|
||||
}
|
||||
],
|
||||
title: "easytier-game"
|
||||
// link: [],
|
||||
// style: [],
|
||||
// script: [],
|
||||
// noscript: []
|
||||
}
|
||||
},
|
||||
compatibilityDate: "2024-11-12"
|
||||
postcss: {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {}
|
||||
}
|
||||
},
|
||||
|
||||
app: {
|
||||
rootId: "__easytier",
|
||||
cdnURL: "./",
|
||||
buildAssetsDir: "__easytier/",
|
||||
head: {
|
||||
meta: [
|
||||
{
|
||||
name: "viewport",
|
||||
content: "width=device-width, initial-scale=1"
|
||||
},
|
||||
{
|
||||
charset: "utf-8"
|
||||
}
|
||||
],
|
||||
title: "easytier-game"
|
||||
// link: [],
|
||||
// style: [],
|
||||
// script: [],
|
||||
// noscript: []
|
||||
}
|
||||
},
|
||||
compatibilityDate: "2024-11-12"
|
||||
});
|
||||
|
||||
+19
-19
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"author": "leizi97",
|
||||
"description": "A simple network initiator based on Easytier",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.5",
|
||||
"scripts": {
|
||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||
"build": "nuxt generate --dotenv env/.env.prod",
|
||||
@@ -12,30 +12,30 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@element-plus/nuxt": "^1.1.1",
|
||||
"@nuxtjs/tailwindcss": "6.13.1",
|
||||
"@pinia/nuxt": "0.9.0",
|
||||
"@tauri-apps/api": "^2.2.0",
|
||||
"@tauri-apps/cli": "2.2.7",
|
||||
"@element-plus/nuxt": "1.1.2",
|
||||
"@nuxtjs/tailwindcss": "6.13.2",
|
||||
"@pinia/nuxt": "0.11.0",
|
||||
"@tauri-apps/api": "2.5.0",
|
||||
"@tauri-apps/cli": "2.5.0",
|
||||
"@tauri-apps/plugin-cli": "^2.2.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.2.0",
|
||||
"@tauri-apps/plugin-dialog": "2.2.0",
|
||||
"@tauri-apps/plugin-fs": "^2.2.0",
|
||||
"@tauri-apps/plugin-log": "2.2.1",
|
||||
"@tauri-apps/plugin-shell": "^2.2.0",
|
||||
"@tauri-apps/plugin-window-state": "2.2.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.2.2",
|
||||
"@tauri-apps/plugin-dialog": "2.2.2",
|
||||
"@tauri-apps/plugin-fs": "2.3.0",
|
||||
"@tauri-apps/plugin-log": "2.4.0",
|
||||
"@tauri-apps/plugin-shell": "2.2.1",
|
||||
"@tauri-apps/plugin-window-state": "2.2.2",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
||||
"@vueuse/core": "12.4.0",
|
||||
"@vitejs/plugin-vue-jsx": "4.1.2",
|
||||
"@vueuse/core": "12.7.0",
|
||||
"archiver": "^7.0.1",
|
||||
"element-plus": "2.9.4",
|
||||
"element-plus": "2.9.11",
|
||||
"less": "4.2.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nuxt": "3.15.4",
|
||||
"pinia": "2.3.1",
|
||||
"pinia-plugin-persistedstate": "^4.2.0",
|
||||
"nuxt": "3.17.4",
|
||||
"pinia": "3.0.2",
|
||||
"pinia-plugin-persistedstate": "4.3.0",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "3.4.2",
|
||||
"prettier": "3.5.2",
|
||||
"prettier-plugin-tailwindcss": "0.6.11"
|
||||
}
|
||||
}
|
||||
|
||||
+116
-33
@@ -2,8 +2,8 @@
|
||||
<div class="flex h-full flex-col items-start overflow-auto px-[25px]">
|
||||
<div class="flex flex-nowrap items-center gap-[15px]">
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.enableCustomProtocol">默认直连(p2p)使用的协议</ElCheckbox>
|
||||
<ElTooltip content="如果没有支持该协议的节点地址,程序会自动处理,请放心使用">
|
||||
<ElCheckbox v-model="mainStore.config.enableCustomProtocol">直连(P2P)优先使用传输协议</ElCheckbox>
|
||||
<ElTooltip content="若无法建立指定的协议,会自动使用可建立连接的协议">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">帮助对等节点建立直连(p2p)通信</ElCheckbox>
|
||||
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">帮助他人建立直连(P2P)连接</ElCheckbox>
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.connectAfterStart">软件启动后,自动"启动联机"(搭配开机自启,无感联机)</ElCheckbox></div>
|
||||
<div class="flex flex-nowrap items-center gap-[15px]">
|
||||
@@ -38,8 +38,8 @@
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止系统休眠(比如:屏幕会一直亮着)</ElCheckbox></div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式,将尝试使用最低延迟路径转发流量</ElCheckbox>
|
||||
<ElTooltip content="视网络质量进行选择,可能会出现中转与直连(p2p)来回切换的情况">
|
||||
<ElCheckbox v-model="mainStore.config.latencyfirst">使用低延迟模式</ElCheckbox>
|
||||
<ElTooltip content="弱网环境下可能会导致网络延迟延迟忽高忽低">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
@@ -59,6 +59,13 @@
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</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>
|
||||
<ElDivider />
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||
@@ -103,6 +110,7 @@
|
||||
class="!mb-0"
|
||||
v-model="listenerDialogData.visible"
|
||||
:close-on-press-escape="false"
|
||||
:close-on-click-modal="false"
|
||||
title="自定义监听地址"
|
||||
>
|
||||
<ElInput
|
||||
@@ -125,38 +133,74 @@
|
||||
</ElDialog>
|
||||
</div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox
|
||||
:disabled="mainStore.config.disbleListenner"
|
||||
v-model="mainStore.config.enableCustomListenerV6"
|
||||
<ElCheckbox v-model="mainStore.config.enablePortForward">端口转发</ElCheckbox>
|
||||
<ElTooltip
|
||||
:disabled="mainStore.config.enablePortForward"
|
||||
content="请先开启端口转发功能"
|
||||
>
|
||||
自定义IPV6监听地址
|
||||
</ElCheckbox>
|
||||
<div class="w-[200px]">
|
||||
<ElInput
|
||||
:disabled="mainStore.config.disbleListenner || mainStore.config.enableCustomListenerV6"
|
||||
<ElButton
|
||||
size="small"
|
||||
:maxlength="100"
|
||||
v-model="mainStore.config.customListenerV6Data"
|
||||
placeholder="请输入自定义IPV6监听地址"
|
||||
/>
|
||||
</div>
|
||||
<ElTooltip content="例如:tcp://[::]:11010,如果未设置,将在随机UDP端口上监听">
|
||||
:disabled="!mainStore.config.enablePortForward"
|
||||
@click="handlePortForwardDialog"
|
||||
>
|
||||
配置
|
||||
</ElButton>
|
||||
</ElTooltip>
|
||||
<ElTooltip content="将本地端口转发到虚拟网络中的远程端口.如:udp://0.0.0.0:12345/10.126.126.1:23456,表示将本地UDP端口12345转发到虚拟网络中的10.126.126.1:23456.可以指定多个">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.1.0" />
|
||||
<CoreVersionWarning version="2.3.0" />
|
||||
<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 />
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
|
||||
<ElCheckbox v-model="mainStore.config.devName">自定义虚拟网卡名称</ElCheckbox>
|
||||
<ElInput
|
||||
size="small"
|
||||
maxlength="10"
|
||||
v-model="mainStore.config.devNameValue"
|
||||
placeholder="请输入网卡名"
|
||||
placeholder="请输入虚拟网卡名称"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.enableNetCardMetric">自定义easytier网卡跃点</ElCheckbox>
|
||||
<ElCheckbox v-model="mainStore.config.enableNetCardMetric">自定义虚拟网卡优先级</ElCheckbox>
|
||||
<ElInputNumber
|
||||
controls-position="right"
|
||||
:min="1"
|
||||
@@ -166,9 +210,9 @@
|
||||
:precision="0"
|
||||
size="small"
|
||||
v-model="mainStore.config.netCardMetricValue"
|
||||
placeholder="请选择跃点数"
|
||||
placeholder="请输入优先级"
|
||||
/>
|
||||
<ElTooltip content="设置easytier网卡的跃点,提升网卡优先级,跃点越小,网卡优先级越高">
|
||||
<ElTooltip content="数值越小,优先级越高">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
@@ -177,17 +221,43 @@
|
||||
size="small"
|
||||
type="warning"
|
||||
>
|
||||
(不使用自定义网卡名,那么联机时默认会生成一个名为 "et_xxx" 的网卡,也可以使用 “设置跃点” 功能,除非你启用了下面的功能)
|
||||
(不使用自定义虚拟网卡名称,那么联机时默认会生成一个名为 "et_xxx" 的网卡,也可以使用 “自定义虚拟网卡优先级”
|
||||
功能,除非你启用了下面的功能)
|
||||
</ElText>
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.noTun">不创建TUN设备(网卡),可以使用子网代理访问节点</ElCheckbox></div>
|
||||
|
||||
<div class="flex items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.noTun">不创建TUN虚拟网卡</ElCheckbox>
|
||||
|
||||
<ElTooltip content="开启后该节点无法主动访问其他节点">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-[5px]">
|
||||
<div><ElCheckbox v-model="mainStore.config.bindDeviceEnable">绑定物理网卡</ElCheckbox></div>
|
||||
<ElTooltip content="将连接器的套接字绑定到物理设备以避免路由问题。比如子网代理网段与某节点的网段冲突,绑定物理设备后可以与该节点正常通信">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.2.3" />
|
||||
</div>
|
||||
|
||||
<ElDivider />
|
||||
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.multiThread">启用多线程运行</ElCheckbox></div>
|
||||
<div class="flex items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.disableEncryption">关闭信息加密</ElCheckbox>
|
||||
<ElTooltip content="关闭后通信数据将在互联网上明文传输,如房间名和密码">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<div class="flex items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.multiThread">开启多线程</ElCheckbox>
|
||||
<ElTooltip content="开启后可能会提高网络性能">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElText>压缩算法</ElText>
|
||||
<ElText>传输数据压缩算法</ElText>
|
||||
<div class="w-[160px]">
|
||||
<ElSelect
|
||||
size="small"
|
||||
@@ -210,8 +280,8 @@
|
||||
<ElDivider />
|
||||
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox>
|
||||
<ElTooltip content="使用用户态TCP/IP协议栈smoltcp,避免操作系统防火墙问题导致无法子网代理">
|
||||
<ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理和 KCP 代理开启用户网络栈</ElCheckbox>
|
||||
<ElTooltip content="开启后会降低网络性能,但不需要配置防火墙">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
@@ -261,6 +331,15 @@
|
||||
loading: false
|
||||
});
|
||||
|
||||
const portForwardDialogData = reactive<{ [key: string]: any }>({
|
||||
visible: false,
|
||||
loading: false
|
||||
});
|
||||
|
||||
const handlePortForwardDialog = () => {
|
||||
portForwardDialogData.visible = true;
|
||||
};
|
||||
|
||||
const handleListenerDialog = () => {
|
||||
listenerDialogData.visible = true;
|
||||
};
|
||||
@@ -269,6 +348,10 @@
|
||||
listenerDialogData.visible = false;
|
||||
};
|
||||
|
||||
const handleFinishInputPortForward = async () => {
|
||||
portForwardDialogData.visible = false;
|
||||
};
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const data = ["trace", "debug", "info", "warn", "error", "off"];
|
||||
const guids = ref<string[][]>([]);
|
||||
@@ -297,7 +380,7 @@
|
||||
};
|
||||
|
||||
// 为bind_device功能增加改方法
|
||||
const _getGuids = async () => {
|
||||
const getGuids = async () => {
|
||||
const guidsValue = await invoke<string[][]>("get_network_adapter_guids");
|
||||
guids.value = guidsValue && guidsValue.length > 0 ? guidsValue : [];
|
||||
};
|
||||
|
||||
+15
-10
@@ -1,12 +1,18 @@
|
||||
<template>
|
||||
<div class="flex h-full flex-col gap-[10px]">
|
||||
<ElRadioGroup
|
||||
:disabled="!data.isSwitchEnable"
|
||||
v-model="mainStore.cidrEnable"
|
||||
>
|
||||
<ElRadioButton :value="true">开启</ElRadioButton>
|
||||
<ElRadioButton :value="false">关闭</ElRadioButton>
|
||||
</ElRadioGroup>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElRadioGroup
|
||||
:disabled="!data.isSwitchEnable"
|
||||
v-model="mainStore.cidrEnable"
|
||||
>
|
||||
<ElRadioButton :value="true">开启</ElRadioButton>
|
||||
<ElRadioButton :value="false">关闭</ElRadioButton>
|
||||
</ElRadioGroup>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.proxyForwardBySystem">通过系统内核转发子网代理数据包,禁用内置NAT</ElCheckbox>
|
||||
<CoreVersionWarning version="2.2.3" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1 overflow-auto">
|
||||
<ElInput
|
||||
placeholder="例如: 192.168.1.0/24 一行一个"
|
||||
@@ -107,12 +113,11 @@
|
||||
|
||||
onMounted(async () => {
|
||||
unlistenStart = await listenStart();
|
||||
dataSubscribe();
|
||||
});
|
||||
|
||||
dataSubscribe();
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
unlistenStart && unlistenStart();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
+164
-99
@@ -2,7 +2,7 @@
|
||||
<ElForm
|
||||
size="small"
|
||||
label-position="top"
|
||||
:model="config"
|
||||
:model="mainStore.config"
|
||||
>
|
||||
<ElFormItem
|
||||
label="服务器"
|
||||
@@ -70,18 +70,18 @@
|
||||
filterable
|
||||
placeholder="请选择服务器地址"
|
||||
default-first-option
|
||||
v-model="config.serverUrl"
|
||||
v-model="mainStore.config.serverUrl"
|
||||
no-data-text="无服务器地址"
|
||||
@change="handleServerUrlChange"
|
||||
>
|
||||
<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
|
||||
placeholder="协议"
|
||||
multiple
|
||||
collapse-tags
|
||||
@click.stop
|
||||
v-model="config.protocol"
|
||||
v-model="mainStore.config.protocol"
|
||||
@change="handleServerUrlChange"
|
||||
>
|
||||
<ElOption
|
||||
@@ -98,7 +98,7 @@
|
||||
<ElLink
|
||||
type="primary"
|
||||
size="small"
|
||||
:underline="false"
|
||||
underline="never"
|
||||
@click.stop="open(publicPeersLink)"
|
||||
>
|
||||
其他公共服务器
|
||||
@@ -161,7 +161,7 @@
|
||||
<ElInput
|
||||
maxlength="100"
|
||||
placeholder="请输入房间名"
|
||||
v-model="config.networkName"
|
||||
v-model="mainStore.config.networkName"
|
||||
></ElInput>
|
||||
</ElFormItem>
|
||||
</div>
|
||||
@@ -179,7 +179,7 @@
|
||||
show-password
|
||||
maxlength="100"
|
||||
placeholder="请输入房间密码"
|
||||
v-model="config.networkPassword"
|
||||
v-model="mainStore.config.networkPassword"
|
||||
type="password"
|
||||
></ElInput>
|
||||
</ElFormItem>
|
||||
@@ -198,7 +198,7 @@
|
||||
<ElInput
|
||||
maxlength="100"
|
||||
placeholder="例如: Player1"
|
||||
v-model="config.hostname"
|
||||
v-model="mainStore.config.hostname"
|
||||
></ElInput>
|
||||
</ElFormItem>
|
||||
<ElFormItem
|
||||
@@ -217,7 +217,7 @@
|
||||
:icon="CopyDocument"
|
||||
></ElButton>
|
||||
<ElSwitch
|
||||
v-model="config.dhcp"
|
||||
v-model="mainStore.config.dhcp"
|
||||
inline-prompt
|
||||
inactive-text="固定IP"
|
||||
active-text="动态获取"
|
||||
@@ -230,21 +230,21 @@
|
||||
</template>
|
||||
<ElInput
|
||||
maxlength="100"
|
||||
:readonly="config.dhcp"
|
||||
:placeholder="data.isStart && config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
||||
v-model="config.ipv4"
|
||||
:readonly="mainStore.config.dhcp"
|
||||
:placeholder="data.isStart && mainStore.config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
||||
v-model="mainStore.config.ipv4"
|
||||
>
|
||||
<template #prefix>
|
||||
<ElTooltip
|
||||
class="!text-[10px]"
|
||||
placement="top-end"
|
||||
:content="config.dhcp ? '动态获取无法手动填写' : '固定IP可以手动填写'"
|
||||
:content="mainStore.config.dhcp ? '动态获取无法手动填写' : '固定IP可以手动填写'"
|
||||
>
|
||||
<ElTag
|
||||
size="small"
|
||||
:type="config.dhcp ? 'info' : 'success'"
|
||||
:type="mainStore.config.dhcp ? 'info' : 'success'"
|
||||
>
|
||||
{{ config.dhcp ? "只读" : "可填" }}
|
||||
{{ mainStore.config.dhcp ? "只读" : "可填" }}
|
||||
</ElTag>
|
||||
</ElTooltip>
|
||||
</template>
|
||||
@@ -252,6 +252,10 @@
|
||||
</ElFormItem>
|
||||
</div>
|
||||
</ElForm>
|
||||
<!-- <div class="flex justify-center items-center gap-[5px]">
|
||||
<el-button>分享当前配置</el-button>
|
||||
<el-button>导入联机配置</el-button>
|
||||
</div> -->
|
||||
<div class="mt-auto flex items-start">
|
||||
<div>
|
||||
<div class="pt-[4px]">
|
||||
@@ -330,7 +334,7 @@
|
||||
</div>
|
||||
<div class="mt-[10px] pl-[2px]">
|
||||
<ElTooltip
|
||||
placement="left"
|
||||
placement="top"
|
||||
content="日志"
|
||||
>
|
||||
<ElButton
|
||||
@@ -359,7 +363,7 @@
|
||||
</div>
|
||||
<div class="ml-auto">
|
||||
<ElCheckbox
|
||||
v-model="config.disbleP2p"
|
||||
v-model="mainStore.config.disbleP2p"
|
||||
size="small"
|
||||
>
|
||||
强制中转
|
||||
@@ -370,7 +374,7 @@
|
||||
>
|
||||
<ElCheckbox
|
||||
@change="handleAutoStartByTask"
|
||||
:model-value="config.autoStart"
|
||||
:model-value="mainStore.config.autoStart"
|
||||
size="small"
|
||||
>
|
||||
开机自启
|
||||
@@ -407,7 +411,7 @@
|
||||
|
||||
<ElBadge
|
||||
badge-class="!text-[9px] cursor-pointer"
|
||||
:hidden="!data.hasNewVersion"
|
||||
:hidden="!hasNewVersion"
|
||||
:offset="[6, 7]"
|
||||
value="N"
|
||||
>
|
||||
@@ -415,7 +419,7 @@
|
||||
<ElLink
|
||||
class="ml-[8px] truncate pb-[2px] !text-[9px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
underline="never"
|
||||
@click="open('https://github.com/EasyTier/EasytierGame')"
|
||||
>
|
||||
EasytierGame主页
|
||||
@@ -711,7 +715,7 @@
|
||||
SwitchFilled
|
||||
} from "@element-plus/icons-vue";
|
||||
import { reactive, onBeforeUnmount, onMounted, ref, toRaw, computed } from "vue";
|
||||
import { useTray, setTrayRunState, setTrayTooltip, checkNewVersion } from "~/composables/tray";
|
||||
import { useTray, setTrayRunState, setTrayTooltip, checkNewVersion, hasNewVersion } from "~/composables/tray";
|
||||
import { getMatches } from "@tauri-apps/plugin-cli";
|
||||
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
||||
import useMainStore from "@/stores/index";
|
||||
@@ -720,11 +724,11 @@
|
||||
import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import etWindows, { dataSubscribe } from "@/composables/windows";
|
||||
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 { updateConfigJson } from "~/composables/configJson";
|
||||
import { readDir, exists, mkdir, BaseDirectory, readTextFile, readFile, writeFile, remove as removeFile, stat } from "@tauri-apps/plugin-fs";
|
||||
import { updateConfigJson, updateConfigJsonBounce } from "~/composables/configJson";
|
||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
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 { getServerArgs } from "@/composables/server";
|
||||
|
||||
@@ -746,11 +750,10 @@
|
||||
);
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const config = mainStore.config;
|
||||
// console.error(config);
|
||||
|
||||
const protocols = supportProtocols();
|
||||
const data = reactive({
|
||||
hasNewVersion: false, //easytierGame有没有新版
|
||||
//easytierGame有没有新版
|
||||
logVisible: false,
|
||||
cidrVisible: false,
|
||||
advanceVisible: false,
|
||||
@@ -812,8 +815,8 @@
|
||||
};
|
||||
|
||||
const handleCopyIp = async () => {
|
||||
if (!config.ipv4?.trim()) return;
|
||||
if (data.isStart || !config.dhcp) {
|
||||
if (!mainStore.config.ipv4?.trim()) return;
|
||||
if (data.isStart || !mainStore.config.dhcp) {
|
||||
await copyText(mainStore.config.ipv4);
|
||||
} else {
|
||||
await copyText(mainStore.config.ipv4, "复制成功,联机后IP可能会变化");
|
||||
@@ -838,8 +841,8 @@
|
||||
const newBasePeers = [...mainStore.basePeers];
|
||||
const idx = newBasePeers.indexOf(url);
|
||||
if (idx >= 0) {
|
||||
if (config.serverUrl === url) {
|
||||
config.serverUrl = "";
|
||||
if (mainStore.config.serverUrl === url) {
|
||||
mainStore.config.serverUrl = "";
|
||||
}
|
||||
newBasePeers.splice(idx, 1);
|
||||
}
|
||||
@@ -852,7 +855,7 @@
|
||||
const handleServerUrlChange = () => {
|
||||
let inputProtocols: string | null = null;
|
||||
for (const p of protocols) {
|
||||
if (config.serverUrl.toLowerCase().startsWith(`${p}://`)) {
|
||||
if (mainStore.config.serverUrl.toLowerCase().startsWith(`${p}://`)) {
|
||||
inputProtocols = p;
|
||||
break;
|
||||
}
|
||||
@@ -1092,9 +1095,9 @@
|
||||
|
||||
const handleAutoStartByTask = async () => {
|
||||
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;
|
||||
config.autoStart = is_enable_by_task;
|
||||
mainStore.config.autoStart = is_enable_by_task;
|
||||
};
|
||||
|
||||
const compatibleInitAutoStart = async () => {
|
||||
@@ -1107,17 +1110,37 @@
|
||||
await invoke("spawn_autostart", { enabled: true });
|
||||
}
|
||||
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) {
|
||||
console.error(err);
|
||||
await invoke("spawn_autostart", { enabled: false });
|
||||
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 () => {
|
||||
// ipv6监听在后续版本合并到customListenner里了,这里做兼容处理
|
||||
if (mainStore.config.enableCustomListenerV6 && mainStore.config.customListenerV6Data) {
|
||||
const customListener = mainStore.config.customListenerV6Data.trim();
|
||||
if (customListener) {
|
||||
const customListenerV4 = mainStore.config.customListenerData
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map(el => el.trim())
|
||||
.filter(el => el);
|
||||
if (!customListenerV4.includes(customListener)) {
|
||||
mainStore.config.customListenerData += `\n${customListener}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mainStore.config.enableCustomListenerV6) {
|
||||
mainStore.config.enableCustomListenerV6 = false;
|
||||
}
|
||||
};
|
||||
|
||||
const initConnectAfterStart = async () => {
|
||||
if (config.connectAfterStart && data.coreVersion) {
|
||||
if (mainStore.config.connectAfterStart && data.coreVersion) {
|
||||
await reset();
|
||||
await handleConnection();
|
||||
}
|
||||
@@ -1132,10 +1155,12 @@
|
||||
try {
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
const guiJsonStr = decoder.decode(guiJsonStrUint8);
|
||||
const regex = /^(\s*\/\/.*)/gm;
|
||||
const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
|
||||
const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
||||
const guiJson = JSON.parse(resultStr);
|
||||
// console.log(guiJsonStr);
|
||||
// const regex = /^(\s*\/\/.*)/gm;
|
||||
// const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
|
||||
// const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
||||
// console.log(resultStr);
|
||||
const guiJson = JSON.parse(guiJsonStr);
|
||||
let saveServerUrl = "";
|
||||
if (guiJson.serverUrl) {
|
||||
if (Array.isArray(guiJson.serverUrl)) {
|
||||
@@ -1153,6 +1178,7 @@
|
||||
config: {
|
||||
...mainStore.config,
|
||||
...guiJson,
|
||||
customListenerData: guiJson?.customListenerData.join("\n") || "",
|
||||
serverUrl: saveServerUrl
|
||||
}
|
||||
});
|
||||
@@ -1204,12 +1230,12 @@
|
||||
let serverLogsTimer: NodeJS.Timeout | null = null;
|
||||
let cidrTimer: NodeJS.Timeout | null = null;
|
||||
|
||||
const b = bounce(600);
|
||||
onMounted(async () => {
|
||||
await initGuiJson();
|
||||
await compatibleInitAutoStart();
|
||||
// await initAutoStart();
|
||||
await initStartWinIpBroadcast();
|
||||
await compatibleIpv6Listener();
|
||||
await getCoreVersion();
|
||||
await listenObj.listenThreadId();
|
||||
await listenObj.listenServerThreadId();
|
||||
@@ -1220,15 +1246,21 @@
|
||||
initPreventSleep();
|
||||
mountedShow(); // 不需要await
|
||||
closePrevent();
|
||||
data.hasNewVersion = await checkNewVersion();
|
||||
dataSubscribe(async () => {
|
||||
if (mainStore.createConfigInEasytier) {
|
||||
b(async () => {
|
||||
await updateConfigJson(data.configJsonSeverUrl);
|
||||
});
|
||||
}
|
||||
});
|
||||
getReleaseList();
|
||||
if (import.meta.env.PROD) {
|
||||
getReleaseList();
|
||||
checkNewVersion();
|
||||
}
|
||||
await storageDialog();
|
||||
});
|
||||
|
||||
// storageEventEmitter.addEventListener("localStorageChange", () => {
|
||||
// if(mainStore.createConfigInEasytier) {
|
||||
// updateConfigJsonBounce(data.configJsonSeverUrl)
|
||||
// }
|
||||
// })
|
||||
|
||||
dataSubscribe(null, () => {
|
||||
return data.configJsonSeverUrl;
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
@@ -1239,6 +1271,7 @@
|
||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||
cidrTimer && clearInterval(cidrTimer);
|
||||
stopPreventSleep();
|
||||
// unListenStorage && unListenStorage();
|
||||
});
|
||||
|
||||
const getArgs = async () => {
|
||||
@@ -1271,42 +1304,42 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (config.dhcp) {
|
||||
if (mainStore.config.dhcp) {
|
||||
args.push("-d");
|
||||
}
|
||||
if (config.hostname) {
|
||||
args.push("--hostname", config.hostname);
|
||||
if (mainStore.config.hostname) {
|
||||
args.push("--hostname", mainStore.config.hostname);
|
||||
}
|
||||
if (config.networkName) {
|
||||
args.push("--network-name", config.networkName);
|
||||
if (mainStore.config.networkName) {
|
||||
args.push("--network-name", mainStore.config.networkName);
|
||||
}
|
||||
if (config.networkPassword) {
|
||||
args.push("--network-secret", config.networkPassword);
|
||||
if (mainStore.config.networkPassword) {
|
||||
args.push("--network-secret", mainStore.config.networkPassword);
|
||||
}
|
||||
if (config.ipv4) {
|
||||
args.push("--ipv4", config.ipv4.trim());
|
||||
if (mainStore.config.ipv4) {
|
||||
args.push("--ipv4", mainStore.config.ipv4.trim());
|
||||
}
|
||||
if (config.serverUrl) {
|
||||
const formatUrl = config.serverUrl.replace(/\\/g, "/");
|
||||
args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
||||
if (mainStore.config.serverUrl) {
|
||||
const formatUrl = mainStore.config.serverUrl.replace(/\\/g, "/");
|
||||
args.push("--peers", ...mainStore.config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
||||
}
|
||||
if (config.enableCustomProtocol) {
|
||||
const includes = config.protocol.includes(config.customProtocol);
|
||||
if (mainStore.config.enableCustomProtocol) {
|
||||
const includes = mainStore.config.protocol.includes(mainStore.config.customProtocol);
|
||||
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");
|
||||
}
|
||||
if (config.disableIpv6) {
|
||||
if (mainStore.config.disableIpv6) {
|
||||
args.push("--disable-ipv6");
|
||||
}
|
||||
if (config.disbleListenner) {
|
||||
if (mainStore.config.disbleListenner) {
|
||||
args.push("--no-listener");
|
||||
}
|
||||
if (!config.disbleListenner && config.enableCustomListener && config.customListenerData) {
|
||||
const customListener = config.customListenerData
|
||||
if (!mainStore.config.disbleListenner && mainStore.config.enableCustomListener && mainStore.config.customListenerData) {
|
||||
const customListener = mainStore.config.customListenerData
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map(el => el.trim())
|
||||
@@ -1315,14 +1348,14 @@
|
||||
args.push("-l", ...customListener);
|
||||
}
|
||||
}
|
||||
if (!config.disbleListenner && config.enableCustomListenerV6 && config.customListenerV6Data) {
|
||||
args.push("--ipv6-listener", config.customListenerV6Data);
|
||||
if (!mainStore.config.disbleListenner && mainStore.config.enableCustomListenerV6 && mainStore.config.customListenerV6Data) {
|
||||
args.push("--ipv6-listener", mainStore.config.customListenerV6Data);
|
||||
}
|
||||
if (!config.disbleListenner && !config.enableCustomListener && config.port) {
|
||||
args.push("-l", config.port);
|
||||
if (!mainStore.config.disbleListenner && !mainStore.config.enableCustomListener && mainStore.config.port) {
|
||||
args.push("-l", mainStore.config.port);
|
||||
}
|
||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
||||
let formatProxyNetworks = config.proxyNetworks.trim().split("\n");
|
||||
if (mainStore.cidrEnable && mainStore.config.proxyNetworks) {
|
||||
let formatProxyNetworks = mainStore.config.proxyNetworks.trim().split("\n");
|
||||
const newformatProxyNetworks = formatProxyNetworks
|
||||
.map(el => el.trim())
|
||||
.filter(cidr => {
|
||||
@@ -1331,55 +1364,73 @@
|
||||
if (newformatProxyNetworks.length > 0) {
|
||||
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");
|
||||
}
|
||||
if (config.multiThread) {
|
||||
if (mainStore.config.multiThread) {
|
||||
args.push("--multi-thread");
|
||||
}
|
||||
if (config.enablExitNode) {
|
||||
if (mainStore.config.enablExitNode) {
|
||||
args.push("--enable-exit-node");
|
||||
}
|
||||
if (config.noTun) {
|
||||
if (mainStore.config.noTun) {
|
||||
args.push("--no-tun");
|
||||
}
|
||||
if (config.latencyfirst) {
|
||||
if (mainStore.config.latencyfirst) {
|
||||
args.push("--latency-first");
|
||||
}
|
||||
if (config.useSmoltcp) {
|
||||
if (mainStore.config.useSmoltcp) {
|
||||
args.push("--use-smoltcp");
|
||||
}
|
||||
if (config.disableUdpHolePunching) {
|
||||
if (mainStore.config.disableUdpHolePunching) {
|
||||
args.push("--disable-udp-hole-punching");
|
||||
}
|
||||
if (config.relayAllPeerrpc) {
|
||||
if (mainStore.config.relayAllPeerrpc) {
|
||||
args.push("--relay-all-peer-rpc");
|
||||
}
|
||||
if (config.saveErrorLog) {
|
||||
args.push("--file-log-level", config.logLevel, "--file-log-dir", import.meta.env.VITE_LOG_PATH);
|
||||
if (mainStore.config.saveErrorLog) {
|
||||
args.push("--file-log-level", mainStore.config.logLevel, "--file-log-dir", import.meta.env.VITE_LOG_PATH);
|
||||
}
|
||||
if (config.devName && config.devNameValue) {
|
||||
args.push("--dev-name", config.devNameValue);
|
||||
if (mainStore.config.devName && mainStore.config.devNameValue) {
|
||||
args.push("--dev-name", mainStore.config.devNameValue);
|
||||
}
|
||||
if (config.compression && config.compression != "none") {
|
||||
args.push("--compression", config.compression);
|
||||
if (mainStore.config.compression && mainStore.config.compression != "none") {
|
||||
args.push("--compression", mainStore.config.compression);
|
||||
}
|
||||
if (config.enableKcpProxy) {
|
||||
if (mainStore.config.enableKcpProxy) {
|
||||
args.push("--enable-kcp-proxy");
|
||||
}
|
||||
if (config.disableKcpInput) {
|
||||
if (mainStore.config.disableKcpInput) {
|
||||
args.push("--disable-kcp-input");
|
||||
}
|
||||
if (mainStore.config.bindDeviceEnable) {
|
||||
args.push("--bind-device", "true");
|
||||
}
|
||||
if (mainStore.proxyForwardBySystem) {
|
||||
args.push("--proxy-forward-by-system");
|
||||
}
|
||||
if (mainStore.config.acceptDNS) {
|
||||
args.push("--accept-dns");
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
return args;
|
||||
};
|
||||
|
||||
const reset = async () => {
|
||||
data.isStart = false;
|
||||
data.isSuccessGetIp = false;
|
||||
if (config.dhcp) {
|
||||
config.ipv4 = "";
|
||||
if (mainStore.config.dhcp) {
|
||||
mainStore.config.ipv4 = "";
|
||||
}
|
||||
const memberDialog = await getAllWebviewWindows();
|
||||
const memberDialogs = memberDialog.filter(item => item.label === "member");
|
||||
@@ -1684,7 +1735,7 @@
|
||||
});
|
||||
if (!err) {
|
||||
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({
|
||||
config: {
|
||||
...mainStore.config,
|
||||
@@ -1693,7 +1744,7 @@
|
||||
});
|
||||
ElMessage.success("导入成功");
|
||||
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 {
|
||||
console.error(err);
|
||||
if (err !== "cancel") {
|
||||
@@ -1793,7 +1844,7 @@
|
||||
cidrTimer && clearInterval(cidrTimer);
|
||||
cidrTimer = setInterval(() => {
|
||||
appWindow.emitTo({ kind: "WebviewWindow", label: "cidr" }, "route", data.isStart);
|
||||
}, 1000);
|
||||
}, 650);
|
||||
},
|
||||
() => {
|
||||
cidrTimer && clearInterval(cidrTimer);
|
||||
@@ -1868,4 +1919,18 @@
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const storageDialog = async () => {
|
||||
await etWindows("storage-listener", {
|
||||
title: "自建服务器",
|
||||
minWidth: 1,
|
||||
minHeight: 1,
|
||||
width: 1,
|
||||
height: 1,
|
||||
x: 9999,
|
||||
y: 9999,
|
||||
resizable: false,
|
||||
url: "#/storage-listener"
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
+53
-1
@@ -54,7 +54,13 @@
|
||||
prop="lat_ms"
|
||||
width="100"
|
||||
label="延迟/ms"
|
||||
></ElTableColumn>
|
||||
:sort-method="sortLatMs"
|
||||
:sort-orders="['ascending', 'descending', null]"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatLatency(row.lat_ms) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="100"
|
||||
@@ -108,6 +114,7 @@
|
||||
import { ATJ, parseCliInfo } from "@/utils";
|
||||
import { ElConfirmDanger } from "~/utils/element";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { isNaN } from "lodash-es";
|
||||
// enum NatType {
|
||||
// // has NAT; but own a single public IP, port is not changed
|
||||
// Unknown = 0;
|
||||
@@ -139,6 +146,51 @@
|
||||
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;
|
||||
};
|
||||
|
||||
// 格式化延迟显示
|
||||
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 = [
|
||||
["hostname", "主机名"],
|
||||
["cost", "路由"],
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<template></template>
|
||||
<script setup lang="ts">
|
||||
import { dataSubscribe } from "~/composables/windows";
|
||||
|
||||
dataSubscribe();
|
||||
</script>
|
||||
+28
-15
@@ -25,7 +25,7 @@
|
||||
<ElLink
|
||||
class="mr-[10px] !text-[15px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
underline="never"
|
||||
@click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')"
|
||||
>
|
||||
WinIPBroadcast
|
||||
@@ -55,7 +55,7 @@
|
||||
<ElLink
|
||||
class="!text-[15px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
underline="never"
|
||||
@click="open('https://r1ch.net/projects/forcebindip')"
|
||||
>
|
||||
ForceBindIP
|
||||
@@ -198,16 +198,10 @@
|
||||
<ElButton
|
||||
type="warning"
|
||||
size="small"
|
||||
@click.stop="handleCloseAllFireWall"
|
||||
>
|
||||
一键关闭防火墙
|
||||
</ElButton>
|
||||
<ElButton
|
||||
@click="handleCustomFireWall"
|
||||
type="danger"
|
||||
size="small"
|
||||
>
|
||||
自定义防火墙策略
|
||||
</ElButton>
|
||||
</div>
|
||||
<div class="mb-[10px]">
|
||||
<ElText class="!mx-[10px]">域防火墙</ElText>
|
||||
@@ -251,10 +245,17 @@
|
||||
<ElButton
|
||||
size="small"
|
||||
:disabled="data.isPing"
|
||||
@click="handleTestPing"
|
||||
@click="handleTestPing('v4')"
|
||||
>
|
||||
Ping一下
|
||||
</ElButton>
|
||||
<!-- <ElButton
|
||||
size="small"
|
||||
:disabled="data.isPing"
|
||||
@click="handleTestPing('v6')"
|
||||
>
|
||||
Ping一下(v6)
|
||||
</ElButton> -->
|
||||
</div>
|
||||
<div class="mt-[5px] flex-1 overflow-auto">
|
||||
<ElInput
|
||||
@@ -305,8 +306,18 @@
|
||||
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) => {
|
||||
@@ -341,14 +352,15 @@
|
||||
});
|
||||
};
|
||||
|
||||
const handleTestPing = async () => {
|
||||
const handleTestPing = async (type: 'v4' | 'v6' = 'v4') => {
|
||||
// const is = isValidIP(data.pingIp);
|
||||
if (data.pingIp) {
|
||||
data.pingLog = "";
|
||||
data.isPing = true;
|
||||
const args = type === 'v4' ? ["-n", "1", data.pingIp] : ["-6", '-n', "1", data.pingIp]
|
||||
try {
|
||||
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"
|
||||
}).execute();
|
||||
if (output.stdout) {
|
||||
@@ -492,6 +504,7 @@
|
||||
data.pingIp = mainStore.config.ipv4;
|
||||
initStartWinIpBroadcast();
|
||||
getGuids();
|
||||
dataSubscribe();
|
||||
});
|
||||
|
||||
dataSubscribe();
|
||||
</script>
|
||||
|
||||
Generated
+4266
-2032
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
/gen/schemas
|
||||
/easytier/logs
|
||||
/easytier/logs/*.*
|
||||
target/
|
||||
gen/schemas
|
||||
./easytier/logs
|
||||
easytier/logs
|
||||
Generated
+598
-451
File diff suppressed because it is too large
Load Diff
+20
-18
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "easytier-game"
|
||||
version = "1.4.1"
|
||||
version = "1.4.5"
|
||||
homepage = "https://github.com/EasyTier/EasyTier"
|
||||
repository = "https://github.com/EasyTier/EasytierGame"
|
||||
description = "A simple network initiator based on Easytier"
|
||||
@@ -18,32 +18,34 @@ name = "app_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.5", features = [] }
|
||||
tauri-build = { version = "2.2.0", features = [] }
|
||||
# prost-build = "0.13.2"
|
||||
|
||||
[target.x86_64-pc-windows-msvc.build-dependencies]
|
||||
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } # 需要安装curl和7zip,并添加他们的路径到环境变量
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.137"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
log = "0.4.25"
|
||||
tauri = { version = "2.2.5", features = [ "protocol-asset",
|
||||
log = "0.4.26"
|
||||
tauri = { version = "2.5.1", features = [ "protocol-asset",
|
||||
"tray-icon",
|
||||
"image-png",
|
||||
"image-ico",
|
||||
"devtools"
|
||||
"image-ico"
|
||||
] }
|
||||
|
||||
tauri-plugin-log = "2.2.1"
|
||||
tauri-plugin-shell = "2.2.0"
|
||||
tauri-plugin-log = "2.3.1"
|
||||
tauri-plugin-shell = "2.2.1"
|
||||
reqwest = { version = "0.12.12", features = ["json"] }
|
||||
zip = "2.2.2"
|
||||
zip = "2.2.3"
|
||||
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"
|
||||
tauri-plugin-fs = "2.2.0"
|
||||
tauri-plugin-clipboard-manager = "2.2.1"
|
||||
rand = "0.8.5"
|
||||
tokio = { version = "1.43.0", features = ["process"] }
|
||||
tauri-plugin-dialog = "2.2.0"
|
||||
tauri-plugin-fs = "2.3.0"
|
||||
tauri-plugin-clipboard-manager = "2.2.2"
|
||||
rand = "0.9.0"
|
||||
tokio = { version = "1.45.1", features = ["process"] }
|
||||
tauri-plugin-dialog = "2.2.2"
|
||||
# prost = "0.13"
|
||||
# prost-types = "0.13"
|
||||
hashbrown = "0.15.2"
|
||||
@@ -51,9 +53,9 @@ hashbrown = "0.15.2"
|
||||
|
||||
[dependencies.windows]
|
||||
version = "0.58.0"
|
||||
features = ["Win32_System_TaskScheduler", "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]
|
||||
tauri-plugin-cli = "2.2.0"
|
||||
tauri-plugin-single-instance = "2.2.1"
|
||||
tauri-plugin-window-state = "2.2.1"
|
||||
tauri-plugin-single-instance = "2.2.4"
|
||||
tauri-plugin-window-state = "2.2.2"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
fn main() {
|
||||
thunk::thunk();
|
||||
let mut windows = tauri_build::WindowsAttributes::new();
|
||||
windows = windows.app_manifest(
|
||||
r#"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"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": [
|
||||
"core:default",
|
||||
"core:window:allow-minimize",
|
||||
|
||||
@@ -4,27 +4,37 @@
|
||||
"tcp",
|
||||
"udp"
|
||||
], // 协议类型
|
||||
|
||||
// easytier服务地址 - 可填写多个 方式1,逗号分隔,"xxxx.cn,yyyy.com" 方式2,数组 ["xxxx.cn","yyyy.com"] (默认选中第一个)
|
||||
"serverUrl": "public.easytier.top:11010",
|
||||
"networkName": "", // 网络名
|
||||
"networkPassword": "", // 网络密码
|
||||
"hostname": "configTest", // 主机名
|
||||
"ipv4": "10.126.126.1", // IP地址(选填,下面有dhcp)
|
||||
"disableIpv6": false, // 禁用ipv6
|
||||
"disbleListenner": true, // 禁用端口监听
|
||||
"serverUrl": "public.easytier.top:11010",
|
||||
"enableCustomListener": true,
|
||||
"customListenerData": [
|
||||
"tcp://0.0.0.0:11010",
|
||||
"udp://0.0.0.0:11010",
|
||||
"tcp://[::]:11010"
|
||||
],
|
||||
"networkName": "", //房间名
|
||||
"networkPassword": "", //房间密码
|
||||
"hostname": "", //主机名
|
||||
"ipv4": "", // 虚拟IP地址
|
||||
"disableIpv6": false, // 禁用ipv6
|
||||
"enableCustomListenerV6": true, // 启用ipv6监听
|
||||
"customListenerV6Data": "udp://[::]:11010", // ipv6监听地址
|
||||
"disbleListenner": false, // 禁用监听
|
||||
"disableEncryption": false, // 禁用加密
|
||||
"enablExitNode": false, // 启用出口节点
|
||||
"noTun": false, // 禁用tun
|
||||
"latencyfirst": false, // 延迟优先
|
||||
"disableUdpHolePunching": false, // 禁用udp打洞
|
||||
"disbleP2p": false, // 禁用p2p, 强制中转
|
||||
"dhcp": false, // 动态分配IP
|
||||
"devName": false, // 是否启用自定义网卡名
|
||||
"devNameValue": "", // 网卡名(启用devName之后才生效)
|
||||
"enableCustonProtocol": false, // 是否启用自定义协议
|
||||
"customProtocol": "tcp", // 自定义协议类型
|
||||
"enableNetCardMetric": false, // 自定义easytier每次生成的网卡跃点
|
||||
"netCardMetricValue": 1, // 网卡跃点数量(1-9999)
|
||||
"enableKcpProxy": false, // 启用kcp代理
|
||||
"disableKcpInput": false //禁用kcp输入
|
||||
"disableUdpHolePunching": false, // 禁用udp打洞
|
||||
"disbleP2p": false, // 禁用p2p 强制中转
|
||||
"dhcp": true, // 启用dhcp,动态获取IP
|
||||
"devName": true, // 启用自定义网卡名
|
||||
"devNameValue": "etgame", // 自定义网卡名
|
||||
"enableCustomProtocol": true, // 自定义p2p时默认协议
|
||||
"customProtocol": "tcp", // 自定义p2p时使用的协议类型
|
||||
"enableNetCardMetric": true, // 启用自定义网卡跃点
|
||||
"netCardMetricValue": 1, // 网卡跃点
|
||||
"enablePreventSleep": false, // 启用防止睡眠
|
||||
"compression": "none", // 压缩算法
|
||||
"enableKcpProxy": true, // 启用kcp代理
|
||||
"disableKcpInput": false // 禁用kcp输入
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+114
-35
@@ -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 futures_util::StreamExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -17,7 +13,7 @@ use sysinfo::System;
|
||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||
use tauri::Emitter;
|
||||
use tauri::Manager;
|
||||
use windows::core::{BSTR, VARIANT};
|
||||
use windows::core::{Interface, BSTR, VARIANT};
|
||||
use windows::Win32::Foundation::VARIANT_BOOL;
|
||||
use windows::Win32::NetworkManagement::IpHelper::{
|
||||
GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH,
|
||||
@@ -92,13 +88,13 @@ fn generate_random_user_agent() -> String {
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:{version}) Gecko/20100101 Firefox/{version}",
|
||||
];
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
let template = user_agents[rng.gen_range(0..user_agents.len())];
|
||||
let mut rng = rand::rng();
|
||||
let template = user_agents[rng.random_range(0..user_agents.len())];
|
||||
|
||||
// 生成随机版本号
|
||||
let version_major: u8 = rng.gen_range(70..90);
|
||||
let version_minor: u8 = rng.gen_range(0..10);
|
||||
let version_patch: u8 = rng.gen_range(0..10);
|
||||
let version_major: u8 = rng.random_range(70..90);
|
||||
let version_minor: u8 = rng.random_range(0..10);
|
||||
let version_patch: u8 = rng.random_range(0..10);
|
||||
let version = format!("{}.{}.{}", version_major, version_minor, version_patch);
|
||||
|
||||
// 替换模板中的版本号占位符
|
||||
@@ -656,6 +652,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 TASKAUTOSTART_ARG: &str = "--task-auto-start";
|
||||
fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -690,33 +730,72 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
||||
CoUninitialize();
|
||||
}
|
||||
} else {
|
||||
let ts = planIfTaskScheduler::new()?;
|
||||
let com = ts.get_com();
|
||||
let sb = ScheduleBuilder::new(&com).unwrap();
|
||||
unsafe {
|
||||
let task_service: ITaskService = CoCreateInstance(&TaskScheduler, None, CLSCTX_ALL)?;
|
||||
task_service.Connect(
|
||||
&VARIANT::default(),
|
||||
&VARIANT::default(),
|
||||
&VARIANT::default(),
|
||||
&VARIANT::default(),
|
||||
)?;
|
||||
|
||||
let folder_path = BSTR::from("\\easytierGame");
|
||||
let task_name = BSTR::from("auto start");
|
||||
|
||||
let task_definition = task_service.NewTask(0)?;
|
||||
|
||||
// 设置任务信息
|
||||
let registration_info = task_definition.RegistrationInfo()?;
|
||||
registration_info.SetDescription(&BSTR::from("EasytierGame auto start task"))?;
|
||||
registration_info.SetAuthor(&BSTR::from("EasytierGame"))?;
|
||||
|
||||
// 改为用户登录触发
|
||||
let triggers = task_definition.Triggers()?;
|
||||
let trigger = triggers.Create(TASK_TRIGGER_LOGON)?;
|
||||
let logon_trigger: ILogonTrigger = trigger.cast()?;
|
||||
logon_trigger.SetEnabled(VARIANT_BOOL::from(true))?;
|
||||
|
||||
// 设置动作
|
||||
let actions = task_definition.Actions()?;
|
||||
let action = actions.Create(TASK_ACTION_EXEC)?;
|
||||
let exec_action: IExecAction = action.cast()?;
|
||||
let exe = std::env::current_exe()?;
|
||||
let exe_path: &str = exe.to_str().unwrap();
|
||||
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 exe = std::env::current_exe()?;
|
||||
let exe = exe.to_str().unwrap();
|
||||
|
||||
let settings = PrincipalSettings {
|
||||
display_name: "".to_string(),
|
||||
group_id: None,
|
||||
id: "".to_string(),
|
||||
logon_type: LogonType::InteractiveToken,
|
||||
run_level: RunLevel::Highest,
|
||||
user_id: Some(whoami::username()),
|
||||
};
|
||||
sb.create_logon()
|
||||
.author("heixiansen")?
|
||||
.trigger("trigger", enabled)?
|
||||
.action(Action::new("auto start", exe, "", &TASKAUTOSTART_ARG))?
|
||||
.in_folder("easytierGame")?
|
||||
.principal(settings)?
|
||||
.delay(Duration {
|
||||
seconds: Some(6),
|
||||
..Default::default()
|
||||
})?
|
||||
.build()?
|
||||
.register("auto start", TaskCreationFlags::CreateOrUpdate as i32)?;
|
||||
// 设置任务设置
|
||||
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"))?;
|
||||
|
||||
|
||||
|
||||
// 获取文件夹并注册任务
|
||||
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(())
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "easytier-game",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.5",
|
||||
"identifier": "com.tauri.easytier-game",
|
||||
|
||||
"build": {
|
||||
@@ -12,7 +12,7 @@
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "easytier-game 1.4.1",
|
||||
"title": "easytier-game 1.4.5",
|
||||
"label": "main",
|
||||
"minWidth": 340,
|
||||
"width": 340,
|
||||
|
||||
+25
-6
@@ -1,4 +1,7 @@
|
||||
import { acceptHMRUpdate, defineStore } from "pinia";
|
||||
|
||||
|
||||
|
||||
const store = defineStore("main", {
|
||||
state() {
|
||||
return {
|
||||
@@ -15,8 +18,8 @@ const store = defineStore("main", {
|
||||
disableIpv6: false, // 是否禁用IPv6
|
||||
port: "11010", // 监听端口号
|
||||
enableCustomListener: true, // 是否自定义监听
|
||||
customListenerV6Data: "udp://[::]:11010", //自定义ipv6监听
|
||||
enableCustomListenerV6: true, // 是否自定义监听
|
||||
enableCustomListenerV6: true, // 是否自定义IPV6监听
|
||||
customListenerV6Data: "udp://[::]:11010", //自定义ipv6监
|
||||
customListenerData: "tcp://0.0.0.0:11010\nudp://0.0.0.0:11010\ntcp://[::]:11010", // 自定义监听地址
|
||||
disbleListenner: false, // 是否禁用监听
|
||||
disableEncryption: false, // 是否禁用加密
|
||||
@@ -41,6 +44,11 @@ const store = defineStore("main", {
|
||||
compression: "none", //加密算法
|
||||
enableKcpProxy: true, //启用kcp代理 默认开启
|
||||
disableKcpInput: false, //禁用kcp输入
|
||||
bindDeviceEnable: false, //是否绑定设备
|
||||
acceptDNS: false, //魔法dns
|
||||
|
||||
enablePortForward: false, //是否启用端口转发
|
||||
portForwardData: "", //端口转发数据
|
||||
},
|
||||
serverConfig: {
|
||||
enableWhiteList: true, // 是否启用白名单
|
||||
@@ -51,7 +59,8 @@ const store = defineStore("main", {
|
||||
port: "11010" // 服务器端口
|
||||
},
|
||||
cidrEnable: false,
|
||||
basePeers: ["public.easytier.top:11010","public.easytier.net:11010"],
|
||||
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
|
||||
basePeers: ["public.easytier.top:11010", "public.easytier.net:11010"],
|
||||
theme: false, //主题 false light true dark
|
||||
configStartEnable: false, //使用配置文件启动
|
||||
configPath: "", //配置文件路径
|
||||
@@ -67,8 +76,9 @@ const store = defineStore("main", {
|
||||
|
||||
winipBcPid: 0,
|
||||
winipBcStart: false,
|
||||
latestTagName: "",
|
||||
|
||||
gameList: [] as Array<{name: string, exePath: string, id: string, coverImg?: string; showImg: string}>, // 游戏列表
|
||||
gameList: [] as Array<{ name: string; exePath: string; id: string; coverImg?: string; showImg: string }> // 游戏列表
|
||||
};
|
||||
},
|
||||
persist: {
|
||||
@@ -101,7 +111,10 @@ const store = defineStore("main", {
|
||||
"config.enableNetCardMetric",
|
||||
"config.netCardMetricValue",
|
||||
"config.port",
|
||||
|
||||
|
||||
"config.enablePortForward",
|
||||
"config.portForwardData",
|
||||
|
||||
"config.disbleListenner",
|
||||
"config.enableCustomListener",
|
||||
"config.customListenerData",
|
||||
@@ -116,6 +129,10 @@ const store = defineStore("main", {
|
||||
"config.enableKcpProxy",
|
||||
"config.disableKcpInput",
|
||||
|
||||
"config.bindDeviceEnable",
|
||||
|
||||
"config.acceptDNS",
|
||||
|
||||
"serverConfig.autoStart",
|
||||
// 'serverConfig.enableListener',
|
||||
"serverConfig.enableWhiteList",
|
||||
@@ -124,6 +141,7 @@ const store = defineStore("main", {
|
||||
"serverConfig.port",
|
||||
|
||||
"cidrEnable",
|
||||
"proxyForwardBySystem",
|
||||
"basePeers",
|
||||
"theme",
|
||||
"configStartEnable",
|
||||
@@ -136,7 +154,8 @@ const store = defineStore("main", {
|
||||
"delayInjectDll",
|
||||
"forceBindInput",
|
||||
"forceBindFile",
|
||||
|
||||
"latestTagName",
|
||||
|
||||
"gameList"
|
||||
]
|
||||
// // 除了这些,其他都要存下来
|
||||
|
||||
Reference in New Issue
Block a user