* Add function to detect operating system distribution
* Add 'distro' property to system types
* Update subtext in StatTile to show distro instead of platform
* Add Linux distribution detection and architecture normalization
* Add archLabel to SystemInfo interface
* Update subtext to use archLabel instead of arch
* Add distro summarization function and update StatTile
* Refactor distro summary to use tooltip for details
* Refactor host system info detection functions
* Enhance Linux distribution detection logic
* Improve Linux distro detection and version parsing
Enhanced Linux distribution detection logic by adding kernel version parsing and improved source handling for OS release information.
* Enhance kernel and distro version detection on Linux
Refactor kernel version extraction and improve distro version parsing logic.
* Enhance RHEL family detection and error handling
* Enhance distro name formatting in overview-page
* Extend RHEL family detection and supported distros
* Add support for additional Linux distributions
* Enhance OS detection for Armbian and DietPi
Added support for detecting Armbian and DietPi distributions from kernel release strings.
* Add support for Raspbian and DietPi in OS name formatting
* Add function to detect operating system distribution
* Add 'distro' property to system types
* Update subtext in StatTile to show distro instead of platform
* Add Linux distribution detection and architecture normalization
* Add archLabel to SystemInfo interface
* Update subtext to use archLabel instead of arch
* Add distro summarization function and update StatTile
* Refactor distro summary to use tooltip for details
* Refactor host system info detection functions
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.
Reshape the desktop shell to feel less "boxed-in", keeping the original
visual design — boundaries now read via depth/tone, not hard borders.
- Sidebar rests as a 64px icon rail and auto-expands on hover (or keyboard
focus-visible), pushing the content rather than overlaying it. Removes the
explicit collapse button; resting state is the rail (`effectiveCollapsed =
!editing`), so it always auto-collapses on mouse-leave.
- Drop hard region borders: sidebar border-r and topbar border-b/divider are
gone; the rail blends into a sidebar-toned chrome.
- Sidebar internal cleanup: brand border, the footer Separator, the update
card / edit-item / 完成 button borders removed; active nav indicator is now
a soft pill + sliding 2px primary left bar (layoutId).
- Content is a nested canvas with a rounded top-left corner at the
sidebar/topbar junction, lifted via a soft shadow; the corner slides with
the rail since the canvas is its flex sibling.
Note: the 「侧栏默认折叠」 appearance toggle (settings-page) is now inert for
the main nav sidebar — to be repurposed as "pin open" or removed in a follow-up.
The 16px faint-bordered box + muted label read as nearly invisible. Make it a
full-width bordered row: a larger (20px) border-2 checkbox with a white unchecked
fill, a checked primary tint on the whole row, and the primary label in
foreground weight (English subtitle stays muted).
ConsentPage shown after login, before the forced password change: tabbed
EULA/PRIVACY rendered by an in-house, dependency-free markdown renderer
(React elements only, XSS-safe; single-pass bounded-class inline parser to
avoid ReDoS on large docs). App gate order is login -> consent -> password ->
app; api client gains agreements.get / recordConsent with a 409 stale-version
re-prompt that refetches the new text.
Switch from open-source to a NapCat-style source-available, NON-commercial
license so the free software cannot be resold / paid-deployed — which an OSI
license (AGPL included) cannot prevent. Source stays public for study and
non-commercial self-hosting; commercial use and public release of modifications
require written permission; the native addon (snowluma-*.node) is carved out as
proprietary. Explicitly NOT OSI open source.
- LICENSE: SnowLuma Source-Available Non-Commercial License v1.0 (bilingual)
- all 14 package.json: "license": "SEE LICENSE IN LICENSE"
- README license section; CONTRIBUTING contribution-licensing note + a grant
letting the project relicense contributions under commercial terms
(contributors keep copyright)
- Change DEFAULT_BODY_TEMPLATE from plaintext to Server酱-style JSON
- Add JSON-safe escaping in renderTemplate for backslashes and quotes
- Update frontend DEFAULT_TEMPLATE to match backend
- Add tests for JSON escaping behavior
Fixes#106 (targets dev branch)
Adversarial pass (MINOR): the new Segmented/IconBtn regressed a11y vs the
project's existing Segmented. Add role=radiogroup/radio + aria-checked to the
segmented control, type="button" to all buttons (segmented, icon, execute,
row toggle), aria-label to icon buttons, aria-expanded to the row toggle.
Move the debug console out of the Settings 调试 subtab into a dedicated
top-level /debug page (sidebar nav + route + AppPath), and redesign it in an
Apple-HIG flavour: translucent sticky header with title block + connection
pill, soft layered cards (rounded-2xl, hairline borders, blurred backdrop),
an iOS-style segmented control with a sliding active pill (params form/JSON,
stream all/event/action filter), refined timeline rows + empty state, calm
type hierarchy with tabular-nums. Logic (tester + live SSE) carried over
verbatim. Remove the old settings/debug-panel + the Settings 'debug' subtab.
New Settings → 调试 tab (DebugPanel): an action tester (account picker +
schema-driven form from /api/debug/actions, with a raw-JSON escape hatch for
legacy actions, real-side-effect warning) and a live merged SSE view of OneBot
events + action calls (pause / clear / kind filter, expandable JSON, drop
marker). Typed debug API client domain (actions/invoke/stream over EventSource
with ?token=). View layer — verified by tsc + vite build.
A '配置备份 / 恢复' card in the 服务 tab: export downloads the JSON bundle
(with an 包含登录凭据 toggle + red warning), restore picks a .json file and
calls importBackup with a 一并恢复登录凭据 toggle (default off). Shows
restored/skipped counts + restart-to-apply. Typed systemSettings.exportBackup/
importBackup client methods. View layer — verified by tsc + vite build.
Add reusable Select (styled native select + chevron) and Textarea components
matching Input's design language, and replace every native <select>/<textarea>
across the app (system-panel, node-edit-dialog, notification-channel-dialog,
settings customCss, widget note) with them.
TLS cert UX: once a cert is installed, the sensitive PEM is no longer rendered
on revisit — show an '已安装(未改变)' summary with 更改/删除 buttons; 更改
reveals the inputs again (with a 取消). Private key is never sent back to the
client. Verified by tsc + vite build.
New Settings → 服务 tab (SystemPanel) over the /api/system/settings + TLS cert
API: edit port / bind host / trust-proxy, paste cert+key PEM to enable HTTPS,
delete cert. Flags env-overridden fields ('被环境变量覆盖') and shows a
restart-to-apply banner (no self-restart). Typed systemSettings API client
domain. View layer — verified by tsc + vite build (webui has no component-test
infra).
Settings → 通知 now mirrors the node-config UX: info-only channel cards
(name / id / url / template + an inline enable toggle), create + edit via a
dialog, and all changes debounced-auto-save (no save button). The save path
is generation-guarded so a superseded in-flight save can't clobber a newer
edit; the test action flushes the pending save first so it never hits an
unsaved channel. The channel id is locked while editing to keep per-account
channelIds references from orphaning.
Per-account opt-in: a globally-disabled channel's toggle is now locked +
forced off (it can never fire). The id is kept in channelIds — the backend
already filters disabled channels — so re-enabling globally restores the
prior selection.
New: notification-channel-dialog.tsx. webui typecheck + build green.
Adversarial review: 0 blockers / 0 should-fix (2 nits applied).
- API client: notifications surface (getConfig/saveConfig/recent/test) + types.
- Settings → 通知 tab: global channel CRUD (id/name/url/body-template/enabled) +
global debounce window, per-channel test-send, dirty-tracked save; invalid
channels (bad slug / non-http URL) are dropped server-side and surfaced.
- Per-account 通用设置: opt-in toggles bound to notifications.channelIds, riding
the ConfigPage's existing debounced autosave; stale opt-ins preserved.
- Overview: opt-in 最近投递 widget (polls /api/notifications/recent, read-only).
Hidden-by-default set is now DERIVED from the catalogue (defaultVisible) and
shared by desktop + mobile reconcile — replaces the hardcoded STATIC_WIDGET_IDS
so a new opt-in widget can't reappear unbidden on existing mobile dashboards.
Typecheck + build green. Adversarial review: 1 should-fix (mobile hidden-set) +
2 nits found, fixed/triaged, and re-verified clean.
Reworks the desktop overview edit UX from per-card show/hide toggles to an
Apple-widgets model:
- The grid shows only the widgets that are on it; hidden ones live in a new
right-side 部件库 ("store") panel that slides in during edit mode.
- Add: drag a gallery tile onto the canvas (HTML5 DnD) — dropped at the cursor
cell, driven entirely through React state.
- Remove ("hide"): drag a card back onto the gallery (gridstack `removable`).
Move/resize/remove all funnel through one onChange writer that derives removal
from a block's absence in the grid snapshot — no separate handler, no state
race.
- Card affordance: the big top "notch" bar is gone. Edit mode now shows two
small square corner icons — a subtle semi-transparent drag hint (top-left, the
whole card stays draggable) and the settings gear (top-right, configurable
widgets only). The eye toggle is removed.
Mobile is unchanged (single-column reorder panel) — the gallery drag UX is
desktop-only by design.
- 导出当前视图: 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.
A session-sticky kiosk mode for showing the dashboard on a wall display:
- Entry: `?kiosk=1` URL param (stripped after read) or a top-bar button
(toggleable via topbarItems 'kiosk').
- Hides the sidebar + top bar (MainLayout) and any in-content edit entry marked
data-kiosk-hide (the overview 编辑布局 toolbar) via an html[data-kiosk] CSS rule.
- Exit: Esc key or a dim corner button.
Purely cosmetic — never touches auth and issues no token. A new KioskProvider
(sessionStorage-backed, mounted under LayoutProvider) owns the state.
Completes the B2 dashboard/components batch.
Three opt-in static widgets join the GRID_WIDGETS catalogue (hidden by default
— enabled from the layout editor), with content stored in block.config:
- 便签 (note): pre-wrap plain text, capped at 4000 chars (under the server's
4096-byte config cap). No Markdown.
- 链接卡 (link): label + http(s)-only url (javascript:/data: rejected) + an
icon from a curated lucide set; renders as a clickable card.
- 账号快捷卡 (account): a specified uin's avatar/nickname/online dot, with a
datalist of connected accounts in the config form.
GridWidgetSpec gains `defaultVisible`, honored by defaultOverviewGrid/Mobile and
migrateOverviewBlocks; reconcileLayoutItems gains a `hiddenByDefault` set so the
mobile catalogue appends these hidden too. parse* validators keep config total
over corrupt input.
Adds the gear config form to two more overview widgets (stat tiles stay
form-less, per plan):
- 主机资源 (host): toggle which resource panels show (CPU / 内存 / 运行进程);
the grid column count tracks the visible panel count, and an all-off config
falls back to all-on (no empty card).
- OneBot 连接 (connections): filter by account nickname/uin, an "仅显示异常端点"
toggle (drops healthy adapters and emptied accounts), and sort by 默认 /
名称 / 异常优先 (worst status first).
Both register in CONFIGURABLE_WIDGETS with parse* validators, render via the
existing dialog, and surface on mobile through the same per-widget config map.
The top-bar's optional right-side elements (connection-status badge, theme
toggle) are now toggleable via `topbarItems`. Essential controls — the
menu/collapse button, page title, and logout — always render and aren't listed.
- A TOPBAR_CATALOGUE (id+label) drives both the render gating and the settings
toggles; TopBar reconciles `topbarItems` against it so a new element defaults
to shown.
- A 顶栏 group in settings → 外观 exposes one switch per catalogue element.
Phones now render the overview from the dedicated `overviewMobile` ordering
instead of deriving a 1-column view from the desktop grid — the two layouts are
fully disjoint, so reordering on a phone never touches grid coords and vice
versa.
- View mode reuses DashboardGrid (drag disabled, cols=1), stacking each widget
at its catalogue height via a pure prefix-sum, so cards keep their cell
sizing. Per-widget config is shared with the desktop blocks.
- Edit mode surfaces a motion `Reorder` drag-sort panel (grip + show/hide eye +
config gear for configurable widgets) — no 2D drag on mobile, per plan.
- The 编辑布局 toggle now appears on mobile too, with a mobile-specific hint.
Order/visibility reconciles against the live widget catalogue, so a widget
added later just appears on phones as well.
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.
Keyboard-a11y polish to match the codebase's standard
`focus-visible:ring-[3px] focus-visible:ring-ring/40` treatment:
- ToggleSwitch (role=switch, used across every settings/config surface) had
no focus-visible ring — keyboard users got no focus indicator.
- Sheet's close button used a bare `focus:outline-none`; now mirrors the
Dialog close button's ring.
Slider, Button, Input, Select, Tabs, Checkbox, Switch already carry the ring.
- Custom-CSS editor stays a plain <textarea> (native Cmd/Ctrl+Z undo) but
gains insert-at-cursor template buttons (string-constant snippets) and a
best-effort on-blur validation that warns on unbalanced braces or CSS that
parses to zero rules. Never blocks saving; ?safe-mode=1 remains the escape.
- Accent picker: choosing a custom colour whose contrast against the canvas
falls below WCAG 3:1 surfaces a one-time (per-session) advisory offering to
revert. Pure-advisory — applies immediately, no persistent banner, no nag.
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.
- Grid row height 80→108px so a 1-row stat tile's icon + 3 text lines clear
the padding with real breathing room (the previous fix still clipped ~8px);
stat tile gets an airier layout (size-10 icon, text-lg value, py-3.5).
- Carry the app's Apple language across the homepage: inner surfaces and
empty-state containers round to xl, empty-state icons calm to size-8/opacity,
edit hint + first-run nudge rounded consistently.
- 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).
The settings sub-tab now lives in the URL (typed `?tab=` search param on the
/settings route, validated against the tab whitelist; default 外观 omits it).
The active tab is derived from the URL and tab clicks navigate (replace), so
tabs are shareable/back-button friendly. The sidebar "有新版本可用" banner now
links to /settings?tab=about, landing directly on 关于 (where 软件更新 lives)
instead of the default settings tab.
- Frosted "vibrancy" card (bg-card/65 + backdrop-blur-2xl) floating over the
wavy background, with a centered brand focal point (logo tile, name,
version, subtitle).
- Larger rounded fields/button (h-12, rounded-xl) for a calmer iOS feel.
- The "我觉得这个界面很卡怎么办?" help line becomes a 灵动岛-style frosted
capsule (rounded-full, blur, float, spring on hover/tap).
- New entrance/hover motion gated on reduceMotion/disableMotion.
The login password field showed two eye icons — our custom show/hide
toggle plus Edge/IE's native ::-ms-reveal. Hide the native reveal/clear
pseudo-elements so only our toggle remains.
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.
- Scrollbars: theme native scrollbars (thin, token-colored thumb) for plain
overflow containers; Radix ScrollArea keeps its own custom bar (it hides
the native one, so no double bar).
- Sliders: new <Slider> component + `.slider` CSS replaces the native range
inputs (UI scale / mask opacity / blur). Filled track + ring-bordered
thumb, themed; input height matches the track so the thumb centers in every
engine; Firefox fills via ::-moz-range-progress.
- Stat tiles: tighten the h=1 tile (py-2 + mt-0.5) so the three text lines +
padding fit the 80px cell without hugging the border.
- Reduce motion: gate the always-present sidebar-width + page-transition
animations to instant when enabled (Framer's reducedMotion only suppresses
transforms, so these needed an explicit opt-out); kill the slider thumb
transition too.
Split the single centered card into a clean three-section stack consistent
with the rest of settings:
- Brand hero card: logo glow + name + version pill + tagline/description.
- "软件更新" grouped list (reuses Group/SettingRow): current-version row +
check-update row (status dot/spinner + 重新检查); when an update exists, a
tinted detail block with version, notes, platform asset hint and 前往下载.
- Support card: refined Star CTA + repo/releases/issues links.
UpdateStatus → UpdateGroup; all update states (checking/disabled/error/
latest) preserved.
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).
Carry the logs/settings visual language across the remaining pages:
- Processes: sort control becomes a segmented radiogroup; action banner
gains a spinner; cards round to xl with a hover tint; calmer empty state.
- Config: save status collapses from bordered pills into one inline
dot/spinner indicator; node summary rows round to xl with hover and
fold the three flag badges into a single muted "数组 · 不上报自身 · 已设
Token" line; empty states round to xl; account rail rounds to xl.
Presentational only — all state wiring and handlers unchanged.
Rework the settings page around the macOS System Settings layout, reusing
existing UI tokens (no new deps):
- Two-pane: a sticky left nav rail (w-52) on lg, a wrapping tab strip on
mobile. Active section mirrors the app sidebar's selected style.
- Grouped inset lists: each Card is a header above a hairline-divided list
of label-left / control-right rows (SettingRow: auto / inline / stack),
replacing the stacked Field + Separator spam.
- Refined segmented control: recessed track with a raised pill on the
selected segment (font-semibold + full ring so it survives high-contrast
/ OLED); exposed as a proper radiogroup (role=radio + aria-checked) and
named via the row label through a small context + useId.
- Per-section fade transition; section heading anchors the detail pane.
Wide controls (时制, 深色强度, fonts, radius scale, poll interval, default
route) stack so they don't crowd their labels; password-saved confirmation
keeps its success color. All settings preserved 1:1.
Rework the run-log viewer around progressive disclosure and a calmer,
content-first hierarchy, reusing existing UI tokens (no new deps):
- Toolbar: live status dot (red when disconnected) replaces the badge;
real search field with inline icon + clear; icon-only actions with
tooltips, grouped (toggles in a track · divider · data actions).
- One always-visible segmented level filter (iOS-style raised pill +
colored dot) instead of strikethrough pills.
- Collapse the server-level switch + highlight-rule editor into a single
animated "选项" panel; server level also surfaced in the subtitle. The
control area drops from three rows to one.
- Log stream: subtle sticky column header (时间/级别/模块/消息) aligned to
rows via a sm:contents trick, dot-style level indicators, hairline row
separators, and distinct empty / no-match states.
a11y: radiogroup on color swatches, aria-pressed on level toggles,
unique remove-button labels, focus rings on all controls.
Rework the layout edit mode from a separate panel to in-place affordances:
- Each dashboard widget gets a semi-transparent floating overlay in edit mode:
a "拖动" grip bar (the whole card is the drag target — forgiving +
discoverable), an eye to show/hide, and a gear that opens the per-widget
settings in a dialog. Hidden widgets show as re-enableable "已隐藏" ghosts;
the bottom-right resize grip is now clearly visible.
- The sidebar nav becomes a drag-to-reorder list directly in the sidebar
(show/hide + locked pinned items + a 完成 button); editing force-expands the
sidebar (and disables the collapse toggle). Edit mode is a shared
LayoutContext flag so one "编辑布局" toggle drives both the grid and the nav.
- The separate editor panel (overview-layout-editor) is removed; the gear
opens config in a dialog instead.
Also: stat-tile typography tightened (leading-tight, smaller value, overflow
clip) so text no longer hugs the edge on small/short tiles. Verified by an
adversarial review round (no MUST-FIX).
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).
The "C" half — reorder + show/hide the overview cards and the sidebar nav,
persisted to config/ui.json's layout section.
- LayoutContext loads the layout (authed GET /api/ui) and persists edits via
the section-merge POST /api/ui {layout} (debounced). reconcileLayoutItems
keeps stored order/visibility, appends new catalogue entries (forward-compat),
and forces pinned items visible.
- Overview is refactored into a block registry (stats/connections/alerts/host/
sessions). A 「编辑布局」 mode (motion Reorder — zero new deps) edits both the
cards and the nav in place, with per-item show/hide and a reset; an all-hidden
dashboard shows an empty state with 恢复默认.
- Anti-self-lock: PINNED_NAV = ['/', '/settings'] can be reordered but never
hidden — the overview hosts the layout editor and settings hosts
account/appearance, so the user can never strand themselves.
- api.ui.save now takes Partial<UiConfig> (the section-merge contract).
A late initial GET can't clobber an in-flight edit (dirtyRef); a pending edit
flushes on unmount. Verified across 2 adversarial review rounds.