Repository navigation
前端:新增 /setup 初始化页面 + 后台开关与「检查并升级数据库」按钮 - #127
Merged
todosdev[bot] merged 2 commits intoOct 18, 2026
Merged
Conversation
- Add public /setup page driven by GET /api/setup/state and POST /api/setup (X-Setup-Secret header), with disabled/loading/form/done states and 403/429 error mapping. - Add setup_page_enabled toggle and "check and upgrade database" button to the admin system settings page (POST /api/admin/setup). - Wire /setup and /admin/system routes and the admin "system" tab. - Add zh/en i18n strings for the new UI. Checkpoint: 3iuwy9uzxonUxglhH3OGM
…e-73d5-a5dd-c00dc699f45b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/setupinitialization page so new installs can initialize/upgrade the database from the browser instead ofcurl, gated by a newsetup_page_enabledadmin setting.GET /api/setup/state,POST /api/admin/setup,setup_page_enabled) are provided by the parallel backend task and already onmain.Changes
web/src/pages/setup/SetupPage.tsx(new) — public/setuproute with four states: loading, disabled (admin turned the page off), form (SETUP_SECRETinput + submit), and done. SubmitsPOST /api/setupwith theX-Setup-Secretheader and maps 403 → wrong-secret, 429 → rate-limited,alreadyInitialized→ "already initialized" copy vs. fresh-init success.web/src/pages/admin/AdminSystemPage.tsx— repurposed the dead combined settings file into a focused System Settings page:setup_page_enabledtoggle (saved viaPUT /api/admin/system/settings) and a database-maintenance card that callsPOST /api/admin/setup, showing up-to-date/initialized on success and status-mapped, non-leaky errors on failure.web/src/App.tsx— registers/setup(public) and/admin/system(admin-only) routes.web/src/pages/admin/AdminPage.tsx— adds the "系统设置" tab (desktop tabs + mobile submenu).web/src/lib/api.ts— newsetupApi(state/run) using rawfetchfor theX-Setup-Secretheader and status-coded errors, plus theSetupResulttype.web/src/types/index.ts—SystemSettings.setup_page_enabled?.web/src/locales/{en,zh}.json—setup.*andadmin.setupPage*/admin.db*strings.Testing
pnpm install --frozen-lockfile,pnpm lint,pnpm format:check,pnpm typecheck,pnpm buildall pass (lint shows only two pre-existing warnings inworker/src/routes/items.tsandPasswordPromptDialog.tsx, unrelated to this change).