Skip to content

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

feat(mobile): separate cloud and client diagnostics

tianma-ifb736e6c12983
diff --git a/apps/ios/EdgeEver/Data/Models/Models.swift b/apps/ios/EdgeEver/Data/Models/Models.swift
index 459a81c6..cdc5d000 100644
--- a/apps/ios/EdgeEver/Data/Models/Models.swift
+++ b/apps/ios/EdgeEver/Data/Models/Models.swift
@@ -29,6 +29,26 @@ struct MobileSession: Codable, Equatable, Sendable {
var user: AuthUser?
}
+struct InstanceStorageDiagnostics: Codable, Equatable, Sendable {
+ var database: String?
+ var resources: String?
+}
+
+struct InstanceHealth: Codable, Equatable, Sendable {
+ var ok: Bool
+ var name: String
+ var runtime: String?
+ var authMode: String?
+ var build: String?
+ var migration: String?
+ var storage: InstanceStorageDiagnostics?
+ var objectStorageProvider: String?
+}
+
+struct InstanceRelease: Codable, Equatable, Sendable {
+ var version: String
+}
+
struct LoginDeviceSession: Codable, Equatable, Sendable, Identifiable {
var id: String
var userAgent: String?
diff --git a/apps/ios/EdgeEver/Data/Network/APIClient.swift b/apps/ios/EdgeEver/Data/Network/APIClient.swift
index c38fc467..a77f51b1 100644
--- a/apps/ios/EdgeEver/Data/Network/APIClient.swift
+++ b/apps/ios/EdgeEver/Data/Network/APIClient.swift
@@ -31,6 +31,16 @@ actor APIClient {
onUnauthorized = handler
}
+ // MARK: - Instance diagnostics
+
+ func getInstanceHealth() async throws -> InstanceHealth {
+ try await request(path: "/api/health")
+ }
+
+ func getInstanceRelease() async throws -> InstanceRelease {
+ try await request(path: "/api/release")
+ }
+
// MARK: - Auth
func login(_ input: LoginInput) async throws -> AuthSession {
diff --git a/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift b/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift
index 61d4eb55..e6ad3031 100644
--- a/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift
+++ b/apps/ios/EdgeEver/Features/Workspace/SettingsView.swift
@@ -20,6 +20,10 @@ struct SettingsView: View {
@State private var tab: RootTab?
@State private var showLocalePicker = false
@State private var copiedSystemInfo = false
+ @State private var instanceHealth: InstanceHealth?
+ @State private var instanceVersion: String?
+ @State private var instanceLatencyMilliseconds: Int?
+ @State private var instanceDiagnosticsFailed = false
private var title: String {
switch tab {
@@ -68,6 +72,10 @@ struct SettingsView: View {
}
.background(AppTheme.background.ignoresSafeArea())
.preferredColorScheme(env.preferences.colorScheme)
+ .task(id: tab) {
+ guard tab == .system else { return }
+ await loadInstanceDiagnostics()
+ }
}
// MARK: - Header (Android settingsHeader)
@@ -448,15 +456,29 @@ struct SettingsView: View {
.frame(minHeight: 44)
}
.buttonStyle(.plain)
-
- ForEach(Array(systemInfoItems.enumerated()), id: \.offset) { index, item in
- infoRow(item.label, item.value, showBorder: true)
- }
- infoRow(env.preferences.t("实例", en: "Instance"),
- env.session.session?.baseUrl ?? "—",
- showBorder: true)
}
+ systemInfoGroup(
+ title: env.preferences.t("云端实例", en: "Cloud instance"),
+ description: env.preferences.t("当前连接实例的版本与部署环境。", en: "Version and deployment environment for the connected instance."),
+ icon: "cloud",
+ items: cloudSystemInfoItems
+ )
+
+ systemInfoGroup(
+ title: env.preferences.t("当前客户端", en: "Current client"),
+ description: env.preferences.t("这台设备上的 EdgeEver 应用与运行环境。", en: "The EdgeEver app and runtime environment on this device."),
+ icon: "iphone",
+ items: clientSystemInfoItems
+ )
+
+ systemInfoGroup(
+ title: env.preferences.t("连接与同步", en: "Connection and sync"),
+ description: env.preferences.t("实例连接与本地同步队列状态。", en: "Connection and local sync queue status."),
+ icon: "arrow.triangle.2.circlepath",
+ items: connectionSystemInfoItems
+ )
+
Button {
Task { await env.runSyncCycle() }
} label: {
@@ -494,7 +516,7 @@ struct SettingsView: View {
}
}
- private var systemInfoItems: [(label: String, value: String)] {
+ private var clientSystemInfoItems: [(label: String, value: String)] {
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "—"
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "—"
let language = env.preferences.localeCode == "system"
@@ -512,8 +534,110 @@ struct SettingsView: View {
]
}
+ private var cloudSystemInfoItems: [(label: String, value: String)] {
+ var items: [(label: String, value: String)] = [
+ (env.preferences.t("实例版本", en: "Instance version"), instanceVersion.map { "v\($0.replacingOccurrences(of: "^v", with: "", options: .regularExpression))" } ?? unknownSystemInfoValue),
+ (env.preferences.t("实例构建", en: "Instance build"), instanceHealth?.build ?? unknownSystemInfoValue),
+ (env.preferences.t("数据库版本", en: "Database version"), instanceHealth?.migration ?? unknownSystemInfoValue),
+ (env.preferences.t("数据库后端", en: "Database backend"), databaseBackendLabel(instanceHealth?.storage?.database)),
+ (env.preferences.t("新上传对象存储", en: "New upload object storage"), objectStorageLabel(instanceHealth)),
+ ]
+ if instanceHealth?.objectStorageProvider == "s3" {
+ items.append((
+ env.preferences.t("已有附件", en: "Existing attachments"),
+ env.preferences.t("继续从原存储读取", en: "Read from original storage")
+ ))
+ }
+ items.append((
+ env.preferences.t("部署平台", en: "Deployment platform"),
+ deploymentPlatformLabel(instanceHealth?.runtime)
+ ))
+ return items
+ }
+
+ private var connectionSystemInfoItems: [(label: String, value: String)] {
+ let queueItems = env.session.dataScope.flatMap { try? env.outbox.listItems(scope: $0) } ?? []
+ let pending = queueItems.filter { $0.status == .pending || $0.status == .syncing }.count
+ let failed = queueItems.filter { $0.status == .error || $0.status == .conflict }.count
+ let connection = instanceHealth != nil
+ ? env.preferences.t("连接正常", en: "Connected")
+ : instanceDiagnosticsFailed
+ ? env.preferences.t("连接失败", en: "Connection failed")
+ : env.preferences.t("正在检查", en: "Checking")
+ return [
+ (env.preferences.t("实例连接", en: "Instance connection"), connection),
+ (env.preferences.t("请求耗时", en: "Request latency"), instanceLatencyMilliseconds.map { "\($0) ms" } ?? unknownSystemInfoValue),
+ (env.preferences.t("待同步", en: "Pending sync"), String(pending)),
+ (env.preferences.t("失败或冲突", en: "Failed or conflicted"), String(failed)),
+ ]
+ }
+
+ private var unknownSystemInfoValue: String {
+ env.preferences.t("未知", en: "Unknown")
+ }
+
+ private func databaseBackendLabel(_ backend: String?) -> String {
+ switch backend {
+ case "d1": return "D1"
+ case "sqlite": return "SQLite"
+ case let value?: return value
+ case nil: return unknownSystemInfoValue
+ }
+ }
+
+ private func objectStorageLabel(_ health: InstanceHealth?) -> String {
+ if health?.objectStorageProvider == "s3" {
+ return env.preferences.t("第三方 S3 兼容 OSS", en: "Third-party S3-compatible OSS")
+ }
+ guard health?.objectStorageProvider == "builtin" else { return unknownSystemInfoValue }
+ switch health?.storage?.resources {
+ case "r2": return env.preferences.t("内置 R2", en: "Built-in R2")
+ case "filesystem": return env.preferences.t("本地文件系统", en: "Local filesystem")
+ case "s3": return env.preferences.t("实例内置 S3 兼容存储", en: "Instance-provided S3-compatible storage")
+ default: return unknownSystemInfoValue
+ }
+ }
+
+ private func deploymentPlatformLabel(_ runtime: String?) -> String {
+ switch runtime {
+ case "cloudflare-workers": return "Cloudflare"
+ case "self-hosted-bun": return "Docker"
+ default: return unknownSystemInfoValue
+ }
+ }
+
private var systemInfoText: String {
- systemInfoItems.map { "\($0.label): \($0.value)" }.joined(separator: "\n")
+ [
+ systemInfoTextSection(env.preferences.t("云端实例", en: "Cloud instance"), items: cloudSystemInfoItems),
+ systemInfoTextSection(env.preferences.t("当前客户端", en: "Current client"), items: clientSystemInfoItems),
+ systemInfoTextSection(env.preferences.t("连接与同步", en: "Connection and sync"), items: connectionSystemInfoItems),
+ ].joined(separator: "\n\n")
+ }
+
+ private func systemInfoTextSection(_ title: String, items: [(label: String, value: String)]) -> String {
+ ([title] + items.map { "\($0.label): \($0.value)" }).joined(separator: "\n")
+ }
+
+ private func loadInstanceDiagnostics() async {
+ guard env.session.isSignedIn else {
+ instanceDiagnosticsFailed = true
+ return
+ }
+ instanceDiagnosticsFailed = false
+ let startedAt = Date()
+ do {
+ async let health = env.session.client.getInstanceHealth()
+ async let release = env.session.client.getInstanceRelease()
+ let (resolvedHealth, resolvedRelease) = try await (health, release)
+ instanceHealth = resolvedHealth
+ instanceVersion = resolvedRelease.version
+ instanceLatencyMilliseconds = max(0, Int(Date().timeIntervalSince(startedAt) * 1_000))
+ } catch {
+ instanceHealth = nil
+ instanceVersion = nil
+ instanceLatencyMilliseconds = nil
+ instanceDiagnosticsFailed = true
+ }
}
private var feedbackURL: URL? {
@@ -574,7 +698,28 @@ struct SettingsView: View {
.overlay(
RoundedRectangle(cornerRadius: 12, style: .continuous)
.stroke(AppTheme.border, lineWidth: 1)
- )
+ )
+ }
+
+ private func systemInfoGroup(
+ title: String,
+ description: String,
+ icon: String,
+ items: [(label: String, value: String)]
+ ) -> some View {
+ settingsGroup(title: title, icon: icon) {
+ Text(description)
+ .font(.system(size: 12))
+ .foregroundStyle(AppTheme.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 16)
+ .padding(.bottom, 12)
+
+ ForEach(Array(items.enumerated()), id: \.offset) { _, item in
+ infoRow(item.label, item.value, showBorder: true)
+ }
+ }
}
private func preferenceBlock<Content: View>(
diff --git a/apps/mobile/src/components/icons.tsx b/apps/mobile/src/components/icons.tsx
index 28a73934..ca9bf5c4 100644
--- a/apps/mobile/src/components/icons.tsx
+++ b/apps/mobile/src/components/icons.tsx
@@ -23,6 +23,7 @@ const createIcon = (name: FeatherName) => {
};
export const Archive = createIcon("archive");
+export const Activity = createIcon("activity");
export const AlertTriangle = createIcon("alert-triangle");
export const ArrowUpCircle = createIcon("arrow-up-circle");
export const BookOpen = createIcon("book-open");
@@ -34,6 +35,7 @@ export const ChevronDown = createIcon("chevron-down");
export const ChevronLeft = createIcon("chevron-left");
export const ChevronRight = createIcon("chevron-right");
export const Code = createIcon("code");
+export const Cloud = createIcon("cloud");
export const Copy = createIcon("copy");
export const Database = createIcon("database");
export const Download = createIcon("download");
@@ -61,6 +63,7 @@ export const LogOut = createIcon("log-out");
export const Moon = createIcon("moon");
export const Merge = createIcon("git-merge");
export const MessageSquare = createIcon("message-square");
+export const MonitorSmartphone = createIcon("smartphone");
export const Minus = createIcon("minus");
export const MoreHorizontal = createIcon("more-horizontal");
export const MoreVertical = createIcon("more-vertical");
diff --git a/apps/mobile/src/screens/WorkspaceSettingsView.tsx b/apps/mobile/src/screens/WorkspaceSettingsView.tsx
index 248e0445..d591d59b 100644
--- a/apps/mobile/src/screens/WorkspaceSettingsView.tsx
+++ b/apps/mobile/src/screens/WorkspaceSettingsView.tsx
@@ -1,14 +1,18 @@
import { useEffect, useRef, useState, type ComponentRef, type ReactNode } from "react";
import * as Clipboard from "expo-clipboard";
import Constants from "expo-constants";
+import type { InstanceHealth } from "@edgeever/client";
import { buildGitHubFeedbackUrl, type AuthUser } from "@edgeever/shared";
+import { useQuery } from "@tanstack/react-query";
import { BackHandler, Linking, Modal, Platform, ScrollView, Switch, View } from "react-native";
-import { ActivityIndicator, Check, ChevronDown, ChevronLeft, ChevronRight, Copy, ExternalLink, Image as ImageIcon, Info, LogOut, MessageSquare, Moon, RefreshCw, ShieldCheck, SlidersHorizontal, Sun, UserRound } from "../components/icons";
+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";
import { useMobileTheme } from "../lib/mobile-theme";
import { useMobileUpdate } from "../lib/mobile-update";
import type { MobileLocalePreference } from "../lib/preferences";
+import { useSession } from "../lib/session";
+import { loadMobileSyncQueueSummary } from "../lib/sync-queue";
import { AccountSecurityPanel } from "./AccountSecurityModal";
import { getResolvedMobileLocale, isEnglishMobileLocale } from "./workspace-utils";
import { styles } from "./workspace-styles";
@@ -39,6 +43,21 @@ const MOBILE_LOCALE_OPTIONS: Array<{ label: string; value: MobileLocalePreferenc
type SettingsTab = "general" | "account" | "system";
export type MobileLocaleMode = MobileLocalePreference;
+type MobileInstanceDiagnostics = {
+ health: InstanceHealth;
+ latencyMs: number;
+ version: string;
+};
+
+type MobileSystemInfoGroup = {
+ description: string;
+ id: "cloud" | "client" | "connection";
+ items: Array<{ label: string; value: string }>;
+ title: string;
+};
+
+type MobileSyncDiagnostics = Awaited<ReturnType<typeof loadMobileSyncQueueSummary>>;
+
export const SettingsView = ({
currentUser,
imageCompressionEnabled,
@@ -59,10 +78,36 @@ export const SettingsView = ({
const { resolvedTheme, toggleTheme } = useMobileTheme();
const { translate } = useMobileLocale();
const { hasUpdate } = useMobileUpdate();
+ const { client, session } = useSession();
const [activeTab, setActiveTab] = useState<SettingsTab | null>(null);
const [localePickerOpen, setLocalePickerOpen] = useState(false);
const [localePickerAnchor, setLocalePickerAnchor] = useState<{ left: number; top: number; width: number } | null>(null);
const localeSelectRef = useRef<ComponentRef<typeof Pressable>>(null);
+ const syncQueueScope = session?.baseUrl ?? "";
+ const instanceDiagnosticsQuery = useQuery({
+ queryKey: ["mobile", "system-info", "instance", session?.baseUrl],
+ queryFn: async (): Promise<MobileInstanceDiagnostics> => {
+ const startedAt = Date.now();
+ const [health, release] = await Promise.all([
+ client!.getInstanceHealth(),
+ client!.getInstanceRelease(),
+ ]);
+ return {
+ health,
+ latencyMs: Math.max(0, Date.now() - startedAt),
+ version: release.version,
+ };
+ },
+ enabled: activeTab === "system" && Boolean(client),
+ staleTime: 60 * 1000,
+ retry: 1,
+ });
+ const syncDiagnosticsQuery = useQuery({
+ queryKey: ["mobile", "system-info", "sync", syncQueueScope],
+ queryFn: () => loadMobileSyncQueueSummary(syncQueueScope),
+ enabled: activeTab === "system" && Boolean(session),
+ refetchInterval: activeTab === "system" ? 10_000 : false,
+ });
const tabs: Array<{ key: SettingsTab; label: string; icon: ReactNode }> = [
{ key: "general", label: "常规设置", icon: <SlidersHorizontal color="#059669" size={17} /> },
{ key: "account", label: "登录设置", icon: <ShieldCheck color="#059669" size={17} /> },
@@ -80,8 +125,20 @@ export const SettingsView = ({
setLocalePickerOpen(true);
});
};
- const openFeedback = () => {
- void Linking.openURL(buildMobileFeedbackUrl(localePreference));
+ const openFeedback = async () => {
+ const [instanceResult, syncResult] = await Promise.all([
+ instanceDiagnosticsQuery.data || !client
+ ? Promise.resolve(instanceDiagnosticsQuery.data)
+ : instanceDiagnosticsQuery.refetch().then((result) => result.data),
+ syncDiagnosticsQuery.data || !session
+ ? Promise.resolve(syncDiagnosticsQuery.data)
+ : syncDiagnosticsQuery.refetch().then((result) => result.data),
+ ]);
+ void Linking.openURL(buildMobileFeedbackUrl(localePreference, {
+ connectionState: instanceResult ? "connected" : instanceDiagnosticsQuery.isError ? "failed" : "checking",
+ instance: instanceResult,
+ sync: syncResult,
+ }));
};
useEffect(() => {
@@ -101,7 +158,12 @@ export const SettingsView = ({
if (activeTab === "system") {
return (
<View style={styles.settingsDetailList}>
- <SystemInfoCard defaultExpanded />
+ <SystemInfoCard
+ connectionState={instanceDiagnosticsQuery.data ? "connected" : instanceDiagnosticsQuery.isError ? "failed" : "checking"}
+ defaultExpanded
+ instance={instanceDiagnosticsQuery.data}
+ sync={syncDiagnosticsQuery.data}
+ />
</View>
);
}
@@ -219,7 +281,7 @@ export const SettingsView = ({
</View>
<ChevronRight color="#94a3b8" size={17} />
</Pressable>
- <Pressable accessibilityRole="link" onPress={openFeedback} style={[styles.settingsMenuRow, styles.settingsMenuRowBorder]}>
+ <Pressable accessibilityRole="link" onPress={() => void openFeedback()} style={[styles.settingsMenuRow, styles.settingsMenuRowBorder]}>
<View style={styles.settingsMenuLabel}>
<View style={[styles.settingsMenuIcon, styles.settingsFeedbackIcon]}><MessageSquare color="#64748b" size={17} /></View>
<View style={styles.settingsFeedbackCopy}>
@@ -288,14 +350,24 @@ const SettingsActionButton = ({
</Pressable>
);
-const SystemInfoCard = ({ defaultExpanded = false }: { defaultExpanded?: boolean }) => {
+const SystemInfoCard = ({
+ connectionState,
+ defaultExpanded = false,
+ instance,
+ sync,
+}: {
+ connectionState: "checking" | "connected" | "failed";
+ defaultExpanded?: boolean;
+ instance?: MobileInstanceDiagnostics;
+ sync?: MobileSyncDiagnostics;
+}) => {
const [copied, setCopied] = useState(false);
const [expanded, setExpanded] = useState(defaultExpanded);
const { checkForUpdate, hasUpdate, openUpdate, status, updateKind } = useMobileUpdate();
const localePreference = useMobileLocalePreference();
const english = isEnglishMobileLocale(localePreference);
const copy = getMobileSystemInfoText(localePreference);
- const infoItems = getMobileSystemInfoItems(localePreference);
+ const infoGroups = getMobileSystemInfoGroups(localePreference, { connectionState, instance, sync });
const description = hasUpdate ? copy.updateAvailableDescription : copy.description;
const checking = status === "checking";
const downloading = status === "downloading";
@@ -311,7 +383,9 @@ const SystemInfoCard = ({ defaultExpanded = false }: { defaultExpanded?: boolean
: copy.openUpdate;
const copySystemInfo = async () => {
- await Clipboard.setStringAsync(infoItems.map((item) => `${item.label}: ${item.value}`).join("\n"));
+ await Clipboard.setStringAsync(infoGroups
+ .map((group) => [group.title, ...group.items.map((item) => `${item.label}: ${item.value}`)].join("\n"))
+ .join("\n\n"));
setCopied(true);
setTimeout(() => setCopied(false), 1600);
};
@@ -354,55 +428,85 @@ const SystemInfoCard = ({ defaultExpanded = false }: { defaultExpanded?: boolean
>
{checking ? <ActivityIndicator color="#047857" size="small" /> : <RefreshCw color="#047857" size={16} />}
</SettingsActionButton>
- <View style={styles.systemInfoRows}>
- {Array.from({ length: Math.ceil(infoItems.length / 3) }, (_, rowIndex) => {
- const rowItems = infoItems.slice(rowIndex * 3, rowIndex * 3 + 3);
-
- return (
- <View
- key={`system-info-row-${rowIndex}`}
- style={[styles.systemInfoRow, rowIndex === Math.ceil(infoItems.length / 3) - 1 && styles.systemInfoRowLast]}
- >
- {rowItems.map((item, itemIndex) => (
- <View
- key={item.label}
- style={[styles.systemInfoCell, itemIndex < rowItems.length - 1 && styles.systemInfoCellDivider]}
- >
- <Text numberOfLines={1} style={styles.panelLabel}>{item.label}</Text>
- <Text numberOfLines={1} selectable style={styles.systemInfoListValue}>
- {item.value}
- </Text>
- </View>
- ))}
- </View>
- );
- })}
- </View>
+ {infoGroups.map((group) => <MobileSystemInfoSection group={group} key={group.id} />)}
</View>
) : null}
</View>
);
};
+const MobileSystemInfoSection = ({ group }: { group: MobileSystemInfoGroup }) => (
+ <View style={styles.systemInfoSection}>
+ <View style={styles.systemInfoSectionHeader}>
+ {group.id === "cloud"
+ ? <Cloud color="#047857" size={16} />
+ : group.id === "client"
+ ? <MonitorSmartphone color="#047857" size={16} />
+ : <Activity color="#047857" size={16} />}
+ <View style={styles.systemInfoSectionCopy}>
+ <Text style={styles.systemInfoSectionTitle}>{group.title}</Text>
+ <Text style={styles.systemInfoSectionDescription}>{group.description}</Text>
+ </View>
+ </View>
+ <View style={styles.systemInfoRows}>
+ {Array.from({ length: Math.ceil(group.items.length / 3) }, (_, rowIndex) => {
+ const rowItems = group.items.slice(rowIndex * 3, rowIndex * 3 + 3);
+
+ return (
+ <View
+ key={`${group.id}-row-${rowIndex}`}
+ style={[styles.systemInfoRow, rowIndex === Math.ceil(group.items.length / 3) - 1 && styles.systemInfoRowLast]}
+ >
+ {rowItems.map((item, itemIndex) => (
+ <View
+ key={item.label}
+ style={[styles.systemInfoCell, itemIndex < rowItems.length - 1 && styles.systemInfoCellDivider]}
+ >
+ <Text numberOfLines={1} style={styles.panelLabel}>{item.label}</Text>
+ <Text numberOfLines={1} selectable style={styles.systemInfoListValue}>{item.value}</Text>
+ </View>
+ ))}
+ </View>
+ );
+ })}
+ </View>
+ </View>
+);
+
const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>
isEnglishMobileLocale(localePreference)
? {
- appIdentifier: "App identifier",
build: "Build",
client: "Client",
- description: "View the current app version, build identifier, and runtime environment.",
- disconnected: "Disconnected",
+ clientDescription: "The EdgeEver app and runtime environment on this device.",
+ clientSection: "Current client",
+ cloudDescription: "Version and deployment environment for the connected instance.",
+ cloudSection: "Cloud instance",
+ connected: "Connected",
+ connectionChecking: "Checking",
+ connectionDescription: "Connection and local sync queue status.",
+ connectionFailed: "Connection failed",
+ connectionSection: "Connection and sync",
+ databaseBackend: "Database backend",
+ databaseVersion: "Database version",
+ description: "View cloud instance and current client diagnostics.",
+ deploymentPlatform: "Deployment platform",
+ existingAttachments: "Existing attachments",
+ existingAttachmentsOriginalStorage: "Read from original storage",
+ failedSync: "Failed or conflicted",
followSystem: "Follow system",
installMode: "Mode",
- instanceUrl: "Instance URL",
+ instanceBuild: "Instance build",
+ instanceConnection: "Instance connection",
+ instanceVersion: "Instance version",
language: "Language",
- memoCount: "Notes",
- notSet: "Not set",
- notebookCount: "Notebooks",
+ newUploadObjectStorage: "New upload object storage",
+ pendingSync: "Pending sync",
platform: "System",
mobileApp: "Mobile app",
platformVersion: "System version",
+ requestLatency: "Request latency",
timeZone: "Time zone",
openUpdate: "Get update",
title: "System info",
@@ -412,21 +516,36 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>
version: "Version",
}
: {
- appIdentifier: "应用标识",
build: "构建",
client: "客户端",
- description: "查看当前应用版本、构建标识和运行环境。",
- disconnected: "未连接",
+ clientDescription: "这台设备上的 EdgeEver 应用与运行环境。",
+ clientSection: "当前客户端",
+ cloudDescription: "当前连接实例的版本与部署环境。",
+ cloudSection: "云端实例",
+ connected: "连接正常",
+ connectionChecking: "正在检查",
+ connectionDescription: "实例连接与本地同步队列状态。",
+ connectionFailed: "连接失败",
+ connectionSection: "连接与同步",
+ databaseBackend: "数据库后端",
+ databaseVersion: "数据库版本",
+ description: "查看云端实例与当前客户端的诊断信息。",
+ deploymentPlatform: "部署平台",
+ existingAttachments: "已有附件",
+ existingAttachmentsOriginalStorage: "继续从原存储读取",
+ failedSync: "失败或冲突",
followSystem: "跟随系统",
installMode: "安装形态",
- instanceUrl: "实例地址",
+ instanceBuild: "实例构建",
+ instanceConnection: "实例连接",
+ instanceVersion: "实例版本",
language: "语言",
- memoCount: "笔记总数",
- notSet: "未设置",
- notebookCount: "笔记本数量",
+ newUploadObjectStorage: "新上传对象存储",
+ pendingSync: "待同步",
platform: "系统",
mobileApp: "移动应用",
platformVersion: "系统版本",
+ requestLatency: "请求耗时",
timeZone: "时区",
openUpdate: "前往更新",
title: "系统信息",
@@ -436,8 +555,39 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>
version: "版本",
};
-const getMobileSystemInfoItems = (localePreference: MobileLocaleMode) => {
+const getMobileDeploymentPlatform = (runtime: string | null | undefined, english: boolean) => {
+ if (runtime === "cloudflare-workers") return "Cloudflare";
+ if (runtime === "self-hosted-bun") return "Docker";
+ return english ? "Unknown" : "未知";
+};
+
+const getMobileDatabaseBackend = (backend: string | null | undefined, unknown: string) => {
+ if (backend === "d1") return "D1";
+ if (backend === "sqlite") return "SQLite";
+ return backend || unknown;
+};
+
+const getMobileObjectStorage = (health: InstanceHealth | undefined, english: boolean, unknown: string) => {
+ if (health?.objectStorageProvider === "s3") return english ? "Third-party S3-compatible OSS" : "第三方 S3 兼容 OSS";
+ if (health?.objectStorageProvider !== "builtin") return unknown;
+ switch (health.storage?.resources) {
+ case "r2": return english ? "Built-in R2" : "内置 R2";
+ case "filesystem": return english ? "Local filesystem" : "本地文件系统";
+ case "s3": return english ? "Instance-provided S3-compatible storage" : "实例内置 S3 兼容存储";
+ default: return unknown;
+ }
+};
+
+const getMobileSystemInfoGroups = (
+ localePreference: MobileLocaleMode,
+ diagnostics: {
+ connectionState?: "checking" | "connected" | "failed";
+ instance?: MobileInstanceDiagnostics;
+ sync?: MobileSyncDiagnostics;
+ } = {},
+): MobileSystemInfoGroup[] => {
const copy = getMobileSystemInfoText(localePreference);
+ const english = isEnglishMobileLocale(localePreference);
const resolvedLocale = getResolvedMobileLocale(localePreference);
const platformName =
Platform.OS === "android"
@@ -450,20 +600,71 @@ const getMobileSystemInfoItems = (localePreference: MobileLocaleMode) => {
? "Windows"
: Platform.OS;
+ const instance = diagnostics.instance;
+ const connectionValue = diagnostics.connectionState === "connected"
+ ? copy.connected
+ : diagnostics.connectionState === "failed"
+ ? copy.connectionFailed
+ : copy.connectionChecking;
+ const pendingSync = diagnostics.sync
+ ? diagnostics.sync.pending + diagnostics.sync.syncing
+ : null;
+ const failedSync = diagnostics.sync
+ ? diagnostics.sync.error + diagnostics.sync.conflict
+ : null;
+
return [
- { label: copy.version, value: `v${MOBILE_APP_VERSION}` },
- { label: copy.build, value: __DEV__ ? "development" : "production" },
- { label: copy.client, value: copy.mobileApp },
- { label: copy.platform, value: platformName },
- { label: copy.platformVersion, value: String(Platform.Version) },
- { 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) },
+ {
+ description: copy.cloudDescription,
+ id: "cloud",
+ items: [
+ { label: copy.instanceVersion, value: instance?.version ? `v${instance.version.replace(/^v/, "")}` : copy.unknown },
+ { label: copy.instanceBuild, value: instance?.health.build || copy.unknown },
+ { label: copy.databaseVersion, value: instance?.health.migration || copy.unknown },
+ { label: copy.databaseBackend, value: getMobileDatabaseBackend(instance?.health.storage?.database, copy.unknown) },
+ { label: copy.newUploadObjectStorage, value: getMobileObjectStorage(instance?.health, english, copy.unknown) },
+ ...(instance?.health.objectStorageProvider === "s3"
+ ? [{ label: copy.existingAttachments, value: copy.existingAttachmentsOriginalStorage }]
+ : []),
+ { label: copy.deploymentPlatform, value: getMobileDeploymentPlatform(instance?.health.runtime, english) },
+ ],
+ title: copy.cloudSection,
+ },
+ {
+ description: copy.clientDescription,
+ id: "client",
+ items: [
+ { label: copy.version, value: `v${MOBILE_APP_VERSION}` },
+ { label: copy.build, value: __DEV__ ? "development" : "production" },
+ { label: copy.client, value: copy.mobileApp },
+ { label: copy.platform, value: platformName },
+ { label: copy.platformVersion, value: String(Platform.Version) },
+ { 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) },
+ ],
+ title: copy.clientSection,
+ },
+ {
+ description: copy.connectionDescription,
+ id: "connection",
+ items: [
+ { label: copy.instanceConnection, value: connectionValue },
+ { label: copy.requestLatency, value: instance ? `${instance.latencyMs} ms` : copy.unknown },
+ { label: copy.pendingSync, value: pendingSync === null ? copy.unknown : String(pendingSync) },
+ { label: copy.failedSync, value: failedSync === null ? copy.unknown : String(failedSync) },
+ ],
+ title: copy.connectionSection,
+ },
];
};
-const buildMobileFeedbackUrl = (localePreference: MobileLocaleMode) => {
+const buildMobileFeedbackUrl = (
+ localePreference: MobileLocaleMode,
+ diagnostics: Parameters<typeof getMobileSystemInfoGroups>[1] = {},
+) => {
const english = isEnglishMobileLocale(localePreference);
+ const infoGroups = getMobileSystemInfoGroups(localePreference, diagnostics);
return buildGitHubFeedbackUrl({
contentHeading: english ? "Feedback" : "反馈内容",
@@ -473,7 +674,10 @@ const buildMobileFeedbackUrl = (localePreference: MobileLocaleMode) => {
privacyNotice: english
? "GitHub Issues are public. Do not include passwords, tokens, instance URLs, or private note content."
: "GitHub Issue 公开可见,请勿提交密码、Token、实例地址或私人笔记内容。",
- systemInfo: getMobileSystemInfoItems(localePreference),
+ systemInfo: infoGroups.flatMap((group) => group.items.map((item) => ({
+ label: `${group.title} / ${item.label}`,
+ value: item.value,
+ }))),
systemInfoHeading: english ? "System information" : "系统信息",
systemInfoNotice: english
? "The following information was generated by EdgeEver to help diagnose the issue."
diff --git a/apps/mobile/src/screens/workspace-styles.ts b/apps/mobile/src/screens/workspace-styles.ts
index 00bb6d21..a68df77a 100644
--- a/apps/mobile/src/screens/workspace-styles.ts
+++ b/apps/mobile/src/screens/workspace-styles.ts
@@ -1047,8 +1047,35 @@ const baseWorkspaceStyles = StyleSheet.create({
padding: 14,
},
systemInfoRows: {
- borderTopColor: "#e2e8f0",
- borderTopWidth: 1,
+ borderColor: "#e2e8f0",
+ borderRadius: 8,
+ borderWidth: 1,
+ overflow: "hidden",
+ },
+ systemInfoSection: {
+ gap: 9,
+ paddingHorizontal: 12,
+ paddingTop: 14,
+ },
+ systemInfoSectionHeader: {
+ alignItems: "flex-start",
+ flexDirection: "row",
+ gap: 8,
+ },
+ systemInfoSectionCopy: {
+ flex: 1,
+ gap: 2,
+ minWidth: 0,
+ },
+ systemInfoSectionTitle: {
+ color: "#0f172a",
+ fontSize: 13,
+ fontWeight: "800",
+ },
+ systemInfoSectionDescription: {
+ color: "#64748b",
+ fontSize: 11,
+ lineHeight: 16,
},
systemInfoRow: {
borderBottomColor: "#e2e8f0",
diff --git a/packages/client/src/index.test.mjs b/packages/client/src/index.test.mjs
index 41655dcf..46bd5f64 100644
--- a/packages/client/src/index.test.mjs
+++ b/packages/client/src/index.test.mjs
@@ -8,6 +8,31 @@ const jsonResponse = (body, init = {}) => new Response(JSON.stringify(body), {
});
describe("EdgeEver client HTTP contract", () => {
+ test("reads public instance diagnostics through the configured base URL", async () => {
+ const calls = [];
+ const client = createEdgeEverClient({
+ baseUrl: "https://notes.example/",
+ fetch: async (input) => {
+ calls.push(String(input));
+ return jsonResponse(String(input).endsWith("/api/health")
+ ? { ok: true, name: "edgeever", runtime: "cloudflare-workers" }
+ : { version: "1.47.0", changes: {} });
+ },
+ });
+
+ const [health, release] = await Promise.all([
+ client.getInstanceHealth(),
+ client.getInstanceRelease(),
+ ]);
+
+ expect(calls).toEqual([
+ "https://notes.example/api/health",
+ "https://notes.example/api/release",
+ ]);
+ expect(health.runtime).toBe("cloudflare-workers");
+ expect(release.version).toBe("1.47.0");
+ });
+
test("normalizes the base URL and sends backup pagination with auth", async () => {
const calls = [];
const client = createEdgeEverClient({
diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts
index 28c29d1a..51e8d10b 100644
--- a/packages/client/src/index.ts
+++ b/packages/client/src/index.ts
@@ -42,6 +42,25 @@ export type EdgeEverClientOptions = {
onUnauthorized?: () => void;
};
+export type InstanceHealth = {
+ ok: true;
+ name: string;
+ runtime?: string | null;
+ authMode?: string | null;
+ build?: string | null;
+ migration?: string | null;
+ storage?: {
+ database?: "d1" | "sqlite" | string | null;
+ resources?: "r2" | "filesystem" | "s3" | string | null;
+ } | null;
+ objectStorageProvider?: "builtin" | "s3" | "unknown" | string | null;
+};
+
+export type InstanceRelease = {
+ version: string;
+ changes: Record<string, readonly string[]>;
+};
+
export type MemoFilterMode = "all" | "tagged" | "untagged" | "pinned";
export type MemoSortMode = "updated-desc" | "created-desc" | "title-asc";
@@ -247,6 +266,10 @@ export const createEdgeEverClient = (options: EdgeEverClientOptions = {}) => {
};
return {
+ getInstanceHealth: () => request<InstanceHealth>("/api/health"),
+
+ getInstanceRelease: () => request<InstanceRelease>("/api/release"),
+
getSession: () => request<AuthSession>("/api/v1/auth/session"),
getPublicMemoShare: (token: string) =>