Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

Move the update check out of System settings into the account menu (#391)

Yaowei Zheng6ff746d76514
diff --git a/changelog/unreleased/2026-08-21-update-check-out-of-settings.md b/changelog/unreleased/2026-08-21-update-check-out-of-settings.md
new file mode 100644
index 00000000..4a7e020f
--- /dev/null
+++ b/changelog/unreleased/2026-08-21-update-check-out-of-settings.md
@@ -0,0 +1,20 @@
+# Update check moved out of System settings, into the account menu
+
+- **Date:** 2026-08-21
+- **Type:** feature
+- **Scope:** `web`, `docs`
+- **PR:** [#391](https://github.com/Prism-Shadow/penguin-harness/pull/391)
+
+[中文版](2026-08-21-update-check-out-of-settings.zh.md)
+
+Moved checking for updates out of the System settings dialog and into the sidebar user menu, on the row directly under the **System settings** entry. The dialog's **Updates** page ([System settings dialog](2026-08-20-system-settings-page.md)) was removed, and the web and desktop update rows now share one slot outside the dialog, so an update is one click from the menu instead of two clicks and a page.
+
+## Details
+
+- The menu's server-update row carries the manual check itself: it reads "check for updates" and runs the forced lookup until a newer release is known, then names that release in place and opens the update dialog — the release-notes link and the admin-only self-update — instead of routing into a settings page. Each check still reports exactly one outcome as a toast.
+- The row shows the running server version on its right, matching the desktop client row it stands beside; the release date it used to carry as a hint stays on the new-chat page's version line, which has room for it.
+- Both rows keep their existing gates and are mutually exclusive: the server row is hidden in desktop mode, the client row appears only in the shell's own window, and a browser signed into a desktop-mode server gets neither.
+- The lazy check is unchanged — nothing is fetched until the user menu is first opened — and so are the avatar's reminder dot, the draft page's "New version available" badge, and the confirmed restart-to-install step of the desktop row.
+- The check state and both dialogs are held by the sidebar rather than by the rows, which unmount with the menu, so a check clicked in the menu still settles and still toasts after the menu closes.
+- A non-admin outside desktop mode is now left with the Personal pages alone, so the settings rail draws no group headings for them.
+- The Web App guide's System Settings and Version-and-Updates chapters were rewritten for the new placement, in both languages.
diff --git a/changelog/unreleased/2026-08-21-update-check-out-of-settings.zh.md b/changelog/unreleased/2026-08-21-update-check-out-of-settings.zh.md
new file mode 100644
index 00000000..00d842f0
--- /dev/null
+++ b/changelog/unreleased/2026-08-21-update-check-out-of-settings.zh.md
@@ -0,0 +1,20 @@
+# 检查更新移出系统设置,改到账号菜单
+
+- **Date:** 2026-08-21
+- **Type:** feature
+- **Scope:** `web`, `docs`
+- **PR:** [#391](https://github.com/Prism-Shadow/penguin-harness/pull/391)
+
+[English](2026-08-21-update-check-out-of-settings.md)
+
+把检查更新从系统设置弹窗中移出,改到侧边栏用户菜单里紧贴「系统设置」下方的一行。弹窗的**更新**页(见[系统设置弹窗](2026-08-20-system-settings-page.zh.md))已删除,网页端与桌面端的更新入口自此共用弹窗之外的同一个位置:更新从「两次点击加一个页面」变成菜单里的一次点击。
+
+## 细节
+
+- 菜单里的服务端更新行自己承担手动检查:未知新版本时读作「检查更新」并执行强制查询,查到后就地改为写出该版本,并打开更新弹窗——更新说明链接与仅管理员可用的自更新——而不再跳进设置页。每次检查仍然只以一条提示汇报一种结果。
+- 该行右侧显示当前运行的服务端版本号,与并列的桌面客户端行一致;原先作为提示文字的发布日期改由新对话页的版本行承载,那里放得下。
+- 两行各自的可见条件不变,且互斥:服务端行在桌面模式下隐藏,客户端行只出现在 shell 自身的窗口里,而登录桌面模式服务器的浏览器两行都看不到。
+- 懒加载检查未变——用户菜单首次打开前不发起任何请求——头像上的提示圆点、新对话页的「有新版本可用」徽标,以及桌面端「重启并安装」前的确认步骤同样未变。
+- 检查状态与两个弹窗由侧边栏持有,而不是由随菜单卸载的行持有,因此在菜单里点下的检查在菜单关闭后仍会落定并弹出提示。
+- 桌面模式之外的非管理员自此只剩「个人」组的几页,设置导航对他们不再绘制分组标题。
+- Web App 指南的「系统设置」与「版本与更新」两章按新位置重写,中英文同步。
diff --git a/packages/docs/content/web-app.en.md b/packages/docs/content/web-app.en.md
index 916aea96..e0553292 100644
--- a/packages/docs/content/web-app.en.md
+++ b/packages/docs/content/web-app.en.md
@@ -127,7 +127,7 @@ Read-only scoreboards per Benchmark: switch the metric (score / cost / duration)
One dialog for the settings that belong to neither a Project nor an Agent, opened from the sidebar user menu's **System settings** row: a left rail of pages, each page a list of rows — title and a one-line explanation on the left, the control on the right.
-The rail is grouped. **Personal** holds preferences that belong to the signed-in account and apply the moment they are touched — no Save button, nothing to lose by closing the dialog. **Server** holds the server-global surfaces: the settings written through `GET|PUT /api/admin/settings` and user management are admin-only — a non-admin gets neither those entries nor any hint they exist, and the APIs answer a non-admin with 403 whatever the browser rendered — while the Updates page is visible to every account outside the desktop app. In the desktop app the update and user-management pages are absent entirely (updating is the desktop shell's job, and the server runs single-user), and the shell's own window also has no Account page — it signs in through the shell's token and holds no password to change, while a browser signed into the same server with a password keeps it.
+The rail is grouped. **Personal** holds preferences that belong to the signed-in account and apply the moment they are touched — no Save button, nothing to lose by closing the dialog. **Server** holds the server-global surfaces: the settings written through `GET|PUT /api/admin/settings` and user management are admin-only — a non-admin gets neither those entries nor any hint they exist, and the APIs answer a non-admin with 403 whatever the browser rendered. A non-admin is therefore left with the Personal pages alone, and the rail draws no group headings at all. In the desktop app the user-management page is absent (the server runs single-user), and the shell's own window also has no Account page — it signs in through the shell's token and holds no password to change, while a browser signed into the same server with a password keeps it. Checking for updates is not a page here — see [Version and Updates](#version-and-updates).
### General
@@ -159,9 +159,11 @@ Two numbers are deliberately not exposed. The per-message file **count** stays a
## Version and Updates
-System settings → **Updates** carries the manual "Check for updates" action; the running version sits muted beside it, and its release date — stamped into the build by the release workflow, displayed without any network access — appears as the row's localized "Last updated Jul 26"-style hint (dev builds and releases that predate the stamping, v0.1.2 and earlier, have no date). The new-chat page shows the same identity as a version line under the brand. The app checks GitHub for a newer release once the sidebar user menu has first been opened, and immediately — bypassing the cached result — when the manual action is clicked; the latter reports "You're on the latest version" when nothing newer exists. When a newer release is found, a dot appears on the user button, the draft page's version line gains a small superscript "New version available" badge linking to the release, and the menu gains a "New version available" row that opens the Updates page, whose dialog carries the release-notes link, plus an "Update now" action for admins that runs `penguin update` on the server (the data directory is untouched). The service must be restarted afterwards for the update to take effect. Set `PENGUIN_UPDATE_CHECK=off` to disable the update check entirely — see the [Configuration Reference](/configuration).
+Checking for updates sits outside the settings dialog: one row in the sidebar user menu, directly under the **System settings** entry, so it is reachable without opening anything. The row has two states — it reads "Check for updates" and runs the manual check until a newer release is known, then turns in place into "New version vX available" and opens the update dialog instead. The running version sits muted on its right.
-**In the desktop app** the Updates page is absent — the shell updates itself — and the sidebar user menu carries a client-update row instead, in the shell's own window only. It drives the app's own updater end to end: "Check for updates", then a background download with its percentage in the label, then "Restart to install vX", which asks for confirmation first because restarting interrupts running Tasks. The installed client version sits muted on the right, and the app also checks on its own schedule, so the row may already offer the restart when you open the menu. A browser signed into the same desktop-mode server with a password gets no such row: it can neither read that machine's updater state nor restart its window. Forms that cannot replace themselves — a Linux install owned by the system package manager (`.deb`), and a development run — render the row disabled with the reason as its tooltip; the [Desktop app guide](/quickstart-desktop) covers the installers.
+The running version's release date is stamped into the build by the release workflow and displayed without any network access: the new-chat page shows it under the brand as `vX.Y.Z · Last updated Jul 26` (dev builds and releases that predate the stamping, v0.1.2 and earlier, have no date). The app checks GitHub for a newer release once the sidebar user menu has first been opened, and immediately — bypassing the cached result — when the manual action is clicked; the latter reports "You're on the latest version" when nothing newer exists. When a newer release is found, a dot appears on the user button and the draft page's version line gains a small superscript "New version available" badge linking to the release. The update dialog carries the release-notes link, plus an "Update now" action for admins that runs `penguin update` on the server (the data directory is untouched). The service must be restarted afterwards for the update to take effect. Set `PENGUIN_UPDATE_CHECK=off` to disable the update check entirely — see the [Configuration Reference](/configuration).
+
+**In the desktop app** that row becomes a client-update row — the shell updates itself, and the server check never appears in desktop mode — in the shell's own window only. It drives the app's own updater end to end: "Check for updates", then a background download with its percentage in the label, then "Restart to install vX", which asks for confirmation first because restarting interrupts running Tasks. The installed client version sits muted on the right, and the app also checks on its own schedule, so the row may already offer the restart when you open the menu. A browser signed into the same desktop-mode server with a password gets neither row: it can neither read that machine's updater state nor restart its window, and it cannot run the CLI self-update on that server either. Forms that cannot replace themselves — a Linux install owned by the system package manager (`.deb`), and a development run — render the row disabled with the reason as its tooltip; the [Desktop app guide](/quickstart-desktop) covers the installers.
## Projects and Members
diff --git a/packages/docs/content/web-app.zh.md b/packages/docs/content/web-app.zh.md
index d5a5875f..893c410f 100644
--- a/packages/docs/content/web-app.zh.md
+++ b/packages/docs/content/web-app.zh.md
@@ -126,7 +126,7 @@ Memory 标签页的开关拨动即写入,不参与标签页的保存按钮,
把既不属于 Project 也不属于 Agent 的设置收进一个弹窗,入口是侧边栏用户菜单的「系统设置」:左侧一列页面导航,右侧每页是一列设置行——左边标题加一行说明,右边控件。
-导航按组划分。**个人**组存放属于当前账号的偏好,改动即刻生效,没有保存按钮,关闭弹窗也不会丢失什么;**服务器**组存放服务器全局的界面:经 `GET|PUT /api/admin/settings` 写入的设置与用户管理仅管理员可见——非管理员既看不到这些条目、也不会得知它们存在,无论前端渲染成什么,接口对非管理员一律返回 403——而「更新」页对桌面应用之外的所有账号可见。桌面应用中没有更新与用户管理两页(更新由桌面 shell 负责,服务端是单用户模式);桌面 shell 自己的窗口还没有「账户」页——它通过 shell 的一次性 token 登录,没有可修改的密码,而用密码登录同一服务器的浏览器会话仍保留该页。
+导航按组划分。**个人**组存放属于当前账号的偏好,改动即刻生效,没有保存按钮,关闭弹窗也不会丢失什么;**服务器**组存放服务器全局的界面:经 `GET|PUT /api/admin/settings` 写入的设置与用户管理仅管理员可见——非管理员既看不到这些条目、也不会得知它们存在,无论前端渲染成什么,接口对非管理员一律返回 403。因此非管理员只会看到「个人」组的几页,此时导航不再绘制分组标题。桌面应用中没有用户管理页(服务端是单用户模式);桌面 shell 自己的窗口还没有「账户」页——它通过 shell 的一次性 token 登录,没有可修改的密码,而用密码登录同一服务器的浏览器会话仍保留该页。检查更新不是这里的一页,见[版本与更新](#版本与更新)。
### 通用
@@ -158,9 +158,11 @@ Memory 标签页的开关拨动即写入,不参与标签页的保存按钮,
## 版本与更新
-系统设置的**更新**页提供手动「检查更新」按钮,当前运行版本号以浅色显示在旁;其发布日期(由发布流程在构建时打入、直接显示、无需联网)以「最近更新日期 7 月 26 日」样式的提示展示(开发构建以及打入机制之前的发布版,v0.1.2 及以前,没有日期)。新对话页在品牌下方以版本行显示同样的信息。侧边栏用户菜单首次打开后会向 GitHub 查询是否有新版本;点击「检查更新」则立即查询(绕过缓存结果),已是最新时以提示告知。发现新版本时,用户按钮上会出现提示圆点,新对话页的版本行会出现可跳转 Release 页面的「有新版本可用」上标小徽标,菜单内出现「有新版本可用」行,点击直达更新页;其弹窗提供更新说明链接,管理员还可点击「立即更新」,在服务器上执行 `penguin update`(数据目录不受影响)。更新完成后需要重启服务才会生效。设置 `PENGUIN_UPDATE_CHECK=off` 可完全关闭新版本检查——见[配置参考](/configuration)。
+检查更新在设置弹窗之外:侧边栏用户菜单里,紧贴「系统设置」下方的一行,无需打开弹窗即可点到。该行只有两种状态——未知有新版本时读作「检查更新」并执行手动检查,一旦查到新版本便就地变为「新版本 vX 可用」并改为打开更新弹窗;当前运行版本号以浅色显示在该行右侧。
-**在桌面应用中**没有更新页——客户端自己更新——侧边栏用户菜单改为提供一行客户端更新入口,且只出现在 shell 自身的窗口里。该行端到端驱动应用自带的更新器:先是「检查更新」,随后是后台下载并把百分比显示在文案里,最后是「重启并安装 vX」;由于重启会打断正在运行的 Task,点击后会先要求确认。当前安装的客户端版本以浅色显示在该行右侧;应用也会按自己的节奏后台检查,所以打开菜单时该行可能已经在等你重启安装。用密码登录同一台桌面模式服务器的浏览器不会看到这一行:它既读不到那台机器的更新状态,也无法重启它的窗口。无法自我替换的形态——由系统包管理器管理的 Linux 安装(`.deb`)以及开发运行——该行渲染为禁用,原因显示在悬浮提示里;安装包本身见[桌面应用指南](/quickstart-desktop)。
+版本的发布日期由发布流程在构建时打入,直接显示、无需联网:新对话页在品牌下方的版本行以「vX.Y.Z · 最近更新日期 7 月 26 日」呈现(开发构建以及打入机制之前的发布版,v0.1.2 及以前,没有日期)。侧边栏用户菜单首次打开后会向 GitHub 查询是否有新版本;点击「检查更新」则立即查询(绕过缓存结果),已是最新时以提示告知。发现新版本时,用户按钮上会出现提示圆点,新对话页的版本行会出现可跳转 Release 页面的「有新版本可用」上标小徽标。更新弹窗提供更新说明链接,管理员还可点击「立即更新」,在服务器上执行 `penguin update`(数据目录不受影响)。更新完成后需要重启服务才会生效。设置 `PENGUIN_UPDATE_CHECK=off` 可完全关闭新版本检查——见[配置参考](/configuration)。
+
+**在桌面应用中**这一行改为客户端更新入口——客户端自己更新,服务端的检查在桌面模式下完全不出现——且只出现在 shell 自身的窗口里。该行端到端驱动应用自带的更新器:先是「检查更新」,随后是后台下载并把百分比显示在文案里,最后是「重启并安装 vX」;由于重启会打断正在运行的 Task,点击后会先要求确认。当前安装的客户端版本以浅色显示在该行右侧;应用也会按自己的节奏后台检查,所以打开菜单时该行可能已经在等你重启安装。用密码登录同一台桌面模式服务器的浏览器两行都不会看到:它既读不到那台机器的更新状态,也无法重启它的窗口,更无法在那台服务器上跑 CLI 自更新。无法自我替换的形态——由系统包管理器管理的 Linux 安装(`.deb`)以及开发运行——该行渲染为禁用,原因显示在悬浮提示里;安装包本身见[桌面应用指南](/quickstart-desktop)。
## Project 与成员
diff --git a/packages/web/src/components/account/desktop-update-row.tsx b/packages/web/src/components/account/desktop-update-row.tsx
index fb9dfca9..61191871 100644
--- a/packages/web/src/components/account/desktop-update-row.tsx
+++ b/packages/web/src/components/account/desktop-update-row.tsx
@@ -1,7 +1,8 @@
/**
- * Client-update row in the sidebar user menu — the desktop-mode counterpart of the
- * server update reminder (which stays hidden there: the CLI self-update has nothing to
- * run under the shell). Rendered only in the shell's own window (see offersClientUpdate).
+ * Client-update row in the sidebar user menu — the desktop-mode counterpart of
+ * ServerUpdateRow, taking the same slot under the System settings entry (the server row
+ * stays hidden there: the CLI self-update has nothing to run under the shell). Rendered
+ * only in the shell's own window (see offersClientUpdate).
*
* Deliberately thin: the snapshot, the polling and the armed-check watch live in
* use-desktop-update.ts at module level, because this row unmounts whenever the menu
diff --git a/packages/web/src/components/account/server-update-row.tsx b/packages/web/src/components/account/server-update-row.tsx
new file mode 100644
index 00000000..43a05ba2
--- /dev/null
+++ b/packages/web/src/components/account/server-update-row.tsx
@@ -0,0 +1,67 @@
+/**
+ * Server-update row in the sidebar user menu — the web counterpart of DesktopUpdateRow,
+ * sitting in the same slot under the System settings entry so the update affordance is
+ * reachable without opening a dialog. Hidden in desktop mode, where updating is the
+ * shell's job and the client row takes this slot instead.
+ *
+ * One row, two states: it reads "check for updates" and runs the manual check until a
+ * newer release is known, then names that release and opens UpdateDialog (which carries
+ * the release-notes link and the admin-only self-update). Deliberately thin — the check
+ * state and the dialog live in the Sidebar, which stays mounted while this row unmounts
+ * with the menu, so a check clicked here still settles and still toasts.
+ */
+import { S } from "../../lib/strings";
+
+export function ServerUpdateRow({
+ version,
+ newVersion,
+ checking,
+ menuItemClass,
+ onCheck,
+ onOpenDialog,
+}: {
+ /** Running server version for the right-aligned chip; null until the lazy fetch lands. */
+ version: string | null;
+ /** The newer release this row names, or null while none is known. */
+ newVersion: string | null;
+ /** A manual check is in flight (owned by the Sidebar, so it survives the menu closing). */
+ checking: boolean;
+ /** The menu's shared row class (owned by sidebar.tsx). */
+ menuItemClass: string;
+ /** Check click: forces a lookup past the server's TTL cache and toasts the outcome. */
+ onCheck: () => void;
+ /** Update click: the Sidebar closes the menu and opens UpdateDialog. */
+ onOpenDialog: () => void;
+}) {
+ const offersUpdate = newVersion !== null;
+ const label = checking
+ ? S.update.checking
+ : offersUpdate
+ ? S.update.newVersion(newVersion)
+ : S.update.checkNow;
+
+ return (
+ <button
+ type="button"
+ disabled={checking}
+ onClick={offersUpdate ? onOpenDialog : onCheck}
+ className={`${menuItemClass} flex items-center justify-between gap-2 disabled:cursor-default disabled:opacity-60`}
+ >
+ <span className="flex min-w-0 items-center gap-2">
+ {checking && (
+ <span
+ aria-hidden
+ className="inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent opacity-70"
+ />
+ )}
+ {!checking && offersUpdate && (
+ <span aria-hidden className="h-2 w-2 shrink-0 rounded-full bg-[var(--accent-bg)]" />
+ )}
+ <span className="min-w-0 truncate">{label}</span>
+ </span>
+ {version !== null && (
+ <span className="shrink-0 text-xs text-gray-400 dark:text-gray-500">{`v${version}`}</span>
+ )}
+ </button>
+ );
+}
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index 534f3e11..d9f30377 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -125,7 +125,7 @@ import {
storeGroupMode,
} from "../ui/group-list";
import type { GroupMode } from "../ui/group-list";
-import { toastError } from "../ui/toast";
+import { toastError, toastInfo, toastSuccess } from "../ui/toast";
import { Truncated } from "../ui/truncated";
import { Badge } from "../ui/badge";
import { SessionActivityIcon } from "../ui/session-activity-icon";
@@ -146,11 +146,12 @@ import {
import type { DraftSessionEntry } from "../../features/chat/draft-sessions";
import { CreateProjectDialog, ProjectSettingsDialog } from "./project-dialogs";
import { DesktopUpdateRow } from "../account/desktop-update-row";
+import { ServerUpdateRow } from "../account/server-update-row";
+import { UpdateDialog } from "../account/update-dialog";
import { offersClientUpdate } from "../../lib/desktop-update";
import { requestClientInstall, useDesktopUpdate } from "../../lib/use-desktop-update";
-import { useVersionInfo } from "../../lib/use-version-info";
+import { forceUpdateCheck, updateCheckOutcome, useVersionInfo } from "../../lib/use-version-info";
import { SettingsDialog } from "../../features/settings/settings-dialog";
-import type { SettingsSectionKey } from "../../lib/settings-sections";
import { ICON_SIZE } from "../../lib/icon-scale";
/** New-chat pencil (the pinned "New chat" button and the collapsed rail share it). */
@@ -321,8 +322,6 @@ export function Sidebar({
const [createProjectOpen, setCreateProjectOpen] = useState(false);
const [projectSettingsOpen, setProjectSettingsOpen] = useState(false);
const [settingsOpen, setSettingsOpen] = useState(false);
- /** Page the settings dialog lands on: the update reminder row jumps straight to Updates. */
- const [settingsSection, setSettingsSection] = useState<SettingsSectionKey>("general");
// Client update (desktop shell window only): the snapshot and the armed-check flag live
// at module level in use-desktop-update.ts; this always-mounted hook instance drives the
// polling, so a check armed in the menu still settles after the menu closes.
@@ -330,8 +329,8 @@ export function Sidebar({
const clientUpdate = useDesktopUpdate(clientUpdateOffered, userOpen);
/** Install confirmation (restarting interrupts running tasks — same consent as the shell's native prompt). */
const [clientInstallOpen, setClientInstallOpen] = useState(false);
- // Update reminder: nothing is fetched until the dropdown first opens.
- const { update } = useVersionInfo(userOpen);
+ // Server update: nothing is fetched until the dropdown first opens.
+ const { version, update } = useVersionInfo(userOpen);
const updateAvailable = update?.updateAvailable === true;
/**
* The newer release's version string, or null while none is known — the single update row's
@@ -340,6 +339,14 @@ export function Sidebar({
* than rendering a versionless reminder.
*/
const newVersion = updateAvailable ? (update?.latestVersion ?? null) : null;
+ /** Release announcement + admin self-update, opened from the update row once a release is known. */
+ const [updateDialogOpen, setUpdateDialogOpen] = useState(false);
+ /**
+ * A manual server-update check is in flight. Held here rather than in the row, which
+ * unmounts with the menu: a check clicked and then dismissed must still settle, and the
+ * spinner must still be there when the menu is reopened mid-flight.
+ */
+ const [updateChecking, setUpdateChecking] = useState(false);
const currentProjectId = currentProject?.projectId ?? null;
/** This Project's read markers; re-renders the rows whenever one is stamped. */
const sessionSeen = useSessionSeen(currentProjectId);
@@ -663,6 +670,29 @@ export function Sidebar({
if (!isLoadedFor(s.agentId, category)) void loadMoreFor([s.agentId], category);
}, [activeSessionId, sessions, groupMode, isLoadedFor, loadMoreFor]);
+ /**
+ * Manual server-update check, from the menu's update row: forces a lookup past the
+ * server's TTL cache and pushes the result into the shared version-info store, so the
+ * row turns into the update entry and the avatar's reminder dot appears at once. Every
+ * outcome toasts — the check is fail-soft (a failed lookup arrives as the `error` field,
+ * not an exception; the catch handles our own server being unreachable).
+ */
+ const runUpdateCheck = async () => {
+ if (updateChecking) return;
+ setUpdateChecking(true);
+ try {
+ const outcome = updateCheckOutcome(await forceUpdateCheck());
+ if (outcome.kind === "disabled") toastInfo(S.update.checkDisabled);
+ else if (outcome.kind === "failed") toastError(S.update.checkFailed);
+ else if (outcome.kind === "found") toastSuccess(S.update.foundNew(outcome.latestVersion));
+ else toastSuccess(S.update.upToDate);
+ } catch (e) {
+ toastError(apiErrorText(e));
+ } finally {
+ setUpdateChecking(false);
+ }
+ };
+
/** Archive / unarchive: persists immediately and updates in place (fails silently; the next list refresh self-corrects). */
const toggleArchive = async (s: SessionInfo) => {
// Archiving the currently open chat: expand the "archived" folder so it doesn't silently vanish from the sidebar with no way back.
@@ -1849,30 +1879,29 @@ export function Sidebar({
className={menuItemClass}
onClick={() => {
setUserOpen(false);
- setSettingsSection("general");
setSettingsOpen(true);
}}
>
{S.settings.systemSettings}
</button>
- {/* Update reminder row: only once the lazy check (menu open) has found a newer
- release. Opens the dialog straight on its Updates page; the manual check
- lives there too. Desktop mode never checks — updating is the shell's job. */}
- {!desktopMode && newVersion !== null && (
- <button
- type="button"
- className={`${menuItemClass} flex items-center gap-2`}
- onClick={() => {
+ {/* Update row, directly under the settings entry rather than on a page inside
+ it: the check is one click from the menu, and the same row turns into the
+ update entry once the lazy check (menu open) names a newer release. Desktop
+ mode never checks here — updating is the shell's job. */}
+ {!desktopMode && (
+ <ServerUpdateRow
+ version={version?.version ?? null}
+ newVersion={newVersion}
+ checking={updateChecking}
+ menuItemClass={menuItemClass}
+ onCheck={() => void runUpdateCheck()}
+ onOpenDialog={() => {
setUserOpen(false);
- setSettingsSection("updates");
- setSettingsOpen(true);
+ setUpdateDialogOpen(true);
}}
- >
- <span aria-hidden className="h-2 w-2 shrink-0 rounded-full bg-[var(--accent-bg)]" />
- <span className="min-w-0 truncate">{S.update.newVersion(newVersion)}</span>
- </button>
+ />
)}
- {/* Desktop stand-in for the reminder row above, in the shell's own window only:
+ {/* Desktop stand-in for the row above, in the shell's own window only:
the same slot updates the CLIENT through the shell's own updater (relayed
via /api/desktop/update) — which is what "updating is the shell's job"
means for someone sitting in front of the app. A browser signed into the
@@ -1908,10 +1937,20 @@ export function Sidebar({
</Dropdown>
</div>
- <SettingsDialog
- open={settingsOpen}
- onClose={() => setSettingsOpen(false)}
- initialSection={settingsSection}
+ <SettingsDialog open={settingsOpen} onClose={() => setSettingsOpen(false)} />
+
+ {/* Release announcement, release-notes link and the admin-only self-update. Mounted
+ here rather than in the row, which unmounts as the menu closes on the click that
+ opens this. */}
+ <UpdateDialog
+ open={updateDialogOpen}
+ onClose={() => setUpdateDialogOpen(false)}
+ latestVersion={newVersion}
+ releaseUrl={update?.releaseUrl ?? null}
+ canUpdate={user?.isAdmin === true}
+ /* A finished self-update makes the known release stale — re-check silently so the
+ row stops offering the version that is now running. */
+ onRunFinished={() => void forceUpdateCheck().catch(() => undefined)}
/>
{/* Client-update install consent: restarting interrupts running tasks, the same
diff --git a/packages/web/src/features/settings/settings-dialog.tsx b/packages/web/src/features/settings/settings-dialog.tsx
index d4a09943..a4f3aeee 100644
--- a/packages/web/src/features/settings/settings-dialog.tsx
+++ b/packages/web/src/features/settings/settings-dialog.tsx
@@ -4,8 +4,8 @@
* rows on the right). The rail is grouped — Personal for the viewer's own preferences,
* Server for the server-global settings an admin writes — and both the rail and the pane
* go through visibleSettingsSections, so a viewer neither sees a page they may not open
- * nor reaches it by request: an unknown or forbidden `initialSection` is replaced with the
- * first page they can actually open.
+ * nor lands on one: the active page is re-resolved against that list on every render, and
+ * anything not on it falls back to the first page they can actually open.
*/
import { useEffect, useState } from "react";
import { S } from "../../lib/strings";
@@ -25,7 +25,6 @@ import { AppearanceSection } from "./appearance-section";
import { AccountSection } from "./account-section";
import { ProxySection } from "./proxy-section";
import { UploadsSection } from "./uploads-section";
-import { UpdatesSection } from "./updates-section";
import { AdminUsersSection } from "../admin/admin-users-page";
/** Rail glyphs, on the shared 24x24 stroke grid (see NAV_ICONS' conventions). */
@@ -41,23 +40,12 @@ const SECTION_ICONS: Record<SettingsSectionKey, string> = {
"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM3.6 9h16.8M3.6 15h16.8M12 3a15 15 0 0 0 0 18M12 3a15 15 0 0 1 0 18",
/** Up arrow over a base: uploads. */
uploads: "M12 15V4m0 0L7 9m5-5l5 5M4 20h16",
- /** Down arrow into a tray: updates arriving. */
- updates: "M12 3v10m0 0l-4-4m4 4l4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",
/** Two people: user management. */
users:
"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75",
};
-export function SettingsDialog({
- open,
- onClose,
- initialSection,
-}: {
- open: boolean;
- onClose: () => void;
- /** Page to land on when opening (e.g. the update reminder jumps to "updates"); resolved against what this viewer may open. */
- initialSection?: SettingsSectionKey;
-}) {
+export function SettingsDialog({ open, onClose }: { open: boolean; onClose: () => void }) {
const { user, desktopMode, sessionVia } = useAuth();
const sections = visibleSettingsSections({
isAdmin: user?.isAdmin === true,
@@ -66,13 +54,11 @@ export function SettingsDialog({
});
const [active, setActive] = useState<SettingsSectionKey | null>(null);
- // Re-resolve the landing page each time the dialog opens (and whenever the viewer's
- // section list would invalidate the current choice).
- // Deliberately keyed on `open` alone: the landing page matters at the moment of opening,
- // and re-running on every sections identity change would yank the user off a page they
- // navigated to. `current` below re-resolves against the live list on every render anyway.
+ // Each opening starts on the viewer's first page: clearing the choice lets `current`
+ // below resolve it against the live list. Deliberately keyed on `open` alone — re-running
+ // on every sections identity change would yank the user off a page they navigated to.
useEffect(() => {
- if (open) setActive(resolveSettingsSection(initialSection, sections));
+ if (open) setActive(null);
}, [open]);
const current = resolveSettingsSection(active, sections);
@@ -85,7 +71,6 @@ export function SettingsDialog({
account: S.settings.accountTitle,
proxy: S.settings.proxyTitle,
uploads: S.settings.uploadLimitsTitle,
- updates: S.settings.updatesTitle,
users: S.admin.users,
};
const groupLabel: Record<SettingsGroupKey, string> = {
@@ -121,7 +106,6 @@ export function SettingsDialog({
{current === "account" && <AccountSection />}
{current === "proxy" && <ProxySection />}
{current === "uploads" && <UploadsSection />}
- {current === "updates" && <UpdatesSection active={open} />}
{current === "users" && <AdminUsersSection />}
</PagedDialog>
);
diff --git a/packages/web/src/features/settings/updates-section.tsx b/packages/web/src/features/settings/updates-section.tsx
deleted file mode 100644
index d0813aae..00000000
--- a/packages/web/src/features/settings/updates-section.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Updates page of System settings: the running server version, one check-for-updates
- * action, and — once a newer release is known — the entry into UpdateDialog, which carries
- * the release-notes link and the admin-only self-update. Moved here from the sidebar user
- * menu's single update row; the row semantics are unchanged: check until a release is
- * known, then offer it. Never mounted in desktop mode (the section registry drops the
- * page), where updating is the desktop shell's job.
- *
- * Version + update state share useVersionInfo's module cache with the sidebar's reminder
- * dot, so the two surfaces never disagree about what is known.
- */
-import { useState } from "react";
-import { S } from "../../lib/strings";
-import { useLocale } from "../../state/locale";
-import { Button } from "../../components/ui/button";
-import { UpdateDialog } from "../../components/account/update-dialog";
-import { forceUpdateCheck, updateCheckOutcome, useVersionInfo } from "../../lib/use-version-info";
-import { apiErrorText } from "../../lib/api-error";
-import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
-import { formatMonthDay } from "../../lib/format";
-import { useAuth } from "../../state/auth";
-import { PrefRow } from "./setting-row";
-
-export function UpdatesSection({ active }: { active: boolean }) {
- const { user } = useAuth();
- const { locale } = useLocale();
- const { version, update } = useVersionInfo(active);
- const [updateDialogOpen, setUpdateDialogOpen] = useState(false);
- const [updateChecking, setUpdateChecking] = useState(false);
-
- const updateAvailable = update?.updateAvailable === true;
- /** The newer release's version string, or null while none is known. */
- const newVersion = updateAvailable ? (update?.latestVersion ?? null) : null;
- const versionDate = version?.buildDate ?? null;
-
- /**
- * Manual update check: forces a lookup past the server's TTL cache and pushes the result
- * into the shared version-info store, so the sidebar's reminder dot appears immediately
- * when a newer release is found. Every outcome toasts — the check is fail-soft (failure
- * arrives as the `error` field, not an exception; the catch handles our own server being
- * unreachable).
- */
- const runUpdateCheck = async () => {
- if (updateChecking) return;
- setUpdateChecking(true);
- try {
- const outcome = updateCheckOutcome(await forceUpdateCheck());
- if (outcome.kind === "disabled") toastInfo(S.update.checkDisabled);
- else if (outcome.kind === "failed") toastError(S.update.checkFailed);
- else if (outcome.kind === "found") toastSuccess(S.update.foundNew(outcome.latestVersion));
- else toastSuccess(S.update.upToDate);
- } catch (e) {
- toastError(apiErrorText(e));
- } finally {
- setUpdateChecking(false);
- }
- };
-
- return (
- <div className="divide-y divide-gray-100 dark:divide-gray-800/60">
- <PrefRow
- label={newVersion !== null ? S.update.newVersion(newVersion) : S.update.checkNow}
- hint={
- versionDate !== null
- ? S.update.lastUpdated(formatMonthDay(versionDate, locale))
- : undefined
- }
- >
- <span className="flex items-center gap-3">
- {version !== null && (
- <span className="text-xs text-gray-400 dark:text-gray-500">{`v${version.version}`}</span>
- )}
- {newVersion !== null ? (
- <Button variant="primary" onClick={() => setUpdateDialogOpen(true)}>
- {S.update.newVersionBadge}
- </Button>
- ) : (
- <Button
- variant="secondary"
- disabled={updateChecking}
- onClick={() => void runUpdateCheck()}
- >
- {updateChecking ? S.update.checking : S.update.checkNow}
- </Button>
- )}
- </span>
- </PrefRow>
- <UpdateDialog
- open={updateDialogOpen}
- onClose={() => setUpdateDialogOpen(false)}
- latestVersion={newVersion}
- releaseUrl={update?.releaseUrl ?? null}
- canUpdate={user?.isAdmin === true}
- /* A finished self-update makes the known release stale — re-check silently so the
- row stops offering the version that is now running (see the old menu row). */
- onRunFinished={() => void forceUpdateCheck().catch(() => undefined)}
- />
- </div>
- );
-}
diff --git a/packages/web/src/lib/settings-sections.ts b/packages/web/src/lib/settings-sections.ts
index 40b076ea..5b9d785c 100644
--- a/packages/web/src/lib/settings-sections.ts
+++ b/packages/web/src/lib/settings-sections.ts
@@ -4,12 +4,13 @@
* Server-global pages write through /api/admin/settings (or the admin user routes) and
* belong to admins alone; the personal pages are per-user preferences every signed-in user
* owns. Two pages additionally depend on how this session runs: the account page only
- * exists where a password can be changed (see offersChangePassword), and updates / user
- * management disappear in desktop mode, where the app is single-user and updating is the
- * desktop shell's job. The rules live here rather than inside the dialog because this
- * package's vitest runs in Node with no DOM — a pure function is the only thing a test can
- * pin directly — and because rail and content have to apply the same rule to avoid a
- * visible-but-forbidden entry.
+ * exists where a password can be changed (see offersChangePassword), and user management
+ * disappears in desktop mode, where the app is single-user. Updating is not a page here at
+ * all — both the server check and the desktop client's live in the sidebar user menu, under
+ * the entry that opens this dialog. The rules live here rather than inside the dialog
+ * because this package's vitest runs in Node with no DOM — a pure function is the only
+ * thing a test can pin directly — and because rail and content have to apply the same rule
+ * to avoid a visible-but-forbidden entry.
*
* A page the viewer may not open is dropped from the list entirely rather than rendered
* disabled: a greyed-out "Proxy" row still tells a non-admin the setting exists and that
@@ -23,7 +24,7 @@ import type { AccountMenuSession } from "./account-menu";
/** A page of the System settings dialog. */
export type SettingsSectionKey =
- "general" | "appearance" | "account" | "proxy" | "uploads" | "updates" | "users";
+ "general" | "appearance" | "account" | "proxy" | "uploads" | "users";
/** Rail heading a page sits under: the viewer's own preferences vs. the whole server's. */
export type SettingsGroupKey = "personal" | "server";
@@ -51,9 +52,6 @@ const SECTION_RULES: ReadonlyArray<SettingsSection & { visible(viewer: SettingsV
{ key: "account", group: "personal", visible: (v) => offersChangePassword(v) },
{ key: "proxy", group: "server", visible: (v) => v.isAdmin },
{ key: "uploads", group: "server", visible: (v) => v.isAdmin },
- // Server updates: every non-desktop account may check; the dialog's self-update stays
- // admin-only inside. Desktop updates are the shell's job (electron-updater).
- { key: "updates", group: "server", visible: (v) => !v.desktopMode },
// Single-user under the desktop shell: the server rejects the admin user routes there.
{ key: "users", group: "server", visible: (v) => v.isAdmin && !v.desktopMode },
];
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 34960ba7..f59ad268 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -69,7 +69,6 @@ export const en: Strings = {
generalTitle: "General",
appearanceTitle: "Appearance",
accountTitle: "Account",
- updatesTitle: "Updates",
/** Sidebar Session list: also show CLI-created Sessions (default off — the list then never scans the Trace directories). */
showCliSessions: "Show CLI sessions",
showCliSessionsHint:
@@ -139,8 +138,8 @@ export const en: Strings = {
*/
checkNow: "Check for updates",
checking: "Checking…",
- /** Success toast when the manual check finds a newer release; the row below turns into the update entry. */
- foundNew: (v: string) => `New version v${v} found — use the update entry below to install`,
+ /** Success toast when the manual check finds a newer release; the row itself turns into the update entry. */
+ foundNew: (v: string) => `New version v${v} found — use the update entry to install`,
upToDate: "You're on the latest version",
checkFailed: "Update check failed — try again later",
checkDisabled: "Update checks are disabled (PENGUIN_UPDATE_CHECK=off)",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 49a1f096..8a25df63 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -71,7 +71,6 @@ export const zh = {
generalTitle: "通用",
appearanceTitle: "外观",
accountTitle: "账户",
- updatesTitle: "更新",
/** Sidebar Session list: also show CLI-created Sessions (default off — the list then never scans the Trace directories). */
showCliSessions: "显示 CLI 会话",
showCliSessionsHint:
@@ -138,8 +137,8 @@ export const zh = {
*/
checkNow: "检查更新",
checking: "检查中…",
- /** Success toast when the manual check finds a newer release; the row below turns into the update entry. */
- foundNew: (v: string) => `发现新版本 v${v},点击下方更新入口即可安装`,
+ /** Success toast when the manual check finds a newer release; the row itself turns into the update entry. */
+ foundNew: (v: string) => `发现新版本 v${v},点击该更新入口即可安装`,
upToDate: "已是最新版本",
checkFailed: "检查更新失败,请稍后重试",
checkDisabled: "更新检查已关闭(PENGUIN_UPDATE_CHECK=off)",
diff --git a/packages/web/test/account-menu.test.ts b/packages/web/test/account-menu.test.ts
index 0961028e..9262cf92 100644
--- a/packages/web/test/account-menu.test.ts
+++ b/packages/web/test/account-menu.test.ts
@@ -71,14 +71,22 @@ describe("the sidebar user menu", () => {
it("keeps sign-out on its own desktopMode gate", () => {
// Sign out is hidden for the whole desktop-mode server, not just the shell's window.
- expect(source).toContain("{!desktopMode && (");
+ // Anchored to sign-out's own block: the server update row above it carries the same
+ // gate, so a bare `toContain("{!desktopMode && (")` would keep passing once this one
+ // was deleted.
+ const signOut = source.indexOf("S.auth.logout");
+ expect(signOut).toBeGreaterThan(-1);
+ const gate = source.lastIndexOf("{!desktopMode && (", signOut);
+ expect(gate).toBeGreaterThan(-1);
+ // Only sign-out's own <button> stands between that gate and the label it renders.
+ expect(source.slice(gate, signOut).match(/<\w/g)).toEqual(["<b"]);
});
it("reaches the settings it no longer holds through one ungated System settings entry", () => {
- // The preference rows, change password, the update row and user management all moved
- // into the settings dialog, whose own section registry decides which pages this viewer
- // sees — so the row itself carries no isAdmin test, or a non-admin would lose the
- // personal pages along with the admin ones.
+ // The preference rows, change password and user management all moved into the settings
+ // dialog, whose own section registry decides which pages this viewer sees — so the row
+ // itself carries no isAdmin test, or a non-admin would lose the personal pages along
+ // with the admin ones.
expect(source).toContain("setSettingsOpen(true)");
expect(source).not.toContain("offersChangePassword");
expect(source).not.toContain("S.settings.showCliSessions");
@@ -87,12 +95,24 @@ describe("the sidebar user menu", () => {
expect(source).not.toContain('go("/admin/users")');
});
- it("no longer mounts the dialogs whose surfaces moved into the settings dialog", () => {
+ it("mounts no dialog for a surface the settings dialog owns", () => {
// A stale mount would be a build failure rather than a silent one, but the menu
// keeping an opener for a surface reachable elsewhere is the regression worth naming.
expect(source).not.toContain("ProxySettingsDialog");
expect(source).not.toContain("UploadLimitsDialog");
expect(source).not.toContain("ChangePasswordDialog");
- expect(source).not.toContain("UpdateDialog");
+ });
+
+ it("keeps both update rows outside the settings dialog, in one slot under its entry", () => {
+ // Updating is deliberately not a settings page: the menu carries the check itself, and
+ // the two rows are mutually exclusive by their own gates (a desktop-mode server never
+ // offers the server check; a browser session against one gets neither).
+ expect(source).toContain("<ServerUpdateRow");
+ expect(source).toContain("<DesktopUpdateRow");
+ expect(source).toContain("<UpdateDialog");
+ // The row's install/announce dialogs hang off the Sidebar, which outlives the menu the
+ // click closes — mounting them in the rows would unmount them on that same click.
+ expect(source).toContain("setUpdateDialogOpen(true)");
+ expect(source).toContain("setClientInstallOpen(true)");
});
});
diff --git a/packages/web/test/settings-sections.test.ts b/packages/web/test/settings-sections.test.ts
index b4e49e33..03f89b5d 100644
--- a/packages/web/test/settings-sections.test.ts
+++ b/packages/web/test/settings-sections.test.ts
@@ -3,8 +3,8 @@
*
* The rule is pinned by value rather than by shape because both halves of it can fail
* silently and separately: a rail that shows a forbidden entry leaks that the setting
- * exists, and an initialSection that is honoured without the same filter hands a
- * non-admin the form itself. Both go through these functions, so both are covered here.
+ * exists, and an active page rendered without the same filter hands a non-admin the form
+ * itself. Both go through these functions, so both are covered here.
*
* The client filter is convenience, not the boundary — the admin APIs answer a non-admin
* with 403 either way (server/test/admin-settings.test.ts, "non-admin access is always
@@ -57,28 +57,27 @@ describe("visibleSettingsSections", () => {
"account",
"proxy",
"uploads",
- "updates",
"users",
]);
});
- it("gives a non-admin their own pages and the update check, nothing server-global", () => {
+ it("gives a non-admin their own pages and nothing server-global", () => {
// Not "fewer pages" — the exact list. Proxy, upload limits and user management are
// admin surfaces, and the whole point of dropping them is that a non-admin is never
- // told they exist. The updates page stays: any account may run the check; the
- // self-update inside stays admin-only.
- expect(plain.map((s) => s.key)).toEqual(["general", "appearance", "account", "updates"]);
+ // told they exist. Updating is not among them either way: it lives in the sidebar user
+ // menu, outside this dialog, for every account.
+ expect(plain.map((s) => s.key)).toEqual(["general", "appearance", "account"]);
});
it("strips the desktop shell's window down to what a token session can use", () => {
- // No account page (no password to change — see offersChangePassword), no updates
- // (electron-updater owns updating there), no user management (single-user server).
+ // No account page (no password to change — see offersChangePassword), no user
+ // management (single-user server).
expect(shell.map((s) => s.key)).toEqual(["general", "appearance", "proxy", "uploads"]);
});
it("keeps the account page for a password session against a desktop-mode server", () => {
// Mirrors the old menu row's two-field rule: that session typed a real password and
- // can still change it, while updates and user management stay desktop-hidden.
+ // can still change it, while user management stays desktop-hidden.
expect(desktopBrowser.map((s) => s.key)).toEqual([
"general",
"appearance",
@@ -94,13 +93,10 @@ describe("settingsGroups", () => {
expect(settingsGroups(admin)).toEqual(["personal", "server"]);
});
- it("keeps both headings for a non-admin, whose updates page sits under Server", () => {
- expect(settingsGroups(plain)).toEqual(["personal", "server"]);
- });
-
it("collapses to a single group when only one remains, the rail's cue to draw no heading", () => {
- // A lone "Personal" heading announces that some other group exists.
- expect(settingsGroups(plain.filter((s) => s.group === "personal"))).toEqual(["personal"]);
+ // A lone "Personal" heading announces that some other group exists — which is exactly a
+ // non-admin's case, whose every page is personal.
+ expect(settingsGroups(plain)).toEqual(["personal"]);
});
});
@@ -111,7 +107,7 @@ describe("resolveSettingsSection", () => {
});
it("sends a non-admin asking for an admin page to their own first page", () => {
- // Answering identically to an unknown request is the point: initialSection cannot be
+ // Answering identically to an unknown request is the point: a requested key cannot be
// used to find out that "users" is a real page.
expect(resolveSettingsSection("users", plain)).toBe("general");
expect(resolveSettingsSection("proxy", plain)).toBe("general");
@@ -144,10 +140,9 @@ describe("the System settings dialog", () => {
expect(source).not.toContain("SECTION_RULES");
});
- it("resolves both the landing page and the rendered page through the same gate", () => {
- // initialSection is a request, not a right: an unknown or forbidden value must land on
- // the viewer's own first page, and the pane renders only what re-resolves.
- expect(source).toContain("resolveSettingsSection(initialSection, sections)");
+ it("resolves the page it renders through the same gate on every render", () => {
+ // The active page is a state value, not a right: a viewer who loses admin mid-dialog
+ // must fall back to their own first page rather than keep rendering the admin form.
expect(source).toContain("resolveSettingsSection(active, sections)");
});
});