Skip to content

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

feat: improve desktop startup and update feedback

tianma-if3099b407098b
diff --git a/apps/web/src/app/App.tsx b/apps/web/src/app/App.tsx
index ab5cddc1..4bb1376a 100644
--- a/apps/web/src/app/App.tsx
+++ b/apps/web/src/app/App.tsx
@@ -27,9 +27,12 @@ const EvernoteImportGuidePane = lazy(() =>
const LoginScreen = lazy(() => import("@/components/LoginScreen").then((module) => ({ default: module.LoginScreen })));
const WorkspaceApp = lazy(() => import("@/components/WorkspaceApp").then((module) => ({ default: module.WorkspaceApp })));
-const AuthLoadingScreen = () => (
- <div className="flex h-[100dvh] items-center justify-center bg-slate-50 text-sm font-medium text-slate-600">
- EdgeEver
+const AuthLoadingScreen = ({ title = "EdgeEver", detail }: { title?: string; detail?: string }) => (
+ <div className="flex h-[100dvh] items-center justify-center bg-slate-50 px-6 text-center text-slate-700">
+ <div role="status" aria-live="polite">
+ <div className="text-sm font-semibold">{title}</div>
+ {detail && <div className="mt-2 text-xs text-slate-500">{detail}</div>}
+ </div>
</div>
);
@@ -179,7 +182,9 @@ const AuthenticatedWorkspace = () => {
}, [queryClient]);
if (sessionQuery.isLoading) {
- return <AuthLoadingScreen />;
+ return desktopBridge?.isAvailable
+ ? <AuthLoadingScreen title={t("login.desktopStarting")} detail={t("login.desktopStartingDescription")} />
+ : <AuthLoadingScreen />;
}
const session = sessionQuery.data;
@@ -213,7 +218,7 @@ const AuthenticatedWorkspace = () => {
</main>
);
}
- return <AuthLoadingScreen />;
+ return <AuthLoadingScreen title={t("login.desktopPreparingData")} detail={t("login.desktopPreparingDataDescription")} />;
}
if (!session?.authenticated) {
diff --git a/apps/web/src/components/ReleaseUpdateNotice.tsx b/apps/web/src/components/ReleaseUpdateNotice.tsx
index 539ee75f..6f2a7ffa 100644
--- a/apps/web/src/components/ReleaseUpdateNotice.tsx
+++ b/apps/web/src/components/ReleaseUpdateNotice.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { ArrowUpCircle, ExternalLink, X } from "lucide-react";
+import { ArrowUpCircle, Download, ExternalLink, RefreshCw, X } from "lucide-react";
import { useTranslation } from "react-i18next";
import { fetchLatestRelease, isVersionOutdated, type LatestRelease } from "@/lib/version-check";
import { dismissRelease, getDismissedRelease } from "@/lib/release-notice";
@@ -10,6 +10,8 @@ export const ReleaseUpdateNotice = () => {
const { t } = useTranslation();
const [release, setRelease] = useState<LatestRelease | null>(null);
const [dismissed, setDismissed] = useState(false);
+ const [nativeUpdateState, setNativeUpdateState] = useState<"idle" | "available" | "downloading" | "downloaded" | "error">("idle");
+ const desktopBridge = window.edgeeverDesktop;
useEffect(() => {
const controller = new AbortController();
@@ -22,13 +24,48 @@ export const ReleaseUpdateNotice = () => {
}, []);
useEffect(() => {
- if (!release) return;
+ if (!desktopBridge?.isAvailable) return;
+ let active = true;
+ const readStatus = async () => {
+ try {
+ const { state } = await desktopBridge.updateStatus();
+ if (active && (state === "available" || state === "downloaded")) setNativeUpdateState(state);
+ } catch {
+ // The release link remains available when the native updater is unavailable.
+ }
+ };
+ void readStatus();
+ const timer = window.setInterval(() => void readStatus(), 5_000);
+ return () => {
+ active = false;
+ window.clearInterval(timer);
+ };
+ }, [desktopBridge]);
+
+ useEffect(() => {
+ if (!release || nativeUpdateState !== "idle") return;
const timer = window.setTimeout(() => setDismissed(true), AUTO_DISMISS_MS);
return () => window.clearTimeout(timer);
- }, [release?.tagName]);
+ }, [nativeUpdateState, release?.tagName]);
+
+ if ((!release && nativeUpdateState === "idle") || dismissed || (release && getDismissedRelease() === release.tagName)) return null;
- if (!release || dismissed || getDismissedRelease() === release.tagName) return null;
+ const handleNativeUpdate = async () => {
+ if (!desktopBridge?.isAvailable) return;
+ try {
+ if (nativeUpdateState === "available") {
+ setNativeUpdateState("downloading");
+ await desktopBridge.downloadUpdate();
+ } else if (nativeUpdateState === "downloaded") {
+ await desktopBridge.installUpdate();
+ }
+ } catch {
+ setNativeUpdateState("error");
+ }
+ };
+
+ const isNativeUpdate = nativeUpdateState !== "idle";
return (
<aside
@@ -43,24 +80,33 @@ export const ReleaseUpdateNotice = () => {
<div className="min-w-0 flex-1">
<div className="text-sm font-semibold leading-5">{t("systemInfo.updateAvailableTitle")}</div>
<div className="mt-0.5 text-xs leading-5 text-slate-500">
- {t("systemInfo.updateAvailableDescription", { version: release.tagName })}
+ {nativeUpdateState === "downloading"
+ ? t("systemInfo.desktopUpdateDownloading")
+ : nativeUpdateState === "downloaded"
+ ? t("systemInfo.desktopUpdateReady")
+ : nativeUpdateState === "error"
+ ? t("systemInfo.desktopUpdateFailed")
+ : t("systemInfo.updateAvailableDescription", { version: release?.tagName ?? "" })}
+ </div>
+ <div className="mt-2 flex flex-wrap items-center gap-3">
+ {isNativeUpdate && nativeUpdateState !== "downloading" && nativeUpdateState !== "error" && (
+ <button className="inline-flex items-center gap-1 text-xs font-semibold text-emerald-700 hover:text-emerald-900" type="button" onClick={() => void handleNativeUpdate()}>
+ {nativeUpdateState === "downloaded" ? <RefreshCw className="h-3 w-3" /> : <Download className="h-3 w-3" />}
+ {nativeUpdateState === "downloaded" ? t("systemInfo.desktopUpdateRestart") : t("systemInfo.desktopUpdateDownload")}
+ </button>
+ )}
+ {release && <a className="inline-flex items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900" href={release.url} target="_blank" rel="noreferrer">
+ {t("systemInfo.viewRelease")}
+ <ExternalLink className="h-3 w-3" />
+ </a>}
</div>
- <a
- className="mt-2 inline-flex items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900"
- href={release.url}
- target="_blank"
- rel="noreferrer"
- >
- {t("systemInfo.viewRelease")}
- <ExternalLink className="h-3 w-3" />
- </a>
</div>
<button
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
type="button"
aria-label={t("systemInfo.closeUpdateNotice")}
onClick={() => {
- dismissRelease(release.tagName);
+ if (release) dismissRelease(release.tagName);
setDismissed(true);
}}
>
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 28ee659c..7ea67212 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -43,6 +43,10 @@ export const enUS = {
username: "Username",
password: "Password",
submitting: "Signing in...",
+ desktopStarting: "Starting EdgeEver",
+ desktopStartingDescription: "Connecting to the local service. This may take a moment.",
+ desktopPreparingData: "Preparing local data",
+ desktopPreparingDataDescription: "Switching to the current account's local data space.",
submit: "Open workspace",
authNotConfigured: "This instance has not completed its security setup. Set EDGE_EVER_AUTH_PASSWORD as a Worker Secret and redeploy. Unauthenticated access stays blocked until it is fixed.",
databaseNotReady: "The database is not ready. Verify that the D1 binding is named DB, apply the remote migrations, and redeploy.",
@@ -255,6 +259,11 @@ export const enUS = {
viewRelease: "View update",
latestVersion: "You are running the latest version",
closeUpdateNotice: "Close update notice",
+ desktopUpdateDownloading: "Downloading update…",
+ desktopUpdateReady: "Update downloaded",
+ desktopUpdateDownload: "Download update",
+ desktopUpdateRestart: "Restart to update",
+ desktopUpdateFailed: "Update failed. Please try again later.",
},
feedback: {
title: "Feedback",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index a3f9812f..f74b8de4 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -43,6 +43,10 @@ export const zhCN = {
username: "账号",
password: "密码",
submitting: "安全登录中...",
+ desktopStarting: "正在启动 EdgeEver",
+ desktopStartingDescription: "正在连接本地服务,请稍候。",
+ desktopPreparingData: "正在准备本地数据",
+ desktopPreparingDataDescription: "正在切换当前账户的数据空间。",
submit: "开启工作区",
authNotConfigured: "实例尚未完成安全配置。请在 Worker 中设置 EDGE_EVER_AUTH_PASSWORD Secret,然后重新部署;在修复前不会开放免登录访问。",
databaseNotReady: "数据库尚未就绪。请确认 D1 绑定名称为 DB,并执行远程数据库迁移后重新部署。",
@@ -255,6 +259,11 @@ export const zhCN = {
viewRelease: "查看更新",
latestVersion: "当前已是最新版本",
closeUpdateNotice: "关闭新版本提示",
+ desktopUpdateDownloading: "正在下载更新…",
+ desktopUpdateReady: "更新已下载完成",
+ desktopUpdateDownload: "下载更新",
+ desktopUpdateRestart: "重启并更新",
+ desktopUpdateFailed: "更新失败,请稍后重试。",
},
feedback: {
title: "意见反馈",