From 40c9c36653f9ab7ee2cb07957dc946389e8e4546 Mon Sep 17 00:00:00 2001 From: liangxu Date: Mon, 20 Apr 2026 16:04:32 +0800 Subject: [PATCH] feat(desktop): show live device name in shell and keep stored info fresh Sidebar now pulls the device name from the runtime snapshot (the client the backend sees) instead of the stale copy persisted at login, so a rebinding or hostname change is visible without relogin. Session composable resolves a more accurate fallback device name/OS from userAgentData and silently re-persists desktopClient.{device_name,os,cpu_arch} on boot when the resolved values differ from what's stored. Also replaces the text logout link with an icon button and adds a status dot to the device tag. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/renderer/components/DesktopShell.vue | 139 ++++++++++++------ .../renderer/composables/useDesktopSession.ts | 75 +++++++++- 2 files changed, 165 insertions(+), 49 deletions(-) diff --git a/apps/desktop-client/src/renderer/components/DesktopShell.vue b/apps/desktop-client/src/renderer/components/DesktopShell.vue index 2fc2850..b1e43d8 100644 --- a/apps/desktop-client/src/renderer/components/DesktopShell.vue +++ b/apps/desktop-client/src/renderer/components/DesktopShell.vue @@ -7,6 +7,7 @@ import { LinkOutlined, RobotOutlined, ToolOutlined, + LogoutOutlined, } from "@ant-design/icons-vue"; import { useDesktopRuntime } from "../composables/useDesktopRuntime"; @@ -73,8 +74,9 @@ const navItems = computed(() => { const operatorName = computed(() => session.value?.user?.name ?? "未命名操作员"); const operatorEmail = computed(() => session.value?.user?.email ?? ""); +const liveClientLabel = computed(() => snapshot.value?.clients[0]?.deviceName ?? null); const clientLabel = computed( - () => session.value?.desktopClient?.device_name ?? "当前设备尚未注册 client", + () => liveClientLabel.value ?? session.value?.desktopClient?.device_name ?? "当前设备尚未注册 client", ); @@ -119,15 +121,23 @@ const clientLabel = computed( - -