feat(admin): maintenance-mode UI toggle + 503 gate (LC-92) #152
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-92-maintenance-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements LC-92: a standalone admin toggle for
maintenance_modeplus the enforcement plumbing.POST /admin/maintenance(standalone-only) flips the flag and the operator-facing message together; the section renders at the top of/admin/settingswith a clear "ON" banner when active.enforce_maintenance_modemiddleware sits betweeninject_userand the routes. Admins always pass;/login,/logout,/version,/assets/*,/avatars/*are exempt before the setting is even read; everyone else gets a 503 renderingtemplates/maintenance.htmlwith the operator's message.ws_handler. Existing live sessions are allowed to drain.mod_actionsaudit row (maintenance_on/maintenance_off, actor = admin, metadata = message).maintenance_webhookis untouched; the two paths sharesettings.maintenance_mode.Test plan
just check(server + desktop, both feature builds, clippy -D warnings, fmt --check)just test- 50 binaries green, including the newroutes_maintenance(6 cases: non-admin POST 403, admin enable+disable writes settings and audit log, non-admin GET 503 with embedded message, admin bypass,/loginreachable during maintenance, non-admin WS upgrade 503)just test-saas- green, the new file is#![cfg(feature = "standalone")]at file scope so it is skipped under saasA locked-out admin could not reach /forgot or /reset/{token} during maintenance because the middleware 503'd them. The 2FA enrollment middleware already enumerates these as recovery paths; mirror that subset here so an admin can recover without an out-of-band DB write. Registration and email verification stay 503'd on purpose.