* feat(core): carry hook process status in notifications `offline` alone cannot tell an external supervisor whether the QQ session dropped (log back in) or the process is gone (restart the client). Resolve the hook process behind a UIN at notify time and expose `status`, `pid` and `error` as template variables; a failing lookup degrades to empty values so delivery is never blocked. The default webhook/email templates gain a process-status line; existing channels keep their stored template untouched. * fix(core): preserve notification lifecycle ordering and simplify state --------- Co-authored-by: zhngzhu <[email protected]> Co-authored-by: 手瓜一十雪 <[email protected]>
74 lines
3.7 KiB
Markdown
74 lines
3.7 KiB
Markdown
# SnowLuma WebUI
|
|
|
|
SnowLuma's browser console is a Vite + React application for managing runtime
|
|
status, OneBot configuration, logs, storage, and server settings.
|
|
|
|
## Interaction conventions
|
|
|
|
- Destructive actions and second confirmations stay in modal dialogs.
|
|
- Operations that may take time show a bottom-right running state.
|
|
- Completed and failed operations use bottom-right result notices that close
|
|
automatically after a visible countdown.
|
|
- Routine, high-frequency adjustments should not generate a notice for every
|
|
intermediate edit.
|
|
- Data-backed surfaces use the Interior Skeleton Swap defaults (120 ms delay,
|
|
380 ms minimum visibility) so fast local responses do not flash a placeholder.
|
|
Submission, upload, and other explicit operation progress keeps its spinner.
|
|
- Variable-height content must release the skeleton's reserved box after it is
|
|
ready; do not introduce a second scrolling region inside the page.
|
|
- The mobile navigation menu uses a controlled Icon Morph whose visual state
|
|
follows the actual drawer state.
|
|
- Failures must remain visible in the affected control and in the operation
|
|
result; do not convert failed responses into successful feedback.
|
|
- JSON endpoints must return an object. Malformed or non-object responses are
|
|
reported as errors rather than displayed as empty lists or default settings.
|
|
- Password change flows use floating labels and inline validation consistently.
|
|
- Password strength details appear only while the new-password field has focus
|
|
and leave with the same motion language when focus moves away.
|
|
- The first-run wizard keeps agreement text as the primary reading surface and
|
|
aligns each step's actions inside one responsive footer. Settings includes a
|
|
visible developer page for safely replaying this wizard and exercising the
|
|
page-level crash screen; replayed consent and passwords are never persisted.
|
|
|
|
## Authentication behind a reverse proxy
|
|
|
|
Authenticated WebUI requests send the session token in `X-SnowLuma-Token`, leaving
|
|
`Authorization` available for the reverse proxy's HTTP authentication (such as
|
|
Nginx Basic Auth). Forward `X-SnowLuma-Token` unchanged if the proxy filters
|
|
request headers. The backend still accepts `Authorization: Bearer <token>` for
|
|
existing clients when the dedicated header is absent. Both layers still require
|
|
their own valid credentials.
|
|
|
|
## Account notification templates
|
|
|
|
Webhook bodies and email subjects/bodies support `{uin}`, `{nickname}`, `{event}`
|
|
(`offline` or `online`), `{time}`, `{status}` (Hook process state), `{pid}`, and
|
|
`{error}` (Hook process error). New webhook and email channels include process
|
|
status in their default body; existing saved templates are preserved.
|
|
|
|
Process facts are resolved when the notification is dispatched, after any offline
|
|
debounce. Each transition carries its process PID, including the final PID detached
|
|
when an account goes offline. Facts are looked up for that PID and UIN without
|
|
substituting another process. Missing facts render empty and mean unknown, not
|
|
proof that QQ exited. Hook status alone does not identify the cause of a QQ login
|
|
failure. Notifications for one account are delivered in transition order; a slow
|
|
account does not delay other accounts.
|
|
|
|
## Local development
|
|
|
|
On Windows, the native API logs the process token and EXE integrity label once
|
|
at startup. A Low (or lower) token triggers a WebUI warning; file labels and
|
|
query failures alone do not. “临时关闭” lasts for the tab session, including
|
|
reloads; “永久关闭” persists in this browser's site storage. Neither suppresses
|
|
startup logs. Failed queries and preference writes remain visible.
|
|
|
|
From the repository root:
|
|
|
|
```bash
|
|
pnpm --filter webui dev
|
|
pnpm --filter webui typecheck
|
|
pnpm --filter webui lint
|
|
pnpm --filter webui test
|
|
pnpm --filter webui build
|
|
```
|