diff --git a/pages/advance.vue b/pages/advance.vue
index ff38635..7e6f496 100644
--- a/pages/advance.vue
+++ b/pages/advance.vue
@@ -76,7 +76,7 @@
允许此节点成为出口节点
- 禁用对等节点通信的加密,默认为false,必须与对等节点相同
+ 禁用对等节点通信的加密,默认为启用,必须与对等节点相同
使用多线程运行时,默认为单线程
diff --git a/pages/index.vue b/pages/index.vue
index 55ab8da..8d00c65 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -2,7 +2,8 @@
+ :model="config"
+ >
+ prop="serverUrl"
+ >
服务器
-
+ :type="data.isSuccessGetIp ? 'success' : 'info'"
+ >
{{ data.isSuccessGetIp ? "联机成功" : data.isStart && !data.isSuccessGetIp ? "联机中" : "未联机" }}
+ @click="getCoreVersion(true)"
+ >
获取内核版本
+ type="info"
+ >
{{ data.coreVersion }}
+ @confirm="handleUpdateCore"
+ >
+ size="small"
+ >
{{ data.coreVersion ? "更新内核" : "下载内核" }}
@@ -55,7 +62,8 @@
placeholder="请选择服务器地址"
default-first-option
v-model="config.serverUrl"
- @change="handleServerUrlChange">
+ @change="handleServerUrlChange"
+ >
+ @change="handleServerUrlChange"
+ >
+ :value="item"
+ >
@@ -77,7 +87,8 @@
v-for="item in mainStore.basePeers"
:key="item"
:label="item"
- :value="item">
+ :value="item"
+ >
{{ item }}
@@ -87,7 +98,8 @@
@click.stop="handleDeleteServerUrl(item)"
round
:icon="Delete"
- type="danger">
+ type="danger"
+ >
@@ -107,7 +119,8 @@
+ v-model="config.networkName"
+ >
@@ -125,7 +138,8 @@
maxlength="100"
placeholder="请输入网络密码"
v-model="config.networkPassword"
- type="password">
+ type="password"
+ >
@@ -142,11 +156,13 @@
+ v-model="config.hostname"
+ >
+ label="局域网IP"
+ >
虚拟网IP
@@ -159,14 +175,16 @@
inline-prompt
inactive-text="固定IP"
active-text="动态获取IP"
- size="small">
+ size="small"
+ >
+ v-model="config.ipv4"
+ >
@@ -180,24 +198,28 @@
size="default"
:type="!data.isStart ? 'primary' : 'danger'"
:disabled="data.startLoading || !data.coreVersion || data.update"
- @click="handleConnection">
+ @click="handleConnection"
+ >
{{ !data.isStart ? "启动联机" : "停止联机" }}
+ :icon="Link"
+ >
导入配置
+ :icon="Share"
+ >
分享配置
+ :disabled="data.isStart"
+ >
使用外部配置文件
@@ -207,51 +229,60 @@
+ content="日志"
+ >
+ plain
+ >
+ content="成员"
+ >
+ size="small"
+ >
+ size="small"
+ >
强制中转
+ content="自启后隐藏于托盘,不显示界面"
+ >
+ size="small"
+ >
开机自启
+ :icon="Share"
+ >
子网代理
+ :icon="Setting"
+ >
高级选项
@@ -262,7 +293,8 @@
type="primary"
size="small"
:icon="MagicStick"
- @click="handleShowToolDialog">
+ @click="handleShowToolDialog"
+ >
增强工具
@@ -270,7 +302,8 @@
class="!text-[9px] pb-[2px] ml-[8px] truncate"
type="info"
:underline="false"
- @click="open('https://github.com/EasyTier/EasytierGame')">
+ @click="open('https://github.com/EasyTier/EasytierGame')"
+ >
EasytierGame主页
@@ -285,12 +318,14 @@
class="!mb-0"
v-model="importConfigData.visible"
:close-on-press-escape="false"
- title="导入分享">
+ title="导入分享"
+ >
+ v-model="importConfigData.data"
+ >
导入成功后,您当前的部分配置将被替换
@@ -299,7 +334,8 @@
+ type="primary"
+ >
导入
@@ -313,7 +349,8 @@
class="!mb-0"
v-model="configStart.visible"
:close-on-press-escape="false"
- title="配置文件启动">
+ title="配置文件启动"
+ >
启用
@@ -322,14 +359,16 @@
+ size="small"
+ >
打开配置目录
+ size="small"
+ >
刷新
@@ -337,12 +376,14 @@
+ placeholder="选择配置文件"
+ >
+ :label="item.name"
+ >
@@ -350,7 +391,8 @@
+ type="danger"
+ >
关闭
@@ -406,25 +448,25 @@
startLoading: false,
isStart: false,
connectionSuccess: false,
- configJsonSeverUrl: "", // 本地保存一次,用于回填config.json
+ configJsonSeverUrl: "" // 本地保存一次,用于回填config.json
});
const configStart = reactive<{ list: Array<{ path: string; name: string }>; [key: string]: any }>({
visible: false,
loading: false,
- list: [], //配置文件列表
+ list: [] //配置文件列表
});
const importConfigData = reactive<{ data: ""; [key: string]: any }>({
visible: false,
loading: false,
- data: "",
+ data: ""
});
const closePrevent = async () => {
const appWindow = getCurrentWindow();
if (appWindow.label == "main") {
- appWindow.onCloseRequested(async (event) => {
+ appWindow.onCloseRequested(async event => {
// console.error(appWindow.label);
if (!is_close) {
// console.error(1);
@@ -472,7 +514,7 @@
thread_id: null,
async listenOutput() {
// const appWindow = getCurrentWindow();
- const unListen = await listen("command-output", async (event) => {
+ const unListen = await listen("command-output", async event => {
data.isStart = true;
// console.error(event.payload);
if (event.payload) {
@@ -487,7 +529,7 @@
await setTrayTooltip(tray, `IP: ${ipv4}`);
}
} else {
- if ((event.payload as string).includes("new peer connection added")) {
+ 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}`);
@@ -505,7 +547,7 @@
"netsh",
["interface", "ipv4", "set", "interface", devName, "metric=", `${mainStore.config.netCardMetricValue}`],
{
- encoding: "gb2312",
+ encoding: "gb2312"
}
).execute();
} catch (err) {
@@ -522,7 +564,7 @@
this.unListenOutPut = unListen;
},
async listenThreadId() {
- const unListen = await listen("thread-id", (event) => {
+ const unListen = await listen("thread-id", event => {
if (event.payload) {
this.thread_id = event.payload;
}
@@ -530,14 +572,14 @@
this.unListenThreadId = unListen;
},
async listenConfigStart() {
- const unListen = await listen("config", (event) => {
+ const unListen = await listen("config", event => {
console.error("config", event.payload);
const ipv4 = config.ipv4;
mainStore.$patch(event.payload as any);
config.ipv4 = ipv4;
});
this.unListenConfigStart = unListen;
- },
+ }
};
const unListenAll = async () => {
@@ -593,7 +635,7 @@
await getCoreVersion();
} catch (err) {
console.error(err);
- }finally {
+ } finally {
data.update = false;
}
};
@@ -704,8 +746,8 @@
config: {
...mainStore.config,
...guiJson,
- serverUrl: saveServerUrl,
- },
+ serverUrl: saveServerUrl
+ }
});
if (mainStore.createConfigInEasytier) {
await updateConfigJson(data.configJsonSeverUrl);
@@ -715,7 +757,7 @@
ElMessage.error(`config.json格式错误`);
} finally {
mainStore.$patch({
- createConfigInEasytier: true, // 发现本地存在config.json 默认启用该功能
+ createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
});
}
}
@@ -781,7 +823,7 @@
}
if (config.serverUrl) {
const formatUrl = config.serverUrl.replace(/\\/g, "/");
- args.push("--peers", ...config.protocol.map((protocol) => `${protocol}://${formatUrl}`));
+ args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
}
if (config.disbleP2p) {
args.push("--disable-p2p");
@@ -797,8 +839,8 @@
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
const formatProxyNetworks = config.proxyNetworks
.split("\n")
- .map((item) => item.trim())
- .filter((item) => item && reg.test(item));
+ .map(item => item.trim())
+ .filter(item => item && reg.test(item));
args.push("--proxy-networks", ...formatProxyNetworks);
config.proxyNetworks = formatProxyNetworks.join("\n");
}
@@ -842,7 +884,7 @@
config.ipv4 = "";
}
const memberDialog = await getAllWebviewWindows();
- const memberDialogs = memberDialog.filter((item) => item.label === "member");
+ const memberDialogs = memberDialog.filter(item => item.label === "member");
if (memberDialogs && memberDialogs.length > 0) {
data.memberVisible = false;
for (const memberDialog of memberDialogs) {
@@ -868,7 +910,7 @@
if (args[0] === "-c") {
ElMessage.warning({
message: "使用配置文件中.",
- duration: 5000,
+ duration: 5000
});
}
data.log = ""; //清空日志
@@ -877,7 +919,7 @@
await listenObj.listenOutput();
await invoke("run_command", {
- args,
+ args
});
}
};
@@ -891,10 +933,10 @@
if (isExists) {
const entries = await readDir(path, { baseDir: BaseDirectory.Resource });
configStart.list = entries
- .filter((item) => item.isFile)
- .map((item) => ({
+ .filter(item => item.isFile)
+ .map(item => ({
name: item.name,
- path: `${path}${item.name}`,
+ path: `${path}${item.name}`
})) as any;
} else {
mainStore.configStartEnable = false;
@@ -937,14 +979,14 @@
try {
await ElMessageBox.confirm("确定导入?", "提示", {
confirmButtonText: "确定",
- cancelButtonText: "取消",
+ cancelButtonText: "取消"
});
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
mainStore.$patch({
config: {
...mainStore.config,
- ...payload.config,
- },
+ ...payload.config
+ }
});
ElMessage.success("导入成功");
importConfigData.visible = false;
@@ -992,7 +1034,7 @@
title: "成员列表",
width: 875,
height: 380,
- url: "#/member",
+ url: "#/member"
},
() => {
data.memberVisible = true;
@@ -1011,7 +1053,7 @@
width: 600,
height: 380,
resizable: false,
- url: "#/log",
+ url: "#/log"
},
(_, appWindow) => {
data.logVisible = true;
@@ -1034,7 +1076,7 @@
width: 600,
height: 380,
resizable: false,
- url: "#/cidr",
+ url: "#/cidr"
},
(_, appWindow) => {
data.cidrVisible = true;
@@ -1053,7 +1095,7 @@
width: 600,
height: 380,
resizable: false,
- url: "#/advance",
+ url: "#/advance"
},
(_, appWindow) => {
data.advanceVisible = true;
@@ -1072,7 +1114,7 @@
width: 460,
height: 480,
resizable: true,
- url: "#/tool",
+ url: "#/tool"
},
(_, appWindow) => {
data.toolVisible = true;
diff --git a/src-tauri/clear_data.bat b/src-tauri/clear_data.bat
new file mode 100644
index 0000000..760fb11
--- /dev/null
+++ b/src-tauri/clear_data.bat
@@ -0,0 +1,54 @@
+@echo off
+chcp 65001 >nul
+setlocal
+
+REM 检查是否具有管理员权限
+openfiles >nul 2>&1
+if %errorlevel% neq 0 (
+ echo 当前没有管理员权限,鼠标右键clear_data.bat,选择使用管理员模式运行...
+ pause
+ exit /b
+)
+
+REM 获取当前用户的 Local 目录路径
+set "local_dir=%LOCALAPPDATA%"
+
+REM 设置要删除的任务计划程序文件夹名称
+set "folder_name=\easytierGame"
+set "task_name=auto start"
+
+REM 设置要删除的目标文件夹
+set "target_data_dir=%local_dir%\com.tauri.easytier-game"
+echo ---
+REM 打印 Local 目录路径
+echo 当前数据目录: %target_data_dir%
+echo ---
+echo 您确定要清除EasytierGame的本地数据吗? (y/n)
+echo ---
+
+REM 等待用户输入
+set /p confirm=输入'y/n'进行确认:
+
+if /i "%confirm%"=="y" (
+ echo 清除数据中,请稍后...
+ echo ---
+ REM 删除任务计划程序文件夹
+ echo delete auto_start task ...
+ echo ---
+ REM 获取文件夹中的所有任务
+ schtasks /delete /tn "%folder_name%\%task_name%" /f
+ schtasks /delete /tn "%folder_name%" /f
+
+ if exist "%target_data_dir%" (
+ REM 删除目标文件夹及其内容
+ rd /s /q "%target_data_dir%"
+ )
+ echo 清楚本地缓存数据完毕.
+ echo ---
+ echo 您可以手动删除当前目录完成EasytierGame的卸载.
+) else (
+ echo 取消清理数据
+)
+
+pause
+endlocal