Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e6f8d602e | ||
|
|
92d25ab907 | ||
|
|
1c8314c6fa | ||
|
|
b352d49e0b | ||
|
|
44183b1ad2 | ||
|
|
fe1bc6f89e | ||
|
|
be59e56bd1 | ||
|
|
f556e17f85 | ||
|
|
c7170967ec | ||
|
|
1801082601 | ||
|
|
189f3467c3 | ||
|
|
2eb69352f7 | ||
|
|
9ea0eea0ac | ||
|
|
c572925a0d | ||
|
|
e4fbaa921c | ||
|
|
76d29cbeeb | ||
|
|
6f57a866a4 | ||
|
|
fe9f1c01b7 | ||
|
|
43d681e888 | ||
|
|
d402f107b0 | ||
|
|
74fbfed7be | ||
|
|
5b9eed9520 | ||
|
|
1ae122ab2a | ||
|
|
3db962f3dc | ||
|
|
a7f1292067 | ||
|
|
022e71de01 | ||
|
|
5350af87ed | ||
|
|
5d6b7bdf13 | ||
|
|
5740bd08c1 |
@@ -41,6 +41,11 @@ Releases: [https://github.com/EasyTier/EasytierGame/releases](https://github.c
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
- 1.1.8 新增了 生成 easytier/config.json 的功能 会将一部分配置写入到 config.json 文件中,方便用户自定义配置,你可以在高级设置里启用和关闭这个功能(默认关闭)
|
||||||
|
**需要注意的是,如果config.json存在,每次启动easytierGame默认按照config.json的配置为准**
|
||||||
|
**解压zip后你可以查看 easytier/config_template.json 里的注释进行配置**
|
||||||
|

|
||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
- 基于easytier组网工具开发,界面清晰简单
|
- 基于easytier组网工具开发,界面清晰简单
|
||||||
|
|||||||
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,16 @@
|
|||||||
|
import { BaseDirectory, writeTextFile } from "@tauri-apps/plugin-fs";
|
||||||
|
import useMainStore from "@/stores/index";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
export const updateConfigJson = async () => {
|
||||||
|
|
||||||
|
const mainStore = useMainStore();
|
||||||
|
const path = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||||
|
try {
|
||||||
|
const { proxyNetworks, autoStart, relayAllPeerrpc, coonectAfterStart, multiThread, enablExitNode, useSmoltcp, saveErrorLog, logLevel, ...otherConfig } =
|
||||||
|
mainStore.config;
|
||||||
|
await writeTextFile(path, JSON.stringify(otherConfig, null, 4), { baseDir: BaseDirectory.Resource });
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
ElMessage.error(`更新config.json失败`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +1,42 @@
|
|||||||
import { type UnlistenFn } from "@tauri-apps/api/event";
|
import { type UnlistenFn } from "@tauri-apps/api/event";
|
||||||
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window } from "@tauri-apps/api/window";
|
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window, currentMonitor } from "@tauri-apps/api/window";
|
||||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||||
import type { WebviewLabel, WebviewOptions, } from "@tauri-apps/api/webview";
|
import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
|
||||||
export default async (
|
export default async (
|
||||||
label: WebviewLabel,
|
label: WebviewLabel,
|
||||||
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
||||||
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
|
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
|
||||||
beforeCloseFunc?: () => void | null
|
beforeCloseFunc?: () => void | null
|
||||||
) => {
|
) => {
|
||||||
let defaultOpts = {
|
|
||||||
parent: undefined,
|
|
||||||
closable: true,
|
|
||||||
resizable: true,
|
|
||||||
decorations: true,
|
|
||||||
maximizable: false,
|
|
||||||
minimizable: false,
|
|
||||||
x: 0,
|
|
||||||
y: 0
|
|
||||||
};
|
|
||||||
const appWindow = getCurrentWindow();
|
|
||||||
if (appWindow) {
|
|
||||||
const appSize = await appWindow.outerSize();
|
|
||||||
const factor = await appWindow.scaleFactor();
|
|
||||||
const appPosition = await appWindow.outerPosition();
|
|
||||||
const logicalPosition = new PhysicalPosition(appPosition.x + appSize.width, appPosition.y).toLogical(factor);
|
|
||||||
defaultOpts.parent = appWindow as any;
|
|
||||||
defaultOpts.x = logicalPosition.x;
|
|
||||||
defaultOpts.y = logicalPosition.y;
|
|
||||||
}
|
|
||||||
let unListenlogClose: UnlistenFn | null = null;
|
let unListenlogClose: UnlistenFn | null = null;
|
||||||
let unlistenLogCreated: UnlistenFn | null = null;
|
let unlistenLogCreated: UnlistenFn | null = null;
|
||||||
let dialog = await WebviewWindow.getByLabel(label);
|
let dialog = await WebviewWindow.getByLabel(label);
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
dialog = new WebviewWindow(label, {...defaultOpts, ...options});
|
let defaultOpts: {[key:string]: any, parent: Window | undefined} = {
|
||||||
|
parent: undefined,
|
||||||
|
closable: true,
|
||||||
|
resizable: true,
|
||||||
|
decorations: true,
|
||||||
|
maximizable: false,
|
||||||
|
minimizable: false,
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
const appWindow = getCurrentWindow();
|
||||||
|
if (appWindow) {
|
||||||
|
const appSize = await appWindow.outerSize();
|
||||||
|
// const monitor = await currentMonitor();
|
||||||
|
// console.log(monitor)
|
||||||
|
const factor = await appWindow.scaleFactor();
|
||||||
|
const appPosition = await appWindow.outerPosition();
|
||||||
|
// console.log((appPosition.x + appSize.width) / 1.25);
|
||||||
|
const logicalPosition = new PhysicalPosition(appPosition.x + appSize.width, appPosition.y).toLogical(factor);
|
||||||
|
defaultOpts.parent = appWindow;
|
||||||
|
// console.log(logicalPosition);
|
||||||
|
defaultOpts.x = logicalPosition.x;
|
||||||
|
defaultOpts.y = logicalPosition.y;
|
||||||
|
}
|
||||||
|
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
||||||
unlistenLogCreated = await dialog.once("tauri://webview-created", async () => {
|
unlistenLogCreated = await dialog.once("tauri://webview-created", async () => {
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
VITE_CONFIG_PATH=easytier/config/
|
VITE_CONFIG_PATH=easytier/config/
|
||||||
|
VITE_CONFIG_FILE_NAME=easytier/config.json
|
||||||
VITE_LOG_PATH=easytier/logs/
|
VITE_LOG_PATH=easytier/logs/
|
||||||
VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart
|
VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
VITE_CONFIG_PATH=easytier/config/
|
VITE_CONFIG_PATH=easytier/config/
|
||||||
|
VITE_CONFIG_FILE_NAME=easytier/config.json
|
||||||
VITE_LOG_PATH=easytier/logs/
|
VITE_LOG_PATH=easytier/logs/
|
||||||
VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart
|
VITE_AUTO_START_SERVICE_NAME=easytierGameAutoStart
|
||||||
@@ -1,16 +1,7 @@
|
|||||||
import { defineNuxtConfig } from "nuxt/config";
|
import { defineNuxtConfig } from "nuxt/config";
|
||||||
import fs from "fs";
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import vueJSX from "@vitejs/plugin-vue-jsx";
|
import vueJSX from "@vitejs/plugin-vue-jsx";
|
||||||
const isDev = process?.argv?.[2] == "_dev" || process?.argv?.[2] == "dev";
|
|
||||||
const optimizeDepsElementPlusIncludes = ["element-plus/es"];
|
|
||||||
fs.readdirSync("node_modules/element-plus/es/components").map(dirname => {
|
|
||||||
fs.access(`node_modules/element-plus/es/components/${dirname}/style/css.mjs`, err => {
|
|
||||||
if (!err) {
|
|
||||||
optimizeDepsElementPlusIncludes.push(`element-plus/es/components/${dirname}/style/css`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
ssr: false,
|
ssr: false,
|
||||||
|
|
||||||
@@ -22,8 +13,19 @@ export default defineNuxtConfig({
|
|||||||
autoImport: false
|
autoImport: false
|
||||||
},
|
},
|
||||||
|
|
||||||
css: ["~/assets/css/main.css", 'element-plus/theme-chalk/dark/css-vars.css'],
|
css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"],
|
||||||
modules: ["@element-plus/nuxt", "@pinia/nuxt", "@pinia-plugin-persistedstate/nuxt", "@nuxtjs/tailwindcss"],
|
modules: [
|
||||||
|
"@element-plus/nuxt",
|
||||||
|
"@pinia/nuxt",
|
||||||
|
[
|
||||||
|
"pinia-plugin-persistedstate/nuxt",
|
||||||
|
{
|
||||||
|
key: "__glj_persisted_%id",
|
||||||
|
storage: "localStorage"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@nuxtjs/tailwindcss"
|
||||||
|
],
|
||||||
|
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "./")
|
"@": path.resolve(__dirname, "./")
|
||||||
@@ -44,12 +46,10 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
vite: {
|
vite: {
|
||||||
plugins: [
|
plugins: [vueJSX({})],
|
||||||
vueJSX({}),
|
|
||||||
],
|
|
||||||
envDir: "env",
|
envDir: "env",
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: [...optimizeDepsElementPlusIncludes]
|
// include: [...optimizeDepsElementPlusIncludes]
|
||||||
},
|
},
|
||||||
// prevent vite from obscuring rust errors
|
// prevent vite from obscuring rust errors
|
||||||
clearScreen: false,
|
clearScreen: false,
|
||||||
@@ -84,7 +84,7 @@ export default defineNuxtConfig({
|
|||||||
|
|
||||||
app: {
|
app: {
|
||||||
rootId: "__easytier",
|
rootId: "__easytier",
|
||||||
cdnURL: "./",
|
cdnURL: "./",
|
||||||
buildAssetsDir: "__easytier/",
|
buildAssetsDir: "__easytier/",
|
||||||
head: {
|
head: {
|
||||||
meta: [
|
meta: [
|
||||||
@@ -102,5 +102,6 @@ export default defineNuxtConfig({
|
|||||||
// script: [],
|
// script: [],
|
||||||
// noscript: []
|
// noscript: []
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
compatibilityDate: "2024-11-12"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,44 +3,35 @@
|
|||||||
"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.1.5",
|
"version": "1.1.8",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||||
"build": "nuxt generate --dotenv env/.env.prod"
|
"build": "nuxt generate --dotenv env/.env.prod"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"@element-plus/nuxt": "^1.0.9",
|
"@element-plus/nuxt": "^1.1.0",
|
||||||
"@nuxtjs/tailwindcss": "^6.12.0",
|
"@nuxtjs/tailwindcss": "^6.12.0",
|
||||||
"@pinia-plugin-persistedstate/nuxt": "^1.2.0",
|
"@pinia/nuxt": "^0.7.0",
|
||||||
"@pinia/nuxt": "^0.5.1",
|
"@tauri-apps/api": "^2.1.1",
|
||||||
"@tauri-apps/api": "^2.0.2",
|
"@tauri-apps/cli": "^2.1.0",
|
||||||
"@tauri-apps/cli": "^2.0.2",
|
"@tauri-apps/plugin-autostart": "~2",
|
||||||
"@tauri-apps/plugin-cli": "^2.0.0",
|
"@tauri-apps/plugin-cli": "^2.0.0",
|
||||||
"@tauri-apps/plugin-http": "^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-shell": "~2",
|
"@tauri-apps/plugin-shell": "~2",
|
||||||
"@tinymce/tinymce-vue": "^5.1.1",
|
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/qs": "^6.9.15",
|
"@vitejs/plugin-vue-jsx": "^4.1.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
||||||
"@vueuse/core": "^11.2.0",
|
"@vueuse/core": "^11.2.0",
|
||||||
"dayjs": "^1.11.10",
|
"element-plus": "^2.8.7",
|
||||||
"defu": "^6.1.4",
|
|
||||||
"element-plus": "^2.8.6",
|
|
||||||
"less": "^4.2.0",
|
"less": "^4.2.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"nuxt": "^3.11.2",
|
"nuxt": "^3.13.2",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.2.6",
|
||||||
|
"pinia-plugin-persistedstate": "^4.1.3",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
"qs": "^6.12.0",
|
"typescript": "^5.6.3",
|
||||||
"typescript": "^5.4.5",
|
"vue-clipboard3": "^2.0.0"
|
||||||
"vue": "^3.4.24",
|
|
||||||
"vue-clipboard3": "^2.0.0",
|
|
||||||
"xlsx": "^0.18.5"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@tauri-apps/plugin-autostart": "~2",
|
|
||||||
"@tauri-apps/plugin-clipboard-manager": "^2.0.0",
|
|
||||||
"@tauri-apps/plugin-fs": "~2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,30 +3,47 @@
|
|||||||
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
||||||
<div class="flex items-center gap-[10px]">
|
<div class="flex items-center gap-[10px]">
|
||||||
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
|
||||||
<ElInput maxlength="10" v-model="mainStore.config.devNameValue" placeholder="请输入网卡名"/>
|
<ElInput
|
||||||
|
maxlength="10"
|
||||||
|
v-model="mainStore.config.devNameValue"
|
||||||
|
placeholder="请输入网卡名"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.coonectAfterStart">软件启动后,自动"启动联机"(搭配开机自启,无感联机)</ElCheckbox></div>
|
|
||||||
<div class="flex items-center gap-[15px] flex-nowrap">
|
<div class="flex items-center gap-[15px] flex-nowrap">
|
||||||
<ElCheckbox v-model="mainStore.config.saveErrorLog">输出日志到本地</ElCheckbox>
|
<ElCheckbox v-model="mainStore.config.saveErrorLog">输出日志到本地</ElCheckbox>
|
||||||
<div class="w-[140px]">
|
<div class="w-[140px]">
|
||||||
<ElSelect
|
<ElSelect
|
||||||
v-model="mainStore.config.logLevel"
|
v-model="mainStore.config.logLevel"
|
||||||
placeholder="请选择日志等级"
|
placeholder="请选择日志等级"
|
||||||
class="ml-[5px]">
|
class="ml-[5px]"
|
||||||
|
>
|
||||||
<ElOption
|
<ElOption
|
||||||
v-for="item in data"
|
v-for="item in data"
|
||||||
:key="item"
|
:key="item"
|
||||||
:label="`level - ${item}`"
|
:label="`level - ${item}`"
|
||||||
:value="item"></ElOption>
|
:value="item"
|
||||||
|
></ElOption>
|
||||||
</ElSelect>
|
</ElSelect>
|
||||||
</div>
|
</div>
|
||||||
<ElButton
|
<ElButton
|
||||||
@click="openLogDir"
|
@click="openLogDir"
|
||||||
size="small">
|
size="small"
|
||||||
|
>
|
||||||
打开日志目录
|
打开日志目录
|
||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
|
<div><ElCheckbox v-model="mainStore.config.coonectAfterStart">软件启动后,自动"启动联机"(搭配开机自启,无感联机)</ElCheckbox></div>
|
||||||
|
<div class="flex items-center gap-[15px] flex-nowrap">
|
||||||
|
<ElCheckbox v-model="mainStore.createConfigInEasytier">自动生成界面配置文件easytier/config.json</ElCheckbox>
|
||||||
|
<ElButton
|
||||||
|
@click="openConfigJsonDir"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
打开config.json目录
|
||||||
|
</ElButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ElDivider />
|
<ElDivider />
|
||||||
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
|
||||||
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密,默认为false,必须与对等节点相同</ElCheckbox></div>
|
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密,默认为false,必须与对等节点相同</ElCheckbox></div>
|
||||||
@@ -47,6 +64,7 @@
|
|||||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||||
import { Command } from "@tauri-apps/plugin-shell";
|
import { Command } from "@tauri-apps/plugin-shell";
|
||||||
import { exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
import { exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
@@ -63,8 +81,21 @@
|
|||||||
}
|
}
|
||||||
await Command.create("explorer", [logDirPath]).execute();
|
await Command.create("explorer", [logDirPath]).execute();
|
||||||
};
|
};
|
||||||
mainStore.$subscribe((...a) => {
|
const openConfigJsonDir = async () => {
|
||||||
|
const resourceDir = await getResourceDir();
|
||||||
|
const easytierDir = await join(resourceDir, "easytier/");
|
||||||
|
const isExists = await exists("easytier/", { baseDir: BaseDirectory.Resource });
|
||||||
|
if (isExists) {
|
||||||
|
await Command.create("explorer", [easytierDir]).execute();
|
||||||
|
} else {
|
||||||
|
ElMessage.error("config.json的目录不存在");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mainStore.$subscribe(async (...a) => {
|
||||||
// console.log("subscribe", a);
|
// console.log("subscribe", a);
|
||||||
appWindow.emitTo("main", "config", { config: { ...mainStore.config } });
|
await appWindow.emitTo("main", "config", { config: { ...mainStore.config }, createConfigInEasytier: mainStore.createConfigInEasytier });
|
||||||
|
// if(mainStore.createConfigInEasytier) {
|
||||||
|
// updateConfigJson();
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
label-position="top"
|
label-position="top"
|
||||||
:model="config"
|
:model="config"
|
||||||
>
|
>
|
||||||
|
<!-- element-loading-custom-class="config-start"
|
||||||
|
v-loading="mainStore.configStartEnable"
|
||||||
|
:element-loading-spinner="'<path />'"
|
||||||
|
element-loading-text="-------已经启用配置文件,界面配置不再生效-------" -->
|
||||||
|
<!-- <div> -->
|
||||||
<ElFormItem
|
<ElFormItem
|
||||||
label="服务器"
|
label="服务器"
|
||||||
prop="serverUrl"
|
prop="serverUrl"
|
||||||
@@ -172,17 +177,19 @@
|
|||||||
<ElInput
|
<ElInput
|
||||||
maxlength="100"
|
maxlength="100"
|
||||||
:disabled="config.dhcp"
|
:disabled="config.dhcp"
|
||||||
:placeholder="data.isStart ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
:placeholder="data.isStart && config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
||||||
v-model="config.ipv4"
|
v-model="config.ipv4"
|
||||||
></ElInput>
|
></ElInput>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-start gap-[0_10px]">
|
<!-- </div> -->
|
||||||
<div class="w-[122px]">
|
<div class="flex items-start">
|
||||||
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<ElDropdown
|
<ElDropdown
|
||||||
@command="handleStartCommand"
|
@command="handleStartCommand"
|
||||||
split-button
|
split-button
|
||||||
|
trigger="click"
|
||||||
size="default"
|
size="default"
|
||||||
:type="!data.isStart ? 'primary' : 'danger'"
|
:type="!data.isStart ? 'primary' : 'danger'"
|
||||||
:disabled="data.startLoading || !data.coreVersion || data.update"
|
:disabled="data.startLoading || !data.coreVersion || data.update"
|
||||||
@@ -241,7 +248,7 @@
|
|||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="ml-auto">
|
||||||
<ElCheckbox
|
<ElCheckbox
|
||||||
v-model="config.disbleP2p"
|
v-model="config.disbleP2p"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -282,7 +289,7 @@
|
|||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
<ElLink
|
<ElLink
|
||||||
class="!text-[10px] pb-[2px] ml-[8px]"
|
class="!text-[9px] pb-[2px] ml-[8px] truncate"
|
||||||
type="info"
|
type="info"
|
||||||
:underline="false"
|
:underline="false"
|
||||||
@click="open('https://github.com/EasyTier/EasytierGame')"
|
@click="open('https://github.com/EasyTier/EasytierGame')"
|
||||||
@@ -296,6 +303,8 @@
|
|||||||
<ElDialog
|
<ElDialog
|
||||||
width="95%"
|
width="95%"
|
||||||
top="10px"
|
top="10px"
|
||||||
|
append-to-body
|
||||||
|
:z-index="10"
|
||||||
class="!mb-0"
|
class="!mb-0"
|
||||||
v-model="importConfigData.visible"
|
v-model="importConfigData.visible"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
@@ -309,7 +318,7 @@
|
|||||||
></ElInput>
|
></ElInput>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div>
|
<div>
|
||||||
<el-text type="danger">导入成功后,您当前的配置将被完全替换</el-text>
|
<el-text type="danger">导入成功后,您当前的部分配置将被替换</el-text>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<ElButton
|
<ElButton
|
||||||
@@ -325,6 +334,8 @@
|
|||||||
<ElDialog
|
<ElDialog
|
||||||
width="95%"
|
width="95%"
|
||||||
top="30px"
|
top="30px"
|
||||||
|
append-to-body
|
||||||
|
:z-index="10"
|
||||||
class="!mb-0"
|
class="!mb-0"
|
||||||
v-model="configStart.visible"
|
v-model="configStart.visible"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
@@ -387,14 +398,16 @@
|
|||||||
import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray";
|
import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray";
|
||||||
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { ElDropdownMenu, ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
||||||
import etWindows from "@/composables/windows";
|
import etWindows from "@/composables/windows";
|
||||||
import * as tauriAutoStart from "@tauri-apps/plugin-autostart";
|
import * as tauriAutoStart from "@tauri-apps/plugin-autostart";
|
||||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||||
import { readDir, exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
import { readDir, exists, mkdir, BaseDirectory, readTextFile } from "@tauri-apps/plugin-fs";
|
||||||
|
import { updateConfigJson } from "~/composables/configJson";
|
||||||
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
|
import { bounce } from "~/utils";
|
||||||
|
|
||||||
let is_close = false;
|
let is_close = false;
|
||||||
|
|
||||||
@@ -474,13 +487,13 @@
|
|||||||
unListenConfigStart: null,
|
unListenConfigStart: null,
|
||||||
thread_id: null,
|
thread_id: null,
|
||||||
async listenOutput() {
|
async listenOutput() {
|
||||||
const appWindow = getCurrentWindow();
|
// const appWindow = getCurrentWindow();
|
||||||
const unListen = await listen("command-output", async event => {
|
const unListen = await listen("command-output", async event => {
|
||||||
data.isStart = true;
|
data.isStart = true;
|
||||||
if (event.payload) {
|
if (event.payload) {
|
||||||
data.startLoading = false;
|
data.startLoading = false;
|
||||||
let ipv4 = /new: Some\((\d+\.\d+\.\d+\.\d+)\/.*\)/g.exec(event.payload as string)?.[1];
|
let ipv4 = /dhcp ip changed. old: None, new: Some\((\d+\.\d+\.\d+\.\d+).*\)/g.exec(event.payload as string)?.[1];
|
||||||
if (config.dhcp) {
|
if (config.dhcp || mainStore.configStartEnable) {
|
||||||
if (ipv4) {
|
if (ipv4) {
|
||||||
config.ipv4 = ipv4;
|
config.ipv4 = ipv4;
|
||||||
await setTrayRunState(tray, true);
|
await setTrayRunState(tray, true);
|
||||||
@@ -495,7 +508,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appWindow.emitTo("log", "logs", data.log);
|
const logArr = data.log.split("\n");
|
||||||
|
const start = logArr.length > 1000 ? logArr.length - 1000 : 0;
|
||||||
|
data.log = logArr.slice(start).join("\n");
|
||||||
data.log += (event.payload as string) + "\n";
|
data.log += (event.payload as string) + "\n";
|
||||||
});
|
});
|
||||||
this.unListenOutPut = unListen;
|
this.unListenOutPut = unListen;
|
||||||
@@ -620,15 +635,15 @@
|
|||||||
|
|
||||||
const compatibleInitAutoStart = async () => {
|
const compatibleInitAutoStart = async () => {
|
||||||
try {
|
try {
|
||||||
const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
// const is_enable_by_task = (await invoke("autostart_is_enabled")) as boolean;
|
||||||
if (is_enable_by_task) {
|
// if (is_enable_by_task) {
|
||||||
await tauriAutoStart.enable();
|
// await tauriAutoStart.enable();
|
||||||
await invoke("spawn_autostart", { enabled: false });
|
// await invoke("spawn_autostart", { enabled: false });
|
||||||
}
|
// }
|
||||||
const is_enable = await tauriAutoStart.isEnabled();
|
const is_enable = await tauriAutoStart.isEnabled();
|
||||||
config.autoStart = is_enable;
|
config.autoStart = is_enable;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await invoke("spawn_autostart", { enabled: false });
|
// await invoke("spawn_autostart", { enabled: false });
|
||||||
await tauriAutoStart.disable();
|
await tauriAutoStart.disable();
|
||||||
config.autoStart = false;
|
config.autoStart = false;
|
||||||
}
|
}
|
||||||
@@ -641,10 +656,49 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initGuiJson = async () => {
|
||||||
|
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) {
|
||||||
|
try {
|
||||||
|
const regex = /^(\s*\/\/.*)/gm;
|
||||||
|
const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
|
||||||
|
const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
|
||||||
|
const guiJson = JSON.parse(resultStr);
|
||||||
|
mainStore.$patch({
|
||||||
|
config: {
|
||||||
|
...mainStore.config,
|
||||||
|
...guiJson
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (guiJson.serverUrl) {
|
||||||
|
mainStore.basePeers = [...new Set([guiJson.serverUrl, ...mainStore.basePeers])];
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
ElMessage.error(`config.json格式错误`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const b = bounce(600);
|
||||||
|
mainStore.$subscribe(
|
||||||
|
(...a) => {
|
||||||
|
if (mainStore.createConfigInEasytier) {
|
||||||
|
b(async () => {
|
||||||
|
await updateConfigJson();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
let logsTimer: NodeJS.Timeout | null = null;
|
let logsTimer: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// await handleUpdateCore(); //默认不自动更新
|
// await handleUpdateCore(); //默认不自动更新
|
||||||
|
await initGuiJson();
|
||||||
await compatibleInitAutoStart();
|
await compatibleInitAutoStart();
|
||||||
// await initAutoStart();
|
// await initAutoStart();
|
||||||
await initStartWinIpBroadcast();
|
await initStartWinIpBroadcast();
|
||||||
@@ -772,10 +826,15 @@
|
|||||||
await reset();
|
await reset();
|
||||||
} else {
|
} else {
|
||||||
const args = await getArgs();
|
const args = await getArgs();
|
||||||
|
|
||||||
if (!args || args.length <= 0) {
|
if (!args || args.length <= 0) {
|
||||||
return ElMessage.error("无配置");
|
return ElMessage.error("无配置");
|
||||||
}
|
}
|
||||||
|
if (args[0] === "-c") {
|
||||||
|
ElMessage.warning({
|
||||||
|
message: "使用配置文件中.",
|
||||||
|
duration: 5000
|
||||||
|
});
|
||||||
|
}
|
||||||
data.log = ""; //清空日志
|
data.log = ""; //清空日志
|
||||||
data.startLoading = true;
|
data.startLoading = true;
|
||||||
await unListenAll();
|
await unListenAll();
|
||||||
@@ -811,9 +870,24 @@
|
|||||||
}
|
}
|
||||||
if (command === "share_config") {
|
if (command === "share_config") {
|
||||||
try {
|
try {
|
||||||
await writeText(btoa(JSON.stringify({ config: mainStore.config })));
|
const {
|
||||||
|
proxyNetworks,
|
||||||
|
autoStart,
|
||||||
|
coonectAfterStart,
|
||||||
|
multiThread,
|
||||||
|
hostname,
|
||||||
|
enablExitNode,
|
||||||
|
useSmoltcp,
|
||||||
|
saveErrorLog,
|
||||||
|
logLevel,
|
||||||
|
ipv4,
|
||||||
|
...otherConfig
|
||||||
|
} = mainStore.config;
|
||||||
|
const WT = btoa(encodeURIComponent(JSON.stringify({ config: otherConfig })));
|
||||||
|
await writeText(WT);
|
||||||
ElMessage.success("配置已复制");
|
ElMessage.success("配置已复制");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
ElMessage.error("分享失败");
|
ElMessage.error("分享失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -829,12 +903,18 @@
|
|||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消"
|
cancelButtonText: "取消"
|
||||||
});
|
});
|
||||||
const payload = JSON.parse(atob(importConfigData.data));
|
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
|
||||||
mainStore.$patch(payload);
|
mainStore.$patch({
|
||||||
|
config: {
|
||||||
|
...mainStore.config,
|
||||||
|
...payload.config
|
||||||
|
}
|
||||||
|
});
|
||||||
ElMessage.success("导入成功");
|
ElMessage.success("导入成功");
|
||||||
importConfigData.visible = false;
|
importConfigData.visible = false;
|
||||||
mainStore.basePeers = [...new Set([config.serverUrl, ...mainStore.basePeers])];
|
mainStore.basePeers = [...new Set([config.serverUrl, ...mainStore.basePeers])];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
if (err !== "cancel") {
|
if (err !== "cancel") {
|
||||||
ElMessage.error("导入失败");
|
ElMessage.error("导入失败");
|
||||||
}
|
}
|
||||||
@@ -864,9 +944,9 @@
|
|||||||
if (!data.isStart) {
|
if (!data.isStart) {
|
||||||
return ElMessage.warning("请先开始联机");
|
return ElMessage.warning("请先开始联机");
|
||||||
}
|
}
|
||||||
if (!mainStore.config.ipv4) {
|
// if (!mainStore.config.ipv4) {
|
||||||
return ElMessage.warning("请等待获取IP");
|
// return ElMessage.warning("请等待获取IP");
|
||||||
}
|
// }
|
||||||
|
|
||||||
await etWindows(
|
await etWindows(
|
||||||
"member",
|
"member",
|
||||||
@@ -899,7 +979,7 @@
|
|||||||
data.logVisible = true;
|
data.logVisible = true;
|
||||||
logsTimer && clearInterval(logsTimer);
|
logsTimer && clearInterval(logsTimer);
|
||||||
logsTimer = setInterval(() => {
|
logsTimer = setInterval(() => {
|
||||||
appWindow.emitTo("log", "logs", data.log ? (data.log as string).split("\n").slice(-1000).join("\n") : "");
|
appWindow.emitTo("log", "logs", data.log);
|
||||||
}, 600);
|
}, 600);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
<ElInputNumber
|
<ElInputNumber
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
size="small"
|
size="small"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
v-model="data.pingNum"
|
v-model="data.pingNum"
|
||||||
:min="1"
|
:min="1"
|
||||||
:max="10"
|
:max="10"
|
||||||
@@ -155,6 +155,7 @@
|
|||||||
</ElInputNumber>
|
</ElInputNumber>
|
||||||
<ElButton
|
<ElButton
|
||||||
size="small"
|
size="small"
|
||||||
|
:disabled="data.isPing"
|
||||||
@click="handleTestPing"
|
@click="handleTestPing"
|
||||||
>
|
>
|
||||||
Ping一下
|
Ping一下
|
||||||
@@ -181,6 +182,7 @@
|
|||||||
import useMainStore from "@/stores/index";
|
import useMainStore from "@/stores/index";
|
||||||
import { handleWinipBcStart, initStartWinIpBroadcast } from "@/composables/netcard";
|
import { handleWinipBcStart, initStartWinIpBroadcast } from "@/composables/netcard";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
|
import { isValidIP } from "~/utils";
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@@ -189,6 +191,7 @@
|
|||||||
pingNum: 1,
|
pingNum: 1,
|
||||||
winipBcStart: false,
|
winipBcStart: false,
|
||||||
pingIp: "",
|
pingIp: "",
|
||||||
|
isPing: false,
|
||||||
pingLog: "",
|
pingLog: "",
|
||||||
firewallStatus: {
|
firewallStatus: {
|
||||||
domain: false,
|
domain: false,
|
||||||
@@ -228,28 +231,41 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const awaitTime = (time: number) => {
|
||||||
|
return new Promise(res => {
|
||||||
|
setTimeout(res, time);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleTestPing = async () => {
|
const handleTestPing = async () => {
|
||||||
/^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/;
|
// const is = isValidIP(data.pingIp);
|
||||||
if (data.pingIp) {
|
if (data.pingIp) {
|
||||||
data.pingLog = "";
|
data.pingLog = "";
|
||||||
|
data.isPing = true;
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < data.pingNum; i++) {
|
for (let i = 0; i < data.pingNum; i++) {
|
||||||
const output = await Command.create("ping", ["-n", "1", data.pingIp], {
|
const output = await Command.create("ping", ["-n", "1", data.pingIp], {
|
||||||
encoding: "gb2312"
|
encoding: "gb2312"
|
||||||
}).execute();
|
}).execute();
|
||||||
|
|
||||||
data.pingLog = data.pingLog.slice(-1000);
|
|
||||||
if (output.stdout) {
|
if (output.stdout) {
|
||||||
data.pingLog += output.stdout.split("\n")[2];
|
data.pingLog += `${i + 1} - ${output.stdout.split("\n")[2]}`;
|
||||||
}
|
}
|
||||||
if (output.stderr) {
|
if (output.stderr) {
|
||||||
data.pingLog += output.stderr;
|
data.pingLog += `${i + 1}error - ${output.stderr}`;
|
||||||
|
}
|
||||||
|
if(i != data.pingNum - 1) {
|
||||||
|
await awaitTime(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.pingLog += '完毕'
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ElMessage.error("Ping发生错误");
|
ElMessage.error("Ping发生错误");
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
} finally {
|
||||||
|
data.isPing = false;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
ElMessage.error("请输入正确的IP");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -306,6 +322,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// netsh advfirewall firewall add rule name="EXE名称" dir=out action=allow program="EXE绝对路径"
|
||||||
ElMessage.error("获取防火墙状态失败");
|
ElMessage.error("获取防火墙状态失败");
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
@@ -318,6 +335,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
data.pingIp = mainStore.config.ipv4;
|
||||||
initStartWinIpBroadcast();
|
initStartWinIpBroadcast();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import { createPersistedState } from "pinia-plugin-persistedstate";
|
|
||||||
import { defineNuxtPlugin } from "nuxt/app";
|
|
||||||
export default defineNuxtPlugin((nuxtApp: any) => {
|
|
||||||
nuxtApp.$pinia.use(
|
|
||||||
createPersistedState({
|
|
||||||
storage: localStorage,
|
|
||||||
key: id => `__glj_persisted_${id}`
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
# will have compiled files and executables
|
# will have compiled files and executables
|
||||||
/target/
|
/target/
|
||||||
/gen/schemas
|
/gen/schemas
|
||||||
/easytier/
|
/easytier/logs
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "easytier-game"
|
name = "easytier-game"
|
||||||
version = "1.1.5"
|
version = "1.1.8"
|
||||||
homepage = "https://github.com/EasyTier/EasyTier"
|
homepage = "https://github.com/EasyTier/EasyTier"
|
||||||
repository = "https://github.com/EasyTier/EasytierGame"
|
repository = "https://github.com/EasyTier/EasytierGame"
|
||||||
description = "A simple network initiator based on Easytier"
|
description = "A simple network initiator based on Easytier"
|
||||||
@@ -18,20 +18,20 @@ name = "app_lib"
|
|||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.0.2", features = [] }
|
tauri-build = { version = "2.0.3", features = [] }
|
||||||
# prost-build = "0.13.2"
|
# prost-build = "0.13.2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
tauri = { version = "2.0.6", features = [
|
tauri = { version = "2.1.1", features = [
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
"image-png",
|
"image-png",
|
||||||
"image-ico",
|
"image-ico",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
tauri-plugin-log = "2.0.1"
|
tauri-plugin-log = "2.0.2"
|
||||||
tauri-plugin-shell = "2.0.2"
|
tauri-plugin-shell = "2.0.2"
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
zip = "2.2.0"
|
zip = "2.2.0"
|
||||||
@@ -39,7 +39,7 @@ sysinfo = '0.32.0'
|
|||||||
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"
|
tauri-plugin-fs = "2"
|
||||||
tauri-plugin-clipboard-manager = "2.0.0-rc"
|
tauri-plugin-clipboard-manager = "2.0.2"
|
||||||
# prost = "0.13"
|
# prost = "0.13"
|
||||||
# prost-types = "0.13"
|
# prost-types = "0.13"
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,8 @@
|
|||||||
"fs:allow-open",
|
"fs:allow-open",
|
||||||
"fs:allow-resource-read",
|
"fs:allow-resource-read",
|
||||||
"fs:allow-resource-read-recursive",
|
"fs:allow-resource-read-recursive",
|
||||||
|
"fs:allow-resource-write",
|
||||||
|
"fs:allow-resource-write-recursive",
|
||||||
"clipboard-manager:allow-clear",
|
"clipboard-manager:allow-clear",
|
||||||
"clipboard-manager:allow-read-text",
|
"clipboard-manager:allow-read-text",
|
||||||
"clipboard-manager:allow-write-text"
|
"clipboard-manager:allow-write-text"
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
// 如果您的配置过于复杂,可以参考 使用配置文件进行联机的办法,以下是基础的界面配置,用于快速分享联机
|
||||||
|
"protocol": [
|
||||||
|
"tcp",
|
||||||
|
"udp"
|
||||||
|
], // 协议类型
|
||||||
|
"serverUrl": "public.easytier.top:11010", // easytier服务地址
|
||||||
|
"networkName": "", // 网络名
|
||||||
|
"networkPassword": "", // 网络密码
|
||||||
|
"hostname": "configTest", // 主机名
|
||||||
|
"ipv4": "10.126.126.1", // IP地址(选填,下面有dhcp)
|
||||||
|
"disableIpv6": false, // 禁用ipv6
|
||||||
|
"disbleListenner": true, // 禁用端口监听
|
||||||
|
"disableEncryption": false, // 禁用加密
|
||||||
|
"noTun": false, // 禁用tun
|
||||||
|
"latencyfirst": false, // 延迟优先
|
||||||
|
"disableUdpHolePunching": false, // 禁用udp打洞
|
||||||
|
"disbleP2p": false, // 禁用p2p, 强制中转
|
||||||
|
"dhcp": false, // 动态分配IP
|
||||||
|
"devName": false, // 是否启用自定义网卡名
|
||||||
|
"devNameValue": "" // 网卡名(启用devName之后才生效)
|
||||||
|
}
|
||||||
@@ -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.1.5",
|
"version": "1.1.8",
|
||||||
"identifier": "com.tauri.easytier-game",
|
"identifier": "com.tauri.easytier-game",
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
@@ -13,10 +13,14 @@
|
|||||||
"app": {
|
"app": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "easytier-game 1.1.5",
|
"title": "easytier-game 1.1.8",
|
||||||
"width": 335,
|
"minWidth": 340,
|
||||||
|
"width": 340,
|
||||||
"height": 305,
|
"height": 305,
|
||||||
"resizable": false,
|
"minHeight": 305,
|
||||||
|
"maxHeight": 305,
|
||||||
|
"maxWidth": 360,
|
||||||
|
"resizable": true,
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
"decorations": true,
|
"decorations": true,
|
||||||
"center": true,
|
"center": true,
|
||||||
@@ -35,6 +39,7 @@
|
|||||||
"resources": [
|
"resources": [
|
||||||
"easytier/config/",
|
"easytier/config/",
|
||||||
"easytier/icons/",
|
"easytier/icons/",
|
||||||
|
"easytier/config_template.json",
|
||||||
"easytier/tool/WinIPBroadcast.exe",
|
"easytier/tool/WinIPBroadcast.exe",
|
||||||
"easytier/easytier-cli.exe",
|
"easytier/easytier-cli.exe",
|
||||||
"easytier/easytier-core.exe",
|
"easytier/easytier-core.exe",
|
||||||
|
|||||||
@@ -27,49 +27,26 @@ export default defineStore("main", {
|
|||||||
saveErrorLog: true, // 是否保存错误日志
|
saveErrorLog: true, // 是否保存错误日志
|
||||||
logLevel: "error", //日志等级
|
logLevel: "error", //日志等级
|
||||||
devName: false, //自定义网卡名
|
devName: false, //自定义网卡名
|
||||||
devNameValue: "", //自定义网卡名
|
devNameValue: "" //自定义网卡名
|
||||||
},
|
},
|
||||||
|
cidrEnable: false,
|
||||||
|
basePeers: ["public.easytier.top:11010"],
|
||||||
theme: false, //主题 false light true dark
|
theme: false, //主题 false light true dark
|
||||||
configStartEnable: false, //使用配置文件启动
|
configStartEnable: false, //使用配置文件启动
|
||||||
configPath: "", //配置文件路径
|
configPath: "", //配置文件路径
|
||||||
cidrEnable: false,
|
winIpBcAutoStart: true,
|
||||||
|
createConfigInEasytier: false, //在easytier目录生成config.json文件吗
|
||||||
|
|
||||||
winipBcPid: 0,
|
winipBcPid: 0,
|
||||||
winipBcStart: false,
|
winipBcStart: false,
|
||||||
winIpBcAutoStart: true,
|
|
||||||
basePeers: ["public.easytier.top:11010"],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
persist: {
|
persist: {
|
||||||
paths: [
|
// 除了这些,其他都要存下来
|
||||||
"basePeers",
|
omit: [
|
||||||
"cidrEnable",
|
"winipBcPid",
|
||||||
"theme",
|
"winipBcStart"
|
||||||
"winIpBcAutoStart",
|
]
|
||||||
"config.proxyNetworks",
|
}
|
||||||
"config.serverUrl",
|
|
||||||
"config.networkName",
|
|
||||||
"config.protocol",
|
|
||||||
"config.networkPassword",
|
|
||||||
"config.disbleP2p",
|
|
||||||
"config.autoStart",
|
|
||||||
"config.coonectAfterStart",
|
|
||||||
"config.disableIpv6",
|
|
||||||
"config.disbleListenner",
|
|
||||||
"config.disableEncryption",
|
|
||||||
"config.multiThread",
|
|
||||||
"config.enablExitNode",
|
|
||||||
"config.noTun",
|
|
||||||
"config.latencyfirst",
|
|
||||||
"config.useSmoltcp",
|
|
||||||
"config.disableUdpHolePunching",
|
|
||||||
"config.relayAllPeerrpc",
|
|
||||||
"config.hostname",
|
|
||||||
"config.ipv4",
|
|
||||||
"config.dhcp",
|
|
||||||
"config.saveErrorLog",
|
|
||||||
"config.logLevel",
|
|
||||||
"config.devName",
|
|
||||||
"config.devNameValue",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"components/**/*.ts",
|
"components/**/*.ts",
|
||||||
"components/**/*.js",
|
"components/**/*.js",
|
||||||
"components/**/*.vue",
|
"components/**/*.vue",
|
||||||
|
"composables/**/*.ts",
|
||||||
"app.vue",
|
"app.vue",
|
||||||
"pages/**/*.ts",
|
"pages/**/*.ts",
|
||||||
"pages/**/*.js",
|
"pages/**/*.js",
|
||||||
@@ -28,16 +29,16 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node",
|
||||||
// "types": ["element-plus/global"]
|
// "types": ["element-plus/global"]
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
// 从 Vue 3.4 开始,Vue 不再隐式注册全局 JSX 命名空间。要指示 TypeScript 使用 Vue 的 JSX 类型定义,请确保在你的 tsconfig.json 中包含以下内容
|
// 从 Vue 3.4 开始,Vue 不再隐式注册全局 JSX 命名空间。要指示 TypeScript 使用 Vue 的 JSX 类型定义,请确保在你的 tsconfig.json 中包含以下内容
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"jsxImportSource": "vue",
|
"jsxImportSource": "vue",
|
||||||
"types": ["@pinia/nuxt", "vite/client", "element-plus/global"],
|
"types": ["@pinia/nuxt", "vite/client", "element-plus/global", "pinia-plugin-persistedstate"],
|
||||||
"allowJs": true, // 允许编译器编译JS,JSX文件
|
"allowJs": true, // 允许编译器编译JS,JSX文件
|
||||||
"checkJs": true, // 允许在JS文件中报错,通常与allowJS一起使用
|
"checkJs": false, // 允许在JS文件中报错,通常与allowJS一起使用
|
||||||
"esModuleInterop": true, // 允许export=导出,由import from 导入
|
"esModuleInterop": true, // 允许export=导出,由import from 导入
|
||||||
|
|
||||||
"lib": ["DOM", "ESNext"],
|
"lib": ["DOM", "ESNext"],
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_CONFIG_PATH: string;
|
readonly VITE_CONFIG_PATH: string;
|
||||||
|
readonly VITE_CONFIG_FILE_NAME: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
@@ -1,18 +1,5 @@
|
|||||||
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
import Clipboard from "vue-clipboard3";
|
|
||||||
|
|
||||||
export const ENV = import.meta.env;
|
export const ENV = import.meta.env;
|
||||||
|
|
||||||
export const clipBoardCopy = async (text: string) => {
|
|
||||||
const { toClipboard } = Clipboard();
|
|
||||||
try {
|
|
||||||
await toClipboard(text);
|
|
||||||
ElMessage.success("复制成功");
|
|
||||||
} catch (e) {
|
|
||||||
ElMessage.error("复制失败");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//防抖
|
//防抖
|
||||||
export const bounce = (time = 3000) => {
|
export const bounce = (time = 3000) => {
|
||||||
@@ -79,36 +66,43 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
|
|||||||
|
|
||||||
export const parsePeerInfo = (content: string) => {
|
export const parsePeerInfo = (content: string) => {
|
||||||
// 将表格字符串分割成行
|
// 将表格字符串分割成行
|
||||||
const lines = content.split('\n')
|
const lines = content.split("\n");
|
||||||
|
|
||||||
// 提取表头(keys)
|
// 提取表头(keys)
|
||||||
const headers = lines[1]
|
const headers = lines[1]
|
||||||
.split('│')
|
.split("│")
|
||||||
.slice(1, -1)
|
.slice(1, -1)
|
||||||
.map((h) => h.trim())
|
.map(h => h.trim());
|
||||||
|
|
||||||
// 初始化结果数组
|
// 初始化结果数组
|
||||||
const result: any[] = []
|
const result: any[] = [];
|
||||||
|
|
||||||
// 遍历数据行
|
// 遍历数据行
|
||||||
for (let i = 3; i < lines.length - 1; i += 2) {
|
for (let i = 3; i < lines.length - 1; i += 2) {
|
||||||
if (lines[i].trim() === '') continue // 跳过空行
|
if (lines[i].trim() === "") continue; // 跳过空行
|
||||||
|
|
||||||
// 分割每一行的数据
|
// 分割每一行的数据
|
||||||
const values = lines[i]
|
const values = lines[i]
|
||||||
.split('│')
|
.split("│")
|
||||||
.slice(1, -1)
|
.slice(1, -1)
|
||||||
.map((v) => v.trim())
|
.map(v => v.trim());
|
||||||
|
|
||||||
// 创建对象并添加到结果数组
|
// 创建对象并添加到结果数组
|
||||||
const obj: any = {}
|
const obj: any = {};
|
||||||
headers.forEach((header, index) => {
|
headers.forEach((header, index) => {
|
||||||
obj[header] = values[index] === '-' || values[index] === '' ? null : values[index]
|
obj[header] = values[index] === "-" || values[index] === "" ? null : values[index];
|
||||||
})
|
});
|
||||||
|
|
||||||
// 每行数据都作为一个新对象添加到结果数组中
|
// 每行数据都作为一个新对象添加到结果数组中
|
||||||
result.push(obj)
|
result.push(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export function isValidIP(ip: string) {
|
||||||
|
const ipv4Pattern =
|
||||||
|
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
||||||
|
const ipv6Pattern = /^(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}$/;
|
||||||
|
return ipv4Pattern.test(ip) || ipv6Pattern.test(ip);
|
||||||
|
}
|
||||||
|
|||||||