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: show deployed release updates
tianma-if61859299d3e3
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsxindex 314da2b2..836794c7 100644--- a/apps/web/src/components/EditorPane.tsx+++ b/apps/web/src/components/EditorPane.tsx@@ -132,7 +132,7 @@ import {import { copyEditorToWeChat, copyMarkdownToWeChat } from "@/lib/wechat-copy";import { ThemeBlock } from "./ThemeBlock";import { SystemInfoDialog } from "./SystemInfoDialog";-import { fetchLatestRelease, isVersionOutdated } from "@/lib/version-check";+import { useDeployedUpdateNotice } from "@/hooks/useDeployedUpdateNotice";import { downloadMarkdownFile } from "@/lib/note-markdown-export";import { NOTE_HTML_FULL_STYLES } from "@/lib/note-html-export-assets";import { downloadNoteHtmlFile, getHtmlImageEmbedNoticeKind } from "@/lib/note-html-export";@@ -742,7 +742,7 @@ const RichEditorPane = ({const aiBubbleMenu = useAiBubbleMenu(aiAssistantOpen);const [aiSelection, setAiSelection] = useState<AiSelectionContext | null>(null);const [systemInfoOpen, setSystemInfoOpen] = useState(false);- const [updateAvailable, setUpdateAvailable] = useState(false);+ const { unseen: deployedUpdateUnseen } = useDeployedUpdateNotice();const [mobileNotebookSheetOpen, setMobileNotebookSheetOpen] = useState(false);const [notebookUpdatePending, setNotebookUpdatePending] = useState(false);const [noteSearchOpen, setNoteSearchOpen] = useState(false);@@ -845,13 +845,6 @@ const RichEditorPane = ({const mobileDefaultEditRequested = Boolean(memo?.id && memo.id === mobileDefaultEditMemoId && !readOnly);const mobileEditingActive = isMobileEditing || mobileDefaultEditRequested;- useEffect(() => {- const controller = new AbortController();- void fetchLatestRelease(controller.signal)- .then((release) => setUpdateAvailable(isVersionOutdated(__EDGEEVER_APP_VERSION__, release.version)))- .catch(() => undefined);- return () => controller.abort();- }, []);const effectiveReadOnly = readOnly || (isMobileViewport && !mobileEditingActive);const useMobilePlainTextEditor = isMobileViewport && mobileEditingActive && !readOnly;const useMarkdownSourceEditor = !useMobilePlainTextEditor && isMarkdownMode;@@ -3835,7 +3828,7 @@ const RichEditorPane = ({<IconTooltip label={t("systemInfo.title")}><Button className="relative hidden h-8 w-8 text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:ring-2 focus-visible:ring-emerald-500/70 min-[1600px]:inline-flex" size="icon" variant="ghost" aria-label={t("systemInfo.title")} onClick={() => setSystemInfoOpen(true)}><Info className="h-5 w-5" strokeWidth={2.25} />- {updateAvailable ? <span className="absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-emerald-500 ring-2 ring-white" /> : null}+ {deployedUpdateUnseen ? <span className="absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-emerald-500 ring-2 ring-white" /> : null}</Button></IconTooltip><PluginToolbarMenu host={pluginHost} onManage={onOpenPluginManager} />diff --git a/apps/web/src/components/PwaUpdateNotice.tsx b/apps/web/src/components/PwaUpdateNotice.tsxindex 2f9b516c..7de2bd10 100644--- a/apps/web/src/components/PwaUpdateNotice.tsx+++ b/apps/web/src/components/PwaUpdateNotice.tsx@@ -1,18 +1,15 @@import { useEffect, useMemo, useState } from "react";-import { CheckCircle2, RefreshCw, X } from "lucide-react";+import { RefreshCw, X } from "lucide-react";import { useTranslation } from "react-i18next";import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";import {- consumePwaBuildUpdate,- consumePwaUpdateReloadPending,PWA_UPDATE_NOTICE_EVENT,type PwaUpdateNoticeEvent,type PwaUpdateNoticeKind,} from "@/lib/pwa-update-notice";type Notice = {- buildLabel?: string;id: number;kind: PwaUpdateNoticeKind;};@@ -51,14 +48,6 @@ const watchDisplayMode = (onChange: () => void) => {};};-const getNoticeDescription = (notice: Notice, fallbackDescription: string, t: ReturnType<typeof useTranslation>["t"]) => {- if (notice.kind === "updated" && notice.buildLabel) {- return t("pwa.latestWithBuild", { buildLabel: notice.buildLabel });- }-- return fallbackDescription;-};-export const PwaUpdateNotice = () => {const { t } = useTranslation();const [displayMode, setDisplayMode] = useState(() => getDisplayMode());@@ -74,18 +63,9 @@ export const PwaUpdateNotice = () => {return;}- const buildLabel = __EDGEEVER_BUILD_LABEL__;-- if (- consumePwaUpdateReloadPending() ||- consumePwaBuildUpdate(__EDGEEVER_BUILD_ID__, { notifyWhenMissingBaseline: true })- ) {- setNotice({ buildLabel, id: Date.now(), kind: "updated" });- }-const handleNotice = (event: Event) => {- const { buildLabel: eventBuildLabel, kind } = (event as PwaUpdateNoticeEvent).detail;- setNotice({ buildLabel: eventBuildLabel ?? buildLabel, id: Date.now(), kind });+ const { kind } = (event as PwaUpdateNoticeEvent).detail;+ setNotice({ id: Date.now(), kind });};window.addEventListener(PWA_UPDATE_NOTICE_EVENT, handleNotice);@@ -107,10 +87,6 @@ export const PwaUpdateNotice = () => {title: t("pwa.checkingTitle"),description: t("pwa.checkingDescription"),},- updated: {- title: t("pwa.appliedTitle"),- description: t("pwa.appliedDescription"),- },"reload-required": {title: t("pwa.readyTitle"),description: t("pwa.readyDescription"),@@ -139,18 +115,12 @@ export const PwaUpdateNotice = () => {aria-live="polite"><div className="flex items-start gap-3">- <div- className={cn(- "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full",- notice.kind === "updated" ? "bg-emerald-50 text-emerald-600" : "bg-slate-100 text-slate-600"- )}- aria-hidden="true"- >- {notice.kind === "updated" ? <CheckCircle2 className="h-4 w-4" /> : <RefreshCw className="h-4 w-4" />}+ <div className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-slate-100 text-slate-600" aria-hidden="true">+ <RefreshCw className="h-4 w-4" /></div><div className="min-w-0 flex-1"><div className="text-sm font-semibold leading-5">{copy.title}</div>- <div className="mt-0.5 text-xs leading-5 text-slate-500">{getNoticeDescription(notice, copy.description, t)}</div>+ <div className="mt-0.5 text-xs leading-5 text-slate-500">{copy.description}</div>{isReloadRequired ? (<Button className="mt-2" size="sm" variant="solid" onClick={() => window.location.reload()}>{t("pwa.refreshNow")}diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsxindex 4908e95c..47b3ec7d 100644--- a/apps/web/src/components/SettingsPane.tsx+++ b/apps/web/src/components/SettingsPane.tsx@@ -41,6 +41,7 @@ import type { AuthUser } from "@edgeever/shared";import { contentEnterMotion } from "@/lib/motion";import type { EdgeEverPluginHost } from "@/lib/plugins/plugin-host";import { PluginToolbarMenu } from "./plugins/PluginToolbarMenu";+import { useDeployedUpdateNotice } from "@/hooks/useDeployedUpdateNotice";interface SettingsPaneProps {onClose: () => void;@@ -111,6 +112,7 @@ export const SettingsPane = ({const [activeTab, setActiveTab] = useState<TabKey>("general");const [activeMobileTab, setActiveMobileTab] = useState<TabKey | null>(null);const [systemInfoOpen, setSystemInfoOpen] = useState(false);+ const { unseen: deployedUpdateUnseen } = useDeployedUpdateNotice();const canClearLocalData = Boolean(window.edgeeverDesktop?.canClearLocalData);const tabItems: TabItem[] = [@@ -395,8 +397,9 @@ export const SettingsPane = ({className="flex min-h-16 w-full items-center justify-between gap-3 px-4 py-2.5 text-left text-slate-600 transition-colors hover:bg-slate-200/50 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70"><span className="flex min-w-0 items-center gap-3">- <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-50/80">+ <span className="relative flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-50/80"><Info className="h-4 w-4 text-emerald-600" />+ {deployedUpdateUnseen ? <span className="absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-emerald-500 ring-2 ring-white" /> : null}</span><span className="min-w-0"><span className="block truncate text-sm font-semibold">{t("systemInfo.title")}</span>diff --git a/apps/web/src/components/SystemInfoDialog.tsx b/apps/web/src/components/SystemInfoDialog.tsxindex 11835f62..d0d93d76 100644--- a/apps/web/src/components/SystemInfoDialog.tsx+++ b/apps/web/src/components/SystemInfoDialog.tsx@@ -1,5 +1,7 @@+import { useEffect } from "react";import { useTranslation } from "react-i18next";import { Button } from "@/components/ui/button";+import { useDeployedUpdateNotice } from "@/hooks/useDeployedUpdateNotice";import {Dialog,DialogContent,@@ -11,6 +13,11 @@ import { SystemInfoPanel } from "./settings/SystemInfoPanel";export const SystemInfoDialog = ({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) => {const { t } = useTranslation();+ const { markSeen } = useDeployedUpdateNotice();++ useEffect(() => {+ if (open) markSeen();+ }, [markSeen, open]);return (<Dialog open={open} onOpenChange={onOpenChange}>diff --git a/apps/web/src/components/UpdateAvailableDescription.tsx b/apps/web/src/components/UpdateAvailableDescription.tsxdeleted file mode 100644index 7c474087..00000000--- a/apps/web/src/components/UpdateAvailableDescription.tsx+++ /dev/null@@ -1,14 +0,0 @@-import { Trans } from "react-i18next";--const LEADING_VERSION_PREFIX = /^v/;--export const UpdateAvailableDescription = ({ version }: { version: string }) => (- <Trans- i18nKey="systemInfo.updateAvailableDescription"- values={{ version: version.replace(LEADING_VERSION_PREFIX, "") }}- components={{- paragraph: <span className="mt-1.5 block first:mt-0" />,- strong: <strong className="font-semibold text-slate-700" />,- }}- />-);diff --git a/apps/web/src/components/settings/SystemInfoPanel.tsx b/apps/web/src/components/settings/SystemInfoPanel.tsxindex 65af7de0..5dcddefd 100644--- a/apps/web/src/components/settings/SystemInfoPanel.tsx+++ b/apps/web/src/components/settings/SystemInfoPanel.tsx@@ -1,11 +1,10 @@-import { useEffect, useMemo, useState } from "react";-import { ArrowUpCircle, CheckCircle2, Copy, ExternalLink } from "lucide-react";+import { useMemo, useState } from "react";+import { Copy, ExternalLink, Sparkles } from "lucide-react";import { useTranslation } from "react-i18next";import { Button } from "@/components/ui/button";-import { UpdateAvailableDescription } from "@/components/UpdateAvailableDescription";import { detectWebClientKind } from "@/lib/client-environment";import { cn } from "@/lib/utils";-import { fetchLatestRelease, isVersionOutdated, type LatestRelease } from "@/lib/version-check";+import { getReleaseTagForVersion } from "@/lib/version-check";import { copyTextToClipboard } from "./settings-utils";export type SystemInfoItem = { label: string; value: string };@@ -70,27 +69,15 @@ export const getWebSystemInfoItems = (t: (key: string) => string, language: striexport const SystemInfoPanel = ({ active = true }: { active?: boolean }) => {const { t, i18n } = useTranslation();const [copied, setCopied] = useState(false);- const [latestRelease, setLatestRelease] = useState<LatestRelease | null>(null);- const [releaseCheck, setReleaseCheck] = useState<"idle" | "checking" | "latest" | "outdated" | "error">("idle");const infoItems = useMemo(() => getWebSystemInfoItems(t, i18n.language), [i18n.language, t]);-- useEffect(() => {- if (!active) {- setReleaseCheck("idle");- return;- }- const controller = new AbortController();- setReleaseCheck("checking");- void fetchLatestRelease(controller.signal)- .then((release) => {- setLatestRelease(release);- setReleaseCheck(isVersionOutdated(__EDGEEVER_APP_VERSION__, release.version) ? "outdated" : "latest");- })- .catch(() => {- if (!controller.signal.aborted) setReleaseCheck("error");- });- return () => controller.abort();- }, [active]);+ const isDesktopClient = window.edgeeverDesktop?.isAvailable === true;+ const releaseTag = getReleaseTagForVersion(__EDGEEVER_APP_VERSION__);+ const releaseHighlights = i18n.language.toLowerCase().startsWith("zh")+ ? __EDGEEVER_RELEASE_SUMMARY__.changes["zh-CN"]+ : __EDGEEVER_RELEASE_SUMMARY__.changes["en-US"];+ const releaseUrl = releaseTag+ ? `https://github.com/tianma-if/edgeever/releases/tag/${encodeURIComponent(releaseTag)}`+ : "https://github.com/tianma-if/edgeever/releases/latest";const handleCopy = async () => {if (!(await copyTextToClipboard(infoItems.map((item) => `${item.label}: ${item.value}`).join("\n")))) return;@@ -106,21 +93,23 @@ export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => {{copied ? t("common.copied") : t("systemInfo.copy")}</Button></div>- {releaseCheck === "outdated" && latestRelease ? (+ {active && !isDesktopClient ? (<div className="flex items-start gap-2 rounded-md border border-emerald-200 border-l-2 border-l-emerald-500 bg-emerald-50/40 px-3 py-2 text-slate-800" role="status">- <ArrowUpCircle className="mt-0.5 h-4 w-4 shrink-0 text-emerald-600" />+ <Sparkles className="mt-0.5 h-4 w-4 shrink-0 text-emerald-600" /><div className="min-w-0 flex-1 text-xs leading-5">- <div className="font-semibold">{t("systemInfo.updateAvailableTitle")}</div>- <div className="text-slate-500"><UpdateAvailableDescription version={latestRelease.version} /></div>+ <div className="font-semibold">{t("systemInfo.deployedUpdateTitle", { version: releaseTag?.replace(/^v/, "") ?? __EDGEEVER_APP_VERSION__ })}</div>+ {releaseHighlights.length > 0 ? (+ <ul className="mt-1 list-disc space-y-0.5 pl-4 text-slate-600">+ {releaseHighlights.map((highlight) => <li key={highlight}>{highlight}</li>)}+ </ul>+ ) : (+ <div className="mt-1 text-slate-500">{t("systemInfo.releaseNotesUnavailable")}</div>+ )}</div>- <a className="inline-flex shrink-0 items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900" href={latestRelease.url} target="_blank" rel="noreferrer">- {t("systemInfo.viewRelease")} <ExternalLink className="h-3 w-3" />+ <a className="inline-flex shrink-0 items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900" href={releaseUrl} target="_blank" rel="noreferrer">+ {t("systemInfo.viewReleaseNotes")} <ExternalLink className="h-3 w-3" /></a></div>- ) : releaseCheck === "latest" ? (- <div className="flex items-center gap-2 text-xs text-emerald-700" role="status">- <CheckCircle2 className="h-4 w-4" /> {t("systemInfo.latestVersion")}- </div>) : null}<dl className="grid border-y border-slate-200 sm:grid-cols-3">{infoItems.map((item) => (diff --git a/apps/web/src/hooks/useDeployedUpdateNotice.ts b/apps/web/src/hooks/useDeployedUpdateNotice.tsnew file mode 100644index 00000000..09e892e8--- /dev/null+++ b/apps/web/src/hooks/useDeployedUpdateNotice.ts@@ -0,0 +1,52 @@+import { useSyncExternalStore } from "react";+import {+ DEPLOYED_UPDATE_SEEN_EVENT,+ hasUnseenDeployedUpdate,+ markDeployedUpdateSeen,+} from "@/lib/pwa-update-notice";+import { getReleaseTagForVersion } from "@/lib/version-check";++const isDesktopClient = () => window.edgeeverDesktop?.isAvailable === true;+const deployedReleaseId = getReleaseTagForVersion(__EDGEEVER_APP_VERSION__) ?? __EDGEEVER_APP_VERSION__;++let cachedUnseen: boolean | null = null;+const subscribers = new Set<() => void>();++const readUnseen = () => {+ if (isDesktopClient()) return false;+ cachedUnseen ??= hasUnseenDeployedUpdate(deployedReleaseId);+ return cachedUnseen;+};++const syncUnseen = () => {+ const nextUnseen = isDesktopClient() ? false : hasUnseenDeployedUpdate(deployedReleaseId);+ if (cachedUnseen === nextUnseen) return;+ cachedUnseen = nextUnseen;+ for (const notify of subscribers) notify();+};++const subscribe = (notify: () => void) => {+ subscribers.add(notify);+ if (subscribers.size === 1) {+ window.addEventListener(DEPLOYED_UPDATE_SEEN_EVENT, syncUnseen);+ window.addEventListener("storage", syncUnseen);+ }+ return () => {+ subscribers.delete(notify);+ if (subscribers.size === 0) {+ window.removeEventListener(DEPLOYED_UPDATE_SEEN_EVENT, syncUnseen);+ window.removeEventListener("storage", syncUnseen);+ }+ };+};++const markSeen = () => {+ if (isDesktopClient()) return;+ markDeployedUpdateSeen(deployedReleaseId);+ syncUnseen();+};++export const useDeployedUpdateNotice = () => {+ const unseen = useSyncExternalStore(subscribe, readUnseen, () => false);+ return { markSeen, unseen };+};diff --git a/apps/web/src/lib/pwa-update-notice.test.mjs b/apps/web/src/lib/pwa-update-notice.test.mjsnew file mode 100644index 00000000..1b8f7283--- /dev/null+++ b/apps/web/src/lib/pwa-update-notice.test.mjs@@ -0,0 +1,31 @@+import { beforeEach, describe, expect, test } from "bun:test";+import { hasUnseenDeployedUpdate, markDeployedUpdateSeen } from "./pwa-update-notice";++const values = new Map();++beforeEach(() => {+ values.clear();+ globalThis.window = {+ dispatchEvent: () => true,+ localStorage: {+ getItem: (key) => values.get(key) ?? null,+ setItem: (key, value) => values.set(key, String(value)),+ },+ };+});++describe("deployed update notice", () => {+ test("uses the first observed release as a read baseline", () => {+ expect(hasUnseenDeployedUpdate("v1.0.0")).toBe(false);+ expect(hasUnseenDeployedUpdate("v1.0.0")).toBe(false);+ });++ test("stays visible after the formal release changes until the user views it", () => {+ expect(hasUnseenDeployedUpdate("v1.0.0")).toBe(false);+ expect(hasUnseenDeployedUpdate("v1.1.0")).toBe(true);+ expect(hasUnseenDeployedUpdate("v1.1.0")).toBe(true);++ markDeployedUpdateSeen("v1.1.0");+ expect(hasUnseenDeployedUpdate("v1.1.0")).toBe(false);+ });+});diff --git a/apps/web/src/lib/pwa-update-notice.ts b/apps/web/src/lib/pwa-update-notice.tsindex 07f88952..3382d763 100644--- a/apps/web/src/lib/pwa-update-notice.ts+++ b/apps/web/src/lib/pwa-update-notice.ts@@ -1,12 +1,12 @@export const PWA_UPDATE_NOTICE_EVENT = "edgeever:pwa-update-notice";+export const DEPLOYED_UPDATE_SEEN_EVENT = "edgeever:deployed-update-seen";-const PWA_BUILD_ID_KEY = "edgeever:pwa-build-id";-const PWA_UPDATE_RELOADED_AT_KEY = "edgeever:pwa-update-reloaded-at";+const DEPLOYED_RELEASE_ID_KEY = "edgeever:deployed-release-id:v1";+const DEPLOYED_SEEN_RELEASE_ID_KEY = "edgeever:deployed-seen-release-id:v1";-export type PwaUpdateNoticeKind = "checking" | "updated" | "reload-required";+export type PwaUpdateNoticeKind = "checking" | "reload-required";export type PwaUpdateNoticeDetail = {- buildLabel?: string;kind: PwaUpdateNoticeKind;};@@ -16,38 +16,38 @@ export const emitPwaUpdateNotice = (detail: PwaUpdateNoticeDetail) => {window.dispatchEvent(new CustomEvent<PwaUpdateNoticeDetail>(PWA_UPDATE_NOTICE_EVENT, { detail }));};-export const markPwaUpdateReloadPending = () => {+export const hasUnseenDeployedUpdate = (currentReleaseId: string) => {try {- window.sessionStorage.setItem(PWA_UPDATE_RELOADED_AT_KEY, String(Date.now()));- } catch {- // Storage can be unavailable in restricted browsing modes.- }-};+ const previousReleaseId = window.localStorage.getItem(DEPLOYED_RELEASE_ID_KEY);+ const seenReleaseId = window.localStorage.getItem(DEPLOYED_SEEN_RELEASE_ID_KEY);-export const consumePwaUpdateReloadPending = () => {- try {- const value = window.sessionStorage.getItem(PWA_UPDATE_RELOADED_AT_KEY);- window.sessionStorage.removeItem(PWA_UPDATE_RELOADED_AT_KEY);- return Boolean(value);+ if (!previousReleaseId) {+ window.localStorage.setItem(DEPLOYED_RELEASE_ID_KEY, currentReleaseId);+ window.localStorage.setItem(DEPLOYED_SEEN_RELEASE_ID_KEY, currentReleaseId);+ return false;+ }++ if (previousReleaseId !== currentReleaseId) {+ window.localStorage.setItem(DEPLOYED_RELEASE_ID_KEY, currentReleaseId);+ }++ if (!seenReleaseId) {+ window.localStorage.setItem(DEPLOYED_SEEN_RELEASE_ID_KEY, previousReleaseId);+ return previousReleaseId !== currentReleaseId;+ }++ return seenReleaseId !== currentReleaseId;} catch {return false;}};-export const consumePwaBuildUpdate = (- currentBuildId: string,- { notifyWhenMissingBaseline = false }: { notifyWhenMissingBaseline?: boolean } = {}-) => {+export const markDeployedUpdateSeen = (currentReleaseId: string) => {try {- const previousBuildId = window.localStorage.getItem(PWA_BUILD_ID_KEY);- window.localStorage.setItem(PWA_BUILD_ID_KEY, currentBuildId);-- if (!previousBuildId) {- return notifyWhenMissingBaseline;- }-- return previousBuildId !== currentBuildId;+ window.localStorage.setItem(DEPLOYED_RELEASE_ID_KEY, currentReleaseId);+ window.localStorage.setItem(DEPLOYED_SEEN_RELEASE_ID_KEY, currentReleaseId);} catch {- return false;+ // Storage can be unavailable in restricted browsing modes.}+ window.dispatchEvent(new Event(DEPLOYED_UPDATE_SEEN_EVENT));};diff --git a/apps/web/src/lib/version-check.test.mjs b/apps/web/src/lib/version-check.test.mjsindex 1f1f785b..17590a76 100644--- a/apps/web/src/lib/version-check.test.mjs+++ b/apps/web/src/lib/version-check.test.mjs@@ -1,5 +1,5 @@import { describe, expect, test } from "bun:test";-import { findDesktopReleaseVersion, isVersionOutdated } from "./version-check";+import { findDesktopReleaseVersion, getReleaseTagForVersion, isVersionOutdated } from "./version-check";describe("platform release version checks", () => {test("derives the installed desktop version from the DMG asset", () => {@@ -30,4 +30,11 @@ describe("platform release version checks", () => {expect(isVersionOutdated("1.6.50-beta.10", "1.6.50")).toBe(true);expect(isVersionOutdated("1.6.50", "1.6.50-beta.10")).toBe(false);});++ test("maps deployed builds back to their formal release tag", () => {+ expect(getReleaseTagForVersion("1.34.1+18")).toBe("v1.34.1");+ expect(getReleaseTagForVersion("v1.35.0-beta.2+4")).toBe("v1.35.0-beta.2");+ expect(getReleaseTagForVersion("local")).toBeNull();+ });+});diff --git a/apps/web/src/lib/version-check.ts b/apps/web/src/lib/version-check.tsindex 8b38ae7c..e873578e 100644--- a/apps/web/src/lib/version-check.ts+++ b/apps/web/src/lib/version-check.ts@@ -1,13 +1,3 @@-const LATEST_RELEASE_URL = "https://api.github.com/repos/tianma-if/edgeever/releases/latest";-const CACHE_KEY = "edgeever:latest-release";-const CACHE_TTL_MS = 60 * 60 * 1000;--export type LatestRelease = {- tagName: string;- version: string;- url: string;-};-const DESKTOP_ASSET_PATTERN = /^EdgeEver-(\d+\.\d+\.\d+)-mac-(arm64|x64)\.dmg$/;export const findDesktopReleaseVersion = (assetNames: string[]) => {@@ -34,6 +24,11 @@ const parseVersion = (value: string) => {} : null;};+export const getReleaseTagForVersion = (version: string) => {+ const match = version.match(/^v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?:\+[0-9A-Za-z.-]+)?$/i);+ return match ? `v${match[1]}` : null;+};+export const isVersionOutdated = (currentVersion: string, latestVersion: string) => {const current = parseVersion(currentVersion);const latest = parseVersion(latestVersion);@@ -60,62 +55,3 @@ export const isVersionOutdated = (currentVersion: string, latestVersion: string)}return false;};--const readCachedRelease = (): LatestRelease | null => {- try {- const cached = JSON.parse(window.sessionStorage.getItem(CACHE_KEY) ?? "null") as {- expiresAt?: number;- release?: Partial<LatestRelease>;- } | null;- return (- cached?.expiresAt &&- cached.expiresAt > Date.now() &&- typeof cached.release?.tagName === "string" &&- typeof cached.release.version === "string" &&- typeof cached.release.url === "string"- )- ? cached.release as LatestRelease- : null;- } catch {- return null;- }-};--export const fetchLatestRelease = async (signal?: AbortSignal): Promise<LatestRelease> => {- const cached = readCachedRelease();- if (cached) return cached;-- const response = await fetch(LATEST_RELEASE_URL, {- headers: { Accept: "application/vnd.github+json" },- signal,- });- if (!response.ok) throw new Error(`Release lookup failed with ${response.status}`);-- const payload = (await response.json()) as {- assets?: Array<{ name?: unknown }>;- html_url?: string;- tag_name?: string;- };- if (!payload.tag_name || !payload.html_url) throw new Error("Release response is incomplete");-- const desktopVersion = findDesktopReleaseVersion(- payload.assets- ?.map((asset) => asset.name)- .filter((name): name is string => typeof name === "string") ?? []- );- const isDesktop = Boolean(window.edgeeverDesktop?.isAvailable);- if (isDesktop && !desktopVersion) {- throw new Error("Release response does not contain matching arm64 and x64 desktop DMGs");- }- const release = {- tagName: payload.tag_name,- version: isDesktop ? desktopVersion! : payload.tag_name,- url: payload.html_url,- };- try {- window.sessionStorage.setItem(CACHE_KEY, JSON.stringify({ expiresAt: Date.now() + CACHE_TTL_MS, release }));- } catch {- // Storage can be unavailable in restricted browsing modes.- }- return release;-};diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsxindex 4327ebd5..0f920e8b 100644--- a/apps/web/src/main.tsx+++ b/apps/web/src/main.tsx@@ -5,7 +5,7 @@ import { BrowserRouter } from "react-router";import { registerSW } from "virtual:pwa-register";import { App } from "./app/App";import "./i18n";-import { emitPwaUpdateNotice, markPwaUpdateReloadPending } from "./lib/pwa-update-notice";+import { emitPwaUpdateNotice } from "./lib/pwa-update-notice";import { initializeTheme, ThemeProvider } from "./components/ThemeProvider";import { DesktopRendererErrorBoundary } from "./components/DesktopRendererErrorBoundary";import "./styles/globals.css";@@ -56,11 +56,10 @@ const registerProductionServiceWorker = () => {updateServiceWorker = registerSW({immediate: true,onNeedRefresh() {- emitPwaUpdateNotice({ buildLabel: __EDGEEVER_BUILD_LABEL__, kind: "checking" });+ emitPwaUpdateNotice({ kind: "checking" });void updateServiceWorker(true);},onNeedReload() {- markPwaUpdateReloadPending();window.location.reload();},onRegisteredSW(_swScriptUrl, registration) {diff --git a/apps/web/src/vite-env.d.ts b/apps/web/src/vite-env.d.tsindex 96c03a95..e632c46c 100644--- a/apps/web/src/vite-env.d.ts+++ b/apps/web/src/vite-env.d.ts@@ -5,6 +5,13 @@ declare const __EDGEEVER_BUILD_ID__: string;declare const __EDGEEVER_BUILD_LABEL__: string;declare const __EDGEEVER_APP_VERSION__: string;declare const __EDGEEVER_RELEASED_AT__: string;+declare const __EDGEEVER_RELEASE_SUMMARY__: {+ version: string;+ changes: {+ "en-US": string[];+ "zh-CN": string[];+ };+};declare const __EDGEEVER_DEPLOYMENT_TRIGGER__: string;declare const __EDGEEVER_DEPLOYMENT_METHOD__: string;declare const __EDGEEVER_DEVELOPMENT_PROFILE__: "" | "local" | "demo";diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.tsindex d2199858..051b2ded 100644--- a/apps/web/vite.config.ts+++ b/apps/web/vite.config.ts@@ -18,6 +18,24 @@ const readPackageVersion = () => {}};+const readReleaseSummary = (packageVersion: string) => {+ const summaryPath = fileURLToPath(new URL("../../release-summary.json", import.meta.url));+ const summary = JSON.parse(readFileSync(summaryPath, "utf8")) as {+ version?: unknown;+ changes?: { "en-US"?: unknown; "zh-CN"?: unknown };+ };+ if (+ summary.version !== packageVersion ||+ !Array.isArray(summary.changes?.["en-US"]) ||+ !summary.changes["en-US"].every((item) => typeof item === "string" && item.trim()) ||+ !Array.isArray(summary.changes?.["zh-CN"]) ||+ !summary.changes["zh-CN"].every((item) => typeof item === "string" && item.trim())+ ) {+ throw new Error(`release-summary.json must contain bilingual changes for package version ${packageVersion}.`);+ }+ return summary as { version: string; changes: { "en-US": string[]; "zh-CN": string[] } };+};+const readGitCommit = () => {try {return execSync("git rev-parse --short=12 HEAD", { encoding: "utf8" }).trim();@@ -56,7 +74,9 @@ const buildId = process.env.WORKERS_CI_COMMIT_SHA?.slice(0, 12)?? readGitCommit()?? "local";const gitDescription = readGitDescription();-const appVersion = resolveAppVersion(readPackageVersion(), gitDescription);+const packageVersion = readPackageVersion();+const appVersion = resolveAppVersion(packageVersion, gitDescription);+const releaseSummary = readReleaseSummary(packageVersion);const OPTIONAL_CHUNK_WARNING_LIMIT_KB = 1_700;const TARGET_VENDOR_CHUNK_BYTES = 450 * 1024;const releaseTimestamp = resolveReleaseTimestamp(process.env.EDGE_EVER_RELEASED_AT) || readLatestReleaseCommitTimestamp();@@ -113,6 +133,7 @@ export default defineConfig({__EDGEEVER_BUILD_ID__: JSON.stringify(buildId),__EDGEEVER_BUILD_LABEL__: JSON.stringify(buildId === "local" ? "local" : buildId.slice(0, 7)),__EDGEEVER_RELEASED_AT__: JSON.stringify(releaseTimestamp),+ __EDGEEVER_RELEASE_SUMMARY__: JSON.stringify(releaseSummary),__EDGEEVER_DEPLOYMENT_TRIGGER__: JSON.stringify(deploymentTrigger),__EDGEEVER_DEPLOYMENT_METHOD__: JSON.stringify(deploymentMethod),__EDGEEVER_DEVELOPMENT_PROFILE__: JSON.stringify(process.env.EDGE_EVER_DEVELOPMENT_PROFILE ?? ""),diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 5ce27b0e..ee1dcc85 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -581,11 +581,9 @@ export const enUS = {browserMode: "Browser",unknown: "Unknown",copy: "Copy info",- updateAvailableTitle: "New version available",- updateAvailableDescription: "<paragraph>Version v{{version}} is available. Cloudflare and Docker instances <strong>update automatically each day by default; no manual action is required</strong>.</paragraph><paragraph><strong>Do not use Sync fork to update EdgeEver</strong>; if you click it by mistake and it reports conflicts, you can safely ignore them.</paragraph><paragraph>To update immediately, Cloudflare users can run the Update deployed EdgeEver workflow, while Docker users can run ~/edgeever/update.sh.</paragraph><paragraph>The desktop app must be updated from the Releases page.</paragraph>",- viewRelease: "View update",- latestVersion: "You are running the latest version",- closeUpdateNotice: "Close update notice",+ deployedUpdateTitle: "What's new in v{{version}}",+ releaseNotesUnavailable: "This build does not include an update summary. You can view the full Release notes.",+ viewReleaseNotes: "Full notes",desktopUpdateDownloading: "Downloading update…",desktopUpdateReady: "Update downloaded",desktopUpdateDownload: "Download update",@@ -1403,13 +1401,10 @@ export const enUS = {items: memoTemplateSeedTranslations("en-US"),},pwa: {- checkingTitle: "New version found",+ checkingTitle: "Applying update",checkingDescription: "Applying the update. The app will refresh shortly.",- appliedTitle: "EdgeEver updated",- appliedDescription: "You are running the latest version.",readyTitle: "New version ready",readyDescription: "Refresh to use the latest features.",- latestWithBuild: "You are running the latest version ({{buildLabel}}).",refreshNow: "Refresh now",closeNotice: "Close update notice",sidebarInstall: "Download Desktop Client",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 5d4a97c3..c55fe7af 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -581,11 +581,9 @@ export const zhCN = {browserMode: "浏览器",unknown: "未知",copy: "复制信息",- updateAvailableTitle: "发现新版本",- updateAvailableDescription: "<paragraph>新版本 v{{version}} 已发布。Cloudflare 和 Docker 实例<strong>默认每日自动更新,无需手动操作</strong>。</paragraph><paragraph><strong>请勿使用 Sync fork 更新 EdgeEver</strong>;若误点后提示冲突,无需理会。</paragraph><paragraph>如需立即更新:Cloudflare 用户可运行 Update deployed EdgeEver 工作流;Docker 用户可运行 ~/edgeever/update.sh。</paragraph><paragraph>桌面客户端需前往 Releases 页面下载更新。</paragraph>",- viewRelease: "查看更新",- latestVersion: "当前已是最新版本",- closeUpdateNotice: "关闭新版本提示",+ deployedUpdateTitle: "v{{version}} 更新内容",+ releaseNotesUnavailable: "本次构建未包含更新摘要,可查看完整 Release 说明。",+ viewReleaseNotes: "完整说明",desktopUpdateDownloading: "正在下载更新…",desktopUpdateReady: "更新已下载完成",desktopUpdateDownload: "下载更新",@@ -1403,13 +1401,10 @@ export const zhCN = {items: memoTemplateSeedTranslations("zh-CN"),},pwa: {- checkingTitle: "发现新版本",+ checkingTitle: "正在应用更新",checkingDescription: "正在应用更新,稍后会自动刷新。",- appliedTitle: "EdgeEver 已更新",- appliedDescription: "当前应用已是最新版本。",readyTitle: "新版本已就绪",readyDescription: "刷新后即可使用最新功能。",- latestWithBuild: "当前应用已是最新版本({{buildLabel}})。",refreshNow: "立即刷新",closeNotice: "关闭更新通知",sidebarInstall: "下载桌面客户端",diff --git a/release-summary.json b/release-summary.jsonnew file mode 100644index 00000000..3108b2ec--- /dev/null+++ b/release-summary.json@@ -0,0 +1,11 @@+{+ "version": "1.34.1",+ "changes": {+ "en-US": [+ "Clarify automatic and manual update paths for Cloudflare, Docker, and desktop users, and warn against using GitHub Sync fork."+ ],+ "zh-CN": [+ "明确 Cloudflare、Docker 与桌面端的自动及手动更新方式,并提醒用户不要使用 GitHub Sync fork。"+ ]+ }+}diff --git a/scripts/plan-native-release.test.mjs b/scripts/plan-native-release.test.mjsindex a45a88c6..e694b122 100644--- a/scripts/plan-native-release.test.mjs+++ b/scripts/plan-native-release.test.mjs@@ -82,7 +82,7 @@ describe("native release planning", () => {test("does not rebuild desktop for release notes or a root version bump alone", () => {expect(- planNativeRelease("desktop", ["package.json", "AGENTS.md"]),+ planNativeRelease("desktop", ["package.json", "release-summary.json", "AGENTS.md"]),).toEqual({ rebuild: false, relevantChanges: [] });});});diff --git a/scripts/release.mjs b/scripts/release.mjsindex 2186072a..a02a427d 100644--- a/scripts/release.mjs+++ b/scripts/release.mjs@@ -360,6 +360,14 @@ export const buildReleaseNotes = ({"",].join("\n");+export const buildReleaseSummary = ({ version, changesEn, changesZh }) => ({+ version,+ changes: {+ "en-US": [...changesEn],+ "zh-CN": [...changesZh],+ },+});+export const reusedAssetMatches = (previousAssets, currentAssets, name) => {const previous = previousAssets.find((asset) => asset.name === name);const current = currentAssets.find((asset) => asset.name === name);@@ -492,11 +500,16 @@ const assertReleasePreconditions = ({ repository, previousTag }) => {}};-const updateReleaseVersions = ({ nextVersion, desktopRebuild, mobileRebuild }) => {- const changedPaths = ["package.json"];+const updateReleaseVersions = ({ nextVersion, desktopRebuild, mobileRebuild, changesEn, changesZh }) => {+ const changedPaths = ["package.json", "release-summary.json"];const rootPackage = readJson("package.json");rootPackage.version = nextVersion;writeJson("package.json", rootPackage);+ writeJson("release-summary.json", buildReleaseSummary({+ version: nextVersion,+ changesEn,+ changesZh,+ }));if (desktopRebuild) {const desktopPackage = readJson("apps/desktop/package.json");@@ -919,6 +932,8 @@ const releaseMain = async (options) => {nextVersion: releaseVersion,desktopRebuild: desktopPlan.rebuild,mobileRebuild: mobilePlan.rebuild,+ changesEn: options.changesEn,+ changesZh: options.changesZh,});run("git", ["add", ...versionPaths]);run("git", ["diff", "--cached", "--check"]);diff --git a/scripts/release.test.mjs b/scripts/release.test.mjsindex 79895240..5ea62f4e 100644--- a/scripts/release.test.mjs+++ b/scripts/release.test.mjs@@ -3,6 +3,7 @@ import {auditReleaseCommitCoverage,buildIssueBody,buildReleaseNotes,+ buildReleaseSummary,buildReleaseTitle,nextVersion,parseReleaseArgs,@@ -177,6 +178,20 @@ describe("release automation", () => {expect(notes).not.toContain("\\n");});+ test("builds the in-app summary from the same bilingual release changes", () => {+ expect(buildReleaseSummary({+ version: "1.6.55",+ changesEn: ["Improve the release flow."],+ changesZh: ["优化发布流程。"],+ })).toEqual({+ version: "1.6.55",+ changes: {+ "en-US": ["Improve the release flow."],+ "zh-CN": ["优化发布流程。"],+ },+ });+ });+test("builds a bilingual umbrella Issue", () => {const body = buildIssueBody({changesEn: ["Parallel checks."],