From 4a0102adeb8344d796b985ceb7acfdd30f88fb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E7=AB=A0=E5=BD=AA?= <1353464539@qq.com> Date: Sat, 22 Aug 2026 17:48:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#Update=20=E5=A2=9E=E5=8A=A0=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E5=BF=AB=E9=80=9F=E5=88=87=E6=8D=A2=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=A4=9A=E6=88=BF=E9=97=B4=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composables/windows.ts | 14 +- pages/cidr.vue | 21 +- pages/index.vue | 1040 ++++++++++++++++++++++++++++--------- pages/member.vue | 58 ++- src-tauri/Cargo.toml | 2 +- src-tauri/src/lib.rs | 432 +++++++++------ src-tauri/tauri.conf.json | 6 +- stores/index.ts | 315 +++++++++-- 8 files changed, 1420 insertions(+), 468 deletions(-) diff --git a/composables/windows.ts b/composables/windows.ts index a4f5501..c41ea38 100644 --- a/composables/windows.ts +++ b/composables/windows.ts @@ -8,6 +8,11 @@ import { updateConfigJsonBounce, type ConfigServerUrlType } from "./configJson"; const _listenersMaps: { [key: string]: [UnlistenFn | null] } = {}; +export const MAIN_WINDOW_LOGICAL_SIZE = Object.freeze({ + width: 340, + height: 350 +}); + const dealCloseListener = async (dialog: WebviewWindow, label: string, beforeCloseFunc?: () => void | null) => { const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null]; let [unListenlogClose] = unlistenFnList; @@ -44,13 +49,12 @@ export default async ( defaultOpts.parent = appWindow; // console.error(logicalPosition); if (defaultOpts.x == 0 && defaultOpts.y == 0) { - const logicalAppSize = { - width: 340, - height: 305 - } const factor = await appWindow.scaleFactor(); const appPosition = await appWindow.outerPosition(); - const logicalPosition = new PhysicalPosition(appPosition.x + Math.ceil((logicalAppSize.width + 5) * factor), appPosition.y).toLogical(factor); + const logicalPosition = new PhysicalPosition( + appPosition.x + Math.ceil((MAIN_WINDOW_LOGICAL_SIZE.width + 5) * factor), + appPosition.y + ).toLogical(factor); defaultOpts.x = logicalPosition.x; defaultOpts.y = logicalPosition.y; } diff --git a/pages/cidr.vue b/pages/cidr.vue index 52a3f69..f3dddfd 100644 --- a/pages/cidr.vue +++ b/pages/cidr.vue @@ -54,9 +54,12 @@ import { dataSubscribe } from "@/composables/windows"; import { invoke } from "@tauri-apps/api/core"; import { reactive, onMounted, onBeforeUnmount } from "vue"; - import { ATJ, parseCliInfo } from "@/utils"; + import { ATJ } from "@/utils"; import { listen, type UnlistenFn } from "@tauri-apps/api/event"; const mainStore = useMainStore(); + if (!mainStore.activeRoomProfile) { + mainStore.initializeRoomProfiles(); + } const data = reactive<{ [key: string]: any }>({ route: [], @@ -67,7 +70,13 @@ const listenOutput = async () => { data.isRunning = true; - const [error, member] = await ATJ(invoke("get_route_by_cli")); + const rpcPortal = mainStore.activeRoomProfile?.rpcPortal; + if (!rpcPortal) { + data.isRunning = false; + data.route = []; + return; + } + const [error, member] = await ATJ(invoke("get_route_by_cli", { rpc_portal: rpcPortal })); data.isRunning = false; if(!member) return; if (error) { @@ -76,10 +85,14 @@ } if (member === "_EasytierGameCliFailedToConnect_") { data.route = []; - await listenOutput(); return; } - data.route = JSON.parse(member); + try { + data.route = JSON.parse(member); + } catch (error) { + console.error("解析当前房间的子网代理路由失败", error); + data.route = []; + } }; const listenStart = async () => { diff --git a/pages/index.vue b/pages/index.vue index 8442318..218f6e6 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,4 +1,76 @@