Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(settings): include device model in system information

tianma-if629b7137a85a
diff --git a/apps/desktop/src/main/desktop-device-model.mjs b/apps/desktop/src/main/desktop-device-model.mjs
new file mode 100644
index 00000000..42160745
--- /dev/null
+++ b/apps/desktop/src/main/desktop-device-model.mjs
@@ -0,0 +1,37 @@
+import { execFileSync } from "node:child_process";
+import { readFileSync } from "node:fs";
+
+const trimModel = (value) => {
+ const text = typeof value === "string" ? value.trim() : "";
+ return text || null;
+};
+
+export const readDesktopDeviceModel = ({
+ execFileSync: execFile = execFileSync,
+ platform = process.platform,
+ readFileSync: readFile = readFileSync,
+} = {}) => {
+ try {
+ if (platform === "darwin") {
+ return trimModel(execFile("sysctl", ["-n", "hw.model"], { encoding: "utf8", timeout: 2_000 }));
+ }
+ if (platform === "win32") {
+ return trimModel(execFile("powershell.exe", [
+ "-NoProfile",
+ "-NonInteractive",
+ "-Command",
+ "(Get-CimInstance -ClassName Win32_ComputerSystem).Model",
+ ], {
+ encoding: "utf8",
+ timeout: 3_000,
+ windowsHide: true,
+ }));
+ }
+ if (platform === "linux") {
+ return trimModel(readFile("/sys/class/dmi/id/product_name", "utf8"));
+ }
+ } catch {
+ return null;
+ }
+ return null;
+};
diff --git a/apps/desktop/src/main/desktop-device-model.test.mjs b/apps/desktop/src/main/desktop-device-model.test.mjs
new file mode 100644
index 00000000..151032c8
--- /dev/null
+++ b/apps/desktop/src/main/desktop-device-model.test.mjs
@@ -0,0 +1,45 @@
+import { describe, expect, test } from "bun:test";
+import { readDesktopDeviceModel } from "./desktop-device-model.mjs";
+
+describe("desktop device model", () => {
+ test("reads the macOS hardware model identifier", () => {
+ expect(readDesktopDeviceModel({
+ execFileSync: (command, args) => {
+ expect(command).toBe("sysctl");
+ expect(args).toEqual(["-n", "hw.model"]);
+ return "Mac16,7\n";
+ },
+ platform: "darwin",
+ })).toBe("Mac16,7");
+ });
+
+ test("reads the Windows computer-system model", () => {
+ expect(readDesktopDeviceModel({
+ execFileSync: (command, args) => {
+ expect(command).toBe("powershell.exe");
+ expect(args.at(-1)).toContain("Win32_ComputerSystem");
+ return "Surface Laptop 5\r\n";
+ },
+ platform: "win32",
+ })).toBe("Surface Laptop 5");
+ });
+
+ test("reads the Linux DMI product name", () => {
+ expect(readDesktopDeviceModel({
+ platform: "linux",
+ readFileSync: (path) => {
+ expect(path).toBe("/sys/class/dmi/id/product_name");
+ return "ThinkPad X1 Carbon Gen 11\n";
+ },
+ })).toBe("ThinkPad X1 Carbon Gen 11");
+ });
+
+ test("returns null when the platform probe fails", () => {
+ expect(readDesktopDeviceModel({
+ execFileSync: () => {
+ throw new Error("sysctl unavailable");
+ },
+ platform: "darwin",
+ })).toBeNull();
+ });
+});
diff --git a/apps/desktop/src/main/desktop-diagnostics.mjs b/apps/desktop/src/main/desktop-diagnostics.mjs
index 71e10e46..067b6130 100644
--- a/apps/desktop/src/main/desktop-diagnostics.mjs
+++ b/apps/desktop/src/main/desktop-diagnostics.mjs
@@ -36,6 +36,7 @@ export const buildDesktopDiagnosticIssueUrl = ({ diagnostic, systemInfo }) => {
appVersion: sanitizeDesktopDiagnosticText(systemInfo.appVersion),
platform: sanitizeDesktopDiagnosticText(systemInfo.platform),
architecture: sanitizeDesktopDiagnosticText(systemInfo.architecture),
+ deviceModel: sanitizeDesktopDiagnosticText(systemInfo.deviceModel),
osVersion: sanitizeDesktopDiagnosticText(systemInfo.osVersion),
osRelease: sanitizeDesktopDiagnosticText(systemInfo.osRelease),
electron: sanitizeDesktopDiagnosticText(systemInfo.electron),
diff --git a/apps/desktop/src/main/desktop-update-flow.test.mjs b/apps/desktop/src/main/desktop-update-flow.test.mjs
index 44fa182b..b8bc9d09 100644
--- a/apps/desktop/src/main/desktop-update-flow.test.mjs
+++ b/apps/desktop/src/main/desktop-update-flow.test.mjs
@@ -48,7 +48,9 @@ describe("desktop update flow", () => {
expect(preloadSource).toContain('systemInfo: () => ipcRenderer.invoke("desktop:system-info")');
expect(systemInfoSource).toContain("getClientRuntimeDiagnostics");
expect(systemInfoSource).toContain('t("systemInfo.runtimeEngine")');
+ expect(systemInfoSource).toContain('t("systemInfo.deviceModel")');
expect(systemInfoSource).toContain('t("systemInfo.connectionSection")');
+ expect(mainSource).toContain("deviceModel: desktopDeviceModel()");
expect(systemInfoSource).not.toContain('t("systemInfo.dataDirectory")');
expect(mainSource).toContain("dataDir: sidecarDataDirectory(activeAccountId)");
});
diff --git a/apps/desktop/src/main/index.mjs b/apps/desktop/src/main/index.mjs
index 97275f24..9748a202 100644
--- a/apps/desktop/src/main/index.mjs
+++ b/apps/desktop/src/main/index.mjs
@@ -32,6 +32,7 @@ import { writeRichClipboard } from "./clipboard-write.mjs";
import { captureScreenToNote, createScreenshotCaptureGuard, screenshotImportIpcPayload, writeScreenshotTempPath } from "./screenshot-capture.mjs";
import { LocalDataResetError, scheduleMacLocalDataReset } from "./local-data-reset.mjs";
import { buildDesktopDiagnosticIssueUrl, normalizeDesktopDiagnostic } from "./desktop-diagnostics.mjs";
+import { readDesktopDeviceModel } from "./desktop-device-model.mjs";
import { createRendererStartupGuard } from "./renderer-startup-guard.mjs";
import { waitForChildProcessSpawn } from "./child-process-start.mjs";
import { ScheduledTaskScheduler } from "./scheduled-task-scheduler.mjs";
@@ -215,11 +216,21 @@ const writeDiagnostic = async (event, details = {}) => {
}
};
+let cachedDesktopDeviceModel;
+
+const desktopDeviceModel = () => {
+ if (cachedDesktopDeviceModel === undefined) {
+ cachedDesktopDeviceModel = readDesktopDeviceModel() || "unknown";
+ }
+ return cachedDesktopDeviceModel;
+};
+
const desktopRuntimeSystemInfo = () => ({
appVersion: app.getVersion(),
autoUpdateSupported: true,
platform: process.platform,
architecture: process.arch,
+ deviceModel: desktopDeviceModel(),
osVersion: process.getSystemVersion?.() || "unknown",
osRelease: operatingSystemRelease(),
electron: process.versions.electron || "unknown",
diff --git a/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift b/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift
index 9ce2b219..19f37cfd 100644
--- a/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift
+++ b/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift
@@ -598,6 +598,18 @@ struct SettingsView: View {
return String(format: "%g", Double(rounded))
}
+ private var currentDeviceModel: String {
+ var info = utsname()
+ uname(&info)
+ let machine = withUnsafePointer(to: &info.machine) { pointer in
+ pointer.withMemoryRebound(to: CChar.self, capacity: Int(_SYS_NAMELEN)) {
+ String(cString: $0)
+ }
+ }
+ let trimmed = machine.trimmingCharacters(in: .whitespacesAndNewlines)
+ return trimmed.isEmpty ? env.preferences.t("未知", en: "Unknown") : trimmed
+ }
+
private var clientSystemInfoItems: [SystemInfoItem] {
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "—"
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "—"
@@ -610,6 +622,10 @@ struct SettingsView: View {
SystemInfoItem(label: env.preferences.t("客户端", en: "Client"), value: env.preferences.t("移动应用", en: "Mobile app")),
SystemInfoItem(label: env.preferences.t("系统", en: "System"), value: "iOS"),
SystemInfoItem(label: env.preferences.t("系统版本", en: "System version"), value: UIDevice.current.systemVersion),
+ SystemInfoItem(
+ label: env.preferences.t("设备型号", en: "Device model", ja: "機種"),
+ value: currentDeviceModel
+ ),
SystemInfoItem(
label: env.preferences.t("屏幕分辨率", en: "Screen resolution", ja: "画面解像度"),
value: currentClientDisplaySize
diff --git a/apps/mobile/src/screens/WorkspaceSettingsView.tsx b/apps/mobile/src/screens/WorkspaceSettingsView.tsx
index f39aae44..6bcb38f5 100644
--- a/apps/mobile/src/screens/WorkspaceSettingsView.tsx
+++ b/apps/mobile/src/screens/WorkspaceSettingsView.tsx
@@ -21,6 +21,18 @@ const useMobileLocalePreference = () => useMobileLocale().preference;
const MOBILE_APP_VERSION = Constants.expoConfig?.version ?? "0.1.2";
+const readMobileDeviceModel = () => {
+ if (Platform.OS !== "android") return null;
+ const { Brand, Manufacturer, Model } = Platform.constants;
+ const model = typeof Model === "string" ? Model.trim() : "";
+ const manufacturer = typeof Manufacturer === "string" && Manufacturer.trim()
+ ? Manufacturer.trim()
+ : typeof Brand === "string" ? Brand.trim() : "";
+ if (!model) return manufacturer || null;
+ if (!manufacturer || model.toLowerCase().startsWith(manufacturer.toLowerCase())) return model;
+ return `${manufacturer} ${model}`;
+};
+
const formatExecutionEnvironment = (environment: string | null | undefined, localePreference: MobileLocaleMode = "system") => {
const english = isEnglishMobileLocale(localePreference);
@@ -527,6 +539,7 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>
mobileApp: "Mobile app",
platformVersion: "System version",
requestLatency: "Health check time",
+ deviceModel: "Device model",
screenResolution: "Screen resolution",
screenResolutionValue: "{{screen}} @{{dpr}}x (window {{windowSize}})",
timeZone: "Time zone",
@@ -573,6 +586,7 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>
mobileApp: "移动应用",
platformVersion: "系统版本",
requestLatency: "健康检查耗时",
+ deviceModel: "设备型号",
screenResolution: "屏幕分辨率",
screenResolutionValue: "{{screen}} @{{dpr}}x(窗口 {{windowSize}})",
timeZone: "时区",
@@ -718,6 +732,7 @@ const getMobileSystemInfoGroups = (
{ label: copy.client, value: copy.mobileApp },
{ label: copy.platform, value: platformName },
{ label: copy.platformVersion, value: String(Platform.Version) },
+ { label: copy.deviceModel, value: readMobileDeviceModel() || copy.unknown },
{
fullWidth: true,
label: copy.screenResolution,
diff --git a/apps/web/src/components/settings/FeedbackLink.tsx b/apps/web/src/components/settings/FeedbackLink.tsx
index b47dfe2d..077904ae 100644
--- a/apps/web/src/components/settings/FeedbackLink.tsx
+++ b/apps/web/src/components/settings/FeedbackLink.tsx
@@ -1,24 +1,34 @@
import { buildGitHubFeedbackUrl } from "@edgeever/shared";
+import { useQuery } from "@tanstack/react-query";
import { ExternalLink, MessageSquare } from "lucide-react";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
+import { getClientRuntimeDiagnostics } from "@/lib/system-diagnostics";
import { cn } from "@/lib/utils";
import { getShareableWebSystemInfoItems } from "./SystemInfoCard";
export const FeedbackLink = ({ className }: { className?: string }) => {
const { t, i18n } = useTranslation();
+ const clientRuntimeQuery = useQuery({
+ queryKey: ["system-info-client-runtime"],
+ queryFn: getClientRuntimeDiagnostics,
+ staleTime: Number.POSITIVE_INFINITY,
+ retry: 1,
+ });
const href = useMemo(
() =>
buildGitHubFeedbackUrl({
contentHeading: t("feedback.issueContentHeading"),
contentPrompt: t("feedback.issueContentPrompt"),
privacyNotice: t("feedback.privacyNotice"),
- systemInfo: getShareableWebSystemInfoItems(t, i18n.language),
+ systemInfo: getShareableWebSystemInfoItems(t, i18n.language, {
+ clientRuntime: clientRuntimeQuery.data,
+ }),
systemInfoHeading: t("feedback.systemInfoHeading"),
systemInfoNotice: t("feedback.systemInfoNotice"),
titlePrefix: t("feedback.issueTitlePrefix"),
}),
- [i18n.language, t]
+ [clientRuntimeQuery.data, i18n.language, t]
);
return (
diff --git a/apps/web/src/components/settings/SystemInfoPanel.test.mjs b/apps/web/src/components/settings/SystemInfoPanel.test.mjs
index bdcd4a42..bc4cbbc9 100644
--- a/apps/web/src/components/settings/SystemInfoPanel.test.mjs
+++ b/apps/web/src/components/settings/SystemInfoPanel.test.mjs
@@ -30,9 +30,17 @@ describe("system information diagnostic fields", () => {
expect(syncIssueSource.replaceAll("getShareableWebSystemInfoItems", "")).not.toContain("getWebSystemInfoItems");
});
+ test("includes current device model from client runtime diagnostics", () => {
+ expect(source).toContain('t("systemInfo.deviceModel")');
+ expect(source).toContain("diagnostics.clientRuntime?.deviceModel");
+ expect(feedbackSource).toContain("getClientRuntimeDiagnostics");
+ expect(feedbackSource).toContain("clientRuntime: clientRuntimeQuery.data");
+ });
+
test("includes current screen resolution with window size", () => {
expect(source).toContain('t("systemInfo.screenResolution")');
expect(source).toContain('t("systemInfo.screenResolutionValue", parts)');
+ expect(source).toMatch(/systemInfo\.screenResolution[\s\S]{0,220}colSpan: "full"/);
expect(source).toContain("readBrowserClientDisplaySize");
expect(source).toContain("getClientDisplaySizeParts");
expect(source).toContain('window.addEventListener("resize", onResize)');
diff --git a/apps/web/src/components/settings/SystemInfoPanel.tsx b/apps/web/src/components/settings/SystemInfoPanel.tsx
index fa21a45a..754b4cc5 100644
--- a/apps/web/src/components/settings/SystemInfoPanel.tsx
+++ b/apps/web/src/components/settings/SystemInfoPanel.tsx
@@ -218,6 +218,10 @@ const getWebSystemInfoGroups = (
?? detectOperatingSystem(userAgent, navigator.platform)
?? t("systemInfo.unknown"),
},
+ {
+ label: t("systemInfo.deviceModel"),
+ value: diagnostics.clientRuntime?.deviceModel ?? t("systemInfo.unknown"),
+ },
{
label: t("systemInfo.architecture"),
value: diagnostics.clientRuntime?.architecture ?? t("systemInfo.unknown"),
@@ -228,13 +232,13 @@ const getWebSystemInfoGroups = (
value: diagnostics.clientRuntime?.engine
?? (clientKind === "desktopApp" ? t("systemInfo.unknown") : detectBrowser(userAgent) ?? t("systemInfo.unknown")),
},
+ { label: t("systemInfo.language"), value: navigator.language || language, mono: true },
{
label: t("systemInfo.screenResolution"),
value: displaySize ?? t("systemInfo.unknown"),
mono: true,
- colSpan: "two",
+ colSpan: "full",
},
- { label: t("systemInfo.language"), value: navigator.language || language, mono: true },
{ label: t("systemInfo.timeZone"), value: timeZone, mono: true, colSpan: "double-sm" },
],
},
diff --git a/apps/web/src/lib/system-diagnostics.ts b/apps/web/src/lib/system-diagnostics.ts
index b40ccc9d..252f6709 100644
--- a/apps/web/src/lib/system-diagnostics.ts
+++ b/apps/web/src/lib/system-diagnostics.ts
@@ -7,6 +7,7 @@ export type ClientRuntimeDiagnostics = {
appVersion: string | null;
architecture: string | null;
autoUpdateSupported: boolean | null;
+ deviceModel: string | null;
engine: string | null;
operatingSystem: string | null;
};
@@ -21,10 +22,12 @@ export type ClientSyncDiagnostics = {
type UserAgentData = {
architecture?: string;
+ model?: string;
platform?: string;
platformVersion?: string;
getHighEntropyValues?: (hints: string[]) => Promise<{
architecture?: string;
+ model?: string;
platformVersion?: string;
}>;
};
@@ -91,6 +94,7 @@ export const getClientRuntimeDiagnostics = async (): Promise<ClientRuntimeDiagno
appVersion: info.appVersion,
architecture: info.architecture === "unknown" ? null : info.architecture,
autoUpdateSupported: info.autoUpdateSupported,
+ deviceModel: info.deviceModel === "unknown" ? null : info.deviceModel,
engine: [
info.electron === "unknown" ? null : `Electron ${info.electron}`,
info.chrome === "unknown" ? null : `Chromium ${info.chrome}`,
@@ -102,11 +106,13 @@ export const getClientRuntimeDiagnostics = async (): Promise<ClientRuntimeDiagno
const navigatorWithData = navigator as NavigatorWithUserAgentData;
const userAgentData = navigatorWithData.userAgentData;
let architecture = userAgentData?.architecture;
+ let deviceModel = userAgentData?.model;
let platformVersion: string | undefined;
if (userAgentData?.getHighEntropyValues) {
try {
- const highEntropy = await userAgentData.getHighEntropyValues(["architecture", "platformVersion"]);
+ const highEntropy = await userAgentData.getHighEntropyValues(["architecture", "model", "platformVersion"]);
architecture = highEntropy.architecture || architecture;
+ deviceModel = highEntropy.model || deviceModel;
platformVersion = highEntropy.platformVersion;
} catch {
// Browsers may decline high-entropy hints; the safe fallback remains useful.
@@ -117,6 +123,7 @@ export const getClientRuntimeDiagnostics = async (): Promise<ClientRuntimeDiagno
appVersion: null,
architecture: architecture || null,
autoUpdateSupported: null,
+ deviceModel: deviceModel?.trim() || null,
engine: browserEngine(navigator.userAgent),
operatingSystem: browserOperatingSystem(
navigator.userAgent,
diff --git a/apps/web/src/vite-env.d.ts b/apps/web/src/vite-env.d.ts
index aa46f5cf..fb2e3cd8 100644
--- a/apps/web/src/vite-env.d.ts
+++ b/apps/web/src/vite-env.d.ts
@@ -52,6 +52,7 @@ interface EdgeEverDesktopBridge {
autoUpdateSupported: boolean;
platform: string;
architecture: string;
+ deviceModel: string;
osVersion: string;
osRelease: string;
electron: string;
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 762e2146..4c667254 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -1193,6 +1193,7 @@ export const enUS = {
timeZone: "Time zone",
screenResolution: "Screen resolution",
screenResolutionValue: "{{screen}} @{{dpr}}x (window {{windowSize}})",
+ deviceModel: "Device model",
instanceConnection: "Instance connection",
requestLatency: "Health check time",
lastSuccessfulSync: "Last successful sync",
diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts
index 484dd507..07ceb806 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -1193,6 +1193,7 @@ export const ja = {
timeZone: "タイムゾーン",
screenResolution: "画面解像度",
screenResolutionValue: "{{screen}} @{{dpr}}x(ウィンドウ {{windowSize}})",
+ deviceModel: "機種",
instanceConnection: "インスタンス接続",
requestLatency: "ヘルスチェック時間",
lastSuccessfulSync: "最後に成功した同期",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 3aef49f9..7ed821f7 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -1193,6 +1193,7 @@ export const zhCN = {
timeZone: "时区",
screenResolution: "屏幕分辨率",
screenResolutionValue: "{{screen}} @{{dpr}}x(窗口 {{windowSize}})",
+ deviceModel: "设备型号",
instanceConnection: "实例连接",
requestLatency: "健康检查耗时",
lastSuccessfulSync: "最近成功同步",