From a135a2b50eacac578bfc3ff82ee51b786b92bbde Mon Sep 17 00:00:00 2001 From: TeLiu <208341024+Te0228@users.noreply.github.com> Date: Thu, 26 Nov 2026 12:26:09 +0800 Subject: [PATCH 1/3] fix(web): display reported device platforms consistently --- apps/web/src/components/icons.tsx | 1 + apps/web/src/features/admin/page.tsx | 7 ++--- apps/web/src/features/connections/editor.tsx | 3 ++- .../src/features/devices/authorization.tsx | 5 ++-- apps/web/src/features/devices/detail.tsx | 4 +-- apps/web/src/features/devices/list.tsx | 2 +- apps/web/src/features/devices/metadata.ts | 6 +++++ apps/web/src/features/overview/page.tsx | 5 ++-- apps/web/tests/device-metadata.test.ts | 27 +++++++++++++++++++ 9 files changed, 47 insertions(+), 13 deletions(-) diff --git a/apps/web/src/components/icons.tsx b/apps/web/src/components/icons.tsx index 55cdbd0..fadf2f0 100644 --- a/apps/web/src/components/icons.tsx +++ b/apps/web/src/components/icons.tsx @@ -72,6 +72,7 @@ export function DeviceIcon({ export function platformName(value: string | null): string { if (!value) return "未知平台"; + if (value.trim().toLowerCase() === "ios") return "iOS"; const brand = platformIcon(value); if (brand) return platformLabels[brand]; return { darwin: "macOS", win32: "Windows", "Browser extension": "浏览器扩展" }[value] ?? value; diff --git a/apps/web/src/features/admin/page.tsx b/apps/web/src/features/admin/page.tsx index b767927..8c10ee5 100644 --- a/apps/web/src/features/admin/page.tsx +++ b/apps/web/src/features/admin/page.tsx @@ -1,3 +1,4 @@ +import { deviceTypeLabel } from "../devices/metadata.js"; import { RefreshButton } from "./refresh-button.js"; import { ChevronDown, Plus } from "lucide-preact"; import { useCallback, useEffect, useRef, useState } from "preact/hooks"; @@ -90,7 +91,7 @@ export function UserAdminPage({ ["用户", overview.totals.users], ["已绑定设备", overview.totals.devices], ["在线设备", overview.totals.online_devices], - ["电脑", overview.totals.computers], + ["本机设备", overview.totals.computers], ["浏览器", overview.totals.browsers], ] as const); return ( @@ -144,7 +145,7 @@ export function UserAdminPage({
- 电脑 {user.computer_count} + 本机设备 {user.computer_count} 浏览器 {user.browser_count} @@ -170,7 +171,7 @@ export function UserAdminPage({ {user.devices.map((device) => ( {device.name} - {device.kind === "computer" ? "电脑" : "浏览器"} + {deviceTypeLabel(device)} {" "} {device.status === "online" ? "在线" : "离线"} diff --git a/apps/web/src/features/connections/editor.tsx b/apps/web/src/features/connections/editor.tsx index e708d3e..f6921a9 100644 --- a/apps/web/src/features/connections/editor.tsx +++ b/apps/web/src/features/connections/editor.tsx @@ -1,3 +1,4 @@ +import { deviceTypeLabel } from "../devices/metadata.js"; import { CapabilityIcon } from "../../components/icons.js"; import { useState } from "preact/hooks"; import { @@ -196,7 +197,7 @@ export function ConnectionEditor({ {device.paused ? "已暂停" : (stateLabels[device.status] ?? device.status)} / - {device.kind === "browser" ? "浏览器" : "电脑"} + {deviceTypeLabel(device)}