mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2026-09-25 11:36:54 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05fe46858d | ||
|
|
a438c48fdc | ||
|
|
777ec9b982 | ||
|
|
167002691c | ||
|
|
434014f690 | ||
|
|
0d0901de94 | ||
|
|
18f6c54a4f | ||
|
|
ad0f252dfd | ||
|
|
6bf4d54361 |
+8
-1
@@ -39,7 +39,7 @@ html.dark body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.full-label .el-form-item__label {
|
.full-label .el-form-item__label {
|
||||||
width: 100%;
|
width: 100%!important;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +50,13 @@ html.dark body {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-select__selection {
|
||||||
|
/* display: none!important; */
|
||||||
|
min-height: 20px!important;
|
||||||
|
flex-wrap: nowrap!important;
|
||||||
|
overflow: hidden!important;
|
||||||
|
}
|
||||||
|
|
||||||
.el-table {
|
.el-table {
|
||||||
font-size: 12px !important;
|
font-size: 12px !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
pnpm run build
|
pnpm run build
|
||||||
@REM rustup default nightly
|
rustup default nightly
|
||||||
@REM rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
|
@REM rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
|
||||||
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x86
|
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x86
|
||||||
@REM pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
|
pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
|
||||||
rustup default stable
|
rustup default stable
|
||||||
pnpm tauri build
|
pnpm tauri build
|
||||||
pnpm run release
|
pnpm run release
|
||||||
@REM pnpm run release-win7
|
pnpm run release-win7
|
||||||
+16
-16
@@ -5,7 +5,7 @@ import { uniq, intersection, isNil } from "lodash-es";
|
|||||||
import { bounce } from "~/utils";
|
import { bounce } from "~/utils";
|
||||||
|
|
||||||
const b = bounce(600);
|
const b = bounce(600);
|
||||||
export type ConfigServerUrlType = Array<string> | string | null | undefined | null;
|
export type ConfigServerUrlType = Array<string>;
|
||||||
|
|
||||||
export const updateConfigJsonBounce = (configJsonSeverUrl?: ConfigServerUrlType) => {
|
export const updateConfigJsonBounce = (configJsonSeverUrl?: ConfigServerUrlType) => {
|
||||||
b(async () => {
|
b(async () => {
|
||||||
@@ -22,8 +22,10 @@ export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType)
|
|||||||
if (isNil(configJsonSeverUrl)) {
|
if (isNil(configJsonSeverUrl)) {
|
||||||
configJsonSeverUrl = [];
|
configJsonSeverUrl = [];
|
||||||
}
|
}
|
||||||
const isArray = Array.isArray(configJsonSeverUrl);
|
if(typeof(configJsonSeverUrl) == 'string') {
|
||||||
const isString = typeof configJsonSeverUrl === "string";
|
configJsonSeverUrl = [configJsonSeverUrl];
|
||||||
|
}
|
||||||
|
configJsonSeverUrl = configJsonSeverUrl || [];
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
proxyNetworks,
|
proxyNetworks,
|
||||||
@@ -37,22 +39,20 @@ export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType)
|
|||||||
acceptDNS,
|
acceptDNS,
|
||||||
enablePortForward,
|
enablePortForward,
|
||||||
portForwardData,
|
portForwardData,
|
||||||
|
tcpWhitelist,
|
||||||
|
udpWhitelist,
|
||||||
|
tcpWhitelistEnable,
|
||||||
|
udpWhitelistEnable,
|
||||||
...otherConfig
|
...otherConfig
|
||||||
} = mainStore.config;
|
} = mainStore.config;
|
||||||
let writeServerUrl: Array<string> | string = serverUrl;
|
let writeServerUrl: Array<string> = serverUrl;
|
||||||
let writeCustomListenerData: Array<string> = (customListenerData || "").split("\n");
|
let writeCustomListenerData: Array<string> = (customListenerData || "").split("\n");
|
||||||
if (isArray) {
|
|
||||||
writeServerUrl = intersection(
|
writeServerUrl = intersection(
|
||||||
uniq([serverUrl, ...configJsonSeverUrl]).filter(boolean => boolean),
|
uniq([...serverUrl, ...configJsonSeverUrl]).filter(boolean => boolean),
|
||||||
mainStore.basePeers
|
mainStore.basePeers
|
||||||
);
|
);
|
||||||
}
|
|
||||||
if (isString && configJsonSeverUrl) {
|
|
||||||
writeServerUrl = intersection(
|
|
||||||
uniq([serverUrl, ...(configJsonSeverUrl as string).split(",")]).filter(boolean => boolean),
|
|
||||||
mainStore.basePeers
|
|
||||||
).join(",");
|
|
||||||
}
|
|
||||||
await writeTextFile(
|
await writeTextFile(
|
||||||
path,
|
path,
|
||||||
JSON.stringify({ serverUrl: writeServerUrl, enableCustomListener, customListenerData: writeCustomListenerData, ...otherConfig }, null, 4),
|
JSON.stringify({ serverUrl: writeServerUrl, enableCustomListener, customListenerData: writeCustomListenerData, ...otherConfig }, null, 4),
|
||||||
|
|||||||
+44
-44
@@ -6,55 +6,55 @@ import { BaseDirectory } from "@tauri-apps/api/path";
|
|||||||
import { exists } from "@tauri-apps/plugin-fs";
|
import { exists } from "@tauri-apps/plugin-fs";
|
||||||
|
|
||||||
const getWinIpBroadcastPid = async () => {
|
const getWinIpBroadcastPid = async () => {
|
||||||
const mainStore = useMainStore();
|
// const mainStore = useMainStore();
|
||||||
const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
// const pid = await invoke("search_pid_by_pname", { target_process_name: "WinIPBroadcast" });
|
||||||
mainStore.winipBcPid = (pid as number) || 0;
|
// mainStore.winipBcPid = (pid as number) || 0;
|
||||||
mainStore.$patch({
|
// mainStore.$patch({
|
||||||
winipBcStart: !!(mainStore.winipBcPid && mainStore.winipBcPid > 0)
|
// winipBcStart: !!(mainStore.winipBcPid && mainStore.winipBcPid > 0)
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const handleWinipBcStart = async () => {
|
export const handleWinipBcStart = async () => {
|
||||||
const mainStore = useMainStore();
|
// const mainStore = useMainStore();
|
||||||
if (!mainStore.winipBcStart) {
|
// if (!mainStore.winipBcStart) {
|
||||||
try {
|
// try {
|
||||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
// await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||||
const isExists = await exists("easytier/tool/WinIPBroadcast.exe", { baseDir: BaseDirectory.Resource });
|
// const isExists = await exists("easytier/tool/WinIPBroadcast.exe", { baseDir: BaseDirectory.Resource });
|
||||||
if (!isExists) {
|
// if (!isExists) {
|
||||||
ElMessage.error(`WinipBc不存在`);
|
// ElMessage.error(`WinipBc不存在`);
|
||||||
console.error(`WinipBc不存在`);
|
// console.error(`WinipBc不存在`);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
// const child = await Command.create("WinIPBroadcast", ["run"]).spawn();
|
||||||
mainStore.winipBcPid = child.pid || 0;
|
// mainStore.winipBcPid = child.pid || 0;
|
||||||
await getWinIpBroadcastPid();
|
// await getWinIpBroadcastPid();
|
||||||
if (mainStore.winipBcPid) {
|
// if (mainStore.winipBcPid) {
|
||||||
mainStore.$patch({
|
// mainStore.$patch({
|
||||||
winIpBcAutoStart: true
|
// winIpBcAutoStart: true
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
ElMessage.error(`WinipBc失败`);
|
// ElMessage.error(`WinipBc失败`);
|
||||||
}
|
// }
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
ElMessage.error(`WinipBc失败`);
|
// ElMessage.error(`WinipBc失败`);
|
||||||
console.error(err);
|
// console.error(err);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
// await invoke("stop_command", { child_id: mainStore.winipBcPid || 0 });
|
||||||
await getWinIpBroadcastPid();
|
// await getWinIpBroadcastPid();
|
||||||
if (mainStore.winipBcPid <= 0) {
|
// if (mainStore.winipBcPid <= 0) {
|
||||||
mainStore.$patch({
|
// mainStore.$patch({
|
||||||
winIpBcAutoStart: false
|
// winIpBcAutoStart: false
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initStartWinIpBroadcast = async () => {
|
export const initStartWinIpBroadcast = async () => {
|
||||||
const mainStore = useMainStore();
|
// const mainStore = useMainStore();
|
||||||
await getWinIpBroadcastPid();
|
// await getWinIpBroadcastPid();
|
||||||
// console.error(mainStore.winipBcStart, mainStore.winIpBcAutoStart)
|
// console.error(mainStore.winipBcStart, mainStore.winIpBcAutoStart)
|
||||||
if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) {
|
// if (mainStore.winIpBcAutoStart && !mainStore.winipBcStart) {
|
||||||
await handleWinipBcStart();
|
// await handleWinipBcStart();
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,5 +23,14 @@ export const getServerArgs = () => {
|
|||||||
if (mainStore.serverConfig.privateMode) {
|
if (mainStore.serverConfig.privateMode) {
|
||||||
args.push("--private-mode", "true");
|
args.push("--private-mode", "true");
|
||||||
}
|
}
|
||||||
|
const networkName = mainStore.serverConfig.privateNetworkName.trim();
|
||||||
|
if (networkName) {
|
||||||
|
args.push("--network-name", networkName);
|
||||||
|
}
|
||||||
|
const networkSecret = mainStore.serverConfig.privateNetworkPassword.trim();
|
||||||
|
if (networkSecret) {
|
||||||
|
args.push("--network-secret", networkSecret);
|
||||||
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-1
@@ -6,7 +6,8 @@
|
|||||||
//屏蔽右键菜单
|
//屏蔽右键菜单
|
||||||
document.addEventListener("contextmenu", (e: MouseEvent) => {
|
document.addEventListener("contextmenu", (e: MouseEvent) => {
|
||||||
const el = (e.target as HTMLElement);
|
const el = (e.target as HTMLElement);
|
||||||
if (import.meta.env.PROD && !el.classList.contains("el-input__inner") && !el.classList.contains("el-textarea__inner")) { // 所有输入框不禁用右键
|
if (import.meta.env.PROD && !el.classList.contains("el-input__inner") && !el.classList.contains("el-textarea__inner")
|
||||||
|
&& !el.classList.contains("allow-contextmenu")) { // 所有输入框不禁用右键
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+20
-17
@@ -3,7 +3,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"author": "leizi97",
|
"author": "leizi97",
|
||||||
"description": "A simple network initiator based on Easytier",
|
"description": "A simple network initiator based on Easytier",
|
||||||
"version": "1.4.7",
|
"version": "1.4.9",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||||
"build": "nuxt generate --dotenv env/.env.prod",
|
"build": "nuxt generate --dotenv env/.env.prod",
|
||||||
@@ -12,30 +12,33 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"@element-plus/nuxt": "1.1.3",
|
"@element-plus/nuxt": "1.1.4",
|
||||||
"@nuxtjs/tailwindcss": "6.13.2",
|
"@nuxtjs/tailwindcss": "6.13.2",
|
||||||
"@pinia/nuxt": "0.11.1",
|
"@pinia/nuxt": "0.11.1",
|
||||||
"@tauri-apps/api": "2.5.0",
|
"@tauri-apps/api": "2.7.0",
|
||||||
"@tauri-apps/cli": "2.5.0",
|
"@tauri-apps/cli": "2.7.1",
|
||||||
"@tauri-apps/plugin-cli": "^2.2.0",
|
"@tauri-apps/plugin-cli": "2.4.0",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.2.2",
|
"@tauri-apps/plugin-clipboard-manager": "2.3.0",
|
||||||
"@tauri-apps/plugin-dialog": "2.2.2",
|
"@tauri-apps/plugin-dialog": "2.3.1",
|
||||||
"@tauri-apps/plugin-fs": "2.3.0",
|
"@tauri-apps/plugin-fs": "2.4.1",
|
||||||
"@tauri-apps/plugin-log": "2.4.0",
|
"@tauri-apps/plugin-log": "2.6.0",
|
||||||
"@tauri-apps/plugin-shell": "2.2.1",
|
"@tauri-apps/plugin-shell": "2.3.0",
|
||||||
"@tauri-apps/plugin-window-state": "2.2.2",
|
"@tauri-apps/plugin-window-state": "2.4.0",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@vitejs/plugin-vue-jsx": "4.1.2",
|
"@vitejs/plugin-vue-jsx": "5.0.1",
|
||||||
"@vueuse/core": "12.7.0",
|
"@vueuse/core": "12.7.0",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"element-plus": "2.10.2",
|
"element-plus": "2.10.7",
|
||||||
"less": "4.2.1",
|
"less": "4.2.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"nuxt": "3.17.5",
|
"nuxt": "3.19.2",
|
||||||
"pinia": "3.0.3",
|
"pinia": "3.0.3",
|
||||||
"pinia-plugin-persistedstate": "4.3.0",
|
"pinia-plugin-persistedstate": "4.4.1",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
"prettier": "3.5.2",
|
"prettier": "3.6.2",
|
||||||
"prettier-plugin-tailwindcss": "0.6.13"
|
"prettier-plugin-tailwindcss": "0.6.14"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"is-ip": "^5.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,16 @@
|
|||||||
<CoreVersionWarning version="2.3.1" />
|
<CoreVersionWarning version="2.3.1" />
|
||||||
</div>
|
</div>
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
|
<div class="flex w-full flex-nowrap items-center gap-[5px] mb-[3px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.tcpWhitelistEnable">TCP端口白名单</ElCheckbox>
|
||||||
|
<ElInput class="flex-1" v-model="mainStore.config.tcpWhitelist" placeholder="支持单个端口(80)和范围(8000-9000)" />
|
||||||
|
<CoreVersionWarning version="2.4.2" />
|
||||||
|
</div>
|
||||||
|
<div class="flex w-full flex-nowrap items-center gap-[5px]">
|
||||||
|
<ElCheckbox v-model="mainStore.config.udpWhitelistEnable">UDP端口白名单</ElCheckbox>
|
||||||
|
<ElInput class="flex-1" v-model="mainStore.config.udpWhitelist" placeholder="支持单个端口(53)和范围(5000-6000)" />
|
||||||
|
<CoreVersionWarning version="2.4.2" />
|
||||||
|
</div>
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||||
<ElTooltip content="无法联机时,可以尝试开启这个选项">
|
<ElTooltip content="无法联机时,可以尝试开启这个选项">
|
||||||
|
|||||||
+204
-76
@@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ElTooltip content="请先停止自建服务和联机后再使用,否则内核被占用的情况下,无法进行内核更换">
|
<ElTooltip content="请先停止自建服务和联机后再使用,否则内核被占用的情况下,无法进行内核更换">
|
||||||
<ElBadge
|
<ElBadge
|
||||||
badge-class="!text-[9px] cursor-pointer"
|
badge-class="!text-[9px] cursor-pointer ml-auto"
|
||||||
:hidden="!haveNewCoreVersion"
|
:hidden="!haveNewCoreVersion"
|
||||||
:offset="[-5, 6]"
|
:offset="[-5, 6]"
|
||||||
@click.stop="handleCoreManagement"
|
@click.stop="handleCoreManagement"
|
||||||
@@ -68,6 +68,9 @@
|
|||||||
<ElSelect
|
<ElSelect
|
||||||
allow-create
|
allow-create
|
||||||
filterable
|
filterable
|
||||||
|
multiple
|
||||||
|
collapse-tags
|
||||||
|
collapse-tags-tooltip
|
||||||
placeholder="请选择服务器地址"
|
placeholder="请选择服务器地址"
|
||||||
default-first-option
|
default-first-option
|
||||||
v-model="mainStore.config.serverUrl"
|
v-model="mainStore.config.serverUrl"
|
||||||
@@ -75,14 +78,13 @@
|
|||||||
@change="handleServerUrlChange"
|
@change="handleServerUrlChange"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<div :class="mainStore.config.protocol && mainStore.config.protocol.length > 1 ? 'w-[120px]' : 'w-[80px]'">
|
<div :class="mainStore.config.protocol && mainStore.config.protocol.length > 1 ? 'w-[110px]' : 'w-[80px]'">
|
||||||
<ElSelect
|
<ElSelect
|
||||||
placeholder="协议"
|
placeholder="协议"
|
||||||
multiple
|
multiple
|
||||||
collapse-tags
|
collapse-tags
|
||||||
@click.stop
|
@click.stop
|
||||||
v-model="mainStore.config.protocol"
|
v-model="mainStore.config.protocol"
|
||||||
@change="handleServerUrlChange"
|
|
||||||
>
|
>
|
||||||
<ElOption
|
<ElOption
|
||||||
v-for="item in protocols"
|
v-for="item in protocols"
|
||||||
@@ -206,23 +208,40 @@
|
|||||||
label="局域网IP"
|
label="局域网IP"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex h-[20px] items-center gap-[3px]">
|
<div class="flex h-[22px] items-center gap-[3px]">
|
||||||
虚拟网IP
|
<div class="mr-[8px]">IP</div>
|
||||||
|
<ElSwitch
|
||||||
|
v-model="mainStore.config.dhcp"
|
||||||
|
inline-prompt
|
||||||
|
inactive-text="固定V4"
|
||||||
|
active-text="动态V4"
|
||||||
|
size="small"
|
||||||
|
></ElSwitch>
|
||||||
|
<ElTooltip>
|
||||||
|
<template #content>
|
||||||
|
<div>选填V6地址,可与IPv4一起使用以进行双栈操作</div>
|
||||||
|
<div>----------------------------------------</div>
|
||||||
|
<div>当前V6地址: {{ mainStore.config.ipv6 || "-" }}</div>
|
||||||
|
</template>
|
||||||
|
<ElButton
|
||||||
|
text
|
||||||
|
size="small"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="handleDealIpv6"
|
||||||
|
:type="mainStore.config.ipv6 ? 'success' : 'info'"
|
||||||
|
>
|
||||||
|
V6
|
||||||
|
</ElButton>
|
||||||
|
</ElTooltip>
|
||||||
|
<ElDivider direction="vertical" />
|
||||||
<ElButton
|
<ElButton
|
||||||
@click.stop="handleCopyIp"
|
@click.stop="handleCopyIp"
|
||||||
type="primary"
|
type="primary"
|
||||||
text
|
text
|
||||||
size="small"
|
size="small"
|
||||||
title="复制IP"
|
title="复制V4"
|
||||||
:icon="CopyDocument"
|
:icon="CopyDocument"
|
||||||
></ElButton>
|
></ElButton>
|
||||||
<ElSwitch
|
|
||||||
v-model="mainStore.config.dhcp"
|
|
||||||
inline-prompt
|
|
||||||
inactive-text="固定IP"
|
|
||||||
active-text="动态获取"
|
|
||||||
size="small"
|
|
||||||
></ElSwitch>
|
|
||||||
<!-- <ElTooltip content="对应命令行参数 --ipv4">
|
<!-- <ElTooltip content="对应命令行参数 --ipv4">
|
||||||
<ElIcon><QuestionFilled /></ElIcon>
|
<ElIcon><QuestionFilled /></ElIcon>
|
||||||
</ElTooltip> -->
|
</ElTooltip> -->
|
||||||
@@ -698,6 +717,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</ElDialog>
|
</ElDialog>
|
||||||
|
<ElDialog
|
||||||
|
width="95%"
|
||||||
|
top="30px"
|
||||||
|
append-to-body
|
||||||
|
:z-index="10"
|
||||||
|
class="!mb-0"
|
||||||
|
title="IPV6地址填写"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:show-close="false"
|
||||||
|
v-model="ipv6InputDialog.visible"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
v-model="mainStore.config.ipv6"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入IPV6地址"
|
||||||
|
></ElInput>
|
||||||
|
<template #footer>
|
||||||
|
<div class="text-right">
|
||||||
|
<ElButton
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleValidateIpv6"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</ElButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
@@ -734,9 +782,10 @@
|
|||||||
import { updateConfigJson, updateConfigJsonBounce } from "~/composables/configJson";
|
import { updateConfigJson, updateConfigJsonBounce } from "~/composables/configJson";
|
||||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { sortedUniq, uniq } from "lodash-es";
|
import { sortedUniq, uniq } from "lodash-es";
|
||||||
import { addQQGroup, supportProtocols, preventSleep, stopPreventSleep, ATJ, copyText, isValidWindowsFileName } from "~/utils";
|
import { addQQGroup, supportProtocols, preventSleep, stopPreventSleep, ATJ, copyText, isValidWindowsFileName, mixedArray } from "~/utils";
|
||||||
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
|
||||||
import { getServerArgs } from "@/composables/server";
|
import { getServerArgs } from "@/composables/server";
|
||||||
|
import { isIPv6 } from "is-ip";
|
||||||
|
|
||||||
let is_close = false;
|
let is_close = false;
|
||||||
const publicPeersLink = import.meta.env.VITE_PUBLIC_PEERS_URL;
|
const publicPeersLink = import.meta.env.VITE_PUBLIC_PEERS_URL;
|
||||||
@@ -781,7 +830,7 @@
|
|||||||
startLoading: false,
|
startLoading: false,
|
||||||
isStart: false,
|
isStart: false,
|
||||||
connectionSuccess: false,
|
connectionSuccess: false,
|
||||||
configJsonSeverUrl: "" // 本地保存一次,用于回填config.json
|
configJsonSeverUrl: [] // 本地保存一次,用于回填config.json
|
||||||
});
|
});
|
||||||
|
|
||||||
const configStart = reactive<{ list: Array<{ path: string; name: string }>; [key: string]: any }>({
|
const configStart = reactive<{ list: Array<{ path: string; name: string }>; [key: string]: any }>({
|
||||||
@@ -823,12 +872,54 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ipv6InputDialog = reactive<{ visible: boolean; [key: string]: any }>({
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDealIpv6 = async () => {
|
||||||
|
ipv6InputDialog.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleValidateIpv6 = () => {
|
||||||
|
mainStore.config.ipv6 = mainStore.config.ipv6?.trim() || "";
|
||||||
|
if (mainStore.config.ipv6 && !isIPv6(mainStore.config.ipv6)) {
|
||||||
|
ElMessage.error("请输入正确的IPV6地址");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ipv6InputDialog.visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
const handleCopyIp = async () => {
|
const handleCopyIp = async () => {
|
||||||
if (!mainStore.config.ipv4?.trim()) return;
|
const v6 = mainStore.config.ipv6?.trim();
|
||||||
if (data.isStart || !mainStore.config.dhcp) {
|
const v4 = mainStore.config.ipv4?.trim();
|
||||||
await copyText(mainStore.config.ipv4);
|
if (v6) {
|
||||||
|
const [err] = await ElConfirmPrimary("检测到您填写了IPV6地址,是否复制IPV6地址?", "提示", {
|
||||||
|
confirmButtonText: "复制IPV6",
|
||||||
|
cancelButtonText: "复制IPV4"
|
||||||
|
});
|
||||||
|
if (!err) {
|
||||||
|
await copyText(v6);
|
||||||
|
} else {
|
||||||
|
if (!v4) {
|
||||||
|
ElMessage.error("没有IPV4地址,无法复制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.isStart || !mainStore.config.dhcp) {
|
||||||
|
await copyText(v4);
|
||||||
|
} else {
|
||||||
|
await copyText(v4, "复制成功,联机后IP可能会变化");
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await copyText(mainStore.config.ipv4, "复制成功,联机后IP可能会变化");
|
if (!v4) {
|
||||||
|
ElMessage.error("没有IPV4地址,无法复制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.isStart || !mainStore.config.dhcp) {
|
||||||
|
await copyText(v4);
|
||||||
|
} else {
|
||||||
|
await copyText(v4, "复制成功,联机后IP可能会变化");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -850,30 +941,40 @@
|
|||||||
const newBasePeers = [...mainStore.basePeers];
|
const newBasePeers = [...mainStore.basePeers];
|
||||||
const idx = newBasePeers.indexOf(url);
|
const idx = newBasePeers.indexOf(url);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
if (mainStore.config.serverUrl === url) {
|
const selectIdx = mainStore.config.serverUrl.indexOf(url);
|
||||||
mainStore.config.serverUrl = "";
|
if (selectIdx >= 0) {
|
||||||
|
mainStore.config.serverUrl.splice(selectIdx, 1);
|
||||||
}
|
}
|
||||||
newBasePeers.splice(idx, 1);
|
newBasePeers.splice(idx, 1);
|
||||||
}
|
}
|
||||||
mainStore.basePeers = uniq([...newBasePeers]);
|
mainStore.basePeers = uniq([...newBasePeers]);
|
||||||
if (mainStore.basePeers.length > 0) {
|
if (mainStore.basePeers.length > 0 && mainStore.config.serverUrl.length <= 0) {
|
||||||
mainStore.config.serverUrl = mainStore.basePeers[0];
|
mainStore.config.serverUrl = [mainStore.basePeers[0]];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleServerUrlChange = () => {
|
const handleServerUrlChange = () => {
|
||||||
let inputProtocols: string | null = null;
|
let inputProtocols: string[] = [];
|
||||||
|
// console.log(mainStore.config.serverUrl);
|
||||||
for (const p of protocols) {
|
for (const p of protocols) {
|
||||||
if (mainStore.config.serverUrl.toLowerCase().startsWith(`${p}://`)) {
|
for (const url of mainStore.config.serverUrl) {
|
||||||
inputProtocols = p;
|
if (url.toLowerCase().startsWith(`${p}://`)) {
|
||||||
break;
|
inputProtocols.push(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inputProtocols) {
|
if (inputProtocols) {
|
||||||
mainStore.config.protocol = [inputProtocols];
|
mainStore.config.protocol = uniq([...mainStore.config.protocol, ...inputProtocols]);
|
||||||
mainStore.config.serverUrl = mainStore.config.serverUrl.slice(inputProtocols.length + 3);
|
mainStore.config.serverUrl = (mainStore.config.serverUrl || []).map(url => {
|
||||||
|
for (const p of protocols) {
|
||||||
|
if (url.toLowerCase().startsWith(`${p}://`)) {
|
||||||
|
return url.slice(inputProtocols.length + 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
mainStore.basePeers = uniq([mainStore.config.serverUrl, ...mainStore.basePeers]);
|
mainStore.basePeers = uniq([...mainStore.config.serverUrl, ...mainStore.basePeers]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const listenObj: { [key: string]: any } = {
|
const listenObj: { [key: string]: any } = {
|
||||||
@@ -1095,7 +1196,7 @@
|
|||||||
data.releaseList = [
|
data.releaseList = [
|
||||||
...list.flat().filter(el => {
|
...list.flat().filter(el => {
|
||||||
// console.log(el, el[0], el[2], el[3]); // el[3] 是prerelease bool值
|
// console.log(el, el[0], el[2], el[3]); // el[3] 是prerelease bool值
|
||||||
return el && el[0] && el[2] && !el[2].includes("gui") && (el[3] != 'true' || !el[3]);
|
return el && el[0] && el[2] && !el[2].includes("gui") && (el[3] != "true" || !el[3]);
|
||||||
})
|
})
|
||||||
] as any;
|
] as any;
|
||||||
coreManagementData.loading = false;
|
coreManagementData.loading = false;
|
||||||
@@ -1128,25 +1229,23 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const compatibleIpv6Listener = async () => {
|
// const compatibleIpv6Listener = async () => {
|
||||||
// ipv6监听在后续版本合并到customListenner里了,这里做兼容处理
|
// // ipv6监听在后续版本合并到customListenner里了,这里做兼容处理,去掉IPV6监听
|
||||||
if (mainStore.config.enableCustomListenerV6 && mainStore.config.customListenerV6Data) {
|
// const customListenerV4 = mainStore.config.customListenerData
|
||||||
const customListener = mainStore.config.customListenerV6Data.trim();
|
// .trim()
|
||||||
if (customListener) {
|
// .split("\n")
|
||||||
const customListenerV4 = mainStore.config.customListenerData
|
// .map(el => el.trim())
|
||||||
.trim()
|
// .filter(el => el);
|
||||||
.split("\n")
|
// const udpv6 = customListenerV4.indexOf("udp://[::]:11010")
|
||||||
.map(el => el.trim())
|
// const tcpv6 = customListenerV4.indexOf("tcp://[::]:11010")
|
||||||
.filter(el => el);
|
// if (udpv6 != -1) {
|
||||||
if (!customListenerV4.includes(customListener)) {
|
// customListenerV4.splice(udpv6, 1);
|
||||||
mainStore.config.customListenerData += `\n${customListener}`;
|
// }
|
||||||
}
|
// if (tcpv6 != -1) {
|
||||||
}
|
// customListenerV4.splice(tcpv6, 1);
|
||||||
}
|
// }
|
||||||
if (mainStore.config.enableCustomListenerV6) {
|
// mainStore.config.customListenerData = customListenerV4.join("\n");
|
||||||
mainStore.config.enableCustomListenerV6 = false;
|
// };
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const initConnectAfterStart = async () => {
|
const initConnectAfterStart = async () => {
|
||||||
if (mainStore.config.connectAfterStart && data.coreVersion) {
|
if (mainStore.config.connectAfterStart && data.coreVersion) {
|
||||||
@@ -1155,6 +1254,13 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 多选serverUrl兼容
|
||||||
|
const compatibleInitServerUrl = async () => {
|
||||||
|
if (typeof mainStore.config.serverUrl == "string") {
|
||||||
|
mainStore.config.serverUrl = [mainStore.config.serverUrl || ""];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const initGuiJson = async () => {
|
const initGuiJson = async () => {
|
||||||
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||||
const isExists = await exists(path, { baseDir: BaseDirectory.Resource });
|
const isExists = await exists(path, { baseDir: BaseDirectory.Resource });
|
||||||
@@ -1170,20 +1276,22 @@
|
|||||||
// const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
// const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
||||||
// console.log(resultStr);
|
// console.log(resultStr);
|
||||||
const guiJson = JSON.parse(guiJsonStr);
|
const guiJson = JSON.parse(guiJsonStr);
|
||||||
let saveServerUrl = "";
|
let saveServerUrl = [];
|
||||||
if (guiJson.serverUrl) {
|
if (guiJson.serverUrl) {
|
||||||
if (Array.isArray(guiJson.serverUrl)) {
|
if (Array.isArray(guiJson.serverUrl)) {
|
||||||
mainStore.basePeers = uniq([...guiJson.serverUrl, ...mainStore.basePeers]);
|
mainStore.basePeers = uniq([...guiJson.serverUrl, ...mainStore.basePeers]);
|
||||||
|
saveServerUrl = uniq([...guiJson.serverUrl]);
|
||||||
}
|
}
|
||||||
if (typeof guiJson.serverUrl === "string") {
|
if (typeof guiJson.serverUrl === "string") {
|
||||||
mainStore.basePeers = uniq([...guiJson.serverUrl.split(","), ...mainStore.basePeers]);
|
mainStore.basePeers = uniq([...guiJson.serverUrl.split(","), ...mainStore.basePeers]);
|
||||||
|
saveServerUrl = [mainStore.basePeers[0] || ""];
|
||||||
|
guiJson.serverUrl = guiJson.serverUrl ? guiJson.serverUrl.split(",") : [];
|
||||||
}
|
}
|
||||||
saveServerUrl = mainStore.basePeers[0] || "";
|
|
||||||
} else {
|
} else {
|
||||||
saveServerUrl = mainStore.basePeers.length > 0 ? mainStore.basePeers[0] || "" : "";
|
saveServerUrl = [mainStore.basePeers.length > 0 ? mainStore.basePeers[0] || "" : ""];
|
||||||
}
|
}
|
||||||
data.configJsonSeverUrl = guiJson.serverUrl;
|
data.configJsonSeverUrl = [...guiJson.serverUrl] as any;
|
||||||
if(guiJson.enableKcpProxy && guiJson.enableQuicProxy) {
|
if (guiJson.enableKcpProxy && guiJson.enableQuicProxy) {
|
||||||
// 如果同时开启kcp代理和quic代理,则禁用quic代理
|
// 如果同时开启kcp代理和quic代理,则禁用quic代理
|
||||||
guiJson.enableQuicProxy = false;
|
guiJson.enableQuicProxy = false;
|
||||||
}
|
}
|
||||||
@@ -1241,7 +1349,7 @@
|
|||||||
const logicalAppSize = {
|
const logicalAppSize = {
|
||||||
width: 340,
|
width: 340,
|
||||||
height: 305
|
height: 305
|
||||||
}
|
};
|
||||||
const scaleFactor = await appWindow.scaleFactor();
|
const scaleFactor = await appWindow.scaleFactor();
|
||||||
const size = new PhysicalSize(Math.ceil(logicalAppSize.width * scaleFactor), Math.ceil(logicalAppSize.height * scaleFactor));
|
const size = new PhysicalSize(Math.ceil(logicalAppSize.width * scaleFactor), Math.ceil(logicalAppSize.height * scaleFactor));
|
||||||
appWindow.setSize(size);
|
appWindow.setSize(size);
|
||||||
@@ -1251,16 +1359,16 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let logsTimer: NodeJS.Timeout | null = null;
|
let logsTimer: number | null = null;
|
||||||
let serverLogsTimer: NodeJS.Timeout | null = null;
|
let serverLogsTimer: number | null = null;
|
||||||
let cidrTimer: NodeJS.Timeout | null = null;
|
let cidrTimer: number | null = null;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await compatibleInitServerUrl();
|
||||||
await initGuiJson();
|
await initGuiJson();
|
||||||
await compatibleInitAutoStart();
|
await compatibleInitAutoStart();
|
||||||
// await initAutoStart();
|
// await initAutoStart();
|
||||||
// await initStartWinIpBroadcast(); // 对于三层tun而言,winipbroadcast没有作用,先禁用
|
// await initStartWinIpBroadcast(); // 对于三层tun而言,winipbroadcast没有作用,先禁用
|
||||||
await compatibleIpv6Listener();
|
|
||||||
await getCoreVersion();
|
await getCoreVersion();
|
||||||
await listenObj.listenThreadId();
|
await listenObj.listenThreadId();
|
||||||
await listenObj.listenServerThreadId();
|
await listenObj.listenServerThreadId();
|
||||||
@@ -1328,7 +1436,16 @@
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mainStore.config.serverUrl?.length <= 0) {
|
||||||
|
ElMessage.warning(`请至少选择一个服务器`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
// lodash-es 如何将两个数组的值混合 比如["tcp","udp"] [1,2]
|
||||||
|
// 混合后["tcp1","tcp2","udp1","udp2"]
|
||||||
|
if (mainStore.config.protocol?.length <= 0) {
|
||||||
|
ElMessage.warning(`请至少选择一个协议`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
if (mainStore.config.dhcp) {
|
if (mainStore.config.dhcp) {
|
||||||
args.push("-d");
|
args.push("-d");
|
||||||
}
|
}
|
||||||
@@ -1345,8 +1462,8 @@
|
|||||||
args.push("--ipv4", mainStore.config.ipv4.trim());
|
args.push("--ipv4", mainStore.config.ipv4.trim());
|
||||||
}
|
}
|
||||||
if (mainStore.config.serverUrl) {
|
if (mainStore.config.serverUrl) {
|
||||||
const formatUrl = mainStore.config.serverUrl.replace(/\\/g, "/");
|
const formatUrlArr = mainStore.config.serverUrl.map((url: string) => url.replace(/\\/g, "/"));
|
||||||
args.push("--peers", ...mainStore.config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
args.push("--peers", ...mixedArray(mainStore.config.protocol, formatUrlArr, "://"));
|
||||||
}
|
}
|
||||||
if (mainStore.config.enableCustomProtocol) {
|
if (mainStore.config.enableCustomProtocol) {
|
||||||
const includes = mainStore.config.protocol.includes(mainStore.config.customProtocol);
|
const includes = mainStore.config.protocol.includes(mainStore.config.customProtocol);
|
||||||
@@ -1373,9 +1490,7 @@
|
|||||||
args.push("-l", ...customListener);
|
args.push("-l", ...customListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mainStore.config.disbleListenner && mainStore.config.enableCustomListenerV6 && mainStore.config.customListenerV6Data) {
|
|
||||||
args.push("--ipv6-listener", mainStore.config.customListenerV6Data);
|
|
||||||
}
|
|
||||||
if (!mainStore.config.disbleListenner && !mainStore.config.enableCustomListener && mainStore.config.port) {
|
if (!mainStore.config.disbleListenner && !mainStore.config.enableCustomListener && mainStore.config.port) {
|
||||||
args.push("-l", mainStore.config.port);
|
args.push("-l", mainStore.config.port);
|
||||||
}
|
}
|
||||||
@@ -1425,16 +1540,16 @@
|
|||||||
args.push("--compression", mainStore.config.compression);
|
args.push("--compression", mainStore.config.compression);
|
||||||
}
|
}
|
||||||
if (mainStore.config.enableKcpProxy) {
|
if (mainStore.config.enableKcpProxy) {
|
||||||
args.push("--enable-kcp-proxy", 'true');
|
args.push("--enable-kcp-proxy", "true");
|
||||||
}
|
}
|
||||||
if (mainStore.config.disableKcpInput) {
|
if (mainStore.config.disableKcpInput) {
|
||||||
args.push("--disable-kcp-input", 'true');
|
args.push("--disable-kcp-input", "true");
|
||||||
}
|
}
|
||||||
if (mainStore.config.enableQuicProxy) {
|
if (mainStore.config.enableQuicProxy) {
|
||||||
args.push("--enable-quic-proxy", 'true');
|
args.push("--enable-quic-proxy", "true");
|
||||||
}
|
}
|
||||||
if (mainStore.config.disableQuicInput) {
|
if (mainStore.config.disableQuicInput) {
|
||||||
args.push("--disable-quic-input", 'true');
|
args.push("--disable-quic-input", "true");
|
||||||
}
|
}
|
||||||
if (mainStore.config.bindDeviceEnable) {
|
if (mainStore.config.bindDeviceEnable) {
|
||||||
args.push("--bind-device", "true");
|
args.push("--bind-device", "true");
|
||||||
@@ -1457,6 +1572,17 @@
|
|||||||
if (mainStore.config.privateMode) {
|
if (mainStore.config.privateMode) {
|
||||||
args.push("--private-mode", "true");
|
args.push("--private-mode", "true");
|
||||||
}
|
}
|
||||||
|
if (mainStore.config.ipv6 && !mainStore.config.disableIpv6) {
|
||||||
|
args.push("--ipv6", mainStore.config.ipv6.trim());
|
||||||
|
}
|
||||||
|
const tcpWhitelist = mainStore.config.tcpWhitelist.trim();
|
||||||
|
if (mainStore.config.tcpWhitelistEnable && tcpWhitelist) {
|
||||||
|
args.push("--tcp-whitelist", tcpWhitelist);
|
||||||
|
}
|
||||||
|
const udpWhitelist = mainStore.config.udpWhitelist.trim();
|
||||||
|
if (mainStore.config.udpWhitelistEnable && udpWhitelist) {
|
||||||
|
args.push("--udp-whitelist", udpWhitelist);
|
||||||
|
}
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1551,8 +1677,6 @@
|
|||||||
port,
|
port,
|
||||||
enableCustomListener,
|
enableCustomListener,
|
||||||
customListenerData,
|
customListenerData,
|
||||||
enableCustomListenerV6,
|
|
||||||
customListenerV6Data,
|
|
||||||
devName,
|
devName,
|
||||||
devNameValue,
|
devNameValue,
|
||||||
enableNetCardMetric,
|
enableNetCardMetric,
|
||||||
@@ -1587,8 +1711,6 @@
|
|||||||
port,
|
port,
|
||||||
enableCustomListener,
|
enableCustomListener,
|
||||||
customListenerData,
|
customListenerData,
|
||||||
enableCustomListenerV6,
|
|
||||||
customListenerV6Data,
|
|
||||||
devName,
|
devName,
|
||||||
devNameValue,
|
devNameValue,
|
||||||
enableNetCardMetric,
|
enableNetCardMetric,
|
||||||
@@ -1794,7 +1916,13 @@
|
|||||||
});
|
});
|
||||||
if (!err) {
|
if (!err) {
|
||||||
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
|
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
|
||||||
payload.config.serverUrl = payload?.config?.serverUrl?.trim() || mainStore.config.serverUrl;
|
payload.config.serverUrl = Array.isArray(payload?.config?.serverUrl)
|
||||||
|
? payload?.config?.serverUrl
|
||||||
|
: typeof payload?.config?.serverUrl == "string"
|
||||||
|
? [payload?.config?.serverUrl.split(",")]
|
||||||
|
: typeof mainStore.config.serverUrl == "string"
|
||||||
|
? [mainStore.config.serverUrl]
|
||||||
|
: [];
|
||||||
mainStore.$patch({
|
mainStore.$patch({
|
||||||
config: {
|
config: {
|
||||||
...mainStore.config,
|
...mainStore.config,
|
||||||
@@ -1803,7 +1931,7 @@
|
|||||||
});
|
});
|
||||||
ElMessage.success("导入成功");
|
ElMessage.success("导入成功");
|
||||||
importConfigData.visible = false;
|
importConfigData.visible = false;
|
||||||
mainStore.basePeers = uniq([mainStore.config.serverUrl, ...mainStore.basePeers].filter(el => el.trim()));
|
mainStore.basePeers = uniq([...(mainStore.config.serverUrl || []), ...mainStore.basePeers].filter(el => el.trim()));
|
||||||
} else {
|
} else {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if (err !== "cancel") {
|
if (err !== "cancel") {
|
||||||
|
|||||||
+126
-8
@@ -1,27 +1,145 @@
|
|||||||
<template>
|
<template>
|
||||||
<ElInput
|
<!-- <ElInput
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="17"
|
:rows="17"
|
||||||
v-model="data.log"
|
v-model="data.originLog"
|
||||||
resize="none"
|
resize="none"
|
||||||
readonly
|
readonly
|
||||||
placeholder="等待日志中,请先'启动联机'..."
|
placeholder="等待日志中,请先'启动联机'..."
|
||||||
/>
|
/> -->
|
||||||
|
<div
|
||||||
|
ref="logRef"
|
||||||
|
@scroll="handleScroll"
|
||||||
|
class="overflow-auto"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="!data.log || data.log.length <= 0"
|
||||||
|
class="p-[5px]"
|
||||||
|
>
|
||||||
|
<ElText type="info">等待日志中,请先'启动联机'...</ElText>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
v-for="item in data.log"
|
||||||
|
:key="item.id"
|
||||||
|
class="p-[5px]"
|
||||||
|
>
|
||||||
|
<div class="group/item flex items-center justify-start leading-[26px]">
|
||||||
|
<ElText
|
||||||
|
:closable="false"
|
||||||
|
:type="item.type"
|
||||||
|
>
|
||||||
|
{{ item.text }}
|
||||||
|
<ElTooltip
|
||||||
|
placement="right"
|
||||||
|
content="复制"
|
||||||
|
>
|
||||||
|
<ElButton
|
||||||
|
class="ml-[3px] !hidden w-fit group-hover/item:!inline-flex"
|
||||||
|
@click.stop="handleCopyLog(item.text)"
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
circle
|
||||||
|
plain
|
||||||
|
:icon="CopyDocument"
|
||||||
|
></ElButton>
|
||||||
|
</ElTooltip>
|
||||||
|
</ElText>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ElAffix
|
||||||
|
v-if="data.originLog"
|
||||||
|
class="w-full"
|
||||||
|
position="bottom"
|
||||||
|
:offset="10"
|
||||||
|
>
|
||||||
|
<div class="bg-(var(--el-color-primary)) mr-[10px] flex items-center justify-end">
|
||||||
|
<ElTooltip
|
||||||
|
content="复制全部"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<ElButton
|
||||||
|
@click.stop="handleCopyLog(data.originLog)"
|
||||||
|
type="info"
|
||||||
|
size="large"
|
||||||
|
circle
|
||||||
|
:icon="CopyDocument"
|
||||||
|
></ElButton>
|
||||||
|
</ElTooltip>
|
||||||
|
</div>
|
||||||
|
</ElAffix>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { CopyDocument } from "@element-plus/icons-vue";
|
||||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
import { reactive, onMounted, onBeforeUnmount, useTemplateRef, nextTick } from "vue";
|
||||||
const data = reactive({
|
import { copyText } from "~/utils";
|
||||||
log: ""
|
type LogItem = { id: string; text: string; type: "danger" | "info" | "warning" | "primary" };
|
||||||
|
const data = reactive<{ log: LogItem[]; originLog: string; autoScrollToBottom: boolean }>({
|
||||||
|
log: [],
|
||||||
|
originLog: "", // 原始日志
|
||||||
|
autoScrollToBottom: true // 是否允许自动滚动到底部
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logEl = useTemplateRef<HTMLDivElement>("logRef");
|
||||||
|
|
||||||
|
const scrollToBottom = () => {
|
||||||
|
if (data.autoScrollToBottom) {
|
||||||
|
logEl.value?.scrollTo({
|
||||||
|
top: logEl.value?.scrollHeight,
|
||||||
|
behavior: "smooth"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleScroll = () => {
|
||||||
|
if (logEl.value) {
|
||||||
|
const autoScrollToBottom = logEl.value.scrollTop + logEl.value.clientHeight >= logEl.value.scrollHeight;
|
||||||
|
data.autoScrollToBottom = autoScrollToBottom;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const listenStart = async () => {
|
const listenStart = async () => {
|
||||||
const unListen = await listen<string>("logs", event => {
|
const unListen = await listen<string>("logs", async event => {
|
||||||
data.log = event.payload || "";
|
const payload = event.payload || "";
|
||||||
|
if (data.originLog === payload) return;
|
||||||
|
data.originLog = payload;
|
||||||
|
data.log = payload
|
||||||
|
.split("\n")
|
||||||
|
.filter(text => text.trim())
|
||||||
|
.map((text, idx) => {
|
||||||
|
if (idx === 0) {
|
||||||
|
return { id: `${text}-${idx}`, text, type: "primary" };
|
||||||
|
}
|
||||||
|
const toLowerCaseText = text.toLocaleLowerCase();
|
||||||
|
return {
|
||||||
|
id: `${text}-${idx}`,
|
||||||
|
text,
|
||||||
|
type:
|
||||||
|
toLowerCaseText.includes("error") ||
|
||||||
|
toLowerCaseText.includes("fail") ||
|
||||||
|
toLowerCaseText.includes("failed") ||
|
||||||
|
toLowerCaseText.includes("exception") ||
|
||||||
|
toLowerCaseText.includes("err")
|
||||||
|
? "danger"
|
||||||
|
: toLowerCaseText.includes("warn")
|
||||||
|
? "warning"
|
||||||
|
: toLowerCaseText.includes("new peer connection")
|
||||||
|
? "primary"
|
||||||
|
: "info"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
await nextTick();
|
||||||
|
scrollToBottom();
|
||||||
});
|
});
|
||||||
return unListen;
|
return unListen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCopyLog = async (text: string) => {
|
||||||
|
await copyText(text, "复制记录成功");
|
||||||
|
};
|
||||||
|
|
||||||
let unlistenStart: UnlistenFn | null = null;
|
let unlistenStart: UnlistenFn | null = null;
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
unlistenStart = await listenStart();
|
unlistenStart = await listenStart();
|
||||||
|
|||||||
+34
-34
@@ -214,7 +214,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 字节数据排序函数
|
// 字节数据排序函数
|
||||||
const sortBytes = (a: any, b: any, field: string = 'rx_bytes'): number => {
|
const sortBytes = (a: any, b: any, field: string = "rx_bytes"): number => {
|
||||||
const parseBytes = (bytesStr: string): number => {
|
const parseBytes = (bytesStr: string): number => {
|
||||||
if (!bytesStr || bytesStr === "-" || bytesStr === "") {
|
if (!bytesStr || bytesStr === "-" || bytesStr === "") {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
|
|
||||||
// 统一转换为小写并去除空格
|
// 统一转换为小写并去除空格
|
||||||
const cleanStr = bytesStr.toLowerCase().trim();
|
const cleanStr = bytesStr.toLowerCase().trim();
|
||||||
|
|
||||||
// 使用正则表达式匹配数字和单位
|
// 使用正则表达式匹配数字和单位
|
||||||
const match = cleanStr.match(/^(\d+(?:\.\d+)?)\s*([a-z]*)$/);
|
const match = cleanStr.match(/^(\d+(?:\.\d+)?)\s*([a-z]*)$/);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
@@ -238,30 +238,30 @@
|
|||||||
|
|
||||||
// 根据单位转换为字节数
|
// 根据单位转换为字节数
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case 'b':
|
case "b":
|
||||||
case 'byte':
|
case "byte":
|
||||||
case 'bytes':
|
case "bytes":
|
||||||
case '':
|
case "":
|
||||||
return value;
|
return value;
|
||||||
case 'k':
|
case "k":
|
||||||
case 'kb':
|
case "kb":
|
||||||
case 'kib':
|
case "kib":
|
||||||
return value * 1024;
|
return value * 1024;
|
||||||
case 'm':
|
case "m":
|
||||||
case 'mb':
|
case "mb":
|
||||||
case 'mib':
|
case "mib":
|
||||||
return value * 1024 * 1024;
|
return value * 1024 * 1024;
|
||||||
case 'g':
|
case "g":
|
||||||
case 'gb':
|
case "gb":
|
||||||
case 'gib':
|
case "gib":
|
||||||
return value * 1024 * 1024 * 1024;
|
return value * 1024 * 1024 * 1024;
|
||||||
case 't':
|
case "t":
|
||||||
case 'tb':
|
case "tb":
|
||||||
case 'tib':
|
case "tib":
|
||||||
return value * 1024 * 1024 * 1024 * 1024;
|
return value * 1024 * 1024 * 1024 * 1024;
|
||||||
case 'p':
|
case "p":
|
||||||
case 'pb':
|
case "pb":
|
||||||
case 'pib':
|
case "pib":
|
||||||
return value * 1024 * 1024 * 1024 * 1024 * 1024;
|
return value * 1024 * 1024 * 1024 * 1024 * 1024;
|
||||||
default:
|
default:
|
||||||
return value; // 未知单位当作字节处理
|
return value; // 未知单位当作字节处理
|
||||||
@@ -305,11 +305,10 @@
|
|||||||
["tx_bytes", "传输"]
|
["tx_bytes", "传输"]
|
||||||
];
|
];
|
||||||
|
|
||||||
let timer: NodeJS.Timeout | null = null;
|
let timer: number | null = null;
|
||||||
|
|
||||||
const listenOutput = async () => {
|
const listenOutput = async () => {
|
||||||
const [error, member] = await ATJ(invoke<string>("get_members_by_cli"));
|
const [error, member] = await ATJ(invoke<string>("get_members_by_cli"));
|
||||||
// if(!member) return;
|
|
||||||
if (error) {
|
if (error) {
|
||||||
data.member = [];
|
data.member = [];
|
||||||
return "";
|
return "";
|
||||||
@@ -329,17 +328,18 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const peerInfo = parseCliInfo(member);
|
// const peerInfo = parseCliInfo(member);
|
||||||
peerInfo.forEach(value => {
|
// peerInfo.forEach(value => {
|
||||||
if (value.cost === "Local") {
|
// if (value.cost === "Local") {
|
||||||
value.cost = "本机";
|
// value.cost = "本机";
|
||||||
}
|
// }
|
||||||
if (value.ipv4 && value.ipv4.includes("/")) {
|
// if (value.ipv4 && value.ipv4.includes("/")) {
|
||||||
value.ipv4 = value.ipv4.split("/")[0];
|
// value.ipv4 = value.ipv4.split("/")[0];
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
// console.log(peerInfo)
|
// data.member = peerInfo;
|
||||||
data.member = peerInfo;
|
|
||||||
|
data.member = JSON.parse(member);
|
||||||
startTimer();
|
startTimer();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+86
-8
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-[10px] h-full">
|
<div class="flex h-full flex-col gap-[10px]">
|
||||||
<ElForm
|
<ElForm
|
||||||
size="small"
|
size="small"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<ElFormItem
|
<ElFormItem
|
||||||
label="白名单"
|
label="白名单"
|
||||||
prop="ServerWhiteList"
|
prop="ServerWhiteList"
|
||||||
class="full-label full-content overflow-hidden !flex flex-col h-full !mb-[0]"
|
class="full-label full-content !mb-[0] !flex h-full flex-col overflow-hidden"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
@@ -31,7 +31,12 @@
|
|||||||
placement="top"
|
placement="top"
|
||||||
content="启用后,不允许使用了与本网络不同的房间名和密码的节点通过本节点进行握手或中转"
|
content="启用后,不允许使用了与本网络不同的房间名和密码的节点通过本节点进行握手或中转"
|
||||||
>
|
>
|
||||||
<ElCheckbox v-model="mainStore.serverConfig.privateMode">私有模式</ElCheckbox>
|
<ElCheckbox
|
||||||
|
@click.stop="handlePrivateModeClick"
|
||||||
|
:model-value="mainStore.serverConfig.privateMode"
|
||||||
|
>
|
||||||
|
私有模式
|
||||||
|
</ElCheckbox>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
<ElTooltip
|
<ElTooltip
|
||||||
placement="top"
|
placement="top"
|
||||||
@@ -42,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="h-full w-full flex flex-col overflow-hidden">
|
<div class="flex h-full w-full flex-col overflow-hidden">
|
||||||
<div class="flex-1 overflow-auto">
|
<div class="flex-1 overflow-auto">
|
||||||
<ElInput
|
<ElInput
|
||||||
:disabled="!mainStore.serverConfig.enableWhiteList"
|
:disabled="!mainStore.serverConfig.enableWhiteList"
|
||||||
@@ -76,6 +81,58 @@
|
|||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ElDialog
|
||||||
|
v-model="privateModeDialogData.visible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
title="私有模式"
|
||||||
|
:show-close="false"
|
||||||
|
width="300px"
|
||||||
|
>
|
||||||
|
<ElAlert
|
||||||
|
type="primary"
|
||||||
|
:closable="false"
|
||||||
|
>
|
||||||
|
建议为服务器设置一个房间名和密码
|
||||||
|
</ElAlert>
|
||||||
|
<div class="h-[15px]"></div>
|
||||||
|
<ElForm
|
||||||
|
:model="mainStore.serverConfig"
|
||||||
|
label-position="top"
|
||||||
|
>
|
||||||
|
<ElFormItem
|
||||||
|
label="房间名"
|
||||||
|
prop="privateNetworkName"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
clearable
|
||||||
|
placeholder="请输入房间名 (默认为default)"
|
||||||
|
v-model="mainStore.serverConfig.privateNetworkName"
|
||||||
|
></ElInput>
|
||||||
|
</ElFormItem>
|
||||||
|
<ElFormItem
|
||||||
|
label="密码"
|
||||||
|
prop="privateNetworkPassword"
|
||||||
|
>
|
||||||
|
<ElInput
|
||||||
|
clearable
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
placeholder="请输入密码 (可选)"
|
||||||
|
v-model="mainStore.serverConfig.privateNetworkPassword"
|
||||||
|
></ElInput>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton
|
||||||
|
type="primary"
|
||||||
|
@click="handlePrivateModeDialogConfirm"
|
||||||
|
>
|
||||||
|
继续启用
|
||||||
|
</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
|
||||||
<ElInput
|
<ElInput
|
||||||
placeholder="服务器日志"
|
placeholder="服务器日志"
|
||||||
:model-value="data.log"
|
:model-value="data.log"
|
||||||
@@ -87,13 +144,14 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
import { reactive, onMounted, onBeforeUnmount, useTemplateRef, nextTick } from "vue";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||||
import { getServerArgs } from "@/composables/server";
|
import { getServerArgs } from "@/composables/server";
|
||||||
import { dataSubscribe } from "@/composables/windows";
|
import { dataSubscribe } from "@/composables/windows";
|
||||||
|
import { ElMessage, type FormInstance } from "element-plus";
|
||||||
|
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
log: "",
|
log: "",
|
||||||
@@ -125,10 +183,30 @@
|
|||||||
|
|
||||||
const hanldeClickStart = async () => {
|
const hanldeClickStart = async () => {
|
||||||
data.loading = true;
|
data.loading = true;
|
||||||
const args = getServerArgs();
|
const args = getServerArgs();
|
||||||
await appWindow.emitTo("main", "startStopServer", { args });
|
await appWindow.emitTo("main", "startStopServer", { args });
|
||||||
};
|
};
|
||||||
|
|
||||||
dataSubscribe();
|
// const privateModeDialogFormEl = useTemplateRef<FormInstance>("privateModeDialogFormRef");
|
||||||
|
|
||||||
|
const privateModeDialogData = reactive({
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const handlePrivateModeClick = async () => {
|
||||||
|
if (mainStore.serverConfig.privateMode) {
|
||||||
|
mainStore.serverConfig.privateMode = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
privateModeDialogData.visible = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePrivateModeDialogConfirm = async () => {
|
||||||
|
privateModeDialogData.visible = false;
|
||||||
|
mainStore.serverConfig.privateMode = true;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
dataSubscribe();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Generated
+2418
-3244
File diff suppressed because it is too large
Load Diff
Generated
+1472
-1495
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.4.7"
|
version = "1.4.9"
|
||||||
homepage = "https://github.com/EasyTier/EasyTier"
|
homepage = "https://github.com/EasyTier/EasyTier"
|
||||||
repository = "https://github.com/EasyTier/EasytierGame"
|
repository = "https://github.com/EasyTier/EasytierGame"
|
||||||
description = "A simple network initiator based on Easytier"
|
description = "A simple network initiator based on Easytier"
|
||||||
@@ -18,7 +18,7 @@ name = "app_lib"
|
|||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.2.0", features = [] }
|
tauri-build = { version = "2.3.1", features = [] }
|
||||||
# prost-build = "0.13.2"
|
# prost-build = "0.13.2"
|
||||||
|
|
||||||
[target.x86_64-pc-windows-msvc.build-dependencies]
|
[target.x86_64-pc-windows-msvc.build-dependencies]
|
||||||
@@ -28,34 +28,34 @@ thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = f
|
|||||||
serde_json = "1.0.137"
|
serde_json = "1.0.137"
|
||||||
serde = { version = "1.0.217", features = ["derive"] }
|
serde = { version = "1.0.217", features = ["derive"] }
|
||||||
log = "0.4.26"
|
log = "0.4.26"
|
||||||
tauri = { version = "2.5.1", features = [ "protocol-asset",
|
tauri = { version = "2.7.0", features = [ "protocol-asset",
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
"image-png",
|
"image-png",
|
||||||
"image-ico"
|
"image-ico"
|
||||||
] }
|
] }
|
||||||
|
|
||||||
tauri-plugin-log = "2.3.1"
|
tauri-plugin-log = "2.6.0"
|
||||||
tauri-plugin-shell = "2.2.1"
|
tauri-plugin-shell = "2.3.0"
|
||||||
reqwest = { version = "0.12.12", features = ["json"] }
|
reqwest = { version = "0.12.12", features = ["json"] }
|
||||||
zip = "2.2.3"
|
zip = "2.2.3"
|
||||||
sysinfo = '0.33.1'
|
sysinfo = '0.33.1'
|
||||||
# planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
|
# planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
|
||||||
whoami = "1.5.2"
|
whoami = "1.5.2"
|
||||||
tauri-plugin-fs = "2.3.0"
|
tauri-plugin-fs = "2.4.1"
|
||||||
tauri-plugin-clipboard-manager = "2.2.2"
|
tauri-plugin-clipboard-manager = "2.3.0"
|
||||||
rand = "0.9.0"
|
rand = "0.9.0"
|
||||||
tokio = { version = "1.45.1", features = ["process"] }
|
tokio = { version = "1.45.1", features = ["process"] }
|
||||||
tauri-plugin-dialog = "2.2.2"
|
tauri-plugin-dialog = "2.3.1"
|
||||||
# prost = "0.13"
|
# prost = "0.13"
|
||||||
# prost-types = "0.13"
|
# prost-types = "0.13"
|
||||||
hashbrown = "0.15.2"
|
hashbrown = "0.15.2"
|
||||||
# futures-util = "0.3"
|
# futures-util = "0.3"
|
||||||
|
|
||||||
[dependencies.windows]
|
[dependencies.windows]
|
||||||
version = "0.58.0"
|
version = "0.61.3"
|
||||||
features = ["Win32_System_TaskScheduler", "Win32_System_Com", "Win32_System_Power", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"]
|
features = ["Win32_System_TaskScheduler", "Win32_System_Com", "Win32_System_Power", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"]
|
||||||
|
|
||||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||||
tauri-plugin-cli = "2.2.0"
|
tauri-plugin-cli = "2.4.0"
|
||||||
tauri-plugin-single-instance = "2.2.4"
|
tauri-plugin-single-instance = "2.3.2"
|
||||||
tauri-plugin-window-state = "2.2.2"
|
tauri-plugin-window-state = "2.4.0"
|
||||||
|
|||||||
@@ -9,16 +9,13 @@
|
|||||||
"enableCustomListener": true,
|
"enableCustomListener": true,
|
||||||
"customListenerData": [
|
"customListenerData": [
|
||||||
"tcp://0.0.0.0:11010",
|
"tcp://0.0.0.0:11010",
|
||||||
"udp://0.0.0.0:11010",
|
"udp://0.0.0.0:11010"
|
||||||
"tcp://[::]:11010"
|
|
||||||
],
|
],
|
||||||
"networkName": "", //房间名
|
"networkName": "", //房间名
|
||||||
"networkPassword": "", //房间密码
|
"networkPassword": "", //房间密码
|
||||||
"hostname": "", //主机名
|
"hostname": "", //主机名
|
||||||
"ipv4": "", // 虚拟IP地址
|
"ipv4": "", // 虚拟IP地址
|
||||||
"disableIpv6": false, // 禁用ipv6
|
"disableIpv6": false, // 禁用ipv6
|
||||||
"enableCustomListenerV6": true, // 启用ipv6监听
|
|
||||||
"customListenerV6Data": "udp://[::]:11010", // ipv6监听地址
|
|
||||||
"disbleListenner": false, // 禁用监听
|
"disbleListenner": false, // 禁用监听
|
||||||
"disableEncryption": false, // 禁用加密
|
"disableEncryption": false, // 禁用加密
|
||||||
"enablExitNode": false, // 启用出口节点
|
"enablExitNode": false, // 启用出口节点
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+10
-1
@@ -13,7 +13,7 @@ use sysinfo::System;
|
|||||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||||
use tauri::Emitter;
|
use tauri::Emitter;
|
||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
use windows::core::{Interface, BSTR, VARIANT};
|
use windows::core::{Interface, BSTR};
|
||||||
use windows::Win32::Foundation::VARIANT_BOOL;
|
use windows::Win32::Foundation::VARIANT_BOOL;
|
||||||
use windows::Win32::NetworkManagement::IpHelper::{
|
use windows::Win32::NetworkManagement::IpHelper::{
|
||||||
GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH,
|
GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH,
|
||||||
@@ -21,6 +21,7 @@ use windows::Win32::NetworkManagement::IpHelper::{
|
|||||||
use windows::Win32::Networking::WinSock::AF_UNSPEC;
|
use windows::Win32::Networking::WinSock::AF_UNSPEC;
|
||||||
use windows::Win32::System::Com::*;
|
use windows::Win32::System::Com::*;
|
||||||
use windows::Win32::System::TaskScheduler::*;
|
use windows::Win32::System::TaskScheduler::*;
|
||||||
|
use windows::Win32::System::Variant::VARIANT;
|
||||||
// use std::ffi::CStr;
|
// use std::ffi::CStr;
|
||||||
|
|
||||||
use windows::Win32::System::Power::SetThreadExecutionState;
|
use windows::Win32::System::Power::SetThreadExecutionState;
|
||||||
@@ -272,6 +273,8 @@ struct MyResponse {
|
|||||||
async fn get_members_by_cli() -> String {
|
async fn get_members_by_cli() -> String {
|
||||||
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
|
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
|
||||||
match tokioCommand::new(&cli_path)
|
match tokioCommand::new(&cli_path)
|
||||||
|
.arg("-o")
|
||||||
|
.arg("json")
|
||||||
.arg("peer")
|
.arg("peer")
|
||||||
.arg("list")
|
.arg("list")
|
||||||
.creation_flags(0x08000000)
|
.creation_flags(0x08000000)
|
||||||
@@ -350,6 +353,12 @@ async fn download_easytier_zip(
|
|||||||
|
|
||||||
let path = path::Path::new(&file_path);
|
let path = path::Path::new(&file_path);
|
||||||
println!("download easytier to {}", path.display());
|
println!("download easytier to {}", path.display());
|
||||||
|
if path.exists() {
|
||||||
|
match fs::remove_file(path) {
|
||||||
|
Ok(_) => println!("删除上次下载的Zip文件成功"),
|
||||||
|
Err(_) => log::error!("删除上次下载Zip的文件失败"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut file = match File::create(&path) {
|
let mut file = match File::create(&path) {
|
||||||
Err(why) => panic!("couldn't create {}", why),
|
Err(why) => panic!("couldn't create {}", why),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||||
"productName": "easytier-game",
|
"productName": "easytier-game",
|
||||||
"version": "1.4.7",
|
"version": "1.4.9",
|
||||||
"identifier": "com.tauri.easytier-game",
|
"identifier": "com.tauri.easytier-game",
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "easytier-game 1.4.7",
|
"title": "easytier-game 1.4.9",
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"minWidth": 340,
|
"minWidth": 340,
|
||||||
"width": 340,
|
"width": 340,
|
||||||
|
|||||||
+17
-7
@@ -7,20 +7,23 @@ const store = defineStore("main", {
|
|||||||
return {
|
return {
|
||||||
config: {
|
config: {
|
||||||
protocol: ["tcp"], // 网络协议
|
protocol: ["tcp"], // 网络协议
|
||||||
serverUrl: "public.easytier.top:11010",
|
serverUrl: ["public.easytier.top:11010"],
|
||||||
networkName: "",
|
networkName: "",
|
||||||
networkPassword: "",
|
networkPassword: "",
|
||||||
hostname: "",
|
hostname: "",
|
||||||
ipv4: "",
|
ipv4: "",
|
||||||
|
ipv6:"",
|
||||||
|
tcpWhitelistEnable: false, // tcp端口白名单
|
||||||
|
udpWhitelistEnable: false, // udp端口白名单
|
||||||
|
tcpWhitelist: "", // tcp端口白名单
|
||||||
|
udpWhitelist: "", // udp端口白名单
|
||||||
proxyNetworks: "", // 子网代理
|
proxyNetworks: "", // 子网代理
|
||||||
autoStart: false, // 是否自动启动
|
autoStart: false, // 是否自动启动
|
||||||
connectAfterStart: false, //软件打开后,是否自动连接
|
connectAfterStart: false, //软件打开后,是否自动连接
|
||||||
disableIpv6: false, // 是否禁用IPv6
|
disableIpv6: false, // 是否禁用IPv6
|
||||||
port: "11010", // 监听端口号
|
port: "0", // 监听端口号
|
||||||
enableCustomListener: true, // 是否自定义监听
|
enableCustomListener: true, // 是否自定义监听
|
||||||
enableCustomListenerV6: true, // 是否自定义IPV6监听
|
customListenerData: "tcp://0.0.0.0:11010\nudp://0.0.0.0:11010", // 自定义监听地址
|
||||||
customListenerV6Data: "udp://[::]:11010", //自定义ipv6监
|
|
||||||
customListenerData: "tcp://0.0.0.0:11010\nudp://0.0.0.0:11010\ntcp://[::]:11010", // 自定义监听地址
|
|
||||||
disbleListenner: false, // 是否禁用监听
|
disbleListenner: false, // 是否禁用监听
|
||||||
disableEncryption: false, // 是否禁用加密
|
disableEncryption: false, // 是否禁用加密
|
||||||
multiThread: false, //使用多线程
|
multiThread: false, //使用多线程
|
||||||
@@ -61,6 +64,8 @@ const store = defineStore("main", {
|
|||||||
autoStart: false, //随软件自启
|
autoStart: false, //随软件自启
|
||||||
port: "11010", // 服务器端口
|
port: "11010", // 服务器端口
|
||||||
privateMode: false, //是否启用私有模式
|
privateMode: false, //是否启用私有模式
|
||||||
|
privateNetworkName: "", // 私有模式房间名
|
||||||
|
privateNetworkPassword: "", // 私有模式密码
|
||||||
},
|
},
|
||||||
cidrEnable: false,
|
cidrEnable: false,
|
||||||
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
|
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
|
||||||
@@ -94,6 +99,7 @@ const store = defineStore("main", {
|
|||||||
"config.networkPassword",
|
"config.networkPassword",
|
||||||
"config.hostname",
|
"config.hostname",
|
||||||
"config.ipv4",
|
"config.ipv4",
|
||||||
|
"config.ipv6",
|
||||||
"config.proxyNetworks",
|
"config.proxyNetworks",
|
||||||
"config.autoStart",
|
"config.autoStart",
|
||||||
"config.connectAfterStart",
|
"config.connectAfterStart",
|
||||||
@@ -115,6 +121,10 @@ const store = defineStore("main", {
|
|||||||
"config.enableNetCardMetric",
|
"config.enableNetCardMetric",
|
||||||
"config.netCardMetricValue",
|
"config.netCardMetricValue",
|
||||||
"config.port",
|
"config.port",
|
||||||
|
"config.tcpWhitelist",
|
||||||
|
"config.udpWhitelist",
|
||||||
|
"config.tcpWhitelistEnable",
|
||||||
|
"config.udpWhitelistEnable",
|
||||||
|
|
||||||
"config.enablePortForward",
|
"config.enablePortForward",
|
||||||
"config.portForwardData",
|
"config.portForwardData",
|
||||||
@@ -122,8 +132,6 @@ const store = defineStore("main", {
|
|||||||
"config.disbleListenner",
|
"config.disbleListenner",
|
||||||
"config.enableCustomListener",
|
"config.enableCustomListener",
|
||||||
"config.customListenerData",
|
"config.customListenerData",
|
||||||
"config.enableCustomListenerV6",
|
|
||||||
"config.customListenerV6Data",
|
|
||||||
|
|
||||||
"config.enableCustomProtocol",
|
"config.enableCustomProtocol",
|
||||||
"config.customProtocol",
|
"config.customProtocol",
|
||||||
@@ -149,6 +157,8 @@ const store = defineStore("main", {
|
|||||||
"serverConfig.serverWhiteList",
|
"serverConfig.serverWhiteList",
|
||||||
"serverConfig.port",
|
"serverConfig.port",
|
||||||
"serverConfig.privateMode",
|
"serverConfig.privateMode",
|
||||||
|
"serverConfig.privateNetworkName",
|
||||||
|
"serverConfig.privateNetworkPassword",
|
||||||
|
|
||||||
"cidrEnable",
|
"cidrEnable",
|
||||||
"proxyForwardBySystem",
|
"proxyForwardBySystem",
|
||||||
|
|||||||
+33
-9
@@ -2,11 +2,17 @@ import { invoke } from "@tauri-apps/api/core";
|
|||||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { open } from "@tauri-apps/plugin-shell";
|
import { open } from "@tauri-apps/plugin-shell";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
|
import { flatMap, map } from "lodash-es";
|
||||||
|
|
||||||
export const ENV = import.meta.env;
|
export const ENV = import.meta.env;
|
||||||
|
|
||||||
|
export const mixedArray = (a: Array<string>, b: Array<string>, split:string="") => {
|
||||||
|
return flatMap(a, protocol => map(b, port => `${protocol}${split}${port}`));
|
||||||
|
};
|
||||||
|
|
||||||
//防抖
|
//防抖
|
||||||
export const bounce = (time = 3000) => {
|
export const bounce = (time = 3000) => {
|
||||||
let bounceTimer: NodeJS.Timeout | null = null;
|
let bounceTimer: number | null = null;
|
||||||
return (cb: Function) => {
|
return (cb: Function) => {
|
||||||
bounceTimer && clearTimeout(bounceTimer);
|
bounceTimer && clearTimeout(bounceTimer);
|
||||||
bounceTimer = setTimeout(() => {
|
bounceTimer = setTimeout(() => {
|
||||||
@@ -67,13 +73,13 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const _supportProtocols = ["tcp", "udp", "ws", "wss", "quic"];
|
const _supportProtocols = ["tcp", "udp", "ws", "wss"];
|
||||||
|
|
||||||
export const supportProtocols = () => {
|
export const supportProtocols = () => {
|
||||||
return _supportProtocols.slice();
|
return _supportProtocols.slice();
|
||||||
};
|
};
|
||||||
|
|
||||||
let _prevent_timer: NodeJS.Timeout | null = null;
|
let _prevent_timer: number | null = null;
|
||||||
let _prevent_timer_count = 15; // 秒
|
let _prevent_timer_count = 15; // 秒
|
||||||
export const preventSleep = () => {
|
export const preventSleep = () => {
|
||||||
_prevent_timer && clearInterval(_prevent_timer);
|
_prevent_timer && clearInterval(_prevent_timer);
|
||||||
@@ -127,17 +133,35 @@ export const parseCliInfo = (content: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function isValidWindowsFileName(name: string) {
|
export function isValidWindowsFileName(name: string) {
|
||||||
if(name.length > 255) return false;
|
if (name.length > 255) return false;
|
||||||
const reserved_names = [
|
const reserved_names = [
|
||||||
"CON", "PRN", "AUX", "NUL",
|
"CON",
|
||||||
"COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
|
"PRN",
|
||||||
"LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"
|
"AUX",
|
||||||
|
"NUL",
|
||||||
|
"COM1",
|
||||||
|
"COM2",
|
||||||
|
"COM3",
|
||||||
|
"COM4",
|
||||||
|
"COM5",
|
||||||
|
"COM6",
|
||||||
|
"COM7",
|
||||||
|
"COM8",
|
||||||
|
"COM9",
|
||||||
|
"LPT1",
|
||||||
|
"LPT2",
|
||||||
|
"LPT3",
|
||||||
|
"LPT4",
|
||||||
|
"LPT5",
|
||||||
|
"LPT6",
|
||||||
|
"LPT7",
|
||||||
|
"LPT8",
|
||||||
|
"LPT9"
|
||||||
];
|
];
|
||||||
if(reserved_names.includes(name.toUpperCase())) {
|
if (reserved_names.includes(name.toUpperCase())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return /^[^<>:"/\\|?*\x00-\x1F]+[^<>:"/\\|?*\x00-\x1F .]$/g.test(name);
|
return /^[^<>:"/\\|?*\x00-\x1F]+[^<>:"/\\|?*\x00-\x1F .]$/g.test(name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const addQQGroup = () => {
|
export const addQQGroup = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user