Separate the custom context menu preference and enable it by default.
Bring dropdowns and settings choices into a consistent, responsive interaction language.
Introduce a CSS-driven adaptive cursor that morphs for controls, text editing, dragging, resizing, busy states, and other native pointer semantics on desktop devices.
Add a themed context menu for editing, selections, links, images, and page navigation while preserving explicit native-menu escape paths. Store a default-on interaction preference through the normalized appearance model and cover its migration and opt-out behavior.
Route selected backup entries through owner-owned config parsers before any filesystem write. Reject unsupported paths, mismatched encodings, malformed base64, lossy normalization, invalid effective overlays, and decoded payloads larger than 32 MiB.
Treat WebUI state, private keys, and every OneBot config as a single sensitive group. Skip unselected sensitive entries without inspecting their contents, preserve recognized migrations, and assign restrictive modes to credential files.
Phase 2. notifications/config and webui/ui-config dropped their verbatim-
duplicated isObject/boolOr/clampInt (+ ui-config clampNum) in favor of the
shared @snowluma/common/coerce. Pure delete-and-import: the shared
primitives are byte-identical to the originals (adversarially verified),
so behavior is unchanged.
Kept local: strOr (notifications-only), oneOf/isFiniteNum/hexOr
(ui-specific). notifications-config suite green (21), core+common
typecheck clean.
The old default-collapsed pref went inert once the sidebar became a
hover-expand rail with no collapse button. Repurpose it as an explicit
opt-out: when 「钉住侧栏展开」 is on, the sidebar stays permanently expanded
and no longer collapses to the rail or reacts to hover.
Renamed the appearance field sidebarDefaultCollapsed -> sidebarPinned across
the webui types/defaults/settings UI and the core ui-config interface,
defaults and validator (kept in lock-step so persistence round-trips). Wired
into main-layout: effectiveCollapsed = !editing && !sidebarPinned.
- 导出当前视图: a toolbar button dumps the current (filtered) log view to a
client-side `.log` text file — no server endpoint, respects the active level
filter + search.
- 视图预设: 开发 / 运维 / 精简 presets bundle the existing display prefs
(visibleLevels / maxLines / autoScroll / wrap); a new `UiLogsPrefs.preset`
field stores the active id. Any hand edit to those prefs drops to 自定义.
The client owns the preset→prefs bundles; the server just stores + validates
the id (oneOf, defaults custom). No non-chronological reordering, per plan.
Schema foundation for the B2 dashboard batch, mirroring the navItems shape:
- `overviewMobile: UiLayoutItem[]` — a separate single-column (id+visible)
ordering for phones, kept fully disjoint from the desktop 2D `overviewBlocks`
grid so mobile ordering never pollutes grid coords.
- `topbarItems: UiLayoutItem[]` — show/hide list for toggleable top-bar
elements (status badge, theme toggle, kiosk button); essential elements stay
pinned in the consumer.
Server `normalizeLayout` round-trips both (idOr + dedup, total over corrupt
input); defaults seed first run. `LayoutContext` exposes them with
setOverviewMobile/setTopbarItems setters and reconcile-on-consume semantics, so
adding a widget/element later just appears. Old configs lacking the fields fall
back to defaults on load.
Consumers (mobile render, topbar render + config, drag-sort panel) land in
follow-up B2 commits.
Adds two appearance customizations from the WebUI plan's B1 batch:
- Custom fonts: new `fontSansCustom`/`fontMonoCustom` free-form family
fields (mirroring accent's preset/custom dual-field). A "自定义" segment
reveals a text input; on Chromium it gets a native <datalist> of installed
fonts via `queryLocalFonts()`, feature-detected with a silent fallback to
a plain text box on Firefox/Safari/mobile. No font-file uploads.
- Theme-variable panel: new `cssVars` map lets the operator override
individual theme tokens (background/foreground/primary/…) with colour
pickers, layered last over palette+accent. Both keys (token whitelist) and
values (hex/named/functional colour) are validated, so — unlike customCss —
this stays safe to serve to the unauthenticated login page.
Server `normalizeAppearance` gains `fontFamilyOr` (rejects control
chars/injection) and `normalizeCssVars` (whitelist keys + colour-only values,
total over corrupt input). Client `ThemeContext` re-validates defensively
(the localStorage cache is locally tamperable) before injecting into CSS.
Tests for the new normalizers land with the B4 batch.
- OLED: toggle switch off-track is now a neutral foreground tint with a white
knob (was invisible bg-muted + bg-background on pure black); the OLED sidebar
override is scoped to sidebar-style=follow so panel/accent work in OLED too.
- Accent: the chosen accent now also tints the selected-state surfaces
(--accent / --sidebar-accent) so the sidebar active item and settings nav
rail follow it — default palette only, respecting accent scope.
- Palettes: add 6 more soft schemes (Rosé Pine / Moon / Dawn, Nord, Everforest
dark + light) via a pal() builder; schema unions + normalizer + bootstrap
light/dark classification updated to match.
- Light/dark switch now animates: a circular View Transitions reveal from the
click (mode/palette/intensity changes only; gated off under reduced/disabled
motion; instant fallback where the API is absent).
Login page now has a mouse-reactive wavy-line background (ported a-waves +
embedded Perlin noise, themed to the accent, rendered behind the card which
sits on a 95%-opaque blurred surface so content stays readable). A "我觉得这个
界面很卡怎么办?" link opens a dialog that toggles it off — a device-local
preference (localStorage, works pre-auth, defaults off when the OS prefers
reduced motion), independent of the system motion settings.
Motion settings are now three:
- 关闭登录页的动效 — the login background toggle above (device-local).
- 减弱动效 (reduceMotion) — soft: transforms/springs off, durations
collapsed, page/sidebar instant; gentle entrance fades remain.
- 关闭全部动效 (disableMotion, NEW appearance field) — everything reduce does
plus data-no-motion CSS (kills pulse dots; spinners excluded so "busy"
stays legible) and the entrance opacity fades gated off across
overview/processes/logs/config lists.
Add a "配色方案" picker offering the four Catppuccin flavors as full color
schemes alongside the default sky theme.
- Schema: new `palette` field on UiAppearance (core + client mirror),
normalized to a 5-value whitelist defaulting to 'default'.
- Apply: each flavor's base/surface tokens are injected into the shared
theme stylesheet over :root (Latte) or .dark (the three dark flavors);
accent (--primary/--ring) stays separate so it composes. A flavor fixes
light/dark (Latte→light, rest→dark), overriding `mode`, and forces
dark-intensity to soft so the OLED "black" rule can't fight the palette.
sidebar-style + high-contrast still compose (higher specificity).
- Pre-paint bootstrap is palette-aware (no light↔dark flash on reload).
- Settings: swatch-preview picker; mode + dark-intensity controls disable
while a flavor is active. The top-bar ThemeToggle hides then (it would be
inert under a fixed-scheme palette).
A `pages` section in config/ui.json (3rd section-merge alongside appearance +
layout):
- defaultRoute: the page to open after login (chosen in Settings → 数据与格式;
DefaultRouteRedirect navigates there once, only from '/', respecting
deep-links + later navigation).
- logs: persisted visible levels, max lines, auto-scroll, line-wrap, and
keyword→colour highlight rules — edited live on the logs page; maxLines is
read via a ref so it never re-subscribes the SSE.
- processes: pid / name / status sort (persisted, default from prefs).
- config: remembers the last-used tab.
"重置全部" now also clears pages. The server normalizer is total and caps the
logs fields (levels subset, maxLines 100-5000, <=20 highlight rules, trimmed
keywords). Verified by an adversarial review round (normalizePages total
against 30 adversarial inputs; zero MUST/SHOULD-FIX).
A "高级" Settings tab adds:
- Custom CSS (appearance.customCss, <=50KB) applied post-auth only, as the
last <style> so it overrides everything. It never reaches the login page:
the server strips it from /api/ui/public, applyAppearance gates injection on
a bearer token (so the localStorage cache can't leak it pre-auth), and the
login page clears any lingering <style> on mount. `?safe-mode=1` (sticky for
the tab session) disables custom CSS so a broken rule can't lock the
operator out.
- Export / import the whole UI config as JSON (import is normalized
server-side, then reload); reset-all behind a confirm dialog.
POST /api/ui and the import file are size-capped (256KB) on top of the
per-field caps. Verified across 2 adversarial review rounds — the pre-auth
cached-CSS leak/lockout vector found in round 1 is closed across the boot /
logout / 401-expiry / re-login paths.
Overview widgets can carry an opaque `config` (stored per grid item). v1:
- alerts: how many entries + which log levels (was fixed at 5 warn/error);
the alert row colour now uses the full 6-level palette instead of a
warn/error binary.
- sessions: sort (recent / uin / nickname) + a nickname/uin filter.
A gear in the layout editor opens an inline config form per configurable
widget; edits apply live (no grid re-init — config isn't in the grid key) and
persist via the section-merge save. Config is parsed client-side with total,
clamping parsers (count 1-50, known levels only, filter <=100 chars); the
server stores it opaquely within a 4KB bound. Widgets with no config render
exactly as before. Verified across 2 adversarial review rounds.
The overview becomes a gridstack-backed free grid — drag, resize, and show/
hide 9 widgets (the 5 top stat tiles split out of the old single block, plus
connections/alerts/host/sessions), persisted to config/ui.json's
layout.overviewBlocks as {id,x,y,w,h,visible}.
- gridstack (zero-dep, vanilla; chosen over react-grid-layout whose
react-draggable uses the React-19-removed findDOMNode). React renders each
widget into a gridstack item via a portal (context flows through); gridstack
owns layout/drag/resize. Per-widget minW/minH prevent content collapse.
- Desktop = editable in place; narrow screens = auto single-column, read-only.
Fixed cellHeight => no ResizeObserver => the narrow column-clamp never
persists over the desktop coords.
- Edit mode shows a panel: widget show/hide + nav reorder (the phase-3 motion
list); the grid below is live-editable. Reset + empty-state preserved.
- Server UiLayoutItem gains optional x/y/w/h (clamped); the stats->5-tiles
migration + default placement live client-side (lib/dashboard-layout.ts).
Verified across 2 adversarial review rounds (gridstack+React lifecycle traced
against the library source: StrictMode-safe, no mount-persist loop, no
re-init on coord change, no narrow-visit data loss).
Wires the Phase 1 store into a full appearance layer.
ThemeContext is rewritten to load/save UiAppearance from the server (with a
localStorage anti-flash cache + a one-time migration of the legacy per-browser
theme keys), apply ~12 dimensions to <html>, and theme the login page pre-auth.
New Settings controls (外观 / 数据与格式): free-hex accent (+ presets + apply
scope), dark intensity (soft / OLED black), sidebar style, background
(solid / gradient / uploaded image with opacity + blur), font presets, UI
scale, reduce-motion, high-contrast, default-collapsed sidebar, 12h/24h time
format (wired into logs + overview timestamps).
- index.html gains a pre-paint bootstrap script that applies the cached theme
before the bundle mounts, eliminating the dark/OLED/scale FOUC.
- server saveUiConfig is now a section-level merge so appearance-only and
layout-only saves never clobber each other.
- reduce-motion uses Framer MotionConfig; the background renders on a fixed
layer revealed by transparent app roots; custom-accent hex and ui-scale are
validated/clamped before use (localStorage-tamper hardening).
Verified across 2 adversarial review rounds (FOUC + CSS-injection + impure
state-updater + ref-staleness all fixed).
Backend foundation for the WebUI appearance + layout customization feature.
- core/src/webui/ui-config.ts: config/ui.json store with TOTAL normalization
(any input -> safe config), atomic write, lazy memoized cache, and the
background-image lifecycle (magic-number sniff for PNG/JPEG/WebP).
- server.ts: GET/POST /api/ui (bearer), GET /api/ui/public (unauth cosmetic
subset for pre-login theming), POST/DELETE /api/ui/background (upload with
Content-Length pre-check + 5MB cap + magic-number validation), and unauth
GET /ui-asset/background (serves the uploaded bytes with sniffed mime +
nosniff). SPA fallback excludes /ui-asset/.
- webui: `ui` API-client namespace + mirror types (no UI wiring yet).
Server-managed background fields (hasImage/imageMime/imageVersion) are taken
from the trusted source per path — the file on load, the on-disk config on
save — so a client save can never forge them, and a wallpaper survives a
restart. Verified across 3 adversarial review rounds.