托盘菜单新增公共节点

This commit is contained in:
黑先森
2025-01-03 17:16:06 +08:00
parent 9d976707ac
commit 8ed652ee26
2 changed files with 25 additions and 8 deletions
+14 -1
View File
@@ -7,7 +7,7 @@ import useMainStore from "@/stores/index";
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
import { invoke } from "@tauri-apps/api/core";
// import { ElConfirmPrimary } from "~/utils/element";
// import { open } from "@tauri-apps/plugin-shell";
import { open } from "@tauri-apps/plugin-shell";
const DEFAULT_TRAY_NAME = "main";
@@ -64,6 +64,8 @@ export async function generateMenuItem(beforExit: Function, handleConnection:Fun
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
await MenuItemTheme(),
await PredefinedMenuItem.new({ item: "Separator" }),
await MenuItemPublicPeers(),
await PredefinedMenuItem.new({ item: "Separator" }),
await MenuItemExit("退出", beforExit),
];
}
@@ -81,6 +83,17 @@ export async function MenuItemExit(text: string, beforExit: Function) {
});
}
export async function MenuItemPublicPeers() {
return await MenuItem.new({
id: "publicPeers",
text: "公共节点",
action: async () => {
await open("https://easytier.gd.nkbpal.cn/status/easytier")
},
});
}
export async function MenuItemShow(text: string) {
return await MenuItem.new({
id: "show",
+11 -7
View File
@@ -41,7 +41,9 @@
></ElSwitch>
</div>
<div>
<ElTooltip content="使用ForceBindIP启动应用 (强制绑定IP或者网卡)">
<ElTooltip
content="使用ForceBindIP启动应用 (强制绑定IP或者网卡),如果还有没启动联机,请先启动联机,联机成功后,点击刷新获取easytier生成的网卡"
>
<ElText>
方案2
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
@@ -85,12 +87,11 @@
</div>
<div class="flex items-center gap-[5px]">
<ElSelect
placeholder="请输入IP地址或选择GUID"
placeholder="请输入IP地址或选择网卡"
v-model="mainStore.forceBindInput"
filterable
allow-create
clearable
no-data-text="暂无网卡数据"
no-data-text="暂无网卡数据请尝试刷新"
>
<ElOption
v-for="guid in data.guids"
@@ -480,9 +481,12 @@
const getGuids = async () => {
const guids = await invoke<string[][]>("get_network_adapter_guids");
mainStore.forceBindInput = mainStore.config.ipv4;
if (guids && guids.length > 0) {
data.guids = guids;
data.guids = guids && guids.length > 0 ? guids : [];
if (mainStore.forceBindInput.startsWith("{")) {
const has = data.guids.find(el => el[0] == mainStore.forceBindInput);
if (!has) {
mainStore.forceBindInput = "";
}
}
};