AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
feat(settings): include current screen resolution in system info
tianma-if2d5f17c9ec0c
diff --git a/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift b/apps/ios/EdgeEver/Features/Workspace/SettingsView.swiftindex b109bb37..9ce2b219 100644--- a/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift+++ b/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift@@ -568,6 +568,36 @@ struct SettingsView: View {var localOnly = false}+ private var currentClientDisplaySize: String {+ let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first+ let screen = scene?.screen ?? UIScreen.main+ let window = scene?.windows.first(where: \.isKeyWindow) ?? scene?.windows.first+ let windowSize = window?.bounds.size ?? screen.bounds.size+ let screenWidth = Int(screen.bounds.width.rounded())+ let screenHeight = Int(screen.bounds.height.rounded())+ let windowWidth = Int(windowSize.width.rounded())+ let windowHeight = Int(windowSize.height.rounded())+ guard screenWidth > 0, screenHeight > 0, windowWidth > 0, windowHeight > 0, screen.scale > 0 else {+ return env.preferences.t("未知", en: "Unknown")+ }+ let screenText = "\(screenWidth)×\(screenHeight)"+ let windowText = "\(windowWidth)×\(windowHeight)"+ let dpr = Self.formatDevicePixelRatio(screen.scale)+ return env.preferences.t(+ "\(screenText) @\(dpr)x(窗口 \(windowText))",+ en: "\(screenText) @\(dpr)x (window \(windowText))",+ ja: "\(screenText) @\(dpr)x(ウィンドウ \(windowText))"+ )+ }++ private static func formatDevicePixelRatio(_ value: CGFloat) -> String {+ let rounded = (value * 100).rounded() / 100+ if rounded == CGFloat(Int(rounded)) {+ return String(Int(rounded))+ }+ return String(format: "%g", Double(rounded))+ }+private var clientSystemInfoItems: [SystemInfoItem] {let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "—"let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "—"@@ -580,6 +610,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: "Screen resolution", ja: "画面解像度"),+ value: currentClientDisplaySize+ ),SystemInfoItem(label: env.preferences.t("语言", en: "Language"), value: language),SystemInfoItem(label: env.preferences.t("时区", en: "Time zone"), value: TimeZone.current.identifier),SystemInfoItem(label: env.preferences.t("安装形态", en: "Mode"), value: env.preferences.t("原生 SwiftUI 应用", en: "Native SwiftUI app")),diff --git a/apps/mobile/src/screens/WorkspaceSettingsView.tsx b/apps/mobile/src/screens/WorkspaceSettingsView.tsxindex 3f0a156d..f39aae44 100644--- a/apps/mobile/src/screens/WorkspaceSettingsView.tsx+++ b/apps/mobile/src/screens/WorkspaceSettingsView.tsx@@ -2,9 +2,9 @@ import { useEffect, useRef, useState, type ComponentRef, type ReactNode } from "import * as Clipboard from "expo-clipboard";import Constants from "expo-constants";import type { InstanceHealth } from "@edgeever/client";-import { buildGitHubFeedbackUrl, isClientAheadOfInstance, type AuthUser } from "@edgeever/shared";+import { buildGitHubFeedbackUrl, formatClientDisplaySize, isClientAheadOfInstance, type AuthUser } from "@edgeever/shared";import { useQuery } from "@tanstack/react-query";-import { BackHandler, Linking, Modal, Platform, ScrollView, Switch, View } from "react-native";+import { BackHandler, Dimensions, Linking, Modal, PixelRatio, Platform, ScrollView, Switch, View } from "react-native";import { Activity, ActivityIndicator, Check, ChevronDown, ChevronLeft, ChevronRight, Cloud, Copy, ExternalLink, Image as ImageIcon, Info, LogOut, MessageSquare, MonitorSmartphone, Moon, RefreshCw, ShieldCheck, SlidersHorizontal, Sun, UserRound } from "../components/icons";import { Pressable, Text } from "../components/LocalizedText";import { useMobileLocale } from "../lib/mobile-locale";@@ -527,6 +527,8 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>mobileApp: "Mobile app",platformVersion: "System version",requestLatency: "Health check time",+ screenResolution: "Screen resolution",+ screenResolutionValue: "{{screen}} @{{dpr}}x (window {{windowSize}})",timeZone: "Time zone",openUpdate: "Get update",title: "System info",@@ -571,6 +573,8 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>mobileApp: "移动应用",platformVersion: "系统版本",requestLatency: "健康检查耗时",+ screenResolution: "屏幕分辨率",+ screenResolutionValue: "{{screen}} @{{dpr}}x(窗口 {{windowSize}})",timeZone: "时区",openUpdate: "前往更新",title: "系统信息",@@ -714,6 +718,17 @@ const getMobileSystemInfoGroups = ({ label: copy.client, value: copy.mobileApp },{ label: copy.platform, value: platformName },{ label: copy.platformVersion, value: String(Platform.Version) },+ {+ fullWidth: true,+ label: copy.screenResolution,+ value: formatClientDisplaySize({+ devicePixelRatio: PixelRatio.get(),+ screenHeight: Dimensions.get("screen").height,+ screenWidth: Dimensions.get("screen").width,+ windowHeight: Dimensions.get("window").height,+ windowWidth: Dimensions.get("window").width,+ }, copy.screenResolutionValue) || copy.unknown,+ },{ label: copy.language, value: localePreference === "system" ? `${resolvedLocale} (${copy.followSystem})` : resolvedLocale },{ label: copy.timeZone, value: Intl.DateTimeFormat().resolvedOptions().timeZone || copy.unknown },{ label: copy.installMode, value: formatExecutionEnvironment(Constants.executionEnvironment, localePreference) },diff --git a/apps/web/src/components/settings/SystemInfoPanel.test.mjs b/apps/web/src/components/settings/SystemInfoPanel.test.mjsindex fb946edf..bdcd4a42 100644--- a/apps/web/src/components/settings/SystemInfoPanel.test.mjs+++ b/apps/web/src/components/settings/SystemInfoPanel.test.mjs@@ -30,6 +30,14 @@ describe("system information diagnostic fields", () => {expect(syncIssueSource.replaceAll("getShareableWebSystemInfoItems", "")).not.toContain("getWebSystemInfoItems");});+ test("includes current screen resolution with window size", () => {+ expect(source).toContain('t("systemInfo.screenResolution")');+ expect(source).toContain('t("systemInfo.screenResolutionValue", parts)');+ expect(source).toContain("readBrowserClientDisplaySize");+ expect(source).toContain("getClientDisplaySizeParts");+ expect(source).toContain('window.addEventListener("resize", onResize)');+ });+test("distinguishes empty sync from never synced", () => {expect(source).not.toContain('t("systemInfo.authMode")');expect(source).toContain('t("systemInfo.nothingToSync")');diff --git a/apps/web/src/components/settings/SystemInfoPanel.tsx b/apps/web/src/components/settings/SystemInfoPanel.tsxindex 6d4b7fc1..fa21a45a 100644--- a/apps/web/src/components/settings/SystemInfoPanel.tsx+++ b/apps/web/src/components/settings/SystemInfoPanel.tsx@@ -1,5 +1,6 @@-import { useMemo, useState } from "react";+import { useEffect, useMemo, useState } from "react";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";+import { getClientDisplaySizeParts } from "@edgeever/shared";import type { DeploymentMetadata } from "@edgeever/shared/deployment-metadata";import { Activity, CircleCheck, Cloud, Copy, ExternalLink, Info, LoaderCircle, MonitorSmartphone, RefreshCw, RotateCcw } from "lucide-react";import { useTranslation } from "react-i18next";@@ -12,6 +13,7 @@ import { resolveDeploymentPlatform } from "@/lib/instance-runtime";import {getClientRuntimeDiagnostics,getClientSyncDiagnostics,+ readBrowserClientDisplaySize,type ClientRuntimeDiagnostics,type ClientSyncDiagnostics,} from "@/lib/system-diagnostics";@@ -104,11 +106,16 @@ const formatLastSuccessfulSync = (};const getWebSystemInfoGroups = (- t: (key: string) => string,+ t: (key: string, options?: Record<string, string>) => string,language: string,diagnostics: SystemInfoDiagnostics = {},): SystemInfoGroup[] => {const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || t("systemInfo.unknown");+ const displaySize = (() => {+ const metrics = readBrowserClientDisplaySize();+ const parts = metrics ? getClientDisplaySizeParts(metrics) : null;+ return parts ? t("systemInfo.screenResolutionValue", parts) : null;+ })();const userAgent = navigator.userAgent;const clientKind = detectWebClientKind({desktopBridgeAvailable: window.edgeeverDesktop?.isAvailable === true,@@ -221,6 +228,12 @@ const getWebSystemInfoGroups = (value: diagnostics.clientRuntime?.engine?? (clientKind === "desktopApp" ? t("systemInfo.unknown") : detectBrowser(userAgent) ?? t("systemInfo.unknown")),},+ {+ label: t("systemInfo.screenResolution"),+ value: displaySize ?? t("systemInfo.unknown"),+ mono: true,+ colSpan: "two",+ },{ label: t("systemInfo.language"), value: navigator.language || language, mono: true },{ label: t("systemInfo.timeZone"), value: timeZone, mono: true, colSpan: "double-sm" },],@@ -229,14 +242,14 @@ const getWebSystemInfoGroups = (};export const getWebSystemInfoItems = (- t: (key: string) => string,+ t: (key: string, options?: Record<string, string>) => string,language: string,diagnostics: SystemInfoDiagnostics = {},): SystemInfoItem[] => getWebSystemInfoGroups(t, language, diagnostics).flatMap((group) => group.items);export const getShareableWebSystemInfoItems = (- t: (key: string) => string,+ t: (key: string, options?: Record<string, string>) => string,language: string,diagnostics: SystemInfoDiagnostics = {},) => getWebSystemInfoItems(t, language, diagnostics)@@ -247,6 +260,7 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => {const { t, i18n } = useTranslation();const [copied, setCopied] = useState(false);const [desktopUpdateChecked, setDesktopUpdateChecked] = useState(false);+ const [viewportRevision, setViewportRevision] = useState(0);const queryClient = useQueryClient();const { release } = useDeployedUpdateNotice();const desktopBridge = window.edgeeverDesktop;@@ -284,6 +298,12 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => {refetchInterval: (query) => query.state.data?.state === "available" ? 1_000 : false,retry: 1,});+ useEffect(() => {+ if (!active) return;+ const onResize = () => setViewportRevision((value) => value + 1);+ window.addEventListener("resize", onResize);+ return () => window.removeEventListener("resize", onResize);+ }, [active]);const desktopUpdateCheckMutation = useMutation({mutationFn: () => desktopBridge!.checkUpdate(),onSuccess: (status) => {@@ -356,6 +376,7 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => {release?.version,syncDiagnosticsQuery.data,t,+ viewportRevision,]);const releaseTag = release ? getReleaseTagForVersion(release.version) : null;const releaseUrl = releaseTagdiff --git a/apps/web/src/lib/system-diagnostics.ts b/apps/web/src/lib/system-diagnostics.tsindex 65d7bf90..b40ccc9d 100644--- a/apps/web/src/lib/system-diagnostics.ts+++ b/apps/web/src/lib/system-diagnostics.ts@@ -1,4 +1,4 @@-import { summarizeSyncQueue } from "@edgeever/shared";+import { summarizeSyncQueue, type ClientDisplaySizeInput } from "@edgeever/shared";import { api, getConfiguredDesktopApiBaseUrl } from "./api";import { localDb } from "./local-db";import { createLocalDataScope } from "./local-mirror";@@ -61,6 +61,17 @@ const browserOperatingSystem = (userAgent: string, platform: string, platformVerreturn null;};+export const readBrowserClientDisplaySize = (): ClientDisplaySizeInput | null => {+ if (typeof window === "undefined" || typeof screen === "undefined") return null;+ return {+ devicePixelRatio: Number(window.devicePixelRatio) || 1,+ screenHeight: Number(screen.height),+ screenWidth: Number(screen.width),+ windowHeight: Number(window.innerHeight),+ windowWidth: Number(window.innerWidth),+ };+};+const desktopOperatingSystem = (platform: string, version: string) => {const name = platform === "darwin"? "macOS"diff --git a/packages/shared/src/client-display-size.test.mjs b/packages/shared/src/client-display-size.test.mjsnew file mode 100644index 00000000..1932e7b8--- /dev/null+++ b/packages/shared/src/client-display-size.test.mjs@@ -0,0 +1,63 @@+import { describe, expect, test } from "bun:test";+import { formatClientDisplaySize, formatDevicePixelRatio, getClientDisplaySizeParts } from "./client-display-size";++const chineseTemplate = "{{screen}} @{{dpr}}x(窗口 {{windowSize}})";+const englishTemplate = "{{screen}} @{{dpr}}x (window {{windowSize}})";++describe("client display size formatting", () => {+ test("exposes interpolation parts for localized system info", () => {+ expect(getClientDisplaySizeParts({+ devicePixelRatio: 2,+ screenHeight: 982,+ screenWidth: 1512,+ windowHeight: 800,+ windowWidth: 1280,+ })).toEqual({+ dpr: "2",+ screen: "1512×982",+ windowSize: "1280×800",+ });+ });++ test("formats screen size, device pixel ratio, and window size", () => {+ expect(formatClientDisplaySize({+ devicePixelRatio: 2,+ screenHeight: 982,+ screenWidth: 1512,+ windowHeight: 800,+ windowWidth: 1280,+ }, chineseTemplate)).toBe("1512×982 @2x(窗口 1280×800)");+ expect(formatClientDisplaySize({+ devicePixelRatio: 1.25,+ screenHeight: 1080,+ screenWidth: 1920,+ windowHeight: 900,+ windowWidth: 1440,+ }, englishTemplate)).toBe("1920×1080 @1.25x (window 1440×900)");+ });++ test("rounds css pixels and trims integer device pixel ratios", () => {+ expect(formatDevicePixelRatio(2)).toBe("2");+ expect(formatDevicePixelRatio(1.5)).toBe("1.5");+ expect(formatDevicePixelRatio(1.333333)).toBe("1.33");+ expect(formatClientDisplaySize({+ devicePixelRatio: 2.0000001,+ screenHeight: 981.4,+ screenWidth: 1511.6,+ windowHeight: 799.6,+ windowWidth: 1279.4,+ }, chineseTemplate)).toBe("1512×981 @2x(窗口 1279×800)");+ });++ test("returns null when a display metric is missing", () => {+ expect(formatClientDisplaySize({+ devicePixelRatio: 2,+ screenHeight: 982,+ screenWidth: 0,+ windowHeight: 800,+ windowWidth: 1280,+ }, chineseTemplate)).toBeNull();+ expect(formatDevicePixelRatio(0)).toBeNull();+ expect(formatDevicePixelRatio(Number.NaN)).toBeNull();+ });+});diff --git a/packages/shared/src/client-display-size.ts b/packages/shared/src/client-display-size.tsnew file mode 100644index 00000000..652f1e2b--- /dev/null+++ b/packages/shared/src/client-display-size.ts@@ -0,0 +1,52 @@+export type ClientDisplaySizeInput = {+ devicePixelRatio: number;+ screenHeight: number;+ screenWidth: number;+ windowHeight: number;+ windowWidth: number;+};++export type ClientDisplaySizeParts = {+ dpr: string;+ screen: string;+ windowSize: string;+};++const formatDisplayPixels = (value: number) => {+ if (!Number.isFinite(value) || value <= 0) return null;+ return String(Math.round(value));+};++export const formatDevicePixelRatio = (value: number) => {+ if (!Number.isFinite(value) || value <= 0) return null;+ const rounded = Math.round(value * 100) / 100;+ return Number.isInteger(rounded) ? String(rounded) : String(rounded);+};++export const getClientDisplaySizeParts = (+ input: ClientDisplaySizeInput,+): ClientDisplaySizeParts | null => {+ const screenWidth = formatDisplayPixels(input.screenWidth);+ const screenHeight = formatDisplayPixels(input.screenHeight);+ const windowWidth = formatDisplayPixels(input.windowWidth);+ const windowHeight = formatDisplayPixels(input.windowHeight);+ const dpr = formatDevicePixelRatio(input.devicePixelRatio);+ if (!screenWidth || !screenHeight || !windowWidth || !windowHeight || !dpr) return null;+ return {+ dpr,+ screen: `${screenWidth}×${screenHeight}`,+ windowSize: `${windowWidth}×${windowHeight}`,+ };+};++export const formatClientDisplaySize = (+ input: ClientDisplaySizeInput,+ template: string,+): string | null => {+ const parts = getClientDisplaySizeParts(input);+ if (!parts) return null;+ return template+ .replaceAll("{{screen}}", parts.screen)+ .replaceAll("{{dpr}}", parts.dpr)+ .replaceAll("{{windowSize}}", parts.windowSize);+};diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 64f83433..8eaf3e26 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -1191,6 +1191,8 @@ export const enUS = {runtimeEngine: "Runtime engine",language: "Language",timeZone: "Time zone",+ screenResolution: "Screen resolution",+ screenResolutionValue: "{{screen}} @{{dpr}}x (window {{windowSize}})",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.tsindex 2246816d..f19a13a5 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -1191,6 +1191,8 @@ export const ja = {runtimeEngine: "ランタイムエンジン",language: "言語",timeZone: "タイムゾーン",+ screenResolution: "画面解像度",+ screenResolutionValue: "{{screen}} @{{dpr}}x(ウィンドウ {{windowSize}})",instanceConnection: "インスタンス接続",requestLatency: "ヘルスチェック時間",lastSuccessfulSync: "最後に成功した同期",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex e0e92342..ee046554 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -1191,6 +1191,8 @@ export const zhCN = {runtimeEngine: "运行引擎",language: "语言",timeZone: "时区",+ screenResolution: "屏幕分辨率",+ screenResolutionValue: "{{screen}} @{{dpr}}x(窗口 {{windowSize}})",instanceConnection: "实例连接",requestLatency: "健康检查耗时",lastSuccessfulSync: "最近成功同步",diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.tsindex 7adf023d..20c0f489 100644--- a/packages/shared/src/index.ts+++ b/packages/shared/src/index.ts@@ -12,6 +12,7 @@ export * from "./attachment-metadata";export * from "./mobile-content-compatibility";export * from "./native-attachment-content";export * from "./backup";+export * from "./client-display-size";export * from "./github-feedback";export * from "./image-display";export * from "./image-gallery";