mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c911f47f9 | ||
|
|
f3fc37957c | ||
|
|
a4d6fe6e95 | ||
|
|
9b883d686d | ||
|
|
2ac0afb847 | ||
|
|
a04fae725d | ||
|
|
3150878dbd |
@@ -27,17 +27,3 @@ body {
|
||||
box-sizing: border-box;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #0003;
|
||||
border-radius: 10px;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
+69
-74
@@ -1,89 +1,86 @@
|
||||
import { Menu, MenuItem, PredefinedMenuItem } from '@tauri-apps/api/menu'
|
||||
import { TrayIcon } from '@tauri-apps/api/tray'
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||
import pkg from '@/package.json'
|
||||
import { Menu, MenuItem, PredefinedMenuItem } from "@tauri-apps/api/menu";
|
||||
import { TrayIcon } from "@tauri-apps/api/tray";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import pkg from "@/package.json";
|
||||
|
||||
const DEFAULT_TRAY_NAME = 'main'
|
||||
const DEFAULT_TRAY_NAME = "main";
|
||||
|
||||
async function toggleVisibility() {
|
||||
if (await getCurrentWindow().isVisible()) {
|
||||
await getCurrentWindow().hide()
|
||||
}
|
||||
else {
|
||||
await getCurrentWindow().show()
|
||||
await getCurrentWindow().setFocus()
|
||||
}
|
||||
if (await getCurrentWindow().isVisible()) {
|
||||
await getCurrentWindow().hide();
|
||||
} else {
|
||||
await getCurrentWindow().show();
|
||||
await getCurrentWindow().setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
export async function useTray(init: boolean = false, beforExit) {
|
||||
let tray
|
||||
try {
|
||||
tray = await TrayIcon.getById(DEFAULT_TRAY_NAME)
|
||||
if (!tray) {
|
||||
tray = await TrayIcon.new({
|
||||
tooltip: `EasyTier\n${pkg.version}`,
|
||||
title: `EasyTier\n${pkg.version}`,
|
||||
id: DEFAULT_TRAY_NAME,
|
||||
menu: await Menu.new({
|
||||
id: 'main',
|
||||
items: await generateMenuItem(beforExit),
|
||||
}),
|
||||
action: async (e) => {
|
||||
toggleVisibility()
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.warn('Error while creating tray icon:', error)
|
||||
return null
|
||||
}
|
||||
export async function useTray(init: boolean = false, beforExit: Function) {
|
||||
let tray;
|
||||
try {
|
||||
tray = await TrayIcon.getById(DEFAULT_TRAY_NAME);
|
||||
if (!tray) {
|
||||
tray = await TrayIcon.new({
|
||||
tooltip: `EasyTier\n${pkg.version}`,
|
||||
title: `EasyTier\n${pkg.version}`,
|
||||
id: DEFAULT_TRAY_NAME,
|
||||
menu: await Menu.new({
|
||||
id: "main",
|
||||
items: await generateMenuItem(beforExit)
|
||||
}),
|
||||
action: async e => {
|
||||
toggleVisibility();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Error while creating tray icon:", error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (init) {
|
||||
tray.setTooltip(`EasyTier\n${pkg.version}`)
|
||||
tray.setMenuOnLeftClick(false)
|
||||
tray.setMenu(await Menu.new({
|
||||
id: 'main',
|
||||
items: await generateMenuItem(beforExit),
|
||||
}))
|
||||
}
|
||||
if (init) {
|
||||
tray.setTooltip(`EasyTier\n${pkg.version}`);
|
||||
tray.setMenuOnLeftClick(false);
|
||||
tray.setMenu(
|
||||
await Menu.new({
|
||||
id: "main",
|
||||
items: await generateMenuItem(beforExit)
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return tray
|
||||
return tray;
|
||||
}
|
||||
|
||||
export async function generateMenuItem(beforExit: Function) {
|
||||
return [
|
||||
await MenuItemExit('退出', beforExit),
|
||||
await PredefinedMenuItem.new({ item: 'Separator' }),
|
||||
await MenuItemShow('显示 / 隐藏'),
|
||||
]
|
||||
return [await MenuItemExit("退出", beforExit), await PredefinedMenuItem.new({ item: "Separator" }), await MenuItemShow("显示 / 隐藏")];
|
||||
}
|
||||
|
||||
export async function MenuItemExit(text: string, beforExit: Function) {
|
||||
return await MenuItem.new({
|
||||
id: "quit",
|
||||
text,
|
||||
action: async () => {
|
||||
if (beforExit) {
|
||||
await beforExit();
|
||||
}
|
||||
await getCurrentWindow().close();
|
||||
}
|
||||
})
|
||||
return await MenuItem.new({
|
||||
id: "quit",
|
||||
text,
|
||||
action: async () => {
|
||||
if (beforExit) {
|
||||
await beforExit();
|
||||
}
|
||||
await getCurrentWindow().close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function MenuItemShow(text: string) {
|
||||
return await MenuItem.new({
|
||||
id: 'show',
|
||||
text,
|
||||
action: async () => {
|
||||
await toggleVisibility()
|
||||
},
|
||||
})
|
||||
return await MenuItem.new({
|
||||
id: "show",
|
||||
text,
|
||||
action: async () => {
|
||||
await toggleVisibility();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// export async function setTrayMenu(items: (MenuItem | PredefinedMenuItem)[] | undefined = undefined) {
|
||||
// const tray = await useTray()
|
||||
// // const tray = await useTray()
|
||||
// const tray = await TrayIcon.getById(DEFAULT_TRAY_NAME)
|
||||
// if (!tray)
|
||||
// return
|
||||
// const menu = await Menu.new({
|
||||
@@ -93,12 +90,10 @@ export async function MenuItemShow(text: string) {
|
||||
// tray.setMenu(menu)
|
||||
// }
|
||||
|
||||
// export async function setTrayRunState(isRunning: boolean = false) {
|
||||
// const tray = await useTray()
|
||||
// if (!tray)
|
||||
// return
|
||||
// tray.setIcon(isRunning ? 'icons/icon-inactive.ico' : 'icons/icon.ico')
|
||||
// }
|
||||
export async function setTrayRunState(tray: TrayIcon | null, isRunning: boolean = false) {
|
||||
if (!tray) return;
|
||||
tray.setIcon(isRunning ? "easytier/icons/icon-inactive.ico" : "easytier/icons/icon.ico");
|
||||
}
|
||||
|
||||
// export async function setTrayTooltip(tooltip: string) {
|
||||
// if (tooltip) {
|
||||
@@ -108,4 +103,4 @@ export async function MenuItemShow(text: string) {
|
||||
// tray.setTooltip(`EasyTier\n${pkg.version}\n${tooltip}`)
|
||||
// tray.setTitle(`EasyTier\n${pkg.version}\n${tooltip}`)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { type UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window } from "@tauri-apps/api/window";
|
||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import type { WebviewLabel, WebviewOptions, } from "@tauri-apps/api/webview";
|
||||
export default async (
|
||||
label: WebviewLabel,
|
||||
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
|
||||
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => 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 unlistenLogCreated: UnlistenFn | null = null;
|
||||
let dialog = await WebviewWindow.getByLabel(label);
|
||||
if (!dialog) {
|
||||
dialog = new WebviewWindow(label, {...defaultOpts, ...options});
|
||||
unlistenLogCreated = await dialog.once("tauri://webview-created", async () => {
|
||||
if (dialog) {
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
}
|
||||
});
|
||||
unListenlogClose = await dialog.onCloseRequested(async () => {
|
||||
beforeCloseFunc && (await beforeCloseFunc());
|
||||
unListenlogClose && (await unListenlogClose());
|
||||
});
|
||||
} else {
|
||||
const visible = await dialog.isVisible();
|
||||
if (visible) {
|
||||
await dialog.close();
|
||||
unlistenLogCreated && (await (unlistenLogCreated as Function)());
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -5,6 +5,6 @@
|
||||
<script setup lang="tsx">
|
||||
//屏蔽右键菜单
|
||||
document.addEventListener("contextmenu", (e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
// e.preventDefault();
|
||||
});
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ export default defineNuxtConfig({
|
||||
sourcemap: !!process.env.TAURI_DEBUG
|
||||
},
|
||||
esbuild: {
|
||||
pure: ["console.log"],
|
||||
// pure: ["console.log"],
|
||||
drop: ["debugger"]
|
||||
}
|
||||
},
|
||||
|
||||
+7
-5
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"author": "leizi97",
|
||||
"description": "A simple network initiator based on Easytier",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.8",
|
||||
"scripts": {
|
||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||
"build": "nuxt generate --dotenv env/.env.prod"
|
||||
@@ -18,14 +18,14 @@
|
||||
"@tauri-apps/cli": "^2.0.2",
|
||||
"@tauri-apps/plugin-cli": "^2.0.0",
|
||||
"@tauri-apps/plugin-http": "^2.0.0",
|
||||
"@tauri-apps/plugin-shell": "~2",
|
||||
"@tinymce/tinymce-vue": "^5.1.1",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/qs": "^6.9.15",
|
||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"defu": "^6.1.4",
|
||||
"element-plus": "^2.7.1",
|
||||
"javascript-obfuscator": "^4.1.0",
|
||||
"element-plus": "^2.8.6",
|
||||
"less": "^4.2.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nuxt": "^3.11.2",
|
||||
@@ -35,7 +35,9 @@
|
||||
"typescript": "^5.4.5",
|
||||
"vue": "^3.4.24",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
"xlsx": "^0.18.5",
|
||||
"@tauri-apps/plugin-shell": "~2"
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/plugin-autostart": "~2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<div class="h-full overflow-auto flex flex-col items-start px-[25px]">
|
||||
<div>
|
||||
<ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox>
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</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.multiThread">使用多线程运行时,默认为单线程</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.noTun">不创建TUN设备,可以使用子网代理访问节点</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式,将尝试使用最低延迟路径转发流量,默认使用最短路径</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
||||
<div>
|
||||
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">转发所有对等节点的RPC数据包,即使对等节点不在转发网络白名</ElCheckbox>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import useMainStore from "@/stores/index";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
const mainStore = useMainStore();
|
||||
const appWindow = getCurrentWindow();
|
||||
mainStore.$subscribe((...a) => {
|
||||
// console.log("subscribe", a);
|
||||
appWindow.emitTo("main", "config", { config: { ...mainStore.config } });
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div class="h-full flex flex-col gap-[10px]">
|
||||
<ElRadioGroup v-model="mainStore.cidrEnable">
|
||||
<ElRadioButton :value="true">开启</ElRadioButton>
|
||||
<ElRadioButton :value="false">关闭</ElRadioButton>
|
||||
</ElRadioGroup>
|
||||
<div class="flex-1 overflow-auto">
|
||||
<ElInput
|
||||
placeholder="例如: 192.168.1.0/24 一行一个"
|
||||
v-model="mainStore.config.proxyNetworks"
|
||||
type="textarea"
|
||||
:rows="30"
|
||||
resize="none"></ElInput>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import useMainStore from "@/stores/index";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
const mainStore = useMainStore();
|
||||
const appWindow = getCurrentWindow();
|
||||
mainStore.$subscribe((...a) => {
|
||||
appWindow.emitTo("main", "config", { cidrEnable: mainStore.cidrEnable, config: { ...mainStore.config } });
|
||||
});
|
||||
</script>
|
||||
+266
-171
@@ -2,32 +2,27 @@
|
||||
<ElForm
|
||||
size="small"
|
||||
label-position="top"
|
||||
:model="config"
|
||||
>
|
||||
:model="config">
|
||||
<ElFormItem
|
||||
label="服务器"
|
||||
prop="serverUrl"
|
||||
>
|
||||
prop="serverUrl">
|
||||
<template #label>
|
||||
<div class="flex items-center gap-[0_5px]">
|
||||
<div>服务器</div>
|
||||
<span>-</span>
|
||||
<ElTag
|
||||
effect="dark"
|
||||
:type="data.isSuccessGetIp ? 'success' : 'info'"
|
||||
>
|
||||
{{ data.isSuccessGetIp ? "联机成功" : "联机中" }}
|
||||
:type="data.isSuccessGetIp ? 'success' : 'info'">
|
||||
{{ data.isSuccessGetIp ? "联机成功" : data.isStart && !data.isSuccessGetIp ? "联机中" : "未联机" }}
|
||||
</ElTag>
|
||||
<ElButton
|
||||
v-if="!data.coreVersion"
|
||||
@click="getCoreVersion(true)"
|
||||
>
|
||||
@click="getCoreVersion(true)">
|
||||
获取工具版本
|
||||
</ElButton>
|
||||
<ElTag
|
||||
v-else
|
||||
type="info"
|
||||
>
|
||||
type="info">
|
||||
core-{{ data.coreVersion }}
|
||||
</ElTag>
|
||||
<ElButton
|
||||
@@ -35,8 +30,7 @@
|
||||
:loading="data.update"
|
||||
type="warning"
|
||||
@click="handleUpdateCore"
|
||||
size="small"
|
||||
>
|
||||
size="small">
|
||||
{{ data.coreVersion ? "更新" : "下载" }}
|
||||
</ElButton>
|
||||
</div>
|
||||
@@ -46,23 +40,21 @@
|
||||
filterable
|
||||
default-first-option
|
||||
v-model="config.serverUrl"
|
||||
@change="handleServerUrlChange"
|
||||
>
|
||||
@change="handleServerUrlChange">
|
||||
<template #prefix>
|
||||
<div :class="config.protocol && config.protocol.length > 1 ? 'w-[120px]' : 'w-[80px]'">
|
||||
<ElSelect
|
||||
placeholder="协议"
|
||||
multiple
|
||||
collapse-tags
|
||||
@click.stop
|
||||
v-model="config.protocol"
|
||||
@change="handleServerUrlChange"
|
||||
>
|
||||
@change="handleServerUrlChange">
|
||||
<ElOption
|
||||
v-for="item in protocols"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
></ElOption>
|
||||
:value="item"></ElOption>
|
||||
</ElSelect>
|
||||
</div>
|
||||
</template>
|
||||
@@ -70,16 +62,14 @@
|
||||
v-for="item in mainStore.basePeers"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
>
|
||||
:value="item">
|
||||
<div class="flex items-center justify-between">
|
||||
<span style="float: left">{{ item }}</span>
|
||||
<ElButton
|
||||
@click.stop="handleDeleteServerUrl(item)"
|
||||
round
|
||||
:icon="Delete"
|
||||
type="danger"
|
||||
></ElButton>
|
||||
type="danger"></ElButton>
|
||||
</div>
|
||||
</ElOption>
|
||||
</ElSelect>
|
||||
@@ -98,8 +88,7 @@
|
||||
<ElInput
|
||||
maxlength="100"
|
||||
placeholder="请输入网络名"
|
||||
v-model="config.networkName"
|
||||
></ElInput>
|
||||
v-model="config.networkName"></ElInput>
|
||||
</ElFormItem>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
@@ -117,8 +106,7 @@
|
||||
maxlength="100"
|
||||
placeholder="请输入网络密码"
|
||||
v-model="config.networkPassword"
|
||||
type="password"
|
||||
></ElInput>
|
||||
type="password"></ElInput>
|
||||
</ElFormItem>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,13 +123,11 @@
|
||||
<ElInput
|
||||
maxlength="100"
|
||||
placeholder="例如: Player1"
|
||||
v-model="config.hostname"
|
||||
></ElInput>
|
||||
v-model="config.hostname"></ElInput>
|
||||
</ElFormItem>
|
||||
<ElFormItem
|
||||
class="w-[70%]"
|
||||
label="局域网IP"
|
||||
>
|
||||
label="局域网IP">
|
||||
<template #label>
|
||||
<div class="flex items-center h-[20px]">
|
||||
虚拟网IP
|
||||
@@ -154,16 +140,14 @@
|
||||
inline-prompt
|
||||
inactive-text="固定IP"
|
||||
active-text="动态获取IP"
|
||||
size="small"
|
||||
></ElSwitch>
|
||||
size="small"></ElSwitch>
|
||||
</div>
|
||||
</template>
|
||||
<ElInput
|
||||
maxlength="100"
|
||||
:disabled="config.dhcp"
|
||||
:placeholder="data.isStart ? '等待动态分配IP...' : '例如: 10.126.126.1'"
|
||||
v-model="config.ipv4"
|
||||
></ElInput>
|
||||
v-model="config.ipv4"></ElInput>
|
||||
</ElFormItem>
|
||||
</div>
|
||||
<div class="flex items-start gap-[0_30px]">
|
||||
@@ -173,86 +157,99 @@
|
||||
:type="!data.isStart ? 'primary' : 'danger'"
|
||||
:disabled="data.startLoading || !data.coreVersion || data.update"
|
||||
@click="handleConnection"
|
||||
size="default"
|
||||
>
|
||||
size="default">
|
||||
{{ !data.isStart ? "启动联机" : "停止联机" }}
|
||||
</ElButton>
|
||||
</div>
|
||||
<div class="mt-[6px]">
|
||||
<div class="mt-[6px] pl-[2px]">
|
||||
<!-- <ElButtonGroup> -->
|
||||
<ElTooltip
|
||||
placement="right"
|
||||
:content="data.logVisible ? '关闭日志' : '打开日志'"
|
||||
>
|
||||
placement="left"
|
||||
content="日志">
|
||||
<ElButton
|
||||
:type="!data.logVisible ? 'info' : 'warning'"
|
||||
@click="handleShowLogDialog"
|
||||
:icon="List"
|
||||
size="small"
|
||||
plain
|
||||
></ElButton>
|
||||
plain></ElButton>
|
||||
</ElTooltip>
|
||||
<ElTooltip
|
||||
placement="left"
|
||||
content="成员信息"
|
||||
>
|
||||
content="成员">
|
||||
<ElButton
|
||||
@click="handleShowMemberDialog"
|
||||
:icon="UserFilled"
|
||||
plain
|
||||
type="success"
|
||||
size="small"
|
||||
></ElButton>
|
||||
size="small"></ElButton>
|
||||
</ElTooltip>
|
||||
<!-- </ElButtonGroup> -->
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<ElCheckbox
|
||||
v-model="config.disbleP2p"
|
||||
size="small"
|
||||
>
|
||||
禁用p2p
|
||||
size="small">
|
||||
强制中转
|
||||
</ElCheckbox>
|
||||
<ElCheckbox
|
||||
<!-- <ElCheckbox
|
||||
v-model="config.disableIpv6"
|
||||
size="small"
|
||||
>
|
||||
禁用ipv6
|
||||
</ElCheckbox>
|
||||
</ElCheckbox> -->
|
||||
<ElCheckbox
|
||||
@change="handleAutoStart"
|
||||
:model-value="config.autoStart"
|
||||
size="small">
|
||||
开机自启
|
||||
</ElCheckbox>
|
||||
<!-- <ElCheckbox
|
||||
v-model="config.disbleListenner"
|
||||
size="small"
|
||||
>
|
||||
禁用端口监听
|
||||
</ElCheckbox>
|
||||
<ElLink
|
||||
class="!text-[11px] pb-[2px] ml-[15px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
@click="open('https://github.com/EasyTier/EasyTier/releases')"
|
||||
>
|
||||
easytier发布页
|
||||
</ElLink>
|
||||
</ElCheckbox> -->
|
||||
<div>
|
||||
<ElButton
|
||||
@click="handleShowCidrDialog"
|
||||
:icon="Share"
|
||||
>子网代理</ElButton
|
||||
>
|
||||
<ElButton
|
||||
@click="handleShowAdvanceDialog"
|
||||
:icon="Setting"
|
||||
>高级选项</ElButton
|
||||
>
|
||||
</div>
|
||||
<div class="flex items-center gap-[0_5px]">
|
||||
<div>
|
||||
<ElLink
|
||||
class="!text-[11px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
@click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')">
|
||||
WinIPBroadcast
|
||||
<ElTooltip content="找不到游戏房间时,就开启它后再刷新尝试(默认开启)">
|
||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
</ElLink>
|
||||
<ElSwitch
|
||||
inline-prompt
|
||||
:model-value="data.winipBcStart"
|
||||
@change="handleWinipBcStart"
|
||||
size="small"
|
||||
label="WinIPBroadcast"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"></ElSwitch>
|
||||
</div>
|
||||
<ElLink
|
||||
class="!text-[11px]"
|
||||
class="!text-[11px] pb-[2px] ml-[15px]"
|
||||
type="info"
|
||||
:underline="false"
|
||||
@click="open('https://github.com/dechamps/WinIPBroadcast/releases/tag/winipbroadcast-1.6')"
|
||||
>
|
||||
WinIPBroadcast
|
||||
<ElTooltip content="找不到游戏房间时,就开启它后再刷新尝试(默认开启)">
|
||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
@click="open('https://github.com/EasyTier/EasytierGame')">
|
||||
主页
|
||||
</ElLink>
|
||||
<ElSwitch
|
||||
inline-prompt
|
||||
:model-value="data.winipBcStart"
|
||||
@change="handleWinipBcStart"
|
||||
size="small"
|
||||
label="WinIPBroadcast"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
></ElSwitch>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -262,17 +259,19 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { open, Command } from "@tauri-apps/plugin-shell";
|
||||
import { QuestionFilled, Delete, List, UserFilled } from "@element-plus/icons-vue";
|
||||
import { QuestionFilled, Delete, List, UserFilled, Setting, Share } from "@element-plus/icons-vue";
|
||||
import { reactive, onBeforeUnmount, onMounted } from "vue";
|
||||
import { useTray } from "~/composables/tray";
|
||||
import { useTray, setTrayRunState } from "~/composables/tray";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { getCurrentWindow, LogicalPosition } from "@tauri-apps/api/window";
|
||||
import { WebviewWindow, getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
||||
import { getCurrentWindow, PhysicalPosition } from "@tauri-apps/api/window";
|
||||
import { getAllWebviewWindows } from "@tauri-apps/api/webviewWindow";
|
||||
import etWindows from "@/composables/windows";
|
||||
import * as tauriAutoStart from "@tauri-apps/plugin-autostart";
|
||||
|
||||
let is_close = false;
|
||||
|
||||
useTray(true, async () => {
|
||||
const tray = await useTray(true, async () => {
|
||||
is_close = true;
|
||||
await invoke("stop_command", { child_id: listenObj.thread_id || 0 });
|
||||
await invoke("stop_command", { child_id: data.winipBcPid || 0 });
|
||||
@@ -280,9 +279,12 @@
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const config = mainStore.config;
|
||||
// console.log(config);
|
||||
const protocols = ["tcp", "udp", "ws", "wss", "wg"];
|
||||
const data = reactive({
|
||||
logVisible: false,
|
||||
cidrVisible: false,
|
||||
advanceVisible: false,
|
||||
winipBcPid: 0, //WinIPBroadcast进程id
|
||||
winipBcStart: false,
|
||||
memberVisible: false,
|
||||
@@ -292,14 +294,14 @@
|
||||
coreVersion: "",
|
||||
isSuccessGetIp: false,
|
||||
startLoading: false,
|
||||
isStart: false
|
||||
isStart: false,
|
||||
});
|
||||
|
||||
const closePrevent = async () => {
|
||||
const appWindow = getCurrentWindow();
|
||||
if (appWindow.label == "main") {
|
||||
appWindow.onCloseRequested(async event => {
|
||||
// console.log(appWindow.label);
|
||||
appWindow.onCloseRequested(async (event) => {
|
||||
console.log(appWindow.label);
|
||||
if (!is_close) {
|
||||
event.preventDefault();
|
||||
appWindow.hide();
|
||||
@@ -327,16 +329,18 @@
|
||||
const listenObj: { [key: string]: any } = {
|
||||
unListenOutPut: null,
|
||||
unListenThreadId: null,
|
||||
unListenConfigStart: null,
|
||||
thread_id: null,
|
||||
async listenOutput() {
|
||||
const appWindow = getCurrentWindow();
|
||||
const unListen = await listen("command-output", event => {
|
||||
const unListen = await listen("command-output", async (event) => {
|
||||
data.isStart = true;
|
||||
if (event.payload) {
|
||||
data.startLoading = false;
|
||||
let ipv4 = /new: Some\((\d+\.\d+\.\d+\.\d+)\/.*\)/g.exec(event.payload as string)?.[1];
|
||||
if (ipv4) {
|
||||
data.isSuccessGetIp = true;
|
||||
await setTrayRunState(tray, true);
|
||||
config.ipv4 = ipv4;
|
||||
}
|
||||
}
|
||||
@@ -346,13 +350,22 @@
|
||||
this.unListenOutPut = unListen;
|
||||
},
|
||||
async listenThreadId() {
|
||||
const unListen = await listen("thread-id", event => {
|
||||
const unListen = await listen("thread-id", (event) => {
|
||||
if (event.payload) {
|
||||
this.thread_id = event.payload;
|
||||
}
|
||||
});
|
||||
this.unListenThreadId = unListen;
|
||||
}
|
||||
},
|
||||
async listenConfigStart() {
|
||||
const unListen = await listen("config", (event) => {
|
||||
// console.log("config", event.payload);
|
||||
const ipv4 = config.ipv4;
|
||||
mainStore.$patch(event.payload as any);
|
||||
config.ipv4 = ipv4;
|
||||
});
|
||||
this.unListenConfigStart = unListen;
|
||||
},
|
||||
};
|
||||
|
||||
const unListenAll = async () => {
|
||||
@@ -431,10 +444,10 @@
|
||||
if (data.winipBcPid) {
|
||||
data.winipBcStart = true;
|
||||
} else {
|
||||
Elmessage.error(`启动失败`);
|
||||
ElMessage.error(`启动失败`);
|
||||
}
|
||||
} catch (err) {
|
||||
Elmessage.error(`启动失败`);
|
||||
ElMessage.error(`启动失败`);
|
||||
console.log(err);
|
||||
}
|
||||
} else {
|
||||
@@ -450,20 +463,63 @@
|
||||
}
|
||||
};
|
||||
|
||||
const handleAutoStart = async () => {
|
||||
let is_enable = await tauriAutoStart.isEnabled();
|
||||
if (!config.autoStart && !is_enable) {
|
||||
try {
|
||||
await tauriAutoStart.enable();
|
||||
} catch (err) {
|
||||
ElMessage.error(`开机自启失败`);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await tauriAutoStart.disable();
|
||||
} catch (err) {
|
||||
// ElMessage.error(`取消自启失败`);
|
||||
}
|
||||
}
|
||||
is_enable = await tauriAutoStart.isEnabled();
|
||||
if (!is_enable) {
|
||||
config.autoStart = false;
|
||||
} else {
|
||||
config.autoStart = true;
|
||||
}
|
||||
};
|
||||
|
||||
const initAutoStart = async () => {
|
||||
try {
|
||||
const is_enable = await tauriAutoStart.isEnabled();
|
||||
if (!is_enable) {
|
||||
config.autoStart = false;
|
||||
} else {
|
||||
config.autoStart = true;
|
||||
}
|
||||
} catch (err) {
|
||||
config.autoStart = false;
|
||||
}
|
||||
};
|
||||
|
||||
let logsTimer: NodeJS.Timeout | null = null;
|
||||
|
||||
onMounted(async () => {
|
||||
// await handleUpdateCore(); //默认不自动更新
|
||||
await initAutoStart();
|
||||
await initStartWinIpBroadcast();
|
||||
await getCoreVersion();
|
||||
await listenObj.listenThreadId();
|
||||
await listenObj.listenConfigStart();
|
||||
closePrevent();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
unListenAll();
|
||||
listenObj.unListenReleaseList && listenObj.unListenReleaseList();
|
||||
listenObj.unListenConfigStart && listenObj.unListenConfigStart();
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
});
|
||||
|
||||
const getArgs = () => {
|
||||
// console.log(config.proxyNetworks);
|
||||
const args = [];
|
||||
if (config.dhcp) {
|
||||
args.push("-d");
|
||||
@@ -482,7 +538,7 @@
|
||||
}
|
||||
if (config.serverUrl) {
|
||||
const formatUrl = config.serverUrl.replace(/\\/g, "/");
|
||||
args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
|
||||
args.push("--peers", ...config.protocol.map((protocol) => `${protocol}://${formatUrl}`));
|
||||
}
|
||||
if (config.disbleP2p) {
|
||||
args.push("--disable-p2p");
|
||||
@@ -493,15 +549,51 @@
|
||||
if (config.disbleListenner) {
|
||||
args.push("--no-listener");
|
||||
}
|
||||
if (mainStore.cidrEnable && config.proxyNetworks) {
|
||||
// console.log(config.proxyNetworks);
|
||||
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
|
||||
const formatProxyNetworks = config.proxyNetworks
|
||||
.split("\n")
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item && reg.test(item));
|
||||
args.push("--proxy-networks", ...formatProxyNetworks);
|
||||
config.proxyNetworks = formatProxyNetworks.join("\n");
|
||||
}
|
||||
if (config.disableEncryption) {
|
||||
args.push("--disable-encryption");
|
||||
}
|
||||
if (config.multiThread) {
|
||||
args.push("--multi-thread");
|
||||
}
|
||||
if (config.enablExitNode) {
|
||||
args.push("--enable-exit-node");
|
||||
}
|
||||
if (config.noTun) {
|
||||
args.push("--no-tun");
|
||||
}
|
||||
if (config.latencyfirst) {
|
||||
args.push("--latency-first");
|
||||
}
|
||||
if (config.useSmoltcp) {
|
||||
args.push("--use-smoltcp");
|
||||
}
|
||||
if (config.disableUdpHolePunching) {
|
||||
args.push("--disable-udp-hole-punching");
|
||||
}
|
||||
if (config.relayAllPeerrpc) {
|
||||
args.push("--relay-all-peer-rpc");
|
||||
}
|
||||
return args;
|
||||
};
|
||||
|
||||
const reset = async () => {
|
||||
data.isStart = false;
|
||||
data.isSuccessGetIp = false;
|
||||
config.ipv4 = "";
|
||||
if (config.dhcp) {
|
||||
config.ipv4 = "";
|
||||
}
|
||||
const memberDialog = await getAllWebviewWindows();
|
||||
const memberDialogs = memberDialog.filter(item => item.label === "member");
|
||||
const memberDialogs = memberDialog.filter((item) => item.label === "member");
|
||||
if (memberDialogs && memberDialogs.length > 0) {
|
||||
data.memberVisible = false;
|
||||
for (const memberDialog of memberDialogs) {
|
||||
@@ -511,7 +603,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await setTrayRunState(tray, false);
|
||||
await unListenAll();
|
||||
};
|
||||
|
||||
@@ -519,97 +611,100 @@
|
||||
if (data.isStart) {
|
||||
await reset();
|
||||
} else {
|
||||
data.log = ""; //清空日志
|
||||
data.startLoading = true;
|
||||
await unListenAll();
|
||||
await listenObj.listenOutput();
|
||||
const args = getArgs();
|
||||
await invoke("run_command", {
|
||||
args
|
||||
args,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleShowMemberDialog = async () => {
|
||||
try {
|
||||
if (!data.isStart) {
|
||||
return ElMessage.warning("请先开始联机");
|
||||
}
|
||||
if (!mainStore.config.ipv4) {
|
||||
return ElMessage.warning("请等待获取IP");
|
||||
}
|
||||
const appWindow = getCurrentWindow();
|
||||
const appSize = await appWindow.innerSize();
|
||||
const appPosition = await appWindow.outerPosition();
|
||||
if (appWindow) {
|
||||
const memberDialog = new WebviewWindow("member", {
|
||||
title: "成员列表",
|
||||
width: 470,
|
||||
height: 380,
|
||||
parent: appWindow,
|
||||
closable: true,
|
||||
resizable: true,
|
||||
decorations: true,
|
||||
maximizable: false,
|
||||
minimizable: false,
|
||||
x: appPosition.x + appSize.width + 10,
|
||||
y: appPosition.y,
|
||||
url: "#/member"
|
||||
});
|
||||
if (!data.memberVisible) {
|
||||
data.memberVisible = true;
|
||||
memberDialog.onCloseRequested(() => {
|
||||
data.logVisible = false;
|
||||
});
|
||||
const appWindow = getCurrentWindow();
|
||||
} else {
|
||||
data.memberVisible = false;
|
||||
memberDialog.destroy();
|
||||
}
|
||||
|
||||
// await memberDialog.setPosition(new LogicalPosition(appPosition.x + appSize.width + 10, appPosition.y));
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
if (!data.isStart) {
|
||||
return ElMessage.warning("请先开始联机");
|
||||
}
|
||||
if (!mainStore.config.ipv4) {
|
||||
return ElMessage.warning("请等待获取IP");
|
||||
}
|
||||
|
||||
await etWindows(
|
||||
"member",
|
||||
{
|
||||
title: "成员列表",
|
||||
width: 470,
|
||||
height: 380,
|
||||
url: "#/member",
|
||||
},
|
||||
() => {
|
||||
data.memberVisible = true;
|
||||
},
|
||||
() => {
|
||||
data.memberVisible = false;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const handleShowLogDialog = async () => {
|
||||
try {
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
const appWindow = getCurrentWindow();
|
||||
const appSize = await appWindow.innerSize();
|
||||
const appPosition = await appWindow.outerPosition();
|
||||
if (appWindow) {
|
||||
const infoDialog = new WebviewWindow("log", {
|
||||
title: "日志",
|
||||
width: 600,
|
||||
height: 380,
|
||||
parent: appWindow,
|
||||
closable: true,
|
||||
resizable: false,
|
||||
decorations: true,
|
||||
maximizable: false,
|
||||
minimizable: false,
|
||||
x: appPosition.x + appSize.width + 10,
|
||||
y: appPosition.y,
|
||||
url: "#/log"
|
||||
});
|
||||
if (!data.logVisible) {
|
||||
data.logVisible = true;
|
||||
infoDialog.onCloseRequested(() => {
|
||||
data.logVisible = false;
|
||||
});
|
||||
|
||||
logsTimer = setInterval(() => {
|
||||
appWindow.emitTo("log", "logs", data.log);
|
||||
}, 3000);
|
||||
} else {
|
||||
data.logVisible = false;
|
||||
infoDialog.destroy();
|
||||
}
|
||||
await etWindows(
|
||||
"log",
|
||||
{
|
||||
title: "联机日志",
|
||||
width: 600,
|
||||
height: 380,
|
||||
resizable: false,
|
||||
url: "#/log",
|
||||
},
|
||||
(_, appWindow) => {
|
||||
data.logVisible = true;
|
||||
logsTimer && clearInterval(logsTimer);
|
||||
logsTimer = setInterval(() => {
|
||||
appWindow.emitTo("log", "logs", data.log);
|
||||
}, 600);
|
||||
},
|
||||
() => {
|
||||
data.logVisible = false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const handleShowCidrDialog = async () => {
|
||||
await etWindows(
|
||||
"cidr",
|
||||
{
|
||||
title: "子网代理",
|
||||
width: 600,
|
||||
height: 380,
|
||||
resizable: false,
|
||||
url: "#/cidr",
|
||||
},
|
||||
(_, appWindow) => {
|
||||
data.cidrVisible = true;
|
||||
},
|
||||
() => {
|
||||
data.cidrVisible = false;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const handleShowAdvanceDialog = async () => {
|
||||
await etWindows(
|
||||
"advance",
|
||||
{
|
||||
title: "高级选项",
|
||||
width: 600,
|
||||
height: 380,
|
||||
resizable: false,
|
||||
url: "#/advance",
|
||||
},
|
||||
(_, appWindow) => {
|
||||
data.advanceVisible = true;
|
||||
},
|
||||
() => {
|
||||
data.advanceVisible = false;
|
||||
}
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<ElInput
|
||||
type="textarea"
|
||||
rows="17"
|
||||
:rows="17"
|
||||
v-model="data.log"
|
||||
resize="none"
|
||||
readonly
|
||||
placeholder="等待日志中..."
|
||||
placeholder="等待日志中,请先'启动联机'..."
|
||||
/>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
+12
-129
@@ -33,6 +33,7 @@
|
||||
<script setup lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { reactive, onMounted, onBeforeUnmount } from "vue";
|
||||
import { parsePeerInfo } from "@/utils";
|
||||
const data = reactive<{ member: any[] }>({
|
||||
member: []
|
||||
});
|
||||
@@ -40,142 +41,24 @@
|
||||
const showTableHeader = [
|
||||
["ipv4", "虚拟网IP"],
|
||||
["hostname", "主机名"],
|
||||
["cost", "方式"],
|
||||
["cost", "路由"],
|
||||
["lat_ms", "延迟/ms"],
|
||||
["loss_rate", "丢包率"],
|
||||
["version", "版本"]
|
||||
];
|
||||
const headers = [
|
||||
"ipv4",
|
||||
"hostname",
|
||||
"cost",
|
||||
"lat_ms",
|
||||
"loss_rate",
|
||||
"rx_bytes",
|
||||
"rx_unit",
|
||||
"tx_bytes",
|
||||
"tx_unit",
|
||||
"tunnel_proto",
|
||||
"nat_type",
|
||||
"id",
|
||||
"version"
|
||||
];
|
||||
|
||||
const formatData = (data: any[]) => {
|
||||
if (!data) return [];
|
||||
const result = [];
|
||||
let obj: any = {};
|
||||
let length = data.length;
|
||||
for (let idx = 0; idx < length; idx++) {
|
||||
let headersIdx = idx % headers.length;
|
||||
if (headersIdx === 0) {
|
||||
console.log(idx, [...data]);
|
||||
obj = {};
|
||||
result.push(obj);
|
||||
}
|
||||
if (["ipv4"].includes(headers[headersIdx]) && !/\d+\.\d+\.\d+\.\d\/\d+/.test(data[idx]) && data[idx]) {
|
||||
const next = data[idx];
|
||||
data[idx] = "-";
|
||||
const head = data.slice(0, idx);
|
||||
const latest = data.slice(idx);
|
||||
data = [...head, next, ...latest];
|
||||
length = data.length;
|
||||
} else if (["rx_bytes", "tx_bytes"].includes(headers[headersIdx]) && data[idx] == "-") {
|
||||
const head = data.slice(0, idx);
|
||||
const latest = data.slice(idx);
|
||||
data = [...head, "-", ...latest];
|
||||
length = data.length;
|
||||
} else if (
|
||||
["tunnel_proto"].includes(headers[headersIdx]) &&
|
||||
![
|
||||
"tcp",
|
||||
"udp",
|
||||
"ws",
|
||||
"wss",
|
||||
"wg",
|
||||
"-",
|
||||
"tcp,udp",
|
||||
"ws,wss",
|
||||
"tcp,udp,ws,wss,wg",
|
||||
"tcp,ws,wss,wg",
|
||||
"udp,ws,wss,wg",
|
||||
"tcp,wg",
|
||||
"udp,wg",
|
||||
"tcp,ws",
|
||||
"tcp,wss",
|
||||
"udp,ws",
|
||||
"udp,wss",
|
||||
"tcp,udp,ws",
|
||||
"tcp,udp,wss",
|
||||
"tcp,udp,ws,wss",
|
||||
"tcp,udp,ws,wss,wg",
|
||||
"tcp,udp,wg",
|
||||
"tcp,udp,ws,wg",
|
||||
"udp,tcp",
|
||||
"udp,tcp,ws",
|
||||
"udp,tcp,wss",
|
||||
"udp,tcp,ws,wss",
|
||||
"udp,tcp,ws,wss,wg",
|
||||
"udp,tcp,wg",
|
||||
"udp,tcp,ws,wg",
|
||||
"tcp,udp,wss,wg",
|
||||
"tcp,udp,ws,wg",
|
||||
"tcp,udp,wss,wg",
|
||||
"ws,tcp",
|
||||
"ws,udp",
|
||||
"ws,tcp,udp",
|
||||
"ws,tcp,udp,ws",
|
||||
"ws,tcp,udp,wss",
|
||||
"ws,tcp,udp,ws,wss",
|
||||
"ws,tcp,udp,ws,wss,wg",
|
||||
"ws,tcp,udp,wg",
|
||||
"ws,tcp,udp,ws,wg",
|
||||
"ws,udp,tcp",
|
||||
"ws,udp,tcp,ws",
|
||||
"ws,udp,tcp,wss",
|
||||
"ws,udp,tcp,ws,wss",
|
||||
"wss,tcp",
|
||||
"wss,udp",
|
||||
"wss,tcp,udp",
|
||||
"wss,tcp,udp,ws",
|
||||
"wss,tcp,udp,wss",
|
||||
"wss,tcp,udp,ws,wss",
|
||||
"wss,tcp,udp,ws,wss,wg",
|
||||
"wss,tcp,udp,wg",
|
||||
"wg,tcp",
|
||||
"wg,udp",
|
||||
"wg,tcp,udp",
|
||||
"wg,tcp,udp,ws",
|
||||
"wg,tcp,udp,wss",
|
||||
"wg,tcp,udp,ws,wss",
|
||||
"wg,tcp,udp,ws,wss,wg",
|
||||
"wg,tcp,udp,wg",
|
||||
"wg,udp,tcp"
|
||||
].includes(data[idx])
|
||||
) {
|
||||
const head = data.slice(0, idx);
|
||||
const latest = data.slice(idx);
|
||||
data = [...head, "-", ...latest];
|
||||
length = data.length;
|
||||
}
|
||||
obj[headers[headersIdx]] = data[idx];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
const listenOutput = async () => {
|
||||
const member = await invoke("get_members_by_cli");
|
||||
let memberData = ((member as string) || "")
|
||||
.replace(/[\│\├\┌\└\─\┬\┴\┼\┤\┐\┘]+/g, "")
|
||||
.split(" ")
|
||||
.filter(el => el && !["\n", "\n\n"].includes(el))
|
||||
.slice(11);
|
||||
if (memberData.length <= 0) {
|
||||
return;
|
||||
}
|
||||
const result = formatData(memberData);
|
||||
data.member = result;
|
||||
console.log({ member: data.member });
|
||||
const peerInfo = parsePeerInfo(member as string);
|
||||
peerInfo.forEach(value => {
|
||||
if (value.cost === "Local") {
|
||||
value.cost = "本机";
|
||||
}
|
||||
if (value.ipv4 && value.ipv4.includes("/")) {
|
||||
value.ipv4 = value.ipv4.split("/")[0];
|
||||
}
|
||||
});
|
||||
data.member = peerInfo;
|
||||
};
|
||||
|
||||
let timer: NodeJS.Timeout | null = null;
|
||||
|
||||
Generated
+20
-430
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,4 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
/gen/schemas
|
||||
/easytier-windows-x86_64-v2.0.3.zip
|
||||
/easytier-windows-x86_64/
|
||||
/gen/schemas
|
||||
Generated
+241
-44
@@ -288,6 +288,17 @@ version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "auto-launch"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"
|
||||
dependencies = [
|
||||
"dirs 4.0.0",
|
||||
"thiserror",
|
||||
"winreg 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
@@ -411,9 +422,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brotli"
|
||||
version = "6.0.0"
|
||||
version = "7.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b"
|
||||
checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd"
|
||||
dependencies = [
|
||||
"alloc-no-stdlib",
|
||||
"alloc-stdlib",
|
||||
@@ -979,13 +990,33 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
dependencies = [
|
||||
"dirs-sys 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
"dirs-sys 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1078,15 +1109,17 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||
|
||||
[[package]]
|
||||
name = "easytier-game"
|
||||
version = "1.0.5"
|
||||
version = "1.0.8"
|
||||
dependencies = [
|
||||
"log",
|
||||
"planif",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sysinfo",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-autostart",
|
||||
"tauri-plugin-log",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-single-instance",
|
||||
@@ -1110,7 +1143,7 @@ dependencies = [
|
||||
"rustc_version",
|
||||
"toml 0.8.2",
|
||||
"vswhom",
|
||||
"winreg",
|
||||
"winreg 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2132,7 +2165,19 @@ version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b1fb8864823fad91877e6caea0baca82e49e8db50f8e5c9f9a453e27d3330fc"
|
||||
dependencies = [
|
||||
"jsonptr",
|
||||
"jsonptr 0.4.7",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "json-patch"
|
||||
version = "3.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08"
|
||||
dependencies = [
|
||||
"jsonptr 0.6.3",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
@@ -2149,6 +2194,16 @@ dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonptr"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "keyboard-types"
|
||||
version = "0.7.0"
|
||||
@@ -2500,7 +2555,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||
dependencies = [
|
||||
"malloc_buf",
|
||||
"objc_exception",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2508,6 +2562,9 @@ name = "objc-sys"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2"
|
||||
@@ -2535,6 +2592,30 @@ dependencies = [
|
||||
"objc2-quartz-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-cloud-kit"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-core-location",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-contacts"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-data"
|
||||
version = "0.2.2"
|
||||
@@ -2559,6 +2640,18 @@ dependencies = [
|
||||
"objc2-metal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-location"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-contacts",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-encode"
|
||||
version = "4.0.3"
|
||||
@@ -2577,6 +2670,18 @@ dependencies = [
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-link-presentation"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-metal"
|
||||
version = "0.2.2"
|
||||
@@ -2603,21 +2708,71 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_exception"
|
||||
version = "0.1.2"
|
||||
name = "objc2-symbols"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
|
||||
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_id"
|
||||
version = "0.1.1"
|
||||
name = "objc2-ui-kit"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
|
||||
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
|
||||
dependencies = [
|
||||
"objc",
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-cloud-kit",
|
||||
"objc2-core-data",
|
||||
"objc2-core-image",
|
||||
"objc2-core-location",
|
||||
"objc2-foundation",
|
||||
"objc2-link-presentation",
|
||||
"objc2-quartz-core",
|
||||
"objc2-symbols",
|
||||
"objc2-uniform-type-identifiers",
|
||||
"objc2-user-notifications",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-uniform-type-identifiers"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-user-notifications"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-core-location",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-web-kit"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68bc69301064cebefc6c4c90ce9cba69225239e4b8ff99d445a2b5563797da65"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2955,6 +3110,14 @@ version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||
|
||||
[[package]]
|
||||
name = "planif"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/mattrobineau/planif?tag=1.0.1#90e228e2bc0f142b16a0ba415ec242e1c836cc35"
|
||||
dependencies = [
|
||||
"windows 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plist"
|
||||
version = "1.7.0"
|
||||
@@ -4080,13 +4243,13 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "2.0.2"
|
||||
version = "2.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5920aad0804ea5e86808d4b6e8753d3bcbae7efc8f4e41a4da00b45427559868"
|
||||
checksum = "d3889b392db6d32a105d3757230ea0220090b8f94c90d3e60b6c5eb91178ab1b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
"dirs",
|
||||
"dirs 5.0.1",
|
||||
"dunce",
|
||||
"embed_plist",
|
||||
"futures-util",
|
||||
@@ -4131,16 +4294,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-build"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "935f9b3c49b22b3e2e485a57f46d61cd1ae07b1cbb2ba87387a387caf2d8c4e7"
|
||||
checksum = "9f96827ccfb1aa40d55d0ded79562d18ba18566657a553f992a982d755148376"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
"dirs",
|
||||
"dirs 5.0.1",
|
||||
"glob",
|
||||
"heck 0.5.0",
|
||||
"json-patch",
|
||||
"json-patch 3.0.1",
|
||||
"schemars",
|
||||
"semver",
|
||||
"serde",
|
||||
@@ -4153,14 +4316,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-codegen"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95d7443dd4f0b597704b6a14b964ee2ed16e99928d8e6292ae9825f09fbcd30e"
|
||||
checksum = "8947f16f47becd9e9cd39b74ee337fd1981574d78819be18e4384d85e5a0b82f"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"brotli",
|
||||
"ico",
|
||||
"json-patch",
|
||||
"json-patch 2.0.0",
|
||||
"plist",
|
||||
"png",
|
||||
"proc-macro2",
|
||||
@@ -4180,9 +4343,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-macros"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d2c0963ccfc3f5194415f2cce7acc975942a8797fbabfb0aa1ed6f59326ae7f"
|
||||
checksum = "8bd1c8d4a66799d3438747c3a79705cd665a95d6f24cb5f315413ff7a981fe2a"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
@@ -4209,6 +4372,21 @@ dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-autostart"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bba6bb936e0fd0a58ed958b49e2e423dd40949c9d9425cc991be996959e3838e"
|
||||
dependencies = [
|
||||
"auto-launch",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-log"
|
||||
version = "2.0.1"
|
||||
@@ -4233,9 +4411,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-shell"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "371fb9aca2823990a2d0db7970573be5fdf07881fcaa2b835b29631feb84aec1"
|
||||
checksum = "0ad7880c5586b6b2104be451e3d7fc0f3800c84bda69e9ba81c828f87cb34267"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"log",
|
||||
@@ -4269,9 +4447,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.0.1"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af12ad1af974b274ef1d32a94e6eba27a312b429ef28fcb98abc710df7f9151d"
|
||||
checksum = "a1ef7363e7229ac8d04e8a5d405670dbd43dde8fc4bc3bc56105c35452d03784"
|
||||
dependencies = [
|
||||
"dpi",
|
||||
"gtk",
|
||||
@@ -4288,9 +4466,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime-wry"
|
||||
version = "2.0.1"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e45e88aa0b11b302d836e6ea3e507a6359044c4a8bc86b865ba99868c695753d"
|
||||
checksum = "62fa2068e8498ad007b54d5773d03d57c3ff6dd96f8c8ce58beff44d0d5e0d30"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
@@ -4314,9 +4492,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-utils"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c38b0230d6880cf6dd07b6d7dd7789a0869f98ac12146e0d18d1c1049215a045"
|
||||
checksum = "1fc65d6f5c54e56b66258948a6d9e47a82ea41f4b5a7612bfbdd1634c2913ed0"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"cargo_metadata",
|
||||
@@ -4325,7 +4503,7 @@ dependencies = [
|
||||
"glob",
|
||||
"html5ever",
|
||||
"infer",
|
||||
"json-patch",
|
||||
"json-patch 2.0.0",
|
||||
"kuchikiki",
|
||||
"log",
|
||||
"memchr",
|
||||
@@ -4609,7 +4787,7 @@ checksum = "533fc2d4105e0e3d96ce1c71f2d308c9fbbe2ef9c587cab63dd627ab5bde218f"
|
||||
dependencies = [
|
||||
"core-graphics",
|
||||
"crossbeam-channel",
|
||||
"dirs",
|
||||
"dirs 5.0.1",
|
||||
"libappindicator",
|
||||
"muda",
|
||||
"objc2",
|
||||
@@ -5061,6 +5239,15 @@ dependencies = [
|
||||
"windows-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.57.0"
|
||||
@@ -5430,6 +5617,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
@@ -5442,14 +5638,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wry"
|
||||
version = "0.44.1"
|
||||
version = "0.46.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "440600584cfbd8b0d28eace95c1f2c253db05dae43780b79380aa1e868f04c73"
|
||||
checksum = "6fa1c8c760041c64ce6be99f83d6cb55fe3fcd85a1ad46d32895f6e65cee87ba"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"block",
|
||||
"cocoa",
|
||||
"core-graphics",
|
||||
"block2",
|
||||
"crossbeam-channel",
|
||||
"dpi",
|
||||
"dunce",
|
||||
@@ -5462,8 +5656,11 @@ dependencies = [
|
||||
"kuchikiki",
|
||||
"libc",
|
||||
"ndk",
|
||||
"objc",
|
||||
"objc_id",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
"objc2-ui-kit",
|
||||
"objc2-web-kit",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"raw-window-handle",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "easytier-game"
|
||||
version = "1.0.5"
|
||||
version = "1.0.8"
|
||||
homepage = "https://github.com/EasyTier/EasyTier"
|
||||
repository = "https://github.com/EasyTier/EasytierGame"
|
||||
description = "A simple network initiator based on Easytier"
|
||||
@@ -12,30 +12,33 @@ rust-version = "1.77.2"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
||||
[lib]
|
||||
name = "app_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.1", features = [] }
|
||||
tauri-build = { version = "2.0.2", features = [] }
|
||||
# prost-build = "0.13.2"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
log = "0.4"
|
||||
tauri = { version = "2.0.2", features = [
|
||||
tauri = { version = "2.0.6", features = [
|
||||
"tray-icon",
|
||||
"image-png",
|
||||
"image-ico",
|
||||
] }
|
||||
tauri-plugin-log = "2.0.0-rc"
|
||||
tauri-plugin-shell = "2"
|
||||
tauri-plugin-log = "2.0.1"
|
||||
tauri-plugin-shell = "2.0.2"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
zip = "2.2.0"
|
||||
sysinfo = '0.32.0'
|
||||
planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
|
||||
# prost = "0.13"
|
||||
# prost-types = "0.13"
|
||||
|
||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||
tauri-plugin-single-instance = "2"
|
||||
tauri-plugin-autostart = "2.0.1"
|
||||
tauri-plugin-single-instance = "2.0.1"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "enables the default permissions",
|
||||
"windows": ["main", "log"],
|
||||
"windows": ["main", "log", "member", "cidr", "advance"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:window:allow-minimize",
|
||||
@@ -20,12 +20,19 @@
|
||||
"core:webview:allow-webview-show",
|
||||
"core:webview:allow-webview-hide",
|
||||
"core:webview:allow-webview-close",
|
||||
"autostart:default",
|
||||
"autostart:allow-enable",
|
||||
"autostart:allow-disable",
|
||||
"autostart:allow-is-enabled",
|
||||
"core:tray:allow-get-by-id",
|
||||
"core:tray:allow-set-icon",
|
||||
"core:tray:allow-new",
|
||||
{
|
||||
"identifier": "shell:allow-spawn",
|
||||
"allow": [
|
||||
{
|
||||
"args": ["run"],
|
||||
"cmd": "WinIPBroadcast",
|
||||
"cmd": "easytier/tool/WinIPBroadcast",
|
||||
"name": "WinIPBroadcast"
|
||||
}
|
||||
]
|
||||
@@ -35,7 +42,7 @@
|
||||
"allow": [
|
||||
{
|
||||
"args": ["run"],
|
||||
"cmd": "WinIPBroadcast",
|
||||
"cmd": "easytier/tool/WinIPBroadcast",
|
||||
"name": "WinIPBroadcast"
|
||||
}
|
||||
]
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
这里存放每次打包需要用到的最新版本的easytier 和 相关工具
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
Binary file not shown.
+30
-12
@@ -14,6 +14,8 @@ use sysinfo::System;
|
||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||
use tauri::Emitter;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
|
||||
// 定义GitHub Release的结构体
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Release {
|
||||
@@ -50,7 +52,7 @@ pub async fn fetch_releases() -> Result<Vec<Release>, Error> {
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_core_version() -> String {
|
||||
match Command::new("easytier-core.exe")
|
||||
match Command::new("easytier/easytier-core.exe")
|
||||
.arg("--version")
|
||||
.creation_flags(0x08000000)
|
||||
.output()
|
||||
@@ -65,7 +67,7 @@ fn get_core_version() -> String {
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_cli_version() -> String {
|
||||
match Command::new("easytier-cli.exe")
|
||||
match Command::new("easytier/easytier-cli.exe")
|
||||
.arg("--version")
|
||||
.creation_flags(0x08000000)
|
||||
.output()
|
||||
@@ -112,7 +114,7 @@ struct MyResponse {
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_members_by_cli() -> String {
|
||||
match Command::new("easytier-cli.exe")
|
||||
match Command::new("easytier/easytier-cli.exe")
|
||||
.arg("peer")
|
||||
.arg("list")
|
||||
.creation_flags(0x08000000)
|
||||
@@ -128,11 +130,17 @@ fn get_members_by_cli() -> String {
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn download_easytier_zip(download_url: String, file_name: String) {
|
||||
let target = format!("https://ghp.ci/{}", download_url);
|
||||
let target = format!("{}", download_url);
|
||||
let response = reqwest::get(target)
|
||||
.await
|
||||
.expect("error to download easytier url");
|
||||
let file_path = format!("./{}", file_name);
|
||||
let file_path = format!("./easytier/{}", file_name);
|
||||
|
||||
let easytier_dir = path::Path::new("./easytier");
|
||||
if !easytier_dir.exists() {
|
||||
fs::create_dir_all(&easytier_dir).unwrap();
|
||||
}
|
||||
|
||||
let path = path::Path::new(&file_path);
|
||||
|
||||
let mut file = match File::create(&path) {
|
||||
@@ -181,7 +189,14 @@ fn unzip(fname: &path::Path) {
|
||||
// fs::create_dir_all(p).unwrap();
|
||||
// }
|
||||
// }
|
||||
let out_file_path = path::Path::new("./").join(outpath.file_name().clone().unwrap());
|
||||
|
||||
let easytier_dir = path::Path::new("./easytier");
|
||||
// if !easytier_dir.exists() {
|
||||
// fs::create_dir_all(&easytier_dir).unwrap();
|
||||
// }
|
||||
|
||||
// let out_file_path = path::Path::new("./").join(outpath.file_name().clone().unwrap());
|
||||
let out_file_path = easytier_dir.join(outpath.file_name().clone().unwrap());
|
||||
println!("outFilePath: {}", out_file_path.display());
|
||||
let mut outfile = fs::File::create(&out_file_path).unwrap();
|
||||
std::io::copy(&mut file, &mut outfile).unwrap();
|
||||
@@ -194,10 +209,7 @@ fn run_command(
|
||||
args: Vec<String>,
|
||||
stop_signal: tauri::State<Arc<AtomicBool>>,
|
||||
) {
|
||||
// if !path::Path::new("easytier-core.exe").exists() {
|
||||
// app_handle.emit("command-output", "easytier-core.exe 不存在");
|
||||
// return
|
||||
// }
|
||||
|
||||
let (tx, rx) = mpsc::channel();
|
||||
stop_signal.store(false, Ordering::Relaxed);
|
||||
let app_handle1 = app_handle.clone();
|
||||
@@ -206,7 +218,7 @@ fn run_command(
|
||||
let stop_signal2 = Arc::clone(&stop_signal);
|
||||
let args2 = args.clone();
|
||||
thread::spawn(move || {
|
||||
let mut child = Command::new("easytier-core.exe")
|
||||
let mut child = Command::new("easytier/easytier-core.exe")
|
||||
.args(args)
|
||||
.creation_flags(0x08000000)
|
||||
.stdout(Stdio::piped())
|
||||
@@ -267,7 +279,7 @@ fn stop_command(child_id: u32) {
|
||||
} else {
|
||||
eprintln!("Failed to terminate process {}.", child_id);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
println!("child id is 0");
|
||||
}
|
||||
}
|
||||
@@ -330,12 +342,18 @@ fn search_pid_by_pname(target_process_name: String) -> u32 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
pub const AUTOSTART_ARG: &str = "--autostart";
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let stop_signal = Arc::new(AtomicBool::new(false)); // 创建一个原子布尔值,用于控制命令的停止
|
||||
let stop_signal_clone = Arc::clone(&stop_signal); // 创建一个原子布尔值的克隆,用于传递给命令
|
||||
let context = tauri::generate_context!();
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_autostart::init(
|
||||
MacosLauncher::LaunchAgent,
|
||||
Some(vec![AUTOSTART_ARG]),
|
||||
))
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||
let _ = app
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "easytier-game",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.8",
|
||||
"identifier": "com.tauri.easytier-game",
|
||||
|
||||
"build": {
|
||||
@@ -15,12 +15,12 @@
|
||||
{
|
||||
"title": "easytier-game",
|
||||
"width": 331,
|
||||
"height": 285,
|
||||
"height": 305,
|
||||
"resizable": false,
|
||||
"fullscreen": false,
|
||||
"decorations": true,
|
||||
"maximizable": false,
|
||||
"center": true,
|
||||
"maximizable": false,
|
||||
"transparent": false
|
||||
}
|
||||
],
|
||||
@@ -28,12 +28,25 @@
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
|
||||
"plugins": {},
|
||||
"bundle": {
|
||||
"active": false,
|
||||
"targets": "all",
|
||||
"externalBin": ["WinIPBroadcast"],
|
||||
"resources": [
|
||||
"easytier/tool/WinIPBroadcast.exe",
|
||||
"easytier/icons/icon-inactive.ico",
|
||||
"easytier/icons/icon.ico",
|
||||
"easytier/easytier-cli.exe",
|
||||
"easytier/easytier-core.exe",
|
||||
"easytier/Packet.dll",
|
||||
"easytier/wintun.dll"
|
||||
],
|
||||
"windows": {
|
||||
"webviewInstallMode": {
|
||||
"type": "embedBootstrapper"
|
||||
}
|
||||
},
|
||||
"createUpdaterArtifacts": false,
|
||||
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"]
|
||||
"icon": ["icons/icon.png", "icons/icon.rgba", "icons/icon.icns", "icons/icon.ico"]
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -9,24 +9,46 @@ export default defineStore("main", {
|
||||
networkPassword: "",
|
||||
hostname: "",
|
||||
ipv4: "",
|
||||
proxyNetworks: "", // 子网代理
|
||||
autoStart: false, // 是否自动启动
|
||||
disableIpv6: false, // 是否禁用IPv6
|
||||
disbleListenner: false, // 是否禁用监听
|
||||
disbleP2p: true, // 是否使用P2P
|
||||
disableEncryption: false, // 是否禁用加密
|
||||
multiThread: false, //使用多线程
|
||||
enablExitNode: false, // 是否启用退出节点
|
||||
noTun: false, // 是否使用TUN
|
||||
latencyfirst: false, // 是否优先延迟
|
||||
useSmoltcp: false, // 是否为子网代理启用smoltcp堆栈
|
||||
disableUdpHolePunching: false, // 是否禁用UDP打洞
|
||||
relayAllPeerrpc: false, // 是否启用所有对等RPC
|
||||
disbleP2p: false, // 是否使用P2P
|
||||
dhcp: true, // 是否使用DHCP
|
||||
},
|
||||
cidrEnable: false,
|
||||
basePeers: ["public.easytier.top:11010"],
|
||||
};
|
||||
},
|
||||
persist: {
|
||||
paths: [
|
||||
"basePeers",
|
||||
"cidrEnable",
|
||||
"config.proxyNetworks",
|
||||
"config.serverUrl",
|
||||
"config.networkName",
|
||||
"config.protocol",
|
||||
"config.networkPassword",
|
||||
"config.disbleP2p",
|
||||
"config.autoStart",
|
||||
"config.disableIpv6",
|
||||
"config.disbleListenner",
|
||||
"config.disableEncryption",
|
||||
"config.multiThread",
|
||||
"config.enablExitNode",
|
||||
"config.noTun",
|
||||
"config.latencyfirst",
|
||||
"config.useSmoltcp",
|
||||
"config.disableUdpHolePunching",
|
||||
"config.relayAllPeerrpc",
|
||||
"config.hostname",
|
||||
"config.dhcp",
|
||||
],
|
||||
|
||||
+35
-4
@@ -77,7 +77,38 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
|
||||
});
|
||||
};
|
||||
|
||||
export const openBrowser = (key: string) => {
|
||||
// logger.info(`${import.meta.env.VITE_BROWSER_JOB_URL}${key}`)
|
||||
// _launcherApi.openBrowser(`${import.meta.env.VITE_BROWSER_JOB_URL}${key}`);
|
||||
};
|
||||
export const parsePeerInfo = (content: string) => {
|
||||
// 将表格字符串分割成行
|
||||
const lines = content.split('\n')
|
||||
|
||||
// 提取表头(keys)
|
||||
const headers = lines[1]
|
||||
.split('│')
|
||||
.slice(1, -1)
|
||||
.map((h) => h.trim())
|
||||
|
||||
// 初始化结果数组
|
||||
const result: any[] = []
|
||||
|
||||
// 遍历数据行
|
||||
for (let i = 3; i < lines.length - 1; i += 2) {
|
||||
if (lines[i].trim() === '') continue // 跳过空行
|
||||
|
||||
// 分割每一行的数据
|
||||
const values = lines[i]
|
||||
.split('│')
|
||||
.slice(1, -1)
|
||||
.map((v) => v.trim())
|
||||
|
||||
// 创建对象并添加到结果数组
|
||||
const obj: any = {}
|
||||
headers.forEach((header, index) => {
|
||||
obj[header] = values[index] === '-' || values[index] === '' ? null : values[index]
|
||||
})
|
||||
|
||||
// 每行数据都作为一个新对象添加到结果数组中
|
||||
result.push(obj)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user