mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9e0b8e1db | ||
|
|
582a4ab819 | ||
|
|
0fde619516 | ||
|
|
410f0dc32b | ||
|
|
e977c633d6 | ||
|
|
3cbfae072c | ||
|
|
9b856f31af | ||
|
|
7d6e93d796 | ||
|
|
0253d95597 | ||
|
|
a2be6ebe86 | ||
|
|
b94d5de463 | ||
|
|
e8b82007c2 | ||
|
|
5d11f39855 | ||
|
|
5875b30c34 | ||
|
|
3aa90dbb67 | ||
|
|
02b53098e8 | ||
|
|
c9fcc40ee3 | ||
|
|
5e418bd6e5 | ||
|
|
779f5cecf1 | ||
|
|
8373efa3ba | ||
|
|
73ae6b90db | ||
|
|
55c6e49d4a | ||
|
|
5fc931f94e |
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"plugins": ["prettier-plugin-tailwindcss"],
|
||||
"arrowParens": "avoid",
|
||||
"bracketSpacing": true,
|
||||
"endOfLine": "lf",
|
||||
"htmlWhitespaceSensitivity": "ignore",
|
||||
"insertPragma": false,
|
||||
"singleAttributePerLine": true,
|
||||
"bracketSameLine": false,
|
||||
"jsxBracketSameLine": false,
|
||||
"jsxSingleQuote": true,
|
||||
"printWidth": 150,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "as-needed",
|
||||
"requirePragma": false,
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"tabWidth": 4,
|
||||
"trailingComma": "none",
|
||||
"useTabs": true,
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"vueIndentScriptAndStyle": true
|
||||
}
|
||||
@@ -29,6 +29,7 @@ Releases: [https://github.com/EasyTier/EasytierGame/releases](https://github.c
|
||||

|
||||
|
||||
- easytier内核升级后,可以点击内核管理按钮就可以进行内核切换和更新,但是需要出国或者github加速链接,如果无法更新,可以在群里获取
|
||||
- 1.2.6内核管理下载的内核 保存于easytier/cache目录,下次切换不用二次下载
|
||||

|
||||
|
||||
- 1.1.4更新了 配置分享功能 可以与朋友之间分享配置,方便联机
|
||||
@@ -52,6 +53,9 @@ Releases: [https://github.com/EasyTier/EasytierGame/releases](https://github.c
|
||||
- 1.2.5新增 自建服务器功能,可以自行搭建服务器,但是需要一些网络知识,具体可以查看文档[自建服务器](https://www.easytier.top/guide/network/host-public-server.html)
|
||||

|
||||
|
||||
- 1.2.6重写 自建服务器功能,可以自行搭建服务器,但是需要一些网络知识,具体可以查看文档[自建服务器](https://www.easytier.top/guide/network/host-public-server.html),也可查看帮助.txt
|
||||

|
||||
|
||||
## 特性
|
||||
|
||||
- 基于easytier组网工具开发,界面清晰简单
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
import { warn, debug, trace, info, error } from "@tauri-apps/plugin-log";
|
||||
function forwardConsole(fnName: "log" | "debug" | "info" | "warn" | "error", logger: (message: string) => Promise<void>) {
|
||||
const original = console[fnName];
|
||||
console[fnName] = (message) => {
|
||||
console[fnName] = message => {
|
||||
original(message);
|
||||
if (import.meta.env.PROD) {
|
||||
try {
|
||||
if (typeof message === "string") {
|
||||
logger(message);
|
||||
} else {
|
||||
logger(JSON.stringify(message));
|
||||
}
|
||||
} catch (e) {
|
||||
logger(`${message}`);
|
||||
try {
|
||||
if (typeof message === "string") {
|
||||
logger(message);
|
||||
} else {
|
||||
logger(JSON.stringify(message));
|
||||
}
|
||||
} catch (e) {
|
||||
logger(`${message}`);
|
||||
}
|
||||
};
|
||||
}
|
||||
forwardConsole("log", info);
|
||||
forwardConsole("debug", debug);
|
||||
forwardConsole("info", info);
|
||||
forwardConsole("warn", warn);
|
||||
forwardConsole("error", error);
|
||||
if (import.meta.env.PROD) {
|
||||
forwardConsole("log", info);
|
||||
forwardConsole("debug", debug);
|
||||
forwardConsole("info", info);
|
||||
forwardConsole("warn", warn);
|
||||
forwardConsole("error", error);
|
||||
}
|
||||
|
||||
const mainStore = useMainStore();
|
||||
// console.log(mainStore.theme)
|
||||
|
||||
+7
-1
@@ -9,7 +9,9 @@
|
||||
font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "Hiragino Sans GB", STHeiti, "Microsoft YaHei";
|
||||
}
|
||||
} */
|
||||
|
||||
html {
|
||||
font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
@@ -46,4 +48,8 @@ html.dark body {
|
||||
align-items: flex-start;
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
font-size: 12px!important;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<ElTag size="small" type="danger">内核 >= {{ $attrs.version }}</ElTag>
|
||||
</template>
|
||||
@@ -22,6 +22,12 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
|
||||
saveErrorLog,
|
||||
logLevel,
|
||||
serverUrl,
|
||||
port,
|
||||
enableCustomListener,
|
||||
enablePreventSleep,
|
||||
customListenerData,
|
||||
customListenerV6Data,
|
||||
enableCustomListenerV6,
|
||||
...otherConfig
|
||||
} = mainStore.config;
|
||||
let writeServerUrl: Array<string> | string = serverUrl;
|
||||
|
||||
+46
-42
@@ -6,51 +6,55 @@ import { BaseDirectory } from "@tauri-apps/api/path";
|
||||
import { exists } from "@tauri-apps/plugin-fs";
|
||||
|
||||
const getWinIpBroadcastPid = async () => {
|
||||
const mainStore = useMainStore();
|
||||
const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
||||
mainStore.winipBcPid = (pid as number) || 0;
|
||||
if (mainStore.winipBcPid && mainStore.winipBcPid > 0) {
|
||||
mainStore.winipBcStart = true;
|
||||
} else {
|
||||
mainStore.winipBcStart = false;
|
||||
}
|
||||
const mainStore = useMainStore();
|
||||
const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
||||
mainStore.winipBcPid = (pid as number) || 0;
|
||||
mainStore.$patch({
|
||||
winipBcStart: !!(mainStore.winipBcPid && mainStore.winipBcPid > 0)
|
||||
});
|
||||
};
|
||||
|
||||
export const handleWinipBcStart = async () => {
|
||||
const mainStore = useMainStore();
|
||||
if (!mainStore.winipBcStart) {
|
||||
try {
|
||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||
const isExists = await exists("easytier/tool/WinIPBroadcast.exe", { baseDir: BaseDirectory.Resource });
|
||||
if(!isExists) {
|
||||
ElMessage.error(`WinipBc不存在`);
|
||||
console.error(`WinipBc不存在`);
|
||||
return;
|
||||
}
|
||||
const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
||||
mainStore.winipBcPid = child.pid || 0;
|
||||
if (mainStore.winipBcPid) {
|
||||
mainStore.winipBcStart = true;
|
||||
mainStore.winIpBcAutoStart = true;
|
||||
} else {
|
||||
ElMessage.error(`WinipBc失败`);
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error(`WinipBc失败`);
|
||||
console.error(err);
|
||||
}
|
||||
} else {
|
||||
mainStore.winIpBcAutoStart = false;
|
||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||
await getWinIpBroadcastPid();
|
||||
}
|
||||
const mainStore = useMainStore();
|
||||
if (!mainStore.winipBcStart) {
|
||||
try {
|
||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||
const isExists = await exists("easytier/tool/WinIPBroadcast.exe", { baseDir: BaseDirectory.Resource });
|
||||
if (!isExists) {
|
||||
ElMessage.error(`WinipBc不存在`);
|
||||
console.error(`WinipBc不存在`);
|
||||
return;
|
||||
}
|
||||
const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
||||
mainStore.winipBcPid = child.pid || 0;
|
||||
await getWinIpBroadcastPid();
|
||||
if (mainStore.winipBcPid) {
|
||||
mainStore.$patch({
|
||||
winIpBcAutoStart: true
|
||||
});
|
||||
} else {
|
||||
ElMessage.error(`WinipBc失败`);
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error(`WinipBc失败`);
|
||||
console.error(err);
|
||||
}
|
||||
} else {
|
||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||
await getWinIpBroadcastPid();
|
||||
if (mainStore.winipBcPid <= 0) {
|
||||
mainStore.$patch({
|
||||
winIpBcAutoStart: false
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const initStartWinIpBroadcast = async () => {
|
||||
const mainStore = useMainStore();
|
||||
await getWinIpBroadcastPid();
|
||||
// console.error(mainStore.winipBcStart, mainStore.winIpBcAutoStart)
|
||||
if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) {
|
||||
await handleWinipBcStart();
|
||||
}
|
||||
};
|
||||
const mainStore = useMainStore();
|
||||
await getWinIpBroadcastPid();
|
||||
// console.error(mainStore.winipBcStart, mainStore.winIpBcAutoStart)
|
||||
if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) {
|
||||
await handleWinipBcStart();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import useMainStore from "@/stores/index";
|
||||
export const getServerArgs = () => {
|
||||
const mainStore = useMainStore();
|
||||
const args = [];
|
||||
if (!mainStore.serverConfig.port) {
|
||||
mainStore.serverConfig.port = "11010";
|
||||
}
|
||||
args.push("-l", mainStore.serverConfig.port);
|
||||
if (mainStore.serverConfig.relayAllPeerrpc) {
|
||||
args.push("--relay-all-peer-rpc");
|
||||
}
|
||||
const whiteList = mainStore.serverConfig.serverWhiteList
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map(el => el.trim())
|
||||
.filter(el => el)
|
||||
if (whiteList && mainStore.serverConfig.enableWhiteList) {
|
||||
args.push("--relay-network-whitelist", ...whiteList);
|
||||
}
|
||||
if (!whiteList && mainStore.serverConfig.enableWhiteList) {
|
||||
args.push("--relay-network-whitelist");
|
||||
}
|
||||
return args;
|
||||
};
|
||||
@@ -5,6 +5,9 @@ import pkg from "@/package.json";
|
||||
import { setTheme } from "~/composables/theme";
|
||||
import useMainStore from "@/stores/index";
|
||||
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";
|
||||
|
||||
const DEFAULT_TRAY_NAME = "main";
|
||||
|
||||
@@ -13,6 +16,7 @@ async function toggleVisibility() {
|
||||
await getCurrentWindow().hide();
|
||||
} else {
|
||||
await getCurrentWindow().show();
|
||||
await getCurrentWindow().unminimize();
|
||||
await getCurrentWindow().setFocus();
|
||||
}
|
||||
}
|
||||
@@ -140,3 +144,19 @@ export async function setTrayTooltip(tray: TrayIcon | null, tooltip?: string | n
|
||||
await tray.setTooltip(`EasyTierGame\n${pkg.version}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const checkNewVersion = async () => {
|
||||
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; //没有新版
|
||||
}
|
||||
+37
-7
@@ -2,17 +2,22 @@ import { type UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window, currentMonitor } from "@tauri-apps/api/window";
|
||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { onBeforeUnmount } from "vue";
|
||||
|
||||
const _listenersMaps: { [key: string]: [UnlistenFn | null, UnlistenFn | null] } = {};
|
||||
|
||||
export default async (
|
||||
label: WebviewLabel,
|
||||
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
||||
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
|
||||
beforeCloseFunc?: () => void | null
|
||||
) => {
|
||||
let unListenlogClose: UnlistenFn | null = null;
|
||||
let unlistenLogCreated: UnlistenFn | null = null;
|
||||
const unlistenFnList: [UnlistenFn | null, UnlistenFn | null] = _listenersMaps[label] || [null, null];
|
||||
let [unlistenLogCreated, unListenlogClose] = unlistenFnList;
|
||||
let dialog = await WebviewWindow.getByLabel(label);
|
||||
if (!dialog) {
|
||||
let defaultOpts: {[key:string]: any, parent: Window | undefined} = {
|
||||
let defaultOpts: { [key: string]: any; parent: Window | undefined } = {
|
||||
parent: undefined,
|
||||
closable: true,
|
||||
resizable: true,
|
||||
@@ -25,28 +30,31 @@ export default async (
|
||||
const appWindow = getCurrentWindow();
|
||||
if (appWindow) {
|
||||
const appSize = await appWindow.outerSize();
|
||||
// const monitor = await currentMonitor();
|
||||
// console.error(monitor)
|
||||
const factor = await appWindow.scaleFactor();
|
||||
const appPosition = await appWindow.outerPosition();
|
||||
// console.error((appPosition.x + appSize.width) / 1.25);
|
||||
const logicalPosition = new PhysicalPosition(appPosition.x + appSize.width, appPosition.y).toLogical(factor);
|
||||
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.once("tauri://webview-created", async () => {
|
||||
unlistenLogCreated = await dialog.listen("tauri://webview-created", async () => {
|
||||
if (dialog) {
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
}
|
||||
});
|
||||
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;
|
||||
} else {
|
||||
const visible = await dialog.isVisible();
|
||||
if (visible) {
|
||||
@@ -55,3 +63,25 @@ export default async (
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const dataSubscribe = async (cb?: (...args: any) => any) => {
|
||||
if (!cb) return;
|
||||
const mainStore = useMainStore();
|
||||
const currentWindow = getCurrentWindow();
|
||||
let removeSubscribe = mainStore.$subscribe(async (...args) => {
|
||||
const emitData = await cb(args);
|
||||
await currentWindow.emitTo({ kind: "Window", label: "main" }, "config", emitData);
|
||||
});
|
||||
const unlisten = currentWindow.listen<any>("global-main-store", event => {
|
||||
removeSubscribe && removeSubscribe();
|
||||
mainStore.$patch({ ...event.payload.store }); // 更新全局状态
|
||||
removeSubscribe = mainStore.$subscribe(async (...args) => {
|
||||
const emitData = await cb(args);
|
||||
await currentWindow.emitTo({ kind: "Window", label: "main" }, "config", emitData);
|
||||
});
|
||||
});
|
||||
onBeforeUnmount(async () => {
|
||||
unlisten && (await unlisten)();
|
||||
removeSubscribe && removeSubscribe();
|
||||
});
|
||||
};
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
VITE_CONFIG_PATH=easytier/config/
|
||||
VITE_CONFIG_FILE_NAME=easytier/config.json
|
||||
VITE_LOG_PATH=easytier/logs/
|
||||
VITE_CACHE_PATH=easytier/cache/
|
||||
VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
VITE_CONFIG_PATH=easytier/config/
|
||||
VITE_CONFIG_FILE_NAME=easytier/config.json
|
||||
VITE_LOG_PATH=easytier/logs/
|
||||
VITE_CACHE_PATH=easytier/cache/
|
||||
VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
<script setup lang="tsx">
|
||||
//屏蔽右键菜单
|
||||
document.addEventListener("contextmenu", (e: MouseEvent) => {
|
||||
if (import.meta.env.PROD) {
|
||||
const el = (e.target as HTMLElement);
|
||||
if (import.meta.env.PROD && !el.classList.contains("el-input__inner") && !el.classList.contains("el-textarea__inner")) { // 所有输入框不禁用右键
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,6 +8,8 @@ export default defineNuxtConfig({
|
||||
devServer: {
|
||||
port: 5000
|
||||
},
|
||||
|
||||
telemetry: false,
|
||||
|
||||
imports: {
|
||||
autoImport: false
|
||||
|
||||
+10
-10
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"author": "leizi97",
|
||||
"description": "A simple network initiator based on Easytier",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.2",
|
||||
"scripts": {
|
||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||
"build": "nuxt generate --dotenv env/.env.prod",
|
||||
@@ -13,28 +13,28 @@
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@element-plus/nuxt": "^1.1.0",
|
||||
"@nuxtjs/tailwindcss": "^6.12.0",
|
||||
"@pinia/nuxt": "^0.7.0",
|
||||
"@pinia/nuxt": "0.9.0",
|
||||
"@tauri-apps/api": "^2.1.1",
|
||||
"@tauri-apps/cli": "^2.1.0",
|
||||
"@tauri-apps/plugin-autostart": "~2",
|
||||
"@tauri-apps/plugin-cli": "^2.0.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
|
||||
"@tauri-apps/plugin-fs": "~2",
|
||||
"@tauri-apps/plugin-http": "^2.0.1",
|
||||
"@tauri-apps/plugin-log": "^2.0.0",
|
||||
"@tauri-apps/plugin-shell": "~2",
|
||||
"@tauri-apps/plugin-window-state": "~2",
|
||||
"@tauri-apps/plugin-fs": "^2.2.0",
|
||||
"@tauri-apps/plugin-log": "^2.2.0",
|
||||
"@tauri-apps/plugin-shell": "^2.2.0",
|
||||
"@tauri-apps/plugin-window-state": "^2.2.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.0",
|
||||
"@vueuse/core": "^11.2.0",
|
||||
"@vueuse/core": "12.0.0",
|
||||
"archiver": "^7.0.1",
|
||||
"element-plus": "^2.8.7",
|
||||
"less": "^4.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nuxt": "^3.14.1592",
|
||||
"pinia": "^2.2.6",
|
||||
"pinia": "^2.3.0",
|
||||
"pinia-plugin-persistedstate": "^4.1.3",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "^3.4.1",
|
||||
"prettier-plugin-tailwindcss": "^0.6.9",
|
||||
"typescript": "^5.6.3",
|
||||
"vue-clipboard3": "^2.0.0"
|
||||
}
|
||||
|
||||
+160
-15
@@ -1,8 +1,30 @@
|
||||
<template>
|
||||
<div class="h-full overflow-auto flex flex-col items-start px-[25px]">
|
||||
<div class="flex h-full flex-col items-start overflow-auto px-[25px]">
|
||||
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox></div>
|
||||
<div class="flex items-center gap-[15px] flex-nowrap">
|
||||
<div class="flex flex-nowrap items-center gap-[15px]">
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.enableCustomProtocol">自定义联机时使用的默认协议</ElCheckbox>
|
||||
<ElTooltip content="如果没有支持该协议的节点地址,程序会自动处理,请放心使用">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<div class="w-[80px]">
|
||||
<ElSelect
|
||||
size="small"
|
||||
v-model="mainStore.config.customProtocol"
|
||||
placeholder="请选择协议"
|
||||
class="ml-[5px]"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in protocols"
|
||||
:key="item"
|
||||
:label="`${item}`"
|
||||
:value="item"
|
||||
></ElOption>
|
||||
</ElSelect>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-nowrap items-center gap-[15px]">
|
||||
<ElCheckbox v-model="mainStore.config.saveErrorLog">输出日志到本地</ElCheckbox>
|
||||
<div class="w-[140px]">
|
||||
<ElSelect
|
||||
@@ -27,7 +49,7 @@
|
||||
</ElButton>
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.connectAfterStart">软件启动后,自动"启动联机"(搭配开机自启,无感联机)</ElCheckbox></div>
|
||||
<div class="flex items-center gap-[15px] flex-nowrap">
|
||||
<div class="flex flex-nowrap items-center gap-[15px]">
|
||||
<ElCheckbox v-model="mainStore.createConfigInEasytier">自动生成界面配置文件easytier/config.json</ElCheckbox>
|
||||
<ElButton
|
||||
@click="openConfigJsonDir"
|
||||
@@ -36,7 +58,93 @@
|
||||
打开config.json目录
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止休眠</ElCheckbox></div>
|
||||
<ElDivider />
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||
<ElTooltip content="无法联机时,可以尝试开启这个选项">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElText
|
||||
class="flex-shrink-0"
|
||||
size="small"
|
||||
>
|
||||
监听端口
|
||||
</ElText>
|
||||
<ElInput
|
||||
:disabled="mainStore.config.disbleListenner || mainStore.config.enableCustomListener"
|
||||
size="small"
|
||||
:maxlength="10"
|
||||
v-model="mainStore.config.port"
|
||||
placeholder="请输入端口号"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox
|
||||
:disabled="mainStore.config.disbleListenner"
|
||||
v-model="mainStore.config.enableCustomListener"
|
||||
>
|
||||
自定义IPV4监听地址
|
||||
</ElCheckbox>
|
||||
<ElButton
|
||||
size="small"
|
||||
:disabled="mainStore.config.disbleListenner"
|
||||
@click="handleListenerDialog"
|
||||
>
|
||||
填写
|
||||
</ElButton>
|
||||
<ElDialog
|
||||
width="95%"
|
||||
top="10px"
|
||||
append-to-body
|
||||
:z-index="10"
|
||||
class="!mb-0"
|
||||
v-model="listenerDialogData.visible"
|
||||
:close-on-press-escape="false"
|
||||
title="自定义监听地址"
|
||||
>
|
||||
<ElInput
|
||||
type="textarea"
|
||||
:rows="8"
|
||||
placeholder="请输入监听地址一行一个"
|
||||
v-model="mainStore.config.customListenerData"
|
||||
></ElInput>
|
||||
<template #footer>
|
||||
<div class="text-right">
|
||||
<ElButton
|
||||
size="default"
|
||||
@click="handleFinishInputListener"
|
||||
type="primary"
|
||||
>
|
||||
确定
|
||||
</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox
|
||||
:disabled="mainStore.config.disbleListenner"
|
||||
v-model="mainStore.config.enableCustomListenerV6"
|
||||
>
|
||||
自定义IPV6监听地址
|
||||
</ElCheckbox>
|
||||
<div class="w-[200px]">
|
||||
<ElInput
|
||||
:disabled="mainStore.config.disbleListenner || mainStore.config.enableCustomListenerV6"
|
||||
size="small"
|
||||
:maxlength="100"
|
||||
v-model="mainStore.config.customListenerV6Data"
|
||||
placeholder="请输入自定义IPV6监听地址"
|
||||
/>
|
||||
</div>
|
||||
<ElTooltip content="例如:tcp://[::]:11010,如果未设置,将在随机UDP端口上监听">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.1.0" />
|
||||
</div>
|
||||
<ElDivider />
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
|
||||
@@ -76,12 +184,33 @@
|
||||
|
||||
<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.disableEncryption">禁用对等节点通信的加密</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.multiThread">启用多线程运行</ElCheckbox></div>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElText>压缩算法</ElText>
|
||||
<div class="w-[90px]">
|
||||
<ElSelect
|
||||
size="small"
|
||||
v-model="mainStore.config.compression"
|
||||
placeholder="请选择压缩算法"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in [
|
||||
['none', '默认'],
|
||||
['zstd', 'zstd算法']
|
||||
]"
|
||||
:key="item[0]"
|
||||
:label="item[1]"
|
||||
:value="item[0]"
|
||||
></ElOption>
|
||||
</ElSelect>
|
||||
</div>
|
||||
<CoreVersionWarning version="2.1.0" />
|
||||
</div>
|
||||
<ElDivider />
|
||||
|
||||
<div><ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式,将尝试使用最低延迟路径转发流量,默认使用最短路径</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式,将尝试使用最低延迟路径转发流量</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
||||
<div>
|
||||
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">转发所有对等节点的RPC数据包,即使对等节点不在转发网络白名单内</ElCheckbox>
|
||||
@@ -91,14 +220,30 @@
|
||||
<script setup lang="ts">
|
||||
import useMainStore from "@/stores/index";
|
||||
import { QuestionFilled } from "@element-plus/icons-vue";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||
import { Command } from "@tauri-apps/plugin-shell";
|
||||
import { exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { reactive } from "vue";
|
||||
import { dataSubscribe } from "@/composables/windows";
|
||||
import { supportProtocols } from "~/utils";
|
||||
import CoreVersionWarning from "@/components/CoreVersionWarning.vue";
|
||||
|
||||
const protocols = supportProtocols();
|
||||
const listenerDialogData = reactive<{ [key: string]: any }>({
|
||||
visible: false,
|
||||
loading: false
|
||||
});
|
||||
|
||||
const handleListenerDialog = () => {
|
||||
listenerDialogData.visible = true;
|
||||
};
|
||||
|
||||
const handleFinishInputListener = async () => {
|
||||
listenerDialogData.visible = false;
|
||||
};
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const appWindow = getCurrentWindow();
|
||||
const data = ["trace", "debug", "info", "warn", "error", "off"];
|
||||
const openLogDir = async () => {
|
||||
const resourceDir = await getResourceDir();
|
||||
@@ -122,11 +267,11 @@
|
||||
ElMessage.error("config.json的目录不存在");
|
||||
}
|
||||
};
|
||||
mainStore.$subscribe(async (...a) => {
|
||||
// console.error("subscribe", a);
|
||||
await appWindow.emitTo("main", "config", { config: { ...mainStore.config }, createConfigInEasytier: mainStore.createConfigInEasytier });
|
||||
// if(mainStore.createConfigInEasytier) {
|
||||
// updateConfigJson();
|
||||
// }
|
||||
|
||||
dataSubscribe(async (...a) => {
|
||||
return {
|
||||
config: { ...mainStore.config },
|
||||
createConfigInEasytier: mainStore.createConfigInEasytier
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
+102
-8
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="h-full flex flex-col gap-[10px]">
|
||||
<ElRadioGroup v-model="mainStore.cidrEnable">
|
||||
<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>
|
||||
@@ -9,17 +12,108 @@
|
||||
placeholder="例如: 192.168.1.0/24 一行一个"
|
||||
v-model="mainStore.config.proxyNetworks"
|
||||
type="textarea"
|
||||
:rows="30"
|
||||
resize="none"></ElInput>
|
||||
:rows="5"
|
||||
resize="none"
|
||||
></ElInput>
|
||||
<ElTable
|
||||
stripe
|
||||
border
|
||||
empty-text="暂无数据"
|
||||
:data="data.route"
|
||||
class="mt-[5px]"
|
||||
>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="140"
|
||||
label="主机名"
|
||||
prop="hostname"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
width="120"
|
||||
sortable
|
||||
label="虚拟网IP"
|
||||
prop="ipv4"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
label="被代理的子网"
|
||||
prop="proxy_cidrs"
|
||||
></ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import useMainStore from "@/stores/index";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { dataSubscribe } from "@/composables/windows";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
||||
import { ATJ, parseCliInfo } from "@/utils";
|
||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||
const mainStore = useMainStore();
|
||||
const appWindow = getCurrentWindow();
|
||||
mainStore.$subscribe((...a) => {
|
||||
appWindow.emitTo("main", "config", { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } });
|
||||
|
||||
const data = reactive<{ [key: string]: any }>({
|
||||
route: [],
|
||||
isStart: false,
|
||||
isSwitchEnable: false,
|
||||
isRunning: false
|
||||
});
|
||||
|
||||
const listenOutput = async () => {
|
||||
data.isRunning = true;
|
||||
const [error, member] = await ATJ(invoke<string>("get_route_by_cli"));
|
||||
data.isRunning = false;
|
||||
// if(!member) return;
|
||||
if (error) {
|
||||
data.route = [];
|
||||
return "";
|
||||
}
|
||||
if (member === "_EasytierGameCliFailedToConnect_") {
|
||||
data.route = [];
|
||||
await listenOutput();
|
||||
return;
|
||||
}
|
||||
const routeInfo = parseCliInfo(member);
|
||||
routeInfo.forEach(value => {
|
||||
if (value.cost === "Local") {
|
||||
value.cost = "本机";
|
||||
}
|
||||
if (value.ipv4 && value.ipv4.includes("/")) {
|
||||
value.ipv4 = value.ipv4.split("/")[0];
|
||||
}
|
||||
});
|
||||
data.route = routeInfo;
|
||||
};
|
||||
|
||||
const listenStart = async () => {
|
||||
const unListen = await listen<boolean>("route", async event => {
|
||||
data.isStart = event.payload;
|
||||
if (data.isStart) {
|
||||
data.isSwitchEnable = false;
|
||||
if (mainStore.cidrEnable && !data.isRunning) {
|
||||
await listenOutput();
|
||||
} else {
|
||||
data.route = [];
|
||||
}
|
||||
} else {
|
||||
data.isSwitchEnable = true;
|
||||
data.route = [];
|
||||
}
|
||||
});
|
||||
return unListen;
|
||||
};
|
||||
|
||||
let unlistenStart: UnlistenFn | null = null;
|
||||
|
||||
onMounted(async () => {
|
||||
unlistenStart = await listenStart();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
unlistenStart && unlistenStart();
|
||||
});
|
||||
|
||||
dataSubscribe(async (...a) => {
|
||||
return { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } };
|
||||
});
|
||||
</script>
|
||||
|
||||
+330
-231
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<ElForm
|
||||
v-if="!mainStore.enableCreateServer"
|
||||
size="small"
|
||||
label-position="top"
|
||||
:model="config"
|
||||
@@ -11,7 +10,7 @@
|
||||
class="full-label"
|
||||
>
|
||||
<template #label>
|
||||
<div class="flex items-center flex-nowrap gap-[0_5px]">
|
||||
<div class="flex flex-nowrap items-center gap-[0_5px]">
|
||||
<div>服务器</div>
|
||||
<span>-</span>
|
||||
<ElTag
|
||||
@@ -36,16 +35,18 @@
|
||||
</ElTag>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<ElButton
|
||||
class="ml-auto"
|
||||
:disabled="data.isStart"
|
||||
@click="handleCoreManagement"
|
||||
:loading="data.update"
|
||||
type="primary"
|
||||
size="small"
|
||||
>
|
||||
内核管理
|
||||
</ElButton>
|
||||
<ElTooltip content="请先停止自建服务和联机后再使用,否则内核被占用的情况下,无法进行内核更换">
|
||||
<ElButton
|
||||
class="ml-auto"
|
||||
:disabled="data.isStart || listenObj.server_thread_id.value"
|
||||
@click="handleCoreManagement"
|
||||
:loading="data.update"
|
||||
type="primary"
|
||||
size="small"
|
||||
>
|
||||
内核管理
|
||||
</ElButton>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
</template>
|
||||
<ElSelect
|
||||
@@ -81,15 +82,35 @@
|
||||
:label="item"
|
||||
:value="item"
|
||||
>
|
||||
<div class="flex items-center gap-[20px] overflow-hidden flex-nowrap max-w-[calc(100vw-62px)]">
|
||||
<ElTooltip :content="item">
|
||||
<div class="flex max-w-[calc(100vw-62px)] flex-nowrap items-center gap-[20px] overflow-hidden">
|
||||
<ElTooltip
|
||||
v-if="item && item.length > 26"
|
||||
placement="top"
|
||||
:content="item || '-'"
|
||||
>
|
||||
<p class="truncate">{{ item }}</p>
|
||||
</ElTooltip>
|
||||
<div class="flex-shrink-0 ml-auto">
|
||||
<p
|
||||
v-else
|
||||
class="truncate"
|
||||
>
|
||||
{{ item }}
|
||||
</p>
|
||||
<div class="ml-auto flex-shrink-0">
|
||||
<ElButton
|
||||
@click.stop="copyServerUrl(item)"
|
||||
circle
|
||||
size="small"
|
||||
title="复制"
|
||||
:icon="CopyDocument"
|
||||
></ElButton>
|
||||
|
||||
<ElButton
|
||||
@click.stop="handleDeleteServerUrl(item)"
|
||||
round
|
||||
circle
|
||||
size="small"
|
||||
:icon="Delete"
|
||||
title="删除"
|
||||
type="danger"
|
||||
></ElButton>
|
||||
</div>
|
||||
@@ -97,7 +118,7 @@
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<div class="flex flex-wrap gap-[0_10px] items-center">
|
||||
<div class="flex flex-wrap items-center gap-[0_10px]">
|
||||
<div class="flex-1">
|
||||
<ElFormItem label="网络名">
|
||||
<template #label>
|
||||
@@ -156,7 +177,7 @@
|
||||
label="局域网IP"
|
||||
>
|
||||
<template #label>
|
||||
<div class="flex items-center h-[20px]">
|
||||
<div class="flex h-[20px] items-center">
|
||||
虚拟网IP
|
||||
<ElTooltip content="对应命令行参数 --ipv4">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
@@ -180,81 +201,7 @@
|
||||
</ElFormItem>
|
||||
</div>
|
||||
</ElForm>
|
||||
<ElForm
|
||||
v-else
|
||||
size="small"
|
||||
label-position="top"
|
||||
class="flex-1 overflow-hidden pb-[5px]"
|
||||
:model="config"
|
||||
>
|
||||
<ElFormItem
|
||||
label="白名单"
|
||||
prop="ServerWhiteList"
|
||||
class="full-label full-content overflow-hidden !flex flex-col h-full !mb-[0]"
|
||||
>
|
||||
<template #label>
|
||||
<div class="flex items-center flex-nowrap gap-[0_5px]">
|
||||
<div>白名单</div>
|
||||
<span>-</span>
|
||||
<ElTag
|
||||
effect="dark"
|
||||
:type="data.isStart ? 'success' : 'info'"
|
||||
>
|
||||
{{ data.isSuccessGetIp ? "运行成功" : data.isStart && !data.isSuccessGetIp ? "运行中" : "未启动" }}
|
||||
</ElTag>
|
||||
<ElButton
|
||||
v-if="!data.coreVersion"
|
||||
@click="getCoreVersion(true)"
|
||||
>
|
||||
获取内核版本
|
||||
</ElButton>
|
||||
<div
|
||||
v-else
|
||||
class="flex-1 truncate"
|
||||
>
|
||||
<ElTooltip :content="data.coreVersion">
|
||||
<ElTag type="info">
|
||||
{{ data.coreVersion }}
|
||||
</ElTag>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<ElButton
|
||||
class="ml-auto"
|
||||
:disabled="data.isStart"
|
||||
@click="handleCoreManagement"
|
||||
:loading="data.update"
|
||||
type="primary"
|
||||
size="small"
|
||||
>
|
||||
内核管理
|
||||
</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
<div class="h-full w-full flex flex-col overflow-hidden">
|
||||
<div class="flex-1 overflow-auto">
|
||||
<ElInput
|
||||
:disabled="!mainStore.enableWhiteList"
|
||||
placeholder="一行一个,支持通配符列表,如(ab*)。当该参数的列表为空时,就不会为所有其他网络提供转发服务。"
|
||||
:maxlength="1000"
|
||||
v-model="mainStore.ServerWhiteList"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 9
|
||||
}"
|
||||
resize="none"
|
||||
></ElInput>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<ElCheckbox v-model="mainStore.enableWhiteList">启用白名单</ElCheckbox>
|
||||
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">转发所有对等节点的RPC数据包</ElCheckbox>
|
||||
<ElTooltip content="帮助其他虚拟网建立P2P链接">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
</ElForm>
|
||||
<div class="flex items-start mt-auto">
|
||||
<div class="mt-auto flex items-start">
|
||||
<div>
|
||||
<div>
|
||||
<ElDropdown
|
||||
@@ -266,15 +213,7 @@
|
||||
:disabled="data.startLoading || !data.coreVersion || data.update"
|
||||
@click="handleConnection"
|
||||
>
|
||||
{{
|
||||
!data.isStart
|
||||
? mainStore.enableCreateServer
|
||||
? "启动服务"
|
||||
: "启动联机"
|
||||
: mainStore.enableCreateServer
|
||||
? "停止服务"
|
||||
: "停止联机"
|
||||
}}
|
||||
{{ !data.isStart ? "启动联机" : "停止联机" }}
|
||||
<template #dropdown>
|
||||
<ElDropdownMenu>
|
||||
<ElDropdownItem
|
||||
@@ -289,16 +228,21 @@
|
||||
>
|
||||
分享联机相关配置
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
disabled
|
||||
>
|
||||
<ElDivider class="!h-[2px] !m-0" />
|
||||
<ElDropdownItem disabled>
|
||||
<ElDivider class="!m-0 !h-[2px]" />
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
:icon="SetUp"
|
||||
command="create_server"
|
||||
>
|
||||
{{ mainStore.enableCreateServer ? "我要联机" : "我要开服(自建)" }}
|
||||
自建服务器
|
||||
<ElTag
|
||||
size="small"
|
||||
class="ml-[5px]"
|
||||
:type="listenObj.server_thread_id.value ? 'success' : 'info'"
|
||||
>
|
||||
{{ listenObj.server_thread_id.value ? "运行中" : "未运行" }}
|
||||
</ElTag>
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
:icon="Tools"
|
||||
@@ -385,14 +329,24 @@
|
||||
增强工具
|
||||
</ElButton>
|
||||
</div>
|
||||
<ElLink
|
||||
class="!text-[9px] pb-[2px] ml-[8px] truncate"
|
||||
type="info"
|
||||
:underline="false"
|
||||
@click="open('https://github.com/EasyTier/EasytierGame')"
|
||||
|
||||
<ElBadge
|
||||
badge-class="!text-[9px] cursor-pointer"
|
||||
:hidden="!data.hasNewVersion"
|
||||
:offset="[6, 7]"
|
||||
value="N"
|
||||
>
|
||||
EasytierGame主页
|
||||
</ElLink>
|
||||
<!-- <ElTooltip :disabled="!data.hasNewVersion" content="有新版发布了!"> -->
|
||||
<ElLink
|
||||
class="ml-[8px] truncate pb-[2px] !text-[9px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
@click="open('https://github.com/EasyTier/EasytierGame')"
|
||||
>
|
||||
EasytierGame主页
|
||||
</ElLink>
|
||||
<!-- </ElTooltip> -->
|
||||
</ElBadge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -418,6 +372,16 @@
|
||||
>
|
||||
刷新
|
||||
</ElButton>
|
||||
<ElTooltip
|
||||
placement="top"
|
||||
content="打开内核缓存目录"
|
||||
>
|
||||
<ElButton
|
||||
:icon="Folder"
|
||||
size="small"
|
||||
@click="handleOpenCache"
|
||||
></ElButton>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<ElSelect
|
||||
placeholder="请选择内核版本"
|
||||
@@ -434,7 +398,7 @@
|
||||
{{ release ? release[0] : "" }}
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
<div class="pb-[5px] mt-[10px]">
|
||||
<div class="mt-[10px] pb-[5px]">
|
||||
<ElTooltip content="不使用出国软件也能告诉下载github Release包的地址,可自行搜索替换使用">
|
||||
<ElText>github下载加速地址</ElText>
|
||||
</ElTooltip>
|
||||
@@ -536,6 +500,7 @@
|
||||
v-model="mainStore.configPath"
|
||||
no-data-text="目录没有配置文件"
|
||||
placeholder="选择配置文件"
|
||||
filterable
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in configStart.list"
|
||||
@@ -562,23 +527,38 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { open, Command } from "@tauri-apps/plugin-shell";
|
||||
import { QuestionFilled, Delete, List, UserFilled, Setting, Share, RefreshRight, Link, Tools, MagicStick, SetUp } from "@element-plus/icons-vue";
|
||||
import { reactive, onBeforeUnmount, onMounted } from "vue";
|
||||
import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray";
|
||||
import {
|
||||
QuestionFilled,
|
||||
Delete,
|
||||
List,
|
||||
UserFilled,
|
||||
Setting,
|
||||
Share,
|
||||
RefreshRight,
|
||||
Link,
|
||||
Tools,
|
||||
MagicStick,
|
||||
SetUp,
|
||||
Folder,
|
||||
CopyDocument
|
||||
} from "@element-plus/icons-vue";
|
||||
import { reactive, onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import { useTray, setTrayRunState, setTrayTooltip, checkNewVersion } from "~/composables/tray";
|
||||
import { getMatches } from "@tauri-apps/plugin-cli";
|
||||
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
||||
import { getCurrentWindow, type Window } from "@tauri-apps/api/window";
|
||||
import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import etWindows from "@/composables/windows";
|
||||
import * as tauriAutoStart from "@tauri-apps/plugin-autostart";
|
||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||
import { readDir, exists, mkdir, BaseDirectory, readTextFile } from "@tauri-apps/plugin-fs";
|
||||
import { readDir, exists, mkdir, BaseDirectory, readTextFile, readFile } from "@tauri-apps/plugin-fs";
|
||||
import { updateConfigJson } from "~/composables/configJson";
|
||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
import { sortedUniq, uniq } from "lodash-es";
|
||||
import { bounce, addQQGroup } from "~/utils";
|
||||
import { bounce, addQQGroup, supportProtocols, preventSleep, stopPreventSleep, ATJ } from "~/utils";
|
||||
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
||||
import { getServerArgs } from "@/composables/server";
|
||||
|
||||
let is_close = false;
|
||||
|
||||
@@ -588,6 +568,7 @@
|
||||
is_close = true;
|
||||
await invoke("stop_command", { child_id: listenObj.thread_id || 0 });
|
||||
await invoke("stop_command", { child_id: data.winipBcPid || 0 });
|
||||
await invoke("stop_command", { child_id: listenObj.server_thread_id.value || 0 });
|
||||
},
|
||||
async () => {
|
||||
await handleConnection();
|
||||
@@ -598,16 +579,19 @@
|
||||
const mainStore = useMainStore();
|
||||
const config = mainStore.config;
|
||||
// console.error(config);
|
||||
const protocols = ["tcp", "udp", "ws", "wss", "wg", "quic"];
|
||||
const protocols = supportProtocols();
|
||||
const data = reactive<{ [key: string]: any; releaseList: Array<Array<string>> }>({
|
||||
hasNewVersion: false, //easytierGame有没有新版
|
||||
logVisible: false,
|
||||
cidrVisible: false,
|
||||
advanceVisible: false,
|
||||
toolVisible: false,
|
||||
serverVisible: false,
|
||||
winipBcPid: 0, //WinIPBroadcast进程id
|
||||
winipBcStart: false,
|
||||
memberVisible: false,
|
||||
log: "",
|
||||
serverLog: "", //服务端日志
|
||||
update: false,
|
||||
releaseList: [],
|
||||
coreVersion: "-",
|
||||
@@ -636,13 +620,24 @@
|
||||
data: ""
|
||||
});
|
||||
|
||||
const copyServerUrl = async (serverUrl: string) => {
|
||||
const [err, _] = await ATJ(writeText(serverUrl));
|
||||
|
||||
if (!err) {
|
||||
ElMessage.success("地址已复制");
|
||||
} else {
|
||||
console.error(err);
|
||||
ElMessage.success("复制失败");
|
||||
}
|
||||
};
|
||||
|
||||
const closePrevent = async () => {
|
||||
const appWindow = getCurrentWindow();
|
||||
if (appWindow.label == "main") {
|
||||
appWindow.onCloseRequested(async event => {
|
||||
// console.error(appWindow.label);
|
||||
if (!is_close) {
|
||||
// console.error(1);
|
||||
// console.error(1);s
|
||||
event.preventDefault();
|
||||
appWindow.hide();
|
||||
}
|
||||
@@ -650,6 +645,20 @@
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenCache = async () => {
|
||||
const cache_path = import.meta.env.VITE_CACHE_PATH;
|
||||
const resourceDir = await getResourceDir();
|
||||
const configPath = await join(resourceDir, cache_path);
|
||||
const isExists = await exists(cache_path, { baseDir: BaseDirectory.Resource });
|
||||
if (!isExists) {
|
||||
try {
|
||||
await mkdir(cache_path, { baseDir: BaseDirectory.Resource });
|
||||
} catch (err) {}
|
||||
}
|
||||
// console.error(configPath);
|
||||
await Command.create("explorer", [configPath]).execute();
|
||||
};
|
||||
|
||||
const handleDeleteServerUrl = (url: string) => {
|
||||
const newBasePeers = [...mainStore.basePeers];
|
||||
const idx = newBasePeers.indexOf(url);
|
||||
@@ -680,34 +689,53 @@
|
||||
mainStore.basePeers = uniq([mainStore.config.serverUrl, ...mainStore.basePeers]);
|
||||
};
|
||||
|
||||
// 手动触发持久化数据
|
||||
const persist = async (appWindow: Window) => {
|
||||
try {
|
||||
appWindow.emitTo({ kind: "Any" }, "global-main-store", { store: { ...mainStore.$state } });
|
||||
mainStore.$persist();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
ElMessage.error("手动持久数据失败");
|
||||
}
|
||||
};
|
||||
|
||||
const listenObj: { [key: string]: any } = {
|
||||
unListenOutPut: null,
|
||||
unListenThreadId: null,
|
||||
unListenServerOutPut: null,
|
||||
unListenServerThreadId: null,
|
||||
unListenConfigStart: null,
|
||||
unListenStartStopServer: null,
|
||||
thread_id: null,
|
||||
server_thread_id: ref(null),
|
||||
async listenOutput() {
|
||||
// const appWindow = getCurrentWindow();
|
||||
const unListen = await listen("command-output", async event => {
|
||||
const unListen = await listen<string>("command-output", async event => {
|
||||
data.isStart = true;
|
||||
// console.error(event.payload);
|
||||
if (event.payload) {
|
||||
data.startLoading = false;
|
||||
let ipv4 = /dhcp ip changed. old: None, new: Some\((\d+\.\d+\.\d+\.\d+).*\)/g.exec(event.payload as string)?.[1];
|
||||
let devName = /tun device ready. dev: (.*)/g.exec(event.payload as string)?.[1];
|
||||
if (config.dhcp || mainStore.configStartEnable) {
|
||||
if (ipv4) {
|
||||
config.ipv4 = ipv4;
|
||||
await setTrayRunState(tray, true);
|
||||
data.isSuccessGetIp = true;
|
||||
await setTrayTooltip(tray, `IP: ${ipv4}`);
|
||||
}
|
||||
} else {
|
||||
if ((event.payload as string).includes("new peer connection added") && !data.isSuccessGetIp) {
|
||||
await setTrayRunState(tray, true);
|
||||
data.isSuccessGetIp = true;
|
||||
await setTrayTooltip(tray, `IP: ${config.ipv4}`);
|
||||
if (mainStore.configStartEnable || mainStore.config.dhcp) {
|
||||
let configIpv4 = /ipv4\s.*=\s.*[\'\"](\d+\.\d+\.\d+\.\d+).*[\'\"]/g.exec(event.payload as string)?.[1];
|
||||
if (configIpv4) {
|
||||
mainStore.config.ipv4 = configIpv4;
|
||||
}
|
||||
}
|
||||
// if (event.payload.includes("peer connection removed")) {
|
||||
// data.isSuccessGetIp = false;
|
||||
// }
|
||||
if (event.payload.includes("new peer connection added") && !data.isSuccessGetIp) {
|
||||
await setTrayRunState(tray, true);
|
||||
data.isSuccessGetIp = true;
|
||||
await setTrayTooltip(tray, `IP: ${mainStore.config.ipv4}`);
|
||||
}
|
||||
if (ipv4) {
|
||||
mainStore.config.ipv4 = ipv4;
|
||||
await setTrayTooltip(tray, `IP: ${ipv4}`);
|
||||
}
|
||||
if (
|
||||
devName &&
|
||||
mainStore.config.enableNetCardMetric &&
|
||||
@@ -744,14 +772,58 @@
|
||||
});
|
||||
this.unListenThreadId = unListen;
|
||||
},
|
||||
async listenServerOutPut() {
|
||||
const unListen = await listen<string>("server-command-output", async event => {
|
||||
// console.log("server-command-output", event);
|
||||
const logArr = data.serverLog.split("\n");
|
||||
const start = logArr.length > 1000 ? logArr.length - 1000 : 0;
|
||||
data.serverLog = logArr.slice(start).join("\n");
|
||||
data.serverLog += (event.payload || "") + "\n";
|
||||
});
|
||||
this.unListenServerOutPut = unListen;
|
||||
},
|
||||
async listenServerThreadId() {
|
||||
const unListen = await listen("server-thread-id", event => {
|
||||
if (event.payload) {
|
||||
this.server_thread_id.value = event.payload;
|
||||
}
|
||||
});
|
||||
this.unListenServerThreadId = unListen;
|
||||
},
|
||||
async listenConfigStart() {
|
||||
const appWindow = getCurrentWindow();
|
||||
const unListen = await listen("config", event => {
|
||||
// console.error("config", event.payload);
|
||||
const ipv4 = config.ipv4;
|
||||
mainStore.$patch(event.payload as any);
|
||||
config.ipv4 = ipv4;
|
||||
if (mainStore.config.enablePreventSleep) {
|
||||
preventSleep();
|
||||
} else {
|
||||
stopPreventSleep();
|
||||
}
|
||||
persist(appWindow);
|
||||
});
|
||||
this.unListenConfigStart = unListen;
|
||||
const unListen2 = mainStore.$subscribe(() => {
|
||||
persist(appWindow);
|
||||
});
|
||||
this.unListenConfigStart = [unListen, unListen2];
|
||||
},
|
||||
async listenStartStopServer() {
|
||||
const unListen = await listen<{ args: Array<string> }>("startStopServer", async event => {
|
||||
await listenObj?.unListenServerOutPut?.();
|
||||
await invoke("stop_command", { child_id: listenObj.server_thread_id.value || 0 });
|
||||
if (listenObj.server_thread_id.value) {
|
||||
listenObj.server_thread_id.value = null;
|
||||
} else {
|
||||
data.serverLog = "";
|
||||
await listenObj.listenServerOutPut();
|
||||
await invoke("run_command", {
|
||||
args: event.payload.args,
|
||||
is_server: true
|
||||
});
|
||||
}
|
||||
});
|
||||
this.unListenStartStopServer = unListen;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -783,7 +855,7 @@
|
||||
const currentVersion = /(\d+\.\d+\.\d+)/g.exec(data.coreVersion || "")?.[1];
|
||||
if (version && currentVersion != version) {
|
||||
// console.error({ currentVersion, latestVersion });
|
||||
ElMessage.success(`更新 -> ${version}`);
|
||||
ElMessage.success(`变更为 -> ${version}`);
|
||||
return [true, downloadUrl, versionFileName];
|
||||
} else if (currentVersion === version) {
|
||||
ElMessage.success(`当前版本无需安装`);
|
||||
@@ -838,42 +910,6 @@
|
||||
// console.log(data.releaseList);
|
||||
};
|
||||
|
||||
const handleAutoStart = async () => {
|
||||
let is_enable = await tauriAutoStart.isEnabled();
|
||||
if (!config.autoStart && !is_enable) {
|
||||
try {
|
||||
await tauriAutoStart.enable();
|
||||
} catch (err) {
|
||||
ElMessage.error(`开机自启失败`);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await tauriAutoStart.disable();
|
||||
} catch (err) {
|
||||
// ElMessage.error(`取消自启失败`);
|
||||
}
|
||||
}
|
||||
is_enable = await tauriAutoStart.isEnabled();
|
||||
if (!is_enable) {
|
||||
config.autoStart = false;
|
||||
} else {
|
||||
config.autoStart = true;
|
||||
}
|
||||
};
|
||||
|
||||
const initAutoStart = async () => {
|
||||
try {
|
||||
const is_enable = await tauriAutoStart.isEnabled();
|
||||
if (!is_enable) {
|
||||
config.autoStart = false;
|
||||
} else {
|
||||
config.autoStart = true;
|
||||
}
|
||||
} catch (err) {
|
||||
config.autoStart = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleAutoStartByTask = async () => {
|
||||
await invoke("spawn_autostart", { enabled: !config.autoStart });
|
||||
const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||
@@ -882,11 +918,6 @@
|
||||
|
||||
const compatibleInitAutoStart = async () => {
|
||||
try {
|
||||
const is_enable = await tauriAutoStart.isEnabled();
|
||||
if (is_enable) {
|
||||
await invoke("spawn_autostart", { enabled: true });
|
||||
await tauriAutoStart.disable();
|
||||
}
|
||||
let is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||
if (is_enable_by_task) {
|
||||
// 每次打开Exe重新加载一次开机自启,因为可能路径变了
|
||||
@@ -914,9 +945,11 @@
|
||||
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||
const isExists = await exists(path, { baseDir: BaseDirectory.Resource });
|
||||
if (isExists) {
|
||||
const guiJsonStr = await readTextFile(path, { baseDir: BaseDirectory.Resource });
|
||||
if (guiJsonStr) {
|
||||
const guiJsonStrUint8 = await readFile(path, { baseDir: BaseDirectory.Resource });
|
||||
if (guiJsonStrUint8) {
|
||||
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");
|
||||
@@ -946,7 +979,7 @@
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
ElMessage.error(`config.json格式错误`);
|
||||
ElMessage.error(`config.json格式或编码错误`);
|
||||
} finally {
|
||||
mainStore.$patch({
|
||||
createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
|
||||
@@ -964,27 +997,68 @@
|
||||
});
|
||||
};
|
||||
|
||||
const initAutoStartServer = async () => {
|
||||
if (mainStore.serverConfig.autoStart && data.coreVersion) {
|
||||
const args = getServerArgs();
|
||||
await listenObj?.unListenServerOutPut?.();
|
||||
await invoke("stop_command", { child_id: listenObj.server_thread_id.value || 0 });
|
||||
data.serverLog = "";
|
||||
await listenObj.listenServerOutPut();
|
||||
await invoke("run_command", {
|
||||
args,
|
||||
is_server: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const initPreventSleep = async () => {
|
||||
if (mainStore.config.enablePreventSleep) {
|
||||
preventSleep();
|
||||
}
|
||||
};
|
||||
|
||||
const mountedShow = async () => {
|
||||
const args = await getMatches();
|
||||
if (!args.args?.["task-auto-start"]?.value) {
|
||||
const appWindow = getCurrentWindow();
|
||||
await appWindow.show();
|
||||
await appWindow.setFocus();
|
||||
}
|
||||
};
|
||||
|
||||
let logsTimer: NodeJS.Timeout | null = null;
|
||||
let serverLogsTimer: NodeJS.Timeout | null = null;
|
||||
let cidrTimer: NodeJS.Timeout | null = null;
|
||||
|
||||
onMounted(async () => {
|
||||
// await handleUpdateCore(); //默认不自动更新
|
||||
await initGuiJson();
|
||||
await compatibleInitAutoStart();
|
||||
// await initAutoStart();
|
||||
await initStartWinIpBroadcast();
|
||||
await getCoreVersion();
|
||||
await listenObj.listenThreadId();
|
||||
await listenObj.listenServerThreadId();
|
||||
await listenObj.listenConfigStart();
|
||||
await listenObj.listenStartStopServer();
|
||||
await initConfigDir();
|
||||
await initAutoStartServer();
|
||||
await initConnectAfterStart();
|
||||
initPreventSleep();
|
||||
mountedShow(); // 不需要await
|
||||
closePrevent();
|
||||
data.hasNewVersion = await checkNewVersion();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
unListenAll();
|
||||
listenObj.unListenReleaseList && listenObj.unListenReleaseList();
|
||||
listenObj.unListenConfigStart && listenObj.unListenConfigStart();
|
||||
listenObj.unListenConfigStart && listenObj.unListenConfigStart[0]();
|
||||
listenObj.unListenConfigStart && listenObj.unListenConfigStart[1]();
|
||||
listenObj.unListenStartStopServer && listenObj.unListenStartStopServer();
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||
cidrTimer && clearInterval(cidrTimer);
|
||||
stopPreventSleep();
|
||||
});
|
||||
|
||||
const getArgs = async () => {
|
||||
@@ -1017,24 +1091,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (mainStore.enableCreateServer) {
|
||||
if (config.relayAllPeerrpc) {
|
||||
args.push("--relay-all-peer-rpc");
|
||||
}
|
||||
const whiteList = mainStore.ServerWhiteList.trim()
|
||||
.split("\n")
|
||||
.map(el => el.trim())
|
||||
.filter(el => el)
|
||||
.join(" ");
|
||||
if (whiteList && mainStore.enableWhiteList) {
|
||||
args.push("--relay-network-whitelist", whiteList);
|
||||
}
|
||||
if (!whiteList && mainStore.enableWhiteList) {
|
||||
args.push("--relay-network-whitelist");
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
if (config.dhcp) {
|
||||
args.push("-d");
|
||||
}
|
||||
@@ -1048,12 +1104,18 @@
|
||||
args.push("--network-secret", config.networkPassword);
|
||||
}
|
||||
if (config.ipv4) {
|
||||
args.push("--ipv4", config.ipv4);
|
||||
args.push("--ipv4", config.ipv4.trim());
|
||||
}
|
||||
if (config.serverUrl) {
|
||||
const formatUrl = config.serverUrl.replace(/\\/g, "/");
|
||||
args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
||||
}
|
||||
if (config.enableCustomProtocol) {
|
||||
const includes = config.protocol.includes(config.customProtocol);
|
||||
if (includes) {
|
||||
args.push("--default-protocol", config.customProtocol);
|
||||
}
|
||||
}
|
||||
if (config.disbleP2p) {
|
||||
args.push("--disable-p2p");
|
||||
}
|
||||
@@ -1063,14 +1125,32 @@
|
||||
if (config.disbleListenner) {
|
||||
args.push("--no-listener");
|
||||
}
|
||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
||||
// console.error(config.proxyNetworks);
|
||||
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
|
||||
const formatProxyNetworks = config.proxyNetworks
|
||||
if (!config.disbleListenner && config.enableCustomListener && config.customListenerData) {
|
||||
const customListener = config.customListenerData
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map(item => item.trim())
|
||||
.filter(item => item && reg.test(item));
|
||||
args.push("--proxy-networks", ...formatProxyNetworks);
|
||||
.map(el => el.trim())
|
||||
.filter(el => el);
|
||||
if (customListener.length > 0) {
|
||||
args.push("-l", ...customListener);
|
||||
}
|
||||
}
|
||||
if (!config.disbleListenner && config.enableCustomListenerV6 && config.customListenerV6Data){
|
||||
args.push("--ipv6-listener", config.customListenerV6Data)
|
||||
}
|
||||
if (!config.disbleListenner && !config.enableCustomListener && config.port) {
|
||||
args.push("-l", config.port);
|
||||
}
|
||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
||||
let formatProxyNetworks = config.proxyNetworks.trim().split("\n");
|
||||
const newformatProxyNetworks = formatProxyNetworks
|
||||
.map(el => el.trim())
|
||||
.filter(cidr => {
|
||||
return /^\d+\.\d+\.\d+\.\d+\/\d+$/g.test(cidr);
|
||||
});
|
||||
if (newformatProxyNetworks.length > 0) {
|
||||
args.push("--proxy-networks", ...newformatProxyNetworks);
|
||||
}
|
||||
config.proxyNetworks = formatProxyNetworks.join("\n");
|
||||
}
|
||||
if (config.disableEncryption) {
|
||||
@@ -1148,7 +1228,6 @@
|
||||
data.startLoading = true;
|
||||
await unListenAll();
|
||||
await listenObj.listenOutput();
|
||||
|
||||
await invoke("run_command", {
|
||||
args
|
||||
});
|
||||
@@ -1205,22 +1284,7 @@
|
||||
importConfigData.visible = true;
|
||||
}
|
||||
if (command === "create_server") {
|
||||
if (data.isStart) {
|
||||
const [error] = await ElConfirmDanger("切换会停止{action},是否继续?", "提示", {
|
||||
action: "`联机/服务`",
|
||||
confirmButtonText: "继续",
|
||||
cancelButtonText: "取消"
|
||||
});
|
||||
if (!error) await reset();
|
||||
}
|
||||
mainStore.enableCreateServer = !mainStore.enableCreateServer;
|
||||
if (mainStore.config.relayAllPeerrpc && !mainStore.enableCreateServer) {
|
||||
const [error] = await ElConfirmPrimary("是否关闭RPC流量转发?", "提示", {
|
||||
confirmButtonText: "关闭",
|
||||
cancelButtonText: "取消"
|
||||
});
|
||||
if (!error) mainStore.config.relayAllPeerrpc = false;
|
||||
}
|
||||
await handleShowServerDialog();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1308,10 +1372,11 @@
|
||||
data.logVisible = true;
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
logsTimer = setInterval(() => {
|
||||
appWindow.emitTo("log", "logs", data.log);
|
||||
appWindow.emitTo({ kind: "WebviewWindow", label: "log" }, "logs", data.log);
|
||||
}, 650);
|
||||
},
|
||||
() => {
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
data.logVisible = false;
|
||||
}
|
||||
);
|
||||
@@ -1329,8 +1394,13 @@
|
||||
},
|
||||
(_, appWindow) => {
|
||||
data.cidrVisible = true;
|
||||
cidrTimer && clearInterval(cidrTimer);
|
||||
cidrTimer = setInterval(() => {
|
||||
appWindow.emitTo({ kind: "WebviewWindow", label: "cidr" }, "route", data.isStart);
|
||||
}, 1000);
|
||||
},
|
||||
() => {
|
||||
cidrTimer && clearInterval(cidrTimer);
|
||||
data.cidrVisible = false;
|
||||
}
|
||||
);
|
||||
@@ -1373,4 +1443,33 @@
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const handleShowServerDialog = async () => {
|
||||
await etWindows(
|
||||
"server",
|
||||
{
|
||||
title: "自建服务器",
|
||||
minWidth: 550,
|
||||
minHeight: 460,
|
||||
width: 550,
|
||||
height: 460,
|
||||
resizable: true,
|
||||
url: "#/server"
|
||||
},
|
||||
(_, appWindow) => {
|
||||
data.serverVisible = true;
|
||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||
serverLogsTimer = setInterval(() => {
|
||||
appWindow.emitTo({ kind: "WebviewWindow", label: "server" }, "server_logs", {
|
||||
log: data.serverLog,
|
||||
threadId: listenObj.server_thread_id.value
|
||||
});
|
||||
}, 650);
|
||||
},
|
||||
() => {
|
||||
serverLogsTimer && clearInterval(serverLogsTimer);
|
||||
data.serverVisible = false;
|
||||
}
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@
|
||||
});
|
||||
|
||||
const listenStart = async () => {
|
||||
const unListen = await listen("logs", event => {
|
||||
data.log = (event.payload as string) || "";
|
||||
const unListen = await listen<string>("logs", event => {
|
||||
data.log = event.payload || "";
|
||||
});
|
||||
return unListen;
|
||||
};
|
||||
|
||||
+82
-22
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="overflow-auto h-full">
|
||||
<div class="h-full overflow-auto">
|
||||
<div class="w-[1200px]">
|
||||
<span v-if="!data.member || data.member.length <= 0">{{ "等待成员信息中..." }}</span>
|
||||
<ElText
|
||||
size="small"
|
||||
v-if="!data.member || data.member.length <= 0"
|
||||
>
|
||||
{{ "等待成员信息中..." }}
|
||||
</ElText>
|
||||
<ElTable
|
||||
stripe
|
||||
border
|
||||
@@ -13,15 +18,24 @@
|
||||
width="140"
|
||||
label="主机名"
|
||||
prop="hostname"
|
||||
></ElTableColumn>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
(row.hostname || "").toLowerCase().includes("publicserver")
|
||||
? (row.hostname || "").replace("PublicServer", "服务器")
|
||||
: row.hostname || "-"
|
||||
}}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="90"
|
||||
prop="cost"
|
||||
label="路由"
|
||||
label="方式"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<ElTag
|
||||
size="small"
|
||||
effect="dark"
|
||||
:type="row.cost == 'p2p' ? 'success' : 'info'"
|
||||
>
|
||||
@@ -38,12 +52,12 @@
|
||||
<ElTableColumn
|
||||
sortable
|
||||
prop="lat_ms"
|
||||
width="130"
|
||||
width="100"
|
||||
label="延迟/ms"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="120"
|
||||
width="100"
|
||||
prop="loss_rate"
|
||||
label="丢包率"
|
||||
>
|
||||
@@ -53,9 +67,9 @@
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="120"
|
||||
label="nat_type"
|
||||
prop="NAT类型"
|
||||
width="110"
|
||||
label="NAT类型"
|
||||
prop="nat_type"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ natMaps[row.nat_type.toLowerCase() as natKyes] || row.nat_type || "-" }}
|
||||
@@ -63,15 +77,27 @@
|
||||
</ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="120"
|
||||
width="122"
|
||||
prop="version"
|
||||
label="版本"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="100"
|
||||
prop="tunnel_proto"
|
||||
label="隧道协议"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
width="90"
|
||||
prop="rx_bytes"
|
||||
label="接收"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
prop="tx_bytes"
|
||||
label="传输"
|
||||
></ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</div>
|
||||
@@ -79,7 +105,9 @@
|
||||
<script setup lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
||||
import { parsePeerInfo } from "@/utils";
|
||||
import { ATJ, parseCliInfo } from "@/utils";
|
||||
import { ElConfirmDanger } from "~/utils/element";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
// enum NatType {
|
||||
// // has NAT; but own a single public IP, port is not changed
|
||||
// Unknown = 0;
|
||||
@@ -107,7 +135,7 @@
|
||||
};
|
||||
type natKyes = keyof typeof natMaps;
|
||||
|
||||
const data = reactive<{ member: any[] }>({
|
||||
const data = reactive<{ member: { hostname: string; cost: string; ipv4: string; lat_msg: string; loss_rate: string; nat_type: string }[] }>({
|
||||
member: []
|
||||
});
|
||||
|
||||
@@ -119,12 +147,36 @@
|
||||
["loss_rate", "丢包率"],
|
||||
["nat_type", "NAT类型"],
|
||||
["version", "版本"],
|
||||
["tunnel_proto", "隧道协议"]
|
||||
["tunnel_proto", "隧道协议"],
|
||||
["rx_bytes", "接收"],
|
||||
["tx_bytes", "传输"]
|
||||
];
|
||||
|
||||
let timer: NodeJS.Timeout | null = null;
|
||||
|
||||
const listenOutput = async () => {
|
||||
const member = await invoke<string>("get_members_by_cli");
|
||||
const peerInfo = parsePeerInfo(member);
|
||||
const [error, member] = await ATJ(invoke<string>("get_members_by_cli"));
|
||||
// if(!member) return;
|
||||
if (error) {
|
||||
data.member = [];
|
||||
return "";
|
||||
}
|
||||
if (member === "_EasytierGameCliFailedToConnect_") {
|
||||
data.member = [];
|
||||
stopTimer();
|
||||
const [error] = await ElConfirmDanger("连接已断开,是否重新尝试?", "警告", {
|
||||
confirmButtonText: "重试",
|
||||
cancelButtonText: "关闭窗口"
|
||||
});
|
||||
if (!error) {
|
||||
await listenOutput();
|
||||
} else {
|
||||
const appWindow = getCurrentWindow();
|
||||
await appWindow.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
const peerInfo = parseCliInfo(member);
|
||||
peerInfo.forEach(value => {
|
||||
if (value.cost === "Local") {
|
||||
value.cost = "本机";
|
||||
@@ -133,20 +185,28 @@
|
||||
value.ipv4 = value.ipv4.split("/")[0];
|
||||
}
|
||||
});
|
||||
// console.error(peerInfo);
|
||||
// console.log(peerInfo)
|
||||
data.member = peerInfo;
|
||||
startTimer();
|
||||
};
|
||||
|
||||
let timer: NodeJS.Timeout | null = null;
|
||||
const startTimer = () => {
|
||||
timer && clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
listenOutput();
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const stopTimer = () => {
|
||||
timer && clearTimeout(timer);
|
||||
timer = null;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
listenOutput();
|
||||
timer = setInterval(() => {
|
||||
listenOutput();
|
||||
}, 1000 * 10);
|
||||
await listenOutput();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
timer && clearInterval(timer);
|
||||
stopTimer();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="flex flex-col gap-[10px] h-full">
|
||||
<ElForm
|
||||
size="small"
|
||||
label-position="top"
|
||||
:model="mainStore.serverConfig"
|
||||
>
|
||||
<ElFormItem
|
||||
label="白名单"
|
||||
prop="ServerWhiteList"
|
||||
class="full-label full-content overflow-hidden !flex flex-col h-full !mb-[0]"
|
||||
>
|
||||
<template #label>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
白名单
|
||||
<ElSwitch
|
||||
v-model="mainStore.serverConfig.enableWhiteList"
|
||||
inline-prompt
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
></ElSwitch>
|
||||
|
||||
<div class="ml-auto">
|
||||
<ElTooltip
|
||||
placement="top"
|
||||
content="打开软件的时候,就会开启这个自建服务"
|
||||
>
|
||||
<ElCheckbox v-model="mainStore.serverConfig.autoStart">自动启动</ElCheckbox>
|
||||
</ElTooltip>
|
||||
<ElTooltip
|
||||
placement="top"
|
||||
content="帮助其他虚拟网建立P2P链接"
|
||||
>
|
||||
<ElCheckbox v-model="mainStore.serverConfig.relayAllPeerrpc">转发所有对等节点的RPC数据包</ElCheckbox>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="h-full w-full flex flex-col overflow-hidden">
|
||||
<div class="flex-1 overflow-auto">
|
||||
<ElInput
|
||||
:disabled="!mainStore.serverConfig.enableWhiteList"
|
||||
placeholder="一行一个,支持通配符列表,如(ab*)。当该参数的列表为空时,就不会为所有其他网络提供转发服务。"
|
||||
:maxlength="1000"
|
||||
v-model="mainStore.serverConfig.serverWhiteList"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
resize="none"
|
||||
></ElInput>
|
||||
</div>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
</ElForm>
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<div class="flex items-center gap-[5px]">
|
||||
<ElText>服务器端口</ElText>
|
||||
<div class="max-w-[100px]">
|
||||
<ElTooltip content="端口号">
|
||||
<ElInput v-model="mainStore.serverConfig.port"></ElInput>
|
||||
</ElTooltip>
|
||||
</div>
|
||||
</div>
|
||||
<ElButton
|
||||
size="large"
|
||||
:loading="data.loading"
|
||||
:type="data.isStart ? 'danger' : 'primary'"
|
||||
@click="hanldeClickStart"
|
||||
>
|
||||
{{ !data.isStart ? "启动服务器" : "停止服务器" }}
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<ElInput
|
||||
placeholder="服务器日志"
|
||||
:model-value="data.log"
|
||||
type="textarea"
|
||||
:rows="14"
|
||||
resize="none"
|
||||
></ElInput>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import useMainStore from "@/stores/index";
|
||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { getServerArgs } from "@/composables/server";
|
||||
import { dataSubscribe } from "@/composables/windows";
|
||||
|
||||
const appWindow = getCurrentWindow();
|
||||
const mainStore = useMainStore();
|
||||
const data = reactive({
|
||||
log: "",
|
||||
isStart: false,
|
||||
loading: true
|
||||
});
|
||||
|
||||
const listenStart = async () => {
|
||||
const unListen = await listen<{ log: string; threadId: number | null }>("server_logs", event => {
|
||||
data.log = event.payload.log || "";
|
||||
if (event.payload.threadId) {
|
||||
data.isStart = true;
|
||||
} else {
|
||||
data.isStart = false;
|
||||
}
|
||||
data.loading = false;
|
||||
});
|
||||
return unListen;
|
||||
};
|
||||
|
||||
let unlistenStart: UnlistenFn | null = null;
|
||||
onMounted(async () => {
|
||||
unlistenStart = await listenStart();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
unlistenStart && unlistenStart();
|
||||
});
|
||||
|
||||
const hanldeClickStart = async () => {
|
||||
data.loading = true;
|
||||
const args = getServerArgs();
|
||||
await appWindow.emitTo("main", "startStopServer", { args });
|
||||
};
|
||||
|
||||
dataSubscribe(async (...a) => {
|
||||
return { serverConfig: { ...mainStore.serverConfig }};
|
||||
});
|
||||
|
||||
</script>
|
||||
+11
-8
@@ -181,8 +181,8 @@
|
||||
import { onMounted, reactive } from "vue";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { handleWinipBcStart, initStartWinIpBroadcast } from "@/composables/netcard";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { isValidIP } from "~/utils";
|
||||
import { dataSubscribe } from "~/composables/windows";
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const data = reactive({
|
||||
@@ -253,18 +253,18 @@
|
||||
if (output.stderr) {
|
||||
data.pingLog += `${i + 1}error - ${output.stderr}`;
|
||||
}
|
||||
if(i != data.pingNum - 1) {
|
||||
if (i != data.pingNum - 1) {
|
||||
await awaitTime(1000);
|
||||
}
|
||||
}
|
||||
data.pingLog += '完毕'
|
||||
data.pingLog += "完毕";
|
||||
} catch (err) {
|
||||
ElMessage.error("Ping发生错误");
|
||||
console.error(err);
|
||||
} finally {
|
||||
data.isPing = false;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
ElMessage.error("请输入正确的IP");
|
||||
}
|
||||
};
|
||||
@@ -328,10 +328,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
const appWindow = getCurrentWindow();
|
||||
mainStore.$subscribe((...a) => {
|
||||
// console.error("subscribe", a);
|
||||
appWindow.emitTo("main", "config", { winIpBcAutoStart: mainStore.winIpBcAutoStart, config: { ...mainStore.config } });
|
||||
dataSubscribe(async (...a) => {
|
||||
return {
|
||||
winIpBcAutoStart: mainStore.winIpBcAutoStart,
|
||||
winipBcStart: mainStore.winipBcStart,
|
||||
winipBcPid: mainStore.winipBcPid,
|
||||
config: { ...mainStore.config }
|
||||
};
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Generated
+133
-87
@@ -18,17 +18,14 @@ importers:
|
||||
specifier: ^6.12.0
|
||||
version: 6.12.2(magicast@0.3.5)(rollup@4.25.0)
|
||||
'@pinia/nuxt':
|
||||
specifier: ^0.7.0
|
||||
version: 0.7.0(magicast@0.3.5)(rollup@4.25.0)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
specifier: 0.9.0
|
||||
version: 0.9.0(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0)
|
||||
'@tauri-apps/api':
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
'@tauri-apps/cli':
|
||||
specifier: ^2.1.0
|
||||
version: 2.1.0
|
||||
'@tauri-apps/plugin-autostart':
|
||||
specifier: ~2
|
||||
version: 2.0.0
|
||||
'@tauri-apps/plugin-cli':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
@@ -36,20 +33,17 @@ importers:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
'@tauri-apps/plugin-fs':
|
||||
specifier: ~2
|
||||
version: 2.0.2
|
||||
'@tauri-apps/plugin-http':
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
'@tauri-apps/plugin-log':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
'@tauri-apps/plugin-shell':
|
||||
specifier: ~2
|
||||
version: 2.0.1
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
'@tauri-apps/plugin-window-state':
|
||||
specifier: ~2
|
||||
version: 2.0.0
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
'@types/lodash-es':
|
||||
specifier: ^4.17.12
|
||||
version: 4.17.12
|
||||
@@ -57,8 +51,8 @@ importers:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0(vite@5.4.11(@types/node@22.9.0)(less@4.2.0)(terser@5.36.0))(vue@3.5.13(typescript@5.6.3))
|
||||
'@vueuse/core':
|
||||
specifier: ^11.2.0
|
||||
version: 11.2.0(vue@3.5.13(typescript@5.6.3))
|
||||
specifier: 12.0.0
|
||||
version: 12.0.0(typescript@5.6.3)
|
||||
archiver:
|
||||
specifier: ^7.0.1
|
||||
version: 7.0.1
|
||||
@@ -75,14 +69,20 @@ importers:
|
||||
specifier: ^3.14.1592
|
||||
version: 3.14.1592(@parcel/watcher@2.5.0)(@types/node@22.9.0)(ioredis@5.4.1)(less@4.2.0)(magicast@0.3.5)(rollup@4.25.0)(terser@5.36.0)(typescript@5.6.3)(vite@5.4.11(@types/node@22.9.0)(less@4.2.0)(terser@5.36.0))
|
||||
pinia:
|
||||
specifier: ^2.2.6
|
||||
version: 2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
pinia-plugin-persistedstate:
|
||||
specifier: ^4.1.3
|
||||
version: 4.1.3(@pinia/nuxt@0.7.0(magicast@0.3.5)(rollup@4.25.0)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(magicast@0.3.5)(pinia@2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0)
|
||||
version: 4.1.3(@pinia/nuxt@0.9.0(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0))(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0)
|
||||
postcss:
|
||||
specifier: ^8.4.38
|
||||
version: 8.4.49
|
||||
prettier:
|
||||
specifier: ^3.4.1
|
||||
version: 3.4.1
|
||||
prettier-plugin-tailwindcss:
|
||||
specifier: ^0.6.9
|
||||
version: 0.6.9(prettier@3.4.1)
|
||||
typescript:
|
||||
specifier: ^5.6.3
|
||||
version: 5.6.3
|
||||
@@ -772,8 +772,10 @@ packages:
|
||||
resolution: {integrity: sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
|
||||
'@pinia/nuxt@0.7.0':
|
||||
resolution: {integrity: sha512-IAKRl7mQCrFKQtD8Z6EzOz5bQ/px0FdeyaB+70A3igkFzHzKVJVblLCjFwXPBC/IO0EwHuMRk/SMgwkUn82jwg==}
|
||||
'@pinia/nuxt@0.9.0':
|
||||
resolution: {integrity: sha512-2yeRo7LeyCF68AbNeL3xu2h6uw0617RkcsYxmA8DJM0R0PMdz5wQHnc44KeENQxR/Mrq8T910XVT6buosqsjBQ==}
|
||||
peerDependencies:
|
||||
pinia: ^2.3.0
|
||||
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
||||
@@ -1145,29 +1147,23 @@ packages:
|
||||
engines: {node: '>= 10'}
|
||||
hasBin: true
|
||||
|
||||
'@tauri-apps/plugin-autostart@2.0.0':
|
||||
resolution: {integrity: sha512-NEwOQWVasZ8RczXkMLNJokRDujneuMH/UFA5t84DLkbNZUmiD3G7HZWhgSd1YQ0BFU9h9w+h2B/py3y6bzWg4Q==}
|
||||
|
||||
'@tauri-apps/plugin-cli@2.0.0':
|
||||
resolution: {integrity: sha512-glQmlL1IiCGEa1FHYa/PTPSeYhfu56omLRgHXWlJECDt6DbJyRuJWVgtkQfUxtqnVdYnnU+DGIGeiInoEqtjLw==}
|
||||
|
||||
'@tauri-apps/plugin-clipboard-manager@2.0.0':
|
||||
resolution: {integrity: sha512-V1sXmbjnwfXt/r48RJMwfUmDMSaP/8/YbH4CLNxt+/sf1eHlIP8PRFdFDQwLN0cNQKu2rqQVbG/Wc/Ps6cDUhw==}
|
||||
|
||||
'@tauri-apps/plugin-fs@2.0.2':
|
||||
resolution: {integrity: sha512-4YZaX2j7ta81M5/DL8aN10kTnpUkEpkPo1FTYPT8Dd0ImHe3azM8i8MrtjrDGoyBYLPO3zFv7df/mSCYF8oA0Q==}
|
||||
'@tauri-apps/plugin-fs@2.2.0':
|
||||
resolution: {integrity: sha512-+08mApuONKI8/sCNEZ6AR8vf5vI9DXD4YfrQ9NQmhRxYKMLVhRW164vdW5BSLmMpuevftpQ2FVoL9EFkfG9Z+g==}
|
||||
|
||||
'@tauri-apps/plugin-http@2.0.1':
|
||||
resolution: {integrity: sha512-j6IA3pVBybSCwPpsihpX4z8bs6PluuGtr06ahL/xy4D8HunNBTmRmadJrFOQi0gOAbaig4MkQ15nzNLBLy8R1A==}
|
||||
'@tauri-apps/plugin-log@2.2.0':
|
||||
resolution: {integrity: sha512-g6CsQAR1lsm5ABSZZxpM/iCn86GrMDTTlhj7GPkZkYBRSm3+WczfOAl7SV7HDn77tOKCzhZffwI5uHfRoHutrw==}
|
||||
|
||||
'@tauri-apps/plugin-log@2.0.0':
|
||||
resolution: {integrity: sha512-C+NII9vzswqnOQE8k7oRtnaw0z5TZsMmnirRhXkCKDEhQQH9841Us/PC1WHtGiAaJ8za1A1JB2xXndEq/47X/w==}
|
||||
'@tauri-apps/plugin-shell@2.2.0':
|
||||
resolution: {integrity: sha512-iC3Ic1hLmasoboG7BO+7p+AriSoqAwKrIk+Hpk+S/bjTQdXqbl2GbdclghI4gM32X0bls7xHzIFqhRdrlvJeaA==}
|
||||
|
||||
'@tauri-apps/plugin-shell@2.0.1':
|
||||
resolution: {integrity: sha512-akU1b77sw3qHiynrK0s930y8zKmcdrSD60htjH+mFZqv5WaakZA/XxHR3/sF1nNv9Mgmt/Shls37HwnOr00aSw==}
|
||||
|
||||
'@tauri-apps/plugin-window-state@2.0.0':
|
||||
resolution: {integrity: sha512-O82iRlrh1BLgBI8CTc+NMTPxQhQo8II5admKq9mLvH45Us5i4Zcr74At6eM46nOflFd7R8bZsVNGy+PxOEqUmQ==}
|
||||
'@tauri-apps/plugin-window-state@2.2.0':
|
||||
resolution: {integrity: sha512-PFZ/vkZ6UPaRyuggEn8jWc/xwpiEw3Id8i6bin54zUR3vHY0MOK+ovvpvp6SEHKryCJbZMigYJz0OUT2eZ4YmQ==}
|
||||
|
||||
'@trysound/sax@0.2.0':
|
||||
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
|
||||
@@ -1316,20 +1312,20 @@ packages:
|
||||
'@vue/shared@3.5.13':
|
||||
resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
|
||||
|
||||
'@vueuse/core@11.2.0':
|
||||
resolution: {integrity: sha512-JIUwRcOqOWzcdu1dGlfW04kaJhW3EXnnjJJfLTtddJanymTL7lF1C0+dVVZ/siLfc73mWn+cGP1PE1PKPruRSA==}
|
||||
'@vueuse/core@12.0.0':
|
||||
resolution: {integrity: sha512-C12RukhXiJCbx4MGhjmd/gH52TjJsc3G0E0kQj/kb19H3Nt6n1CA4DRWuTdWWcaFRdlTe0npWDS942mvacvNBw==}
|
||||
|
||||
'@vueuse/core@9.13.0':
|
||||
resolution: {integrity: sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==}
|
||||
|
||||
'@vueuse/metadata@11.2.0':
|
||||
resolution: {integrity: sha512-L0ZmtRmNx+ZW95DmrgD6vn484gSpVeRbgpWevFKXwqqQxW9hnSi2Ppuh2BzMjnbv4aJRiIw8tQatXT9uOB23dQ==}
|
||||
'@vueuse/metadata@12.0.0':
|
||||
resolution: {integrity: sha512-Yzimd1D3sjxTDOlF05HekU5aSGdKjxhuhRFHA7gDWLn57PRbBIh+SF5NmjhJ0WRgF3my7T8LBucyxdFJjIfRJQ==}
|
||||
|
||||
'@vueuse/metadata@9.13.0':
|
||||
resolution: {integrity: sha512-gdU7TKNAUVlXXLbaF+ZCfte8BjRJQWPCa2J55+7/h+yDtzw3vOoGQDRXzI6pyKyo6bXFT5/QoPE4hAknExjRLQ==}
|
||||
|
||||
'@vueuse/shared@11.2.0':
|
||||
resolution: {integrity: sha512-VxFjie0EanOudYSgMErxXfq6fo8vhr5ICI+BuE3I9FnX7ePllEsVrRQ7O6Q1TLgApeLuPKcHQxAXpP+KnlrJsg==}
|
||||
'@vueuse/shared@12.0.0':
|
||||
resolution: {integrity: sha512-3i6qtcq2PIio5i/vVYidkkcgvmTjCqrf26u+Fd4LhnbBmIT6FN8y6q/GJERp8lfcB9zVEfjdV0Br0443qZuJpw==}
|
||||
|
||||
'@vueuse/shared@9.13.0':
|
||||
resolution: {integrity: sha512-UrnhU+Cnufu4S6JLCPZnkWh0WwZGUp72ktOF2DFptMlOs3TOdVv8xJN53zhHGARmVOsz5KqOls09+J1NR6sBKw==}
|
||||
@@ -2889,15 +2885,12 @@ packages:
|
||||
pinia:
|
||||
optional: true
|
||||
|
||||
pinia@2.2.6:
|
||||
resolution: {integrity: sha512-vIsR8JkDN5Ga2vAxqOE2cJj4VtsHnzpR1Fz30kClxlh0yCHfec6uoMeM3e/ddqmwFUejK3NlrcQa/shnpyT4hA==}
|
||||
pinia@2.3.0:
|
||||
resolution: {integrity: sha512-ohZj3jla0LL0OH5PlLTDMzqKiVw2XARmC1XYLdLWIPBMdhDW/123ZWr4zVAhtJm+aoSkFa13pYXskAvAscIkhQ==}
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.4.0
|
||||
typescript: '>=4.4.4'
|
||||
vue: ^2.6.14 || ^3.5.11
|
||||
vue: ^2.7.0 || ^3.5.11
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
@@ -3129,6 +3122,66 @@ packages:
|
||||
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
|
||||
prettier-plugin-tailwindcss@0.6.9:
|
||||
resolution: {integrity: sha512-r0i3uhaZAXYP0At5xGfJH876W3HHGHDp+LCRUJrs57PBeQ6mYHMwr25KH8NPX44F2yGTvdnH7OqCshlQx183Eg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
peerDependencies:
|
||||
'@ianvs/prettier-plugin-sort-imports': '*'
|
||||
'@prettier/plugin-pug': '*'
|
||||
'@shopify/prettier-plugin-liquid': '*'
|
||||
'@trivago/prettier-plugin-sort-imports': '*'
|
||||
'@zackad/prettier-plugin-twig-melody': '*'
|
||||
prettier: ^3.0
|
||||
prettier-plugin-astro: '*'
|
||||
prettier-plugin-css-order: '*'
|
||||
prettier-plugin-import-sort: '*'
|
||||
prettier-plugin-jsdoc: '*'
|
||||
prettier-plugin-marko: '*'
|
||||
prettier-plugin-multiline-arrays: '*'
|
||||
prettier-plugin-organize-attributes: '*'
|
||||
prettier-plugin-organize-imports: '*'
|
||||
prettier-plugin-sort-imports: '*'
|
||||
prettier-plugin-style-order: '*'
|
||||
prettier-plugin-svelte: '*'
|
||||
peerDependenciesMeta:
|
||||
'@ianvs/prettier-plugin-sort-imports':
|
||||
optional: true
|
||||
'@prettier/plugin-pug':
|
||||
optional: true
|
||||
'@shopify/prettier-plugin-liquid':
|
||||
optional: true
|
||||
'@trivago/prettier-plugin-sort-imports':
|
||||
optional: true
|
||||
'@zackad/prettier-plugin-twig-melody':
|
||||
optional: true
|
||||
prettier-plugin-astro:
|
||||
optional: true
|
||||
prettier-plugin-css-order:
|
||||
optional: true
|
||||
prettier-plugin-import-sort:
|
||||
optional: true
|
||||
prettier-plugin-jsdoc:
|
||||
optional: true
|
||||
prettier-plugin-marko:
|
||||
optional: true
|
||||
prettier-plugin-multiline-arrays:
|
||||
optional: true
|
||||
prettier-plugin-organize-attributes:
|
||||
optional: true
|
||||
prettier-plugin-organize-imports:
|
||||
optional: true
|
||||
prettier-plugin-sort-imports:
|
||||
optional: true
|
||||
prettier-plugin-style-order:
|
||||
optional: true
|
||||
prettier-plugin-svelte:
|
||||
optional: true
|
||||
|
||||
prettier@3.4.1:
|
||||
resolution: {integrity: sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
|
||||
pretty-bytes@6.1.1:
|
||||
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
||||
engines: {node: ^14.13.1 || >=16.0.0}
|
||||
@@ -4526,13 +4579,12 @@ snapshots:
|
||||
std-env: 3.8.0
|
||||
ufo: 1.5.4
|
||||
uncrypto: 0.1.3
|
||||
unimport: 3.13.1(rollup@4.25.0)
|
||||
unimport: 3.13.3(rollup@4.25.0)
|
||||
untyped: 1.5.1
|
||||
transitivePeerDependencies:
|
||||
- magicast
|
||||
- rollup
|
||||
- supports-color
|
||||
- webpack-sources
|
||||
|
||||
'@nuxt/schema@3.14.1592(magicast@0.3.5)(rollup@4.25.0)':
|
||||
dependencies:
|
||||
@@ -4725,18 +4777,14 @@ snapshots:
|
||||
'@parcel/watcher-win32-ia32': 2.5.0
|
||||
'@parcel/watcher-win32-x64': 2.5.0
|
||||
|
||||
'@pinia/nuxt@0.7.0(magicast@0.3.5)(rollup@4.25.0)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))':
|
||||
'@pinia/nuxt@0.9.0(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0)':
|
||||
dependencies:
|
||||
'@nuxt/kit': 3.14.159(magicast@0.3.5)(rollup@4.25.0)
|
||||
pinia: 2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.25.0)
|
||||
pinia: 2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- magicast
|
||||
- rollup
|
||||
- supports-color
|
||||
- typescript
|
||||
- vue
|
||||
- webpack-sources
|
||||
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
optional: true
|
||||
@@ -4994,10 +5042,6 @@ snapshots:
|
||||
'@tauri-apps/cli-win32-ia32-msvc': 2.1.0
|
||||
'@tauri-apps/cli-win32-x64-msvc': 2.1.0
|
||||
|
||||
'@tauri-apps/plugin-autostart@2.0.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
'@tauri-apps/plugin-cli@2.0.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
@@ -5006,23 +5050,19 @@ snapshots:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
'@tauri-apps/plugin-fs@2.0.2':
|
||||
'@tauri-apps/plugin-fs@2.2.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
'@tauri-apps/plugin-http@2.0.1':
|
||||
'@tauri-apps/plugin-log@2.2.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
'@tauri-apps/plugin-log@2.0.0':
|
||||
'@tauri-apps/plugin-shell@2.2.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
'@tauri-apps/plugin-shell@2.0.1':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
'@tauri-apps/plugin-window-state@2.0.0':
|
||||
'@tauri-apps/plugin-window-state@2.2.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
@@ -5115,7 +5155,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@babel/types': 7.26.0
|
||||
'@rollup/pluginutils': 5.1.3(rollup@4.25.0)
|
||||
'@vue/compiler-sfc': 3.5.12
|
||||
'@vue/compiler-sfc': 3.5.13
|
||||
ast-kit: 1.3.1
|
||||
local-pkg: 0.5.0
|
||||
magic-string-ast: 0.6.2
|
||||
@@ -5268,15 +5308,14 @@ snapshots:
|
||||
|
||||
'@vue/shared@3.5.13': {}
|
||||
|
||||
'@vueuse/core@11.2.0(vue@3.5.13(typescript@5.6.3))':
|
||||
'@vueuse/core@12.0.0(typescript@5.6.3)':
|
||||
dependencies:
|
||||
'@types/web-bluetooth': 0.0.20
|
||||
'@vueuse/metadata': 11.2.0
|
||||
'@vueuse/shared': 11.2.0(vue@3.5.13(typescript@5.6.3))
|
||||
vue-demi: 0.14.10(vue@3.5.13(typescript@5.6.3))
|
||||
'@vueuse/metadata': 12.0.0
|
||||
'@vueuse/shared': 12.0.0(typescript@5.6.3)
|
||||
vue: 3.5.13(typescript@5.6.3)
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
- typescript
|
||||
|
||||
'@vueuse/core@9.13.0(vue@3.5.13(typescript@5.6.3))':
|
||||
dependencies:
|
||||
@@ -5288,16 +5327,15 @@ snapshots:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
|
||||
'@vueuse/metadata@11.2.0': {}
|
||||
'@vueuse/metadata@12.0.0': {}
|
||||
|
||||
'@vueuse/metadata@9.13.0': {}
|
||||
|
||||
'@vueuse/shared@11.2.0(vue@3.5.13(typescript@5.6.3))':
|
||||
'@vueuse/shared@12.0.0(typescript@5.6.3)':
|
||||
dependencies:
|
||||
vue-demi: 0.14.10(vue@3.5.13(typescript@5.6.3))
|
||||
vue: 3.5.13(typescript@5.6.3)
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
- typescript
|
||||
|
||||
'@vueuse/shared@9.13.0(vue@3.5.13(typescript@5.6.3))':
|
||||
dependencies:
|
||||
@@ -7033,28 +7071,30 @@ snapshots:
|
||||
pify@4.0.1:
|
||||
optional: true
|
||||
|
||||
pinia-plugin-persistedstate@4.1.3(@pinia/nuxt@0.7.0(magicast@0.3.5)(rollup@4.25.0)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(magicast@0.3.5)(pinia@2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0):
|
||||
pinia-plugin-persistedstate@4.1.3(@pinia/nuxt@0.9.0(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0))(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0):
|
||||
dependencies:
|
||||
'@nuxt/kit': 3.14.159(magicast@0.3.5)(rollup@4.25.0)
|
||||
deep-pick-omit: 1.2.1
|
||||
defu: 6.1.4
|
||||
destr: 2.0.3
|
||||
optionalDependencies:
|
||||
'@pinia/nuxt': 0.7.0(magicast@0.3.5)(rollup@4.25.0)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
pinia: 2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
'@pinia/nuxt': 0.9.0(magicast@0.3.5)(pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)))(rollup@4.25.0)
|
||||
pinia: 2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))
|
||||
transitivePeerDependencies:
|
||||
- magicast
|
||||
- rollup
|
||||
- supports-color
|
||||
- webpack-sources
|
||||
|
||||
pinia@2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)):
|
||||
pinia@2.3.0(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)):
|
||||
dependencies:
|
||||
'@vue/devtools-api': 6.6.4
|
||||
vue: 3.5.13(typescript@5.6.3)
|
||||
vue-demi: 0.14.10(vue@3.5.13(typescript@5.6.3))
|
||||
optionalDependencies:
|
||||
typescript: 5.6.3
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
|
||||
pirates@4.0.6: {}
|
||||
|
||||
@@ -7272,6 +7312,12 @@ snapshots:
|
||||
picocolors: 1.1.1
|
||||
source-map-js: 1.2.1
|
||||
|
||||
prettier-plugin-tailwindcss@0.6.9(prettier@3.4.1):
|
||||
dependencies:
|
||||
prettier: 3.4.1
|
||||
|
||||
prettier@3.4.1: {}
|
||||
|
||||
pretty-bytes@6.1.1: {}
|
||||
|
||||
process-nextick-args@2.0.1: {}
|
||||
@@ -7982,7 +8028,7 @@ snapshots:
|
||||
'@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.26.0)
|
||||
'@babel/plugin-transform-typescript': 7.25.9(@babel/core@7.26.0)
|
||||
'@vue/babel-plugin-jsx': 1.2.5(@babel/core@7.26.0)
|
||||
'@vue/compiler-dom': 3.5.12
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
kolorist: 1.8.0
|
||||
magic-string: 0.30.14
|
||||
vite: 5.4.11(@types/node@22.9.0)(less@4.2.0)(terser@5.36.0)
|
||||
|
||||
Generated
+109
-52
@@ -95,6 +95,55 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.92"
|
||||
@@ -306,17 +355,6 @@ version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "auto-launch"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"
|
||||
dependencies = [
|
||||
"dirs 4.0.0",
|
||||
"thiserror 1.0.64",
|
||||
"winreg 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
@@ -692,6 +730,33 @@ dependencies = [
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7"
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "5.4.0"
|
||||
@@ -731,6 +796,12 @@ dependencies = [
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.7"
|
||||
@@ -1057,33 +1128,13 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
dependencies = [
|
||||
"dirs-sys 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1176,23 +1227,25 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||
|
||||
[[package]]
|
||||
name = "easytier-game"
|
||||
version = "1.2.6"
|
||||
version = "1.3.2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"planif",
|
||||
"rand 0.8.5",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sysinfo",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-autostart",
|
||||
"tauri-plugin-cli",
|
||||
"tauri-plugin-clipboard-manager",
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-log",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-single-instance",
|
||||
"tauri-plugin-window-state",
|
||||
"tokio",
|
||||
"whoami",
|
||||
"windows 0.58.0",
|
||||
"zip",
|
||||
@@ -1215,7 +1268,7 @@ dependencies = [
|
||||
"rustc_version",
|
||||
"toml 0.8.2",
|
||||
"vswhom",
|
||||
"winreg 0.52.0",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2164,6 +2217,12 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.8"
|
||||
@@ -4312,7 +4371,7 @@ checksum = "e545de0a2dfe296fa67db208266cd397c5a55ae782da77973ef4c4fac90e9f2c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
"dirs 5.0.1",
|
||||
"dirs",
|
||||
"dunce",
|
||||
"embed_plist",
|
||||
"futures-util",
|
||||
@@ -4363,7 +4422,7 @@ checksum = "7bd2a4bcfaf5fb9f4be72520eefcb61ae565038f8ccba2a497d8c28f463b8c01"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
"dirs 5.0.1",
|
||||
"dirs",
|
||||
"glob",
|
||||
"heck 0.5.0",
|
||||
"json-patch",
|
||||
@@ -4436,12 +4495,12 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-autostart"
|
||||
name = "tauri-plugin-cli"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bba6bb936e0fd0a58ed958b49e2e423dd40949c9d9425cc991be996959e3838e"
|
||||
checksum = "2bccd4692b56822a60874542c7655546c8e7aed3c2e2926166e1498e595bd2a2"
|
||||
dependencies = [
|
||||
"auto-launch",
|
||||
"clap",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -4782,15 +4841,16 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.40.0"
|
||||
version = "1.41.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
@@ -4933,7 +4993,7 @@ checksum = "533fc2d4105e0e3d96ce1c71f2d308c9fbbe2ef9c587cab63dd627ab5bde218f"
|
||||
dependencies = [
|
||||
"core-graphics 0.24.0",
|
||||
"crossbeam-channel",
|
||||
"dirs 5.0.1",
|
||||
"dirs",
|
||||
"libappindicator",
|
||||
"muda",
|
||||
"objc2",
|
||||
@@ -5085,6 +5145,12 @@ version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.10.0"
|
||||
@@ -5786,15 +5852,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "easytier-game"
|
||||
version = "1.2.6"
|
||||
version = "1.3.2"
|
||||
homepage = "https://github.com/EasyTier/EasyTier"
|
||||
repository = "https://github.com/EasyTier/EasytierGame"
|
||||
description = "A simple network initiator based on Easytier"
|
||||
@@ -34,20 +34,23 @@ tauri = { version = "2.1.1", features = [
|
||||
tauri-plugin-log = "2.0.2"
|
||||
tauri-plugin-shell = "2.0.2"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
zip = "2.2.0"
|
||||
zip = "2.2"
|
||||
sysinfo = '0.32.0'
|
||||
planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
|
||||
whoami = "1.5.2"
|
||||
tauri-plugin-fs = "2"
|
||||
tauri-plugin-clipboard-manager = "2.0.2"
|
||||
rand = "0.8.5"
|
||||
tokio = { version = "1.41.1", features = ["process"] }
|
||||
# prost = "0.13"
|
||||
# prost-types = "0.13"
|
||||
|
||||
|
||||
[dependencies.windows]
|
||||
version = "0.58.0"
|
||||
features = ["Win32_System_TaskScheduler"]
|
||||
features = ["Win32_System_TaskScheduler", "Win32_System_Power"]
|
||||
|
||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||
tauri-plugin-autostart = "2.0.1"
|
||||
tauri-plugin-cli = "2"
|
||||
tauri-plugin-single-instance = "2.0.1"
|
||||
tauri-plugin-window-state = "2"
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
"member",
|
||||
"cidr",
|
||||
"advance",
|
||||
"tool"
|
||||
"tool",
|
||||
"server"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-unminimize",
|
||||
"core:window:allow-hide",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-set-focus",
|
||||
@@ -29,10 +31,6 @@
|
||||
"core:webview:allow-webview-show",
|
||||
"core:webview:allow-webview-hide",
|
||||
"core:webview:allow-webview-close",
|
||||
"autostart:default",
|
||||
"autostart:allow-enable",
|
||||
"autostart:allow-disable",
|
||||
"autostart:allow-is-enabled",
|
||||
"core:tray:allow-get-by-id",
|
||||
"core:tray:allow-set-icon",
|
||||
"core:tray:allow-new",
|
||||
@@ -96,6 +94,10 @@
|
||||
"window-state:allow-save-window-state",
|
||||
"window-state:allow-restore-state",
|
||||
|
||||
|
||||
"cli:default",
|
||||
"cli:allow-cli-matches",
|
||||
|
||||
"log:default",
|
||||
"log:allow-log"
|
||||
]
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
"dhcp": false, // 动态分配IP
|
||||
"devName": false, // 是否启用自定义网卡名
|
||||
"devNameValue": "", // 网卡名(启用devName之后才生效)
|
||||
"enableCustonProtocol": false, // 是否启用自定义协议
|
||||
"customProtocol": "tcp", // 自定义协议类型
|
||||
"enableNetCardMetric": false, // 自定义easytier每次生成的网卡跃点
|
||||
"netCardMetricValue": 1 // 网卡跃点数量(1-9999)
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+203
-66
@@ -9,21 +9,64 @@ use std::fs::{self, File};
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::os::windows::process::CommandExt;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
mpsc, Arc,
|
||||
};
|
||||
use std::sync::mpsc;
|
||||
use std::{path, thread};
|
||||
use sysinfo::System;
|
||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||
use tauri::Emitter;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
use windows::core::{BSTR, VARIANT};
|
||||
use windows::Win32::Foundation::VARIANT_BOOL;
|
||||
use windows::Win32::System::Com::*;
|
||||
use windows::Win32::System::TaskScheduler::*;
|
||||
|
||||
use windows::Win32::System::Power::SetThreadExecutionState;
|
||||
use windows::Win32::System::Power::{
|
||||
ES_CONTINUOUS, ES_DISPLAY_REQUIRED, ES_SYSTEM_REQUIRED, EXECUTION_STATE,
|
||||
};
|
||||
|
||||
use tokio::process::Command as tokioCommand;
|
||||
use rand::Rng;
|
||||
|
||||
fn generate_random_user_agent() -> String {
|
||||
let user_agents = vec![
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Safari/537.36",
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/{version} Safari/605.1.15",
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/{version} Mobile/15E148 Safari/604.1",
|
||||
"Mozilla/5.0 (Linux; Android 10; SM-G973F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Mobile Safari/537.36",
|
||||
"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 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 = format!("{}.{}.{}", version_major, version_minor, version_patch);
|
||||
|
||||
// 替换模板中的版本号占位符
|
||||
template.replace("{version}", &version)
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn prevent_sleep() -> bool {
|
||||
unsafe {
|
||||
let result =
|
||||
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_CONTINUOUS);
|
||||
result != EXECUTION_STATE(0)
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn allow_sleep() -> bool {
|
||||
unsafe {
|
||||
let result = SetThreadExecutionState(ES_CONTINUOUS);
|
||||
result != EXECUTION_STATE(0)
|
||||
}
|
||||
}
|
||||
|
||||
// 定义GitHub Release的结构体
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Release {
|
||||
@@ -47,20 +90,61 @@ pub async fn fetch_releases() -> Result<Vec<Release>, Error> {
|
||||
let client = Client::new();
|
||||
// 构建请求的URL
|
||||
let url = format!("https://api.github.com/repos/easytier/easytier/releases",);
|
||||
|
||||
let user_agent = generate_random_user_agent();
|
||||
// 发送HTTP GET请求
|
||||
let response = client
|
||||
.get(&url)
|
||||
.header("User-Agent", "Tauri-fetch")
|
||||
.header("User-Agent", user_agent)
|
||||
.send()
|
||||
.await?;
|
||||
// 反序列化响应体为Release列表
|
||||
response.json::<Vec<Release>>().await
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn fetch_game_releases() -> [String; 2] {
|
||||
// 创建HTTP客户端
|
||||
let client = Client::new();
|
||||
// 构建请求的URL
|
||||
let url = format!("https://api.github.com/repos/Easytier/EasytierGame/releases",);
|
||||
let user_agent = generate_random_user_agent();
|
||||
// 发送HTTP GET请求
|
||||
if let Ok(response) = client
|
||||
.get(&url)
|
||||
.header("User-Agent", user_agent)
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
// 反序列化响应体为Release列表
|
||||
match response.json::<Vec<Release>>().await {
|
||||
Ok(releases) => {
|
||||
if releases.len() <= 0 {
|
||||
return [String::from(""), String::from("")];
|
||||
}
|
||||
let release = releases.first().unwrap();
|
||||
let tag_name = release.tag_name.as_str();
|
||||
let browser_download_url = release
|
||||
.assets
|
||||
.first()
|
||||
.unwrap()
|
||||
.browser_download_url
|
||||
.as_str();
|
||||
[String::from(tag_name), String::from(browser_download_url)]
|
||||
}
|
||||
Err(_e) => {
|
||||
log::error!("game release {}", _e.to_string());
|
||||
[String::from(""), String::from("")]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::error!("failed to get game release");
|
||||
[String::from(""), String::from("")]
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_core_version() -> String {
|
||||
let core_path = get_tool_exe_path(String::from("\\easytier\\easytier-core.exe"));
|
||||
let core_path = get_tool_exe_path("\\easytier\\easytier-core.exe");
|
||||
match Command::new(&core_path)
|
||||
.arg("--version")
|
||||
.creation_flags(0x08000000)
|
||||
@@ -80,7 +164,7 @@ fn get_core_version() -> String {
|
||||
// #[tauri::command(rename_all = "snake_case")]
|
||||
// #[warn(dead_code)]
|
||||
// fn get_cli_version() -> String {
|
||||
// let cli_path = get_tool_exe_path(String::from("\\easytier\\easytier-cli.exe"));
|
||||
// let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
|
||||
// match Command::new(&cli_path)
|
||||
// .arg("--version")
|
||||
// .creation_flags(0x08000000)
|
||||
@@ -94,9 +178,10 @@ fn get_core_version() -> String {
|
||||
// }
|
||||
// }
|
||||
|
||||
fn get_tool_exe_path(path: String) -> String {
|
||||
fn get_tool_exe_path(path: &str) -> String {
|
||||
let cur_vec = get_exe_directory();
|
||||
let tool_path = cur_vec[1].to_string() + &path.to_string();
|
||||
let tool_path = format!("{}{}", cur_vec[1].as_str(), path);
|
||||
// log::error!("tool path: {}", tool_path);
|
||||
return tool_path;
|
||||
}
|
||||
|
||||
@@ -133,29 +218,73 @@ struct MyResponse {
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_members_by_cli() -> String {
|
||||
let cli_path = get_tool_exe_path(String::from("\\easytier\\easytier-cli.exe"));
|
||||
match Command::new(&cli_path)
|
||||
async fn get_members_by_cli() -> String {
|
||||
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
|
||||
match tokioCommand::new(&cli_path)
|
||||
.arg("peer")
|
||||
.arg("list")
|
||||
.creation_flags(0x08000000)
|
||||
.output()
|
||||
.await
|
||||
{
|
||||
Ok(output) => {
|
||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
||||
return output_str.trim().to_string();
|
||||
if output.status.success() {
|
||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
||||
return output_str.trim().to_string();
|
||||
} else {
|
||||
let output_str = String::from_utf8_lossy(&output.stderr);
|
||||
log::error!("{}", output_str.trim().to_string());
|
||||
return "_EasytierGameCliFailedToConnect_".to_string();
|
||||
}
|
||||
}
|
||||
Err(_e) => {
|
||||
log::error!("get member list error");
|
||||
return "".to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn get_route_by_cli() -> String {
|
||||
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
|
||||
match tokioCommand::new(&cli_path)
|
||||
.arg("route")
|
||||
.creation_flags(0x08000000)
|
||||
.output()
|
||||
.await
|
||||
{
|
||||
Ok(output) => {
|
||||
if output.status.success() {
|
||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
||||
return output_str.trim().to_string();
|
||||
} else {
|
||||
let output_str = String::from_utf8_lossy(&output.stderr);
|
||||
log::error!("{}", output_str.trim().to_string());
|
||||
return "_EasytierGameCliFailedToConnect_".to_string();
|
||||
}
|
||||
}
|
||||
Err(_e) => {
|
||||
log::error!("get route list error");
|
||||
return "".to_string();
|
||||
}
|
||||
Err(_e) => return _e.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn download_easytier_zip(download_url: String, file_name: String) {
|
||||
let cache_dir_path = get_tool_exe_path("\\easytier\\cache");
|
||||
let cache_file_name = format!("{}\\{}", cache_dir_path, file_name);
|
||||
let cache_file_name_path = path::Path::new(&cache_file_name);
|
||||
if cache_file_name_path.exists() {
|
||||
unzip(cache_file_name_path);
|
||||
return;
|
||||
}
|
||||
|
||||
let target = format!("{}", download_url);
|
||||
let response = reqwest::get(target)
|
||||
.await
|
||||
.expect("error to download easytier url");
|
||||
let easytier_path = get_tool_exe_path(String::from("\\easytier"));
|
||||
let easytier_path = get_tool_exe_path("\\easytier");
|
||||
let file_path = format!("{}\\{}", easytier_path, file_name);
|
||||
println!("download easytier to {}", file_path);
|
||||
|
||||
@@ -177,10 +306,19 @@ async fn download_easytier_zip(download_url: String, file_name: String) {
|
||||
file.write_all(&content).expect("error to write easytier");
|
||||
println!("写入完成");
|
||||
unzip(path);
|
||||
match fs::remove_file(path) {
|
||||
Ok(_) => println!("删除zip文件成功"),
|
||||
Err(_) => log::error!("删除zip文件失败"),
|
||||
|
||||
let cache_dir_path = path::Path::new(&cache_dir_path);
|
||||
if !cache_dir_path.exists() {
|
||||
fs::create_dir_all(&cache_dir_path).unwrap();
|
||||
}
|
||||
match fs::rename(path, cache_file_name) {
|
||||
Ok(_) => println!("保存zip文件至easytier/cache成功"),
|
||||
Err(_) => log::error!("保存zip文件失败"),
|
||||
}
|
||||
// match fs::remove_file(path) {
|
||||
// Ok(_) => println!("删除zip文件成功"),
|
||||
// Err(_) => log::error!("删除zip文件失败"),
|
||||
// }
|
||||
}
|
||||
|
||||
fn unzip(fname: &path::Path) {
|
||||
@@ -213,7 +351,7 @@ fn unzip(fname: &path::Path) {
|
||||
// fs::create_dir_all(p).unwrap();
|
||||
// }
|
||||
// }
|
||||
let easytier_path = get_tool_exe_path(String::from("\\easytier"));
|
||||
let easytier_path = get_tool_exe_path("\\easytier");
|
||||
let easytier_dir = path::Path::new(&easytier_path);
|
||||
// if !easytier_dir.exists() {
|
||||
// fs::create_dir_all(&easytier_dir).unwrap();
|
||||
@@ -228,20 +366,24 @@ fn unzip(fname: &path::Path) {
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn run_command(
|
||||
app_handle: tauri::AppHandle,
|
||||
args: Vec<String>,
|
||||
stop_signal: tauri::State<Arc<AtomicBool>>,
|
||||
) {
|
||||
fn run_command(app_handle: tauri::AppHandle, args: Vec<String>, is_server: Option<bool>) {
|
||||
let is_server = is_server.unwrap_or(false);
|
||||
let (tx, rx) = mpsc::channel();
|
||||
stop_signal.store(false, Ordering::Relaxed);
|
||||
|
||||
let app_handle1 = app_handle.clone();
|
||||
let app_handle2 = app_handle.clone();
|
||||
let stop_signal1 = Arc::clone(&stop_signal);
|
||||
let stop_signal2 = Arc::clone(&stop_signal);
|
||||
|
||||
let args2 = args.clone();
|
||||
let mut thread_id_str = "thread-id";
|
||||
if is_server {
|
||||
thread_id_str = "server-thread-id";
|
||||
}
|
||||
let mut command_output_str = "command-output";
|
||||
if is_server {
|
||||
command_output_str = "server-command-output";
|
||||
}
|
||||
thread::spawn(move || {
|
||||
let core_path = get_tool_exe_path(String::from("\\easytier\\easytier-core.exe"));
|
||||
let core_path = get_tool_exe_path("\\easytier\\easytier-core.exe");
|
||||
// trace, debug, info, warn, error, off
|
||||
let mut child = Command::new(&core_path)
|
||||
.args(args)
|
||||
@@ -252,36 +394,36 @@ fn run_command(
|
||||
|
||||
println!("child id: {}", child.id());
|
||||
app_handle1
|
||||
.emit("thread-id", child.id())
|
||||
.emit(thread_id_str, child.id())
|
||||
.expect("failed to emit id event");
|
||||
app_handle1
|
||||
.emit("command-output", args2.join(" "))
|
||||
.emit(command_output_str, args2.join(" "))
|
||||
.expect("error output args");
|
||||
let stdout = child.stdout.take().expect("failed to capture stdout");
|
||||
let reader = BufReader::new(stdout);
|
||||
|
||||
for line in reader.lines() {
|
||||
match line {
|
||||
Ok(line) => {
|
||||
tx.send(line).expect("failed to send line");
|
||||
}
|
||||
Ok(line) => match tx.send(line) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
log::error!("error sending line: {}", e);
|
||||
break;
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
log::error!("error reading line: {}", e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
stop_signal1.store(true, Ordering::Relaxed);
|
||||
println!("end");
|
||||
});
|
||||
|
||||
thread::spawn(move || {
|
||||
while let Ok(line) = rx.recv() {
|
||||
if stop_signal2.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
app_handle2
|
||||
.emit("command-output", line)
|
||||
.emit(command_output_str, line)
|
||||
.expect("failed to emit event");
|
||||
}
|
||||
});
|
||||
@@ -327,20 +469,17 @@ async fn fetch_easytier_list() -> Vec<Vec<[String; 3]>> {
|
||||
}
|
||||
release_list.push(assets_list);
|
||||
}
|
||||
return release_list;
|
||||
release_list
|
||||
} else {
|
||||
return Vec::new();
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle_window_visibility<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if window.is_visible().unwrap_or_default() {
|
||||
let _ = window.hide();
|
||||
} else {
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
let _ = window.show();
|
||||
let _ = window.unminimize();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,7 +592,7 @@ fn autostart_is_enabled() -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub const AUTOSTART_ARG: &str = "--autostart";
|
||||
// pub const AUTOSTART_ARG: &str = "--autostart";
|
||||
pub const TASKAUTOSTART_ARG: &str = "--task-auto-start";
|
||||
fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
if !enabled {
|
||||
@@ -521,12 +660,11 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
// 获取命令行参数
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
let _args: Vec<String> = std::env::args().collect();
|
||||
|
||||
let stop_signal = Arc::new(AtomicBool::new(false)); // 创建一个原子布尔值,用于控制命令的停止
|
||||
let stop_signal_clone = Arc::clone(&stop_signal); // 创建一个原子布尔值的克隆,用于传递给命令
|
||||
let context = tauri::generate_context!();
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_cli::init())
|
||||
.plugin(
|
||||
tauri_plugin_window_state::Builder::new()
|
||||
.with_state_flags(tauri_plugin_window_state::StateFlags::SIZE)
|
||||
@@ -534,10 +672,6 @@ pub fn run() {
|
||||
)
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_autostart::init(
|
||||
MacosLauncher::LaunchAgent,
|
||||
Some(vec![AUTOSTART_ARG]),
|
||||
))
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||
let _ = app
|
||||
@@ -547,9 +681,9 @@ pub fn run() {
|
||||
.expect("failed to set focus");
|
||||
}))
|
||||
.setup(move |app| {
|
||||
let args = args.clone();
|
||||
// let args = args.clone();
|
||||
// if cfg!(debug_assertions) {
|
||||
let log_path = get_tool_exe_path(String::from("\\easytier\\guiLogs"));
|
||||
let log_path = get_tool_exe_path("\\easytier\\guiLogs");
|
||||
app.handle().plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.target(tauri_plugin_log::Target::new(
|
||||
@@ -584,26 +718,29 @@ pub fn run() {
|
||||
.build(app)?;
|
||||
|
||||
// 开机自启隐藏到托盘或者显示主窗口
|
||||
if !args.contains(&String::from(TASKAUTOSTART_ARG)) {
|
||||
let main_window = app.get_webview_window("main").unwrap();
|
||||
main_window.show().expect("failed to show window");
|
||||
main_window.set_focus().expect("failed to set focus");
|
||||
}
|
||||
// if !args.contains(&String::from(TASKAUTOSTART_ARG)) {
|
||||
// let main_window = app.get_webview_window("main").unwrap();
|
||||
// main_window.show().expect("failed to show window");
|
||||
// main_window.set_focus().expect("failed to set focus");
|
||||
// }
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.manage(stop_signal_clone)
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
run_command,
|
||||
stop_command,
|
||||
get_core_version,
|
||||
fetch_easytier_list,
|
||||
fetch_game_releases,
|
||||
download_easytier_zip,
|
||||
get_members_by_cli,
|
||||
get_route_by_cli,
|
||||
search_pid_by_pname,
|
||||
get_exe_directory,
|
||||
spawn_autostart,
|
||||
autostart_is_enabled
|
||||
autostart_is_enabled,
|
||||
prevent_sleep,
|
||||
allow_sleep
|
||||
])
|
||||
.run(context)
|
||||
.expect("error while running tauri application");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "easytier-game",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.2",
|
||||
"identifier": "com.tauri.easytier-game",
|
||||
|
||||
"build": {
|
||||
@@ -13,7 +13,7 @@
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "easytier-game 1.2.6",
|
||||
"title": "easytier-game 1.3.2",
|
||||
"label": "main",
|
||||
"minWidth": 340,
|
||||
"width": 340,
|
||||
@@ -34,7 +34,17 @@
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"plugins": {},
|
||||
"plugins": {
|
||||
"cli": {
|
||||
"description": "easytier game CLI Plugin",
|
||||
"args": [
|
||||
{
|
||||
"name": "task-auto-start",
|
||||
"description": "easytier game autostart"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": false,
|
||||
"targets": "all",
|
||||
|
||||
+9
-1
@@ -13,4 +13,12 @@
|
||||
|
||||
2. 运行easytier-game安装目录下的 easytier/clear_local_data.bat (需要管理员权限) 输入y确认,清除本地存储数据
|
||||
|
||||
3. 删除easytierGame文件夹
|
||||
3. 删除easytierGame文件夹
|
||||
|
||||
|
||||
[没有服务器,怎么自建服务]
|
||||
1. 点击 启动联机 按钮旁边的箭头 选择自建服务 设置好端口号后 点击启动服务器
|
||||
|
||||
2. 搜索一下 openFrp mossFrp sakurafrp 等 将你的本地服务通过它(们)代理到公网
|
||||
|
||||
3. 将代理之后的地址发给别人,他们就可以通过这个加入你的服务了
|
||||
+43
-13
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from "pinia";
|
||||
export default defineStore("main", {
|
||||
import { acceptHMRUpdate, defineStore } from "pinia";
|
||||
const store = defineStore("main", {
|
||||
state() {
|
||||
return {
|
||||
config: {
|
||||
@@ -13,6 +13,11 @@ export default defineStore("main", {
|
||||
autoStart: false, // 是否自动启动
|
||||
connectAfterStart: false, //软件打开后,是否自动连接
|
||||
disableIpv6: false, // 是否禁用IPv6
|
||||
port: "11010", // 监听端口号
|
||||
enableCustomListener: false, // 是否自定义监听
|
||||
customListenerV6Data: "", //自定义ipv6监听
|
||||
enableCustomListenerV6: false, // 是否自定义监听
|
||||
customListenerData: "", // 自定义监听地址
|
||||
disbleListenner: false, // 是否禁用监听
|
||||
disableEncryption: true, // 是否禁用加密
|
||||
multiThread: false, //使用多线程
|
||||
@@ -28,8 +33,20 @@ export default defineStore("main", {
|
||||
logLevel: "error", //日志等级
|
||||
devName: false, //自定义网卡名
|
||||
devNameValue: "", //自定义网卡名
|
||||
enableCustomProtocol: false, //自定义默认协议
|
||||
customProtocol: "tcp", //自定义默认协议
|
||||
enableNetCardMetric: false, //启用网卡自定义跃点
|
||||
netCardMetricValue: 1 //自定义网卡跃点值
|
||||
netCardMetricValue: 1, //自定义网卡跃点值
|
||||
enablePreventSleep: false, //组织系统休眠
|
||||
compression: "none", //加密算法
|
||||
},
|
||||
serverConfig: {
|
||||
enableWhiteList: true, // 是否启用白名单
|
||||
relayAllPeerrpc: false, // 是否启用所有对等RPC
|
||||
serverWhiteList: "", // 服务器流量转发白名单
|
||||
// enableListener: true, // 是否启用监听
|
||||
autoStart: false, //随软件自启
|
||||
port: "11010" // 服务器端口
|
||||
},
|
||||
cidrEnable: false,
|
||||
basePeers: ["public.easytier.top:11010"],
|
||||
@@ -39,9 +56,6 @@ export default defineStore("main", {
|
||||
winIpBcAutoStart: true,
|
||||
createConfigInEasytier: false, //在easytier目录生成config.json文件吗
|
||||
githubFastUrl: "https://ghproxy.cc/",
|
||||
enableCreateServer: false, // 自建服务器
|
||||
enableWhiteList: true, // 是否启用白名单
|
||||
ServerWhiteList: "", // 服务器流量转发白名单
|
||||
|
||||
winipBcPid: 0,
|
||||
winipBcStart: false
|
||||
@@ -60,7 +74,6 @@ export default defineStore("main", {
|
||||
"config.autoStart",
|
||||
"config.connectAfterStart",
|
||||
"config.disableIpv6",
|
||||
"config.disbleListenner",
|
||||
"config.disableEncryption",
|
||||
"config.multiThread",
|
||||
"config.enablExitNode",
|
||||
@@ -77,6 +90,25 @@ export default defineStore("main", {
|
||||
"config.devNameValue",
|
||||
"config.enableNetCardMetric",
|
||||
"config.netCardMetricValue",
|
||||
"config.port",
|
||||
|
||||
"config.disbleListenner",
|
||||
"config.enableCustomListener",
|
||||
"config.customListenerData",
|
||||
"config.enableCustomListenerV6",
|
||||
"config.customListenerV6Data",
|
||||
|
||||
"config.enableCustonProtocol",
|
||||
"config.customProtocol",
|
||||
"config.enablePreventSleep",
|
||||
"config.compression",
|
||||
|
||||
"serverConfig.autoStart",
|
||||
// 'serverConfig.enableListener',
|
||||
"serverConfig.enableWhiteList",
|
||||
"serverConfig.relayAllPeerrpc",
|
||||
"serverConfig.serverWhiteList",
|
||||
"serverConfig.port",
|
||||
|
||||
"cidrEnable",
|
||||
"basePeers",
|
||||
@@ -85,13 +117,11 @@ export default defineStore("main", {
|
||||
"configPath",
|
||||
"winIpBcAutoStart",
|
||||
"createConfigInEasytier",
|
||||
"githubFastUrl",
|
||||
|
||||
"enableCreateServer",
|
||||
"enableWhiteList",
|
||||
"ServerWhiteList"
|
||||
],
|
||||
"githubFastUrl"
|
||||
]
|
||||
// // 除了这些,其他都要存下来
|
||||
// omit: ["winipBcPid", "winipBcStart"]
|
||||
}
|
||||
});
|
||||
if (import.meta.hot) import.meta.hot.accept(acceptHMRUpdate(store, import.meta.hot));
|
||||
export default store;
|
||||
|
||||
@@ -29,6 +29,8 @@ export const ElConfirmDanger = (
|
||||
}
|
||||
return ATJ(
|
||||
ElMessageBox.confirm(message, title, {
|
||||
closeOnClickModal: false, // 点击遮罩层不关闭弹窗
|
||||
closeOnPressEscape: false, // 按下Esc键不关闭弹窗
|
||||
cancelButtonText,
|
||||
confirmButtonText,
|
||||
confirmButtonClass: "el-button--danger"
|
||||
@@ -63,6 +65,8 @@ export const ElConfirmSucces = (
|
||||
}
|
||||
return ATJ(
|
||||
ElMessageBox.confirm(message, title, {
|
||||
closeOnClickModal: false, // 点击遮罩层不关闭弹窗
|
||||
closeOnPressEscape: false, // 按下Esc键不关闭弹窗
|
||||
cancelButtonText,
|
||||
confirmButtonText,
|
||||
confirmButtonClass: "el-button--success"
|
||||
@@ -97,6 +101,8 @@ export const ElConfirmPrimary = (
|
||||
}
|
||||
return ATJ(
|
||||
ElMessageBox.confirm(message, title, {
|
||||
closeOnClickModal: false, // 点击遮罩层不关闭弹窗
|
||||
closeOnPressEscape: false, // 按下Esc键不关闭弹窗
|
||||
cancelButtonText,
|
||||
confirmButtonText,
|
||||
confirmButtonClass: "el-button--primary"
|
||||
|
||||
+24
-1
@@ -1,3 +1,4 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { open } from "@tauri-apps/plugin-shell";
|
||||
export const ENV = import.meta.env;
|
||||
|
||||
@@ -64,7 +65,29 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
|
||||
});
|
||||
};
|
||||
|
||||
export const parsePeerInfo = (content: string) => {
|
||||
const _supportProtocols = ["tcp", "udp", "ws", "wss", "quic"];
|
||||
|
||||
export const supportProtocols = () => {
|
||||
return _supportProtocols.slice();
|
||||
}
|
||||
|
||||
let _prevent_timer: NodeJS.Timeout| null = null;
|
||||
let _prevent_timer_count = 15; // 秒
|
||||
export const preventSleep = () => {
|
||||
_prevent_timer && clearInterval(_prevent_timer);
|
||||
_prevent_timer = setInterval(async () => {
|
||||
const result = await invoke('prevent_sleep');
|
||||
// console.log(`trigger prevent sleep ${result}`);
|
||||
}, _prevent_timer_count * 1000);
|
||||
}
|
||||
|
||||
export const stopPreventSleep = () => {
|
||||
_prevent_timer && clearInterval(_prevent_timer);
|
||||
_prevent_timer = null;
|
||||
}
|
||||
|
||||
export const parseCliInfo = (content: string) => {
|
||||
if(!content) return [];
|
||||
// 将表格字符串分割成行
|
||||
const lines = content.split("\n");
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import useMainStore from "@/stores/index";
|
||||
import * as tauriAutoStart from "@tauri-apps/plugin-autostart";
|
||||
import { open, Command } from "@tauri-apps/plugin-shell";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
@@ -52,19 +51,3 @@ const handleAutoStartByNssm = async () => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 兼容autostart插件
|
||||
const compatibleAutoStart = async () => {
|
||||
const config = useMainStore().config;
|
||||
const is_enable = await tauriAutoStart.isEnabled();
|
||||
if (is_enable) {
|
||||
try {
|
||||
await tauriAutoStart.disable();
|
||||
config.autoStart = false;
|
||||
} catch (err) {
|
||||
// ElMessage.error(`取消自启失败`);
|
||||
}
|
||||
}
|
||||
const serverStatus = await Command.create("nssm", ["status", import.meta.env.VITE_AUTO_START_SERVICE_NAME]).execute();
|
||||
console.log(serverStatus);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ const releaseDir = "./src-tauri/target/release";
|
||||
const releaseDirEasytier = `${releaseDir}/easytier/`;
|
||||
const releaseExe = `${releaseDir}/easytier-game.exe`;
|
||||
const releaseHelp = `${releaseDir}/帮助.txt`;
|
||||
const deleteEasytierFiles = ["logs/", "guiLogs/"];
|
||||
const deleteEasytierFiles = ["logs/", "guiLogs/", "cache/"];
|
||||
const pkg = require("./package.json");
|
||||
const fileName = `easytier-game_windows_x86_64_${pkg.version}.zip`; // 发布包格式
|
||||
const releaseZipDir = "./release";
|
||||
|
||||
Reference in New Issue
Block a user