Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

v0.9.0: message reliability, dashboard UX consolidation, and dead-code cleanup (#802)

Yudhi Armyndharisfa8d863b888a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 269b4f68c..52fab492a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
are started with an `--openwa-session=<id>` marker arg, and any leftover browser process carrying
this session's marker from a previous process lifetime (e.g. after the gateway itself was killed)
is terminated before the new launch, alongside the existing stale Singleton-file cleanup.
+- Messages composed on a linked phone are now persisted to local history (previously only API
+ sends and inbound messages were stored). Deduplication against the REST send path is atomic on the
+ existing unique message index, and delivery/read state advances via acks on these rows as well.
+- The whatsapp-web.js own-send echo now downloads media through the same capped inbound path as
+ inbound messages (declared-size pre-gate, timeout, concurrency limiter), so phone-composed images
+ persist and render with their real payload.
+
+### Changed
+
+- Dashboard theming is simplified to a single light/dark toggle button; the accent-palette picker
+ was removed for maintainability. The stored theme is applied before first paint, so standalone
+ routes no longer flash the OS default, and the message-analytics chart now defaults to 24h.
+- The dev compose defaults `AUTO_START_SESSIONS=true`, so previously authenticated sessions come
+ back by themselves after a container restart (the application-level default stays off).
+
+### Removed
+
+- Verified dead dashboard code: unused CSS across multiple pages, dead client methods and utilities,
+ unused image assets, and 39 unused i18n keys across all locales.
### Fixed
@@ -38,6 +57,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
force-killed browser can never block startup; and page transport errors (`Protocol error`,
`Target closed`, detached frame, …) observed during send/query operations are now treated as an
immediate death signal, cutting dead-session detection from minutes to the first failed call.
+- Sent images no longer vanish from the chat thread: the realtime own-send echo carries no media
+ payload by design, and the live cache merge replaced metadata wholesale, wiping the optimistic
+ bubble's base64. Metadata now merges per field (a real payload always beats a payload-less echo
+ marker), and the post-send reconciliation folds the optimistic copy into the echo row.
+- Chat thread scrolling now behaves on every path: opens at the latest message, restores the exact
+ per-chat position when returning (position is saved continuously, not read after the content
+ swap), and stays pinned while media decodes instead of clamping the restore to the pre-decode
+ height — releasing cleanly on user scroll.
+- The messages-by-type chart no longer shows a misleading Unknown slice: rows with no body and no
+ metadata (content-less system/event rows) are excluded from the aggregation.
+- Full-text search self-heals its schema at boot when migrations are skipped (`DATABASE_SYNCHRONIZE=true`),
+ and SQLite FTS5 queries are sanitized per token, so phone numbers, chat identifiers, quotes, and
+ parentheses no longer fail as malformed queries.
+- Audit log rows now carry the resolved API key and client IP for every call site: the values are
+ stamped into the per-request async context by the auth guard and auto-filled on write (explicit
+ context still wins).
+- Dashboard readability and behavior: the send button stays readable when disabled, API Keys badges
+ render on desktop (rules were stranded in a mobile-only media query), the Templates page gets real
+ primary/secondary button styles, fourteen dark-mode selectors are corrected so dark mode applies,
+ Sessions modals regain the 90vh cap with a scrolling body, QR provisioning uses the realtime push
+ with fetching gated to `qr_ready` (no more expected-but-noisy 400 console errors), and enabling a
+ plugin with unset required config opens its config dialog with a warning instead of failing with a
+ raw sandbox error.
## [0.9.0] - 2026-07-18
@@ -74,6 +116,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.8.19] - 2026-07-17
### Added
+
- **Official Go SDK (`sdk/go`).** Hand-written, stdlib-only (no third-party dependencies) Go client
covering the user-facing API surface, joining the JavaScript/Python/PHP/Java clients. Entry point is
`openwa.New(baseURL, apiKey, opts...)`, which returns a concurrency-safe `*Client` whose exported
@@ -94,6 +137,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
test time. Requires Go 1.22+. Thanks @Revelts.
### Changed
+
- **v0.8.18's whatsapp-web.js id-rename fix also restored the Chats page (docs only).** The v0.8.18 entry
credits that fix with repairing inbound media downloads, message ids, acks, reply quoting, and reactions,
but never mentions `GET /sessions/{id}/chats` — which the same patch repaired as well. The rename broke the
@@ -164,11 +208,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Corrected the send-response documentation (docs only).** The guidance added in #739 overstated what a
stalled send tells you: it said a message resting at `sent` for a recipient you have never reached is
"almost certainly a number that is not on WhatsApp." That inference does not hold in the other
- direction — a *registered* recipient whose device has not come online since the send stays at `sent`
+ direction — a _registered_ recipient whose device has not come online since the send stays at `sent`
indefinitely too, by design, so the state is not diagnostic on its own. The unevidenced claim that an
unregistered recipient is "the most common cause" of a send that never arrives is gone, as is the
description of what the message looks like in a WhatsApp client, which is not ours to assert. The
- section also claimed *every* send route returns `201` with `{ messageId, timestamp }`; `POST send-bulk`
+ section also claimed _every_ send route returns `201` with `{ messageId, timestamp }`; `POST send-bulk`
returns `202` with a batch envelope, and the `status/send-*` routes return a `statusId` and an ISO
timestamp rather than a `messageId` and epoch seconds. Both exceptions are now stated where the rule
is. Finally, the documented `status` lifecycle omitted its terminal error state: WhatsApp reporting an
@@ -215,7 +259,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
absent, but missed the busiest path of all: `buildIncomingMessageBase`, which runs on every message
that arrives (`onMessage`) and every message the account sends from a linked phone
(`onMessage_create`). It read `msg.id._serialized` unguarded — and its parameter type declared the
- id as `{ _serialized: string }`, so the renamed field was not merely unread but *unreachable*
+ id as `{ _serialized: string }`, so the renamed field was not merely unread but _unreachable_
without a cast, and the `id: string` it produced was `undefined` at runtime. On an affected build
without the build-time backport applied, every inbound message reached the webhook, the WebSocket
and the database with no id: nothing to dedup on, nothing to quote in a reply, nothing for an ack
@@ -236,7 +280,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
"+N" trend arrow beneath it was not a delta at all: it rendered the current READY count as though it
were a period-over-period gain, so a steady deployment appeared to be permanently growing. The card
now reports the READY count (relabelled "Connected Sessions") with a plain `{running} running ·
- {total} total` breakdown, and the fake trend indicator is gone. Thanks @kabir74705 for spotting both.
+{total} total` breakdown, and the fake trend indicator is gone. Thanks @kabir74705 for spotting both.
- **The whatsapp-web.js backport can no longer latch in a half-patched dependency.** The patcher proves a
tree is whole before standing down, and #759 added that check precisely so a run that died mid-apply
@@ -250,13 +294,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
image build runs the patcher directly, so it now fails the build on such a tree instead of shipping it.
Separately, the half-patched error was the only one of the four not marked as leaving a partial tree, so
`--best-effort` downgraded it to a warning; it now exits non-zero like the other three. Note this makes
- the tree *reported* on the `npm install` path rather than rejected there — the `postinstall` hook
+ the tree _reported_ on the `npm install` path rather than rejected there — the `postinstall` hook
discards the patcher's exit code, so the install still succeeds; that is pre-existing and deliberately
untouched, since failing `npm install` outright is the trade the flag exists to avoid. Both fixes are
regression-tested, including the `--best-effort` path.
- **A status post no longer claims success it cannot prove, and no longer throws away a readable id.**
- #762 established that `whatsapp-web.js` can *resolve* `undefined` instead of throwing, and that reporting
+ #762 established that `whatsapp-web.js` can _resolve_ `undefined` instead of throwing, and that reporting
that as success is unrecoverable — so a send with no message back now fails loudly. Status posts were
left on the old behavior: they returned **201** with an empty `statusId` and a `new Date()` invented on
the spot, for a status that may never have been published. Their case is in fact simpler than a send's —
@@ -273,7 +317,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **The Message Tester no longer invents HTTP status codes.** Its result banner rendered one of two
hardcoded strings — `200 OK - Success` or `400 - Failed` — for every outcome, in all eleven locales.
Neither number was ever read from the response. Send routes return **201**, not 200, so the success
- banner was wrong on every successful send; and *any* failure displayed `400`, including a server 500
+ banner was wrong on every successful send; and _any_ failure displayed `400`, including a server 500
and the recipient pre-check that short-circuits in the browser without issuing a request at all. The
banner now states the outcome and, when a request actually reached the gateway, the real status the
gateway returned — which `services/api.ts` already attaches to the error for exactly this purpose.
@@ -320,7 +364,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
absent and the lookup falls back to `id`, as before. Refs #755.
- **A failed group creation now reports why it failed.** `whatsapp-web.js` signals a failed
- `createGroup` by *resolving* with a plain string (`'CreateGroupError: …'`) instead of throwing, and
+ `createGroup` by _resolving_ with a plain string (`'CreateGroupError: …'`) instead of throwing, and
its typings say so (`Promise<CreateGroupResult | string>`) — but the adapter cast that union away and
read `.gid` off the string, so the reason upstream gave us was replaced by an opaque
`TypeError`. The union is handled, and an unreadable group id now fails loudly rather than being
@@ -334,7 +378,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
advanced" line behind. It is now dropped at the adapter boundary, where the reason is still visible.
- **A send whose message can't be read back no longer crashes, and never claims a delivery it can't
- prove.** `whatsapp-web.js`'s `Client.sendMessage()` can *resolve* with `undefined` instead of
+ prove.** `whatsapp-web.js`'s `Client.sendMessage()` can _resolve_ with `undefined` instead of
throwing, while its typings declare `Promise<Message>` — so the adapter's `msg.id._serialized` reads
surfaced as an opaque `TypeError: Cannot read properties of undefined (reading 'id')` and a 500, at
seven send sites. All of them now route through one helper that distinguishes the two cases the
@@ -347,7 +391,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
-
## [0.8.18] - 2026-07-17
### Added
@@ -433,7 +476,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
declaring a huge entry size could drive an unbounded `Buffer.alloc` and exhaust memory during
extraction. This closes the declared-size allocation vector on the plugin marketplace install path
(`src/modules/plugins/plugin-installer.ts`), complementing the project's own `readEntryData()` guard
- that already caps *decompressed* bytes via zlib `maxOutputLength`. The two adm-zip 0.6.0 behavior
+ that already caps _decompressed_ bytes via zlib `maxOutputLength`. The two adm-zip 0.6.0 behavior
changes (`extractEntryTo` subdirectory preservation, non-fatal `utimes`) touch APIs this project does
not use. The now-redundant `@types/adm-zip` devDependency is dropped as well — adm-zip 0.6.0 ships its
own `types.d.ts`.
@@ -514,8 +557,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Chat labels on the Baileys engine.** `addLabelToChat` and `removeLabelFromChat` now work on
the Baileys engine — 1:1 to `sock.addChatLabel(chatId, labelId)` / `sock.removeChatLabel(chatId,
- labelId)` instead of returning 501. WhatsApp-Business-only (rejects on personal accounts). Label
- *listing* (`getLabels` / `getLabelById` / `getChatLabels`) remains unavailable on Baileys (no
+labelId)` instead of returning 501. WhatsApp-Business-only (rejects on personal accounts). Label
+ _listing_ (`getLabels` / `getLabelById` / `getChatLabels`) remains unavailable on Baileys (no
first-class library API — see `docs/engine-capability-matrix.md`).
- **Status delete on the whatsapp-web.js engine.** `deleteStatus(statusId)` now works on
@@ -527,7 +570,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`getContactStatus(contactId)` now return contact "stories" (24h status posts) via
whatsapp-web.js `getBroadcasts()` / `getBroadcastById()` flattened to `Status[]` (contact via
`broadcast.getContact()`, type from `MessageTypes`, 24h TTL) instead of stubbing to `[]`. The
- Baileys engine still cannot read stories — `fetchStatus` returns the *about* text, not stories
+ Baileys engine still cannot read stories — `fetchStatus` returns the _about_ text, not stories
(documented as a library limitation).
- **Channel lookup / subscribe / unsubscribe on the Baileys engine.** `getChannelById(id)`,
@@ -587,7 +630,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
which that rule rejects). The data connection now uses a temp-dir SQLite file that is removed on
exit, so the snapshot generator runs hermetically again.
-
## [0.8.16] - 2026-07-12
### Added
diff --git a/dashboard/public/vite.svg b/dashboard/public/vite.svg
deleted file mode 100644
index e7b8dfb1b..000000000
--- a/dashboard/public/vite.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
\ No newline at end of file
diff --git a/dashboard/src/App.css b/dashboard/src/App.css
index 002ba4c05..e9ddf8c0c 100644
--- a/dashboard/src/App.css
+++ b/dashboard/src/App.css
@@ -14,49 +14,13 @@
--error: #ef4444;
--success: #22c55e;
--warning: #f59e0b;
- --info: #2563eb; /* Blue 600 — info/permission/log badges + qr-ready pill; no palette blue token */
+ --info: #2563eb; /* Blue 600 — info/permission/log badges + qr-ready pill */
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--radius: 10px;
}
-[data-palette='blue'] {
- --primary: #2563eb;
- --primary-hover: #1d4ed8;
- --primary-soft: rgba(37, 99, 235, 0.12);
-}
-
-[data-palette='graphite'] {
- --primary: #64748b;
- --primary-hover: #475569;
- --primary-soft: rgba(100, 116, 139, 0.14);
-}
-
-[data-palette='indigo'] {
- --primary: #4f46e5;
- --primary-hover: #4338ca;
- --primary-soft: rgba(79, 70, 229, 0.12);
-}
-
-[data-palette='amber'] {
- --primary: #d97706;
- --primary-hover: #b45309;
- --primary-soft: rgba(217, 119, 6, 0.13);
-}
-
-[data-palette='rose'] {
- --primary: #e11d48;
- --primary-hover: #be123c;
- --primary-soft: rgba(225, 29, 72, 0.12);
-}
-
-[data-palette='teal'] {
- --primary: #0d9488;
- --primary-hover: #0f766e;
- --primary-soft: rgba(13, 148, 136, 0.12);
-}
-
/* Dark Mode */
[data-theme='dark'] {
/* Make native controls (select option popups, scrollbars, date pickers) follow the EXPLICIT
@@ -169,5 +133,9 @@ a:hover {
}
/* yarl theme — match dashboard dark palette. */
-.yarl__container { --yarl__color_backdrop: rgba(0, 0, 0, 0.92); }
-.yarl__button { --yarl__color_button: rgba(255, 255, 255, 0.9); }
+.yarl__container {
+ --yarl__color_backdrop: rgba(0, 0, 0, 0.92);
+}
+.yarl__button {
+ --yarl__color_button: rgba(255, 255, 255, 0.9);
+}
diff --git a/dashboard/src/assets/react.svg b/dashboard/src/assets/react.svg
deleted file mode 100644
index 6c87de9bb..000000000
--- a/dashboard/src/assets/react.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
\ No newline at end of file
diff --git a/dashboard/src/components/DashboardCharts.tsx b/dashboard/src/components/DashboardCharts.tsx
index 9a2568934..888fa5323 100644
--- a/dashboard/src/components/DashboardCharts.tsx
+++ b/dashboard/src/components/DashboardCharts.tsx
@@ -62,7 +62,7 @@ function shortChat(chatId: string): string {
export function DashboardCharts() {
const { t } = useTranslation();
- const [period, setPeriod] = useState<StatsPeriod>('7d');
+ const [period, setPeriod] = useState<StatsPeriod>('24h');
const { data, isLoading, isError, error } = useStatsMessagesQuery(period);
// Non-admin keys 403 on /stats/messages → hide the section entirely. Any OTHER error (e.g. a
@@ -75,7 +75,9 @@ export function DashboardCharts() {
const byType = Object.entries(data?.byType ?? {})
.map(([name, value]) => ({ name, value }))
.sort((a, b) => b.value - a.value);
- const topChats = (data?.topChats ?? []).slice(0, 8).map(c => ({ name: c.chatName || shortChat(c.chatId), count: c.messageCount }));
+ const topChats = (data?.topChats ?? [])
+ .slice(0, 8)
+ .map(c => ({ name: c.chatName || shortChat(c.chatId), count: c.messageCount }));
const hasData = timeSeries.length > 0 || byType.length > 0 || topChats.length > 0;
return (
diff --git a/dashboard/src/components/Layout.css b/dashboard/src/components/Layout.css
index 0fdd72990..35157ebc8 100644
--- a/dashboard/src/components/Layout.css
+++ b/dashboard/src/components/Layout.css
@@ -62,14 +62,6 @@
letter-spacing: -0.01em;
}
-.brand-subtitle {
- font-size: 0.7rem;
- font-weight: 500;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- color: var(--text-muted);
-}
-
.brand-version {
font-size: 0.625rem;
font-weight: 500;
@@ -201,16 +193,8 @@
width: 24px;
height: 24px;
flex-shrink: 0;
- border-radius: 999px;
- background: radial-gradient(circle at 70% 25%, rgba(255, 255, 255, 0.8), transparent 24%), var(--swatch-color);
- color: white;
- box-shadow:
- 0 0 0 2px var(--bg-white),
- 0 0 0 3px color-mix(in srgb, var(--swatch-color) 35%, transparent);
-}
-
-.appearance-button-cue svg {
- filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
+ /* Plain icon, no brand orb — the green swatch belonged to the removed palette picker. */
+ color: inherit;
}
.sidebar.collapsed .theme-toggle-btn,
@@ -284,157 +268,6 @@
bottom: 0;
}
-.appearance-menu-list {
- position: absolute;
- left: 0;
- right: 0;
- bottom: calc(100% + 0.35rem);
- display: flex;
- flex-direction: column;
- gap: 0.85rem;
- max-width: 100%;
- padding: 0.85rem;
- background: var(--bg-white);
- border: 1px solid var(--border);
- border-radius: 12px;
- box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
- z-index: 120;
-}
-
-.appearance-menu-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 0.75rem;
- padding: 0.2rem 0.1rem 0.75rem;
- border-bottom: 1px solid var(--border);
-}
-
-.appearance-menu-header strong {
- display: block;
- color: var(--text-primary);
- font-size: 0.9375rem;
- line-height: 1.2;
-}
-
-.appearance-menu-header span {
- display: block;
- margin-top: 0.15rem;
- color: var(--text-muted);
- font-size: 0.75rem;
-}
-
-.appearance-current-swatch {
- width: 34px;
- height: 34px;
- flex-shrink: 0;
- border-radius: 999px;
- background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), transparent 42%), var(--swatch-color);
- box-shadow:
- inset 0 0 0 1px rgba(255, 255, 255, 0.35),
- 0 0 0 4px color-mix(in srgb, var(--swatch-color) 13%, transparent);
-}
-
-.appearance-section {
- display: flex;
- flex-direction: column;
- gap: 0.5rem;
-}
-
-.appearance-section-label {
- font-size: 0.6875rem;
- font-weight: 800;
- color: var(--text-muted);
- text-transform: uppercase;
- letter-spacing: 0.06em;
-}
-
-.appearance-mode-grid {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 0.35rem;
-}
-
-.appearance-mode {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 0.25rem;
- min-height: 58px;
- padding: 0.45rem;
- background: var(--bg-light);
- border: 1px solid var(--border);
- border-radius: 8px;
- color: var(--text-secondary);
- font-size: 0.75rem;
-}
-
-.appearance-mode:hover {
- color: var(--text-primary);
- border-color: var(--primary);
- background: var(--bg-white);
-}
-
-.appearance-mode.active {
- background: var(--primary-soft);
- border-color: var(--primary);
- color: var(--primary);
- box-shadow: inset 0 -2px 0 var(--primary);
-}
-
-.palette-grid {
- display: flex;
- flex-wrap: wrap;
- gap: 0.45rem;
-}
-
-.palette-swatch {
- position: relative;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 30px;
- height: 30px;
- flex: 0 0 auto;
- padding: 0;
- border: 1px solid var(--border);
- border-radius: 999px;
- background: var(--bg-light);
-}
-
-.palette-swatch span {
- width: 20px;
- height: 20px;
- border-radius: 999px;
- background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), transparent 45%), var(--swatch-color);
- box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
-}
-
-.palette-swatch:hover,
-.palette-swatch.active {
- border-color: var(--swatch-color);
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch-color) 18%, transparent);
-}
-
-.palette-swatch.active::after {
- position: absolute;
- right: -1px;
- bottom: -1px;
- width: 10px;
- height: 10px;
- border: 2px solid var(--bg-white);
- border-radius: 999px;
- background: var(--primary);
- content: '';
-}
-
-.sidebar.collapsed .appearance-menu-list {
- right: auto;
- left: calc(100% + 0.5rem);
- bottom: 0;
-}
-
.logout-btn {
display: flex;
align-items: center;
@@ -601,11 +434,6 @@
left: auto;
}
-[dir='rtl'] .sidebar.collapsed .appearance-menu-list {
- right: calc(100% + 0.5rem);
- left: auto;
-}
-
[dir='rtl'] .main-content {
margin-left: 0;
margin-right: 260px;
diff --git a/dashboard/src/components/Layout.tsx b/dashboard/src/components/Layout.tsx
index 221758431..8a18963a3 100644
--- a/dashboard/src/components/Layout.tsx
+++ b/dashboard/src/components/Layout.tsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useRef, type CSSProperties } from 'react';
+import { useState, useEffect, useRef } from 'react';
import { NavLink, Outlet } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import {
@@ -51,10 +51,9 @@ const themeIcons = { light: Sun, dark: Moon, system: Monitor };
export function Layout({ onLogout, userRole }: LayoutProps) {
const { t, i18n } = useTranslation();
- const { theme, setTheme, palette, setPalette, paletteOptions } = useTheme();
+ const { theme, setTheme, resolvedTheme } = useTheme();
const ThemeIcon = themeIcons[theme];
const themeLabel = t(`theme.${theme}`);
- const activePalette = paletteOptions.find(option => option.value === palette) ?? paletteOptions[0];
const navItems = allNavItems.filter(item => !item.adminOnly || userRole === 'admin');
@@ -65,9 +64,7 @@ export function Layout({ onLogout, userRole }: LayoutProps) {
// backend so a stale-built bundle can't display the wrong number. Falls back silently on error.
const [version, setVersion] = useState(__APP_VERSION__);
const [isLanguageMenuOpen, setIsLanguageMenuOpen] = useState(false);
- const [isAppearanceMenuOpen, setIsAppearanceMenuOpen] = useState(false);
const languageMenuRef = useRef<HTMLDivElement>(null);
- const appearanceMenuRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const handleResize = () => {
@@ -125,26 +122,6 @@ export function Layout({ onLogout, userRole }: LayoutProps) {
};
}, [isLanguageMenuOpen]);
- useEffect(() => {
- if (!isAppearanceMenuOpen) return;
-
- const closeOnOutsideClick = (event: MouseEvent) => {
- if (!appearanceMenuRef.current?.contains(event.target as Node)) {
- setIsAppearanceMenuOpen(false);
- }
- };
- const closeOnEscape = (event: KeyboardEvent) => {
- if (event.key === 'Escape') setIsAppearanceMenuOpen(false);
- };
-
- document.addEventListener('mousedown', closeOnOutsideClick);
- document.addEventListener('keydown', closeOnEscape);
- return () => {
- document.removeEventListener('mousedown', closeOnOutsideClick);
- document.removeEventListener('keydown', closeOnEscape);
- };
- }, [isAppearanceMenuOpen]);
-
const toggleCollapse = () => setIsCollapsed(!isCollapsed);
const toggleMobile = () => setIsMobileOpen(!isMobileOpen);
@@ -255,79 +232,18 @@ export function Layout({ onLogout, userRole }: LayoutProps) {
</div>
)}
</div>
- <div className="appearance-menu" ref={appearanceMenuRef}>
+ <div className="appearance-menu">
<button
className="theme-toggle-btn"
- onClick={() => setIsAppearanceMenuOpen(open => !open)}
- title={t('theme.label', { value: themeLabel })}
- aria-label={t('theme.appearance')}
- aria-haspopup="menu"
- aria-expanded={isAppearanceMenuOpen}
+ onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}
+ title={t('theme.toggleTo', { value: t(resolvedTheme === 'dark' ? 'theme.light' : 'theme.dark') })}
+ aria-label={t('theme.toggleTo', { value: t(resolvedTheme === 'dark' ? 'theme.light' : 'theme.dark') })}
>
- <span
- className="appearance-button-cue"
- style={{ '--swatch-color': activePalette.color } as CSSProperties}
- aria-hidden="true"
- >
- <ThemeIcon size={14} />
+ <span className="appearance-button-cue" aria-hidden="true">
+ <ThemeIcon size={16} />
</span>
{!isCollapsed && <span>{themeLabel}</span>}
</button>
- {isAppearanceMenuOpen && (
- <div className="appearance-menu-list" role="menu" aria-label={t('theme.appearance')}>
- <div className="appearance-menu-header">
- <div>
- <strong>{t('theme.appearance')}</strong>
- <span>{activePalette.label}</span>
- </div>
- <span
- className="appearance-current-swatch"
- style={{ '--swatch-color': activePalette.color } as CSSProperties}
- aria-hidden="true"
- />
- </div>
- <div className="appearance-section">
- <span className="appearance-section-label">{t('theme.mode')}</span>
- <div className="appearance-mode-grid">
- {(['light', 'dark', 'system'] as const).map(mode => {
- const ModeIcon = themeIcons[mode];
- return (
- <button
- key={mode}
- className={`appearance-mode ${theme === mode ? 'active' : ''}`}
- onClick={() => setTheme(mode)}
- type="button"
- role="menuitemradio"
- aria-checked={theme === mode}
- >
- <ModeIcon size={16} />
- <span>{t(`theme.${mode}`)}</span>
- </button>
- );
- })}
- </div>
- </div>
- <div className="appearance-section">
- <span className="appearance-section-label">{t('theme.palette')}</span>
- <div className="palette-grid">
- {paletteOptions.map(option => (
- <button
- key={option.value}
- className={`palette-swatch ${palette === option.value ? 'active' : ''}`}
- onClick={() => setPalette(option.value)}
- type="button"
- title={option.label}
- role="menuitemradio"
- aria-checked={palette === option.value}
- style={{ '--swatch-color': option.color } as CSSProperties}
- >
- <span />
- </button>
- ))}
- </div>
- </div>
- </div>
- )}
</div>
<button className="logout-btn" onClick={onLogout} title={isCollapsed ? t('common.logout') : undefined}>
<LogOut size={20} />
diff --git a/dashboard/src/hooks/useChatScrollPosition.test.ts b/dashboard/src/hooks/useChatScrollPosition.test.ts
index 05e2e7f71..8821c4cfc 100644
--- a/dashboard/src/hooks/useChatScrollPosition.test.ts
+++ b/dashboard/src/hooks/useChatScrollPosition.test.ts
@@ -1,72 +1,46 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { decideRestoreTarget } from './useChatScrollPosition.ts';
+import { decideRestoreTarget, isNearBottom } from './useChatScrollPosition.ts';
-test('first render with no previous chat: no save, restore to bottom if loaded', () => {
- assert.deepEqual(
- decideRestoreTarget(null, 'A', false, true, undefined),
- { save: null, restore: 'bottom' },
- );
+test('isNearBottom: exactly at the bottom counts as near', () => {
+ assert.equal(isNearBottom(1000, 2000, 1000), true); // 2000-1000-1000 = 0
});
-test('first render still loading: no save, no restore', () => {
- assert.deepEqual(
- decideRestoreTarget(null, 'A', false, false, undefined),
- { save: null, restore: null },
- );
+test('isNearBottom: within the 24px tolerance counts as near', () => {
+ assert.equal(isNearBottom(980, 2000, 1000), true); // 20px above bottom
});
-test('first-visit cold open: enter A while loading, then loaded transition restores to bottom', () => {
- // First effect run: enter A, not yet loaded → no save (no prev), no restore.
- assert.deepEqual(
- decideRestoreTarget(null, 'A', false, false, undefined),
- { save: null, restore: null },
- );
- // Second effect run after data lands: same chat, becomes loaded → restore to bottom.
- assert.deepEqual(
- decideRestoreTarget('A', 'A', false, true, undefined),
- { save: null, restore: 'bottom' },
- );
+test('isNearBottom: beyond the tolerance does not count', () => {
+ assert.equal(isNearBottom(500, 2000, 1000), false); // 500px above bottom
});
-test('switch from loaded chat A to loaded cached chat B: save A, restore B saved', () => {
- assert.deepEqual(
- decideRestoreTarget('A', 'B', true, true, 250),
- { save: 'previous', restore: 'saved' },
- );
+test('isNearBottom: a scrolled-to-top container is not near the bottom', () => {
+ assert.equal(isNearBottom(0, 20000, 800), false);
});
-test('switch from loaded A to uncached B (still loading): save A, no restore yet', () => {
- assert.deepEqual(
- decideRestoreTarget('A', 'B', true, false, undefined),
- { save: 'previous', restore: null },
- );
+test('first render with no saved position: restore to bottom when loaded', () => {
+ assert.deepEqual(decideRestoreTarget('A', true, undefined), { restore: 'bottom' });
});
-test('switch from loaded A to uncached B, then B finishes loading: do not double-save A', () => {
- // Step 1: switch A → B, B loading → save A, no restore.
- assert.deepEqual(
- decideRestoreTarget('A', 'B', true, false, undefined),
- { save: 'previous', restore: null },
- );
- // Step 2: same chat B, transitions to loaded → no save (prev === next), restore B to bottom (first visit).
- assert.deepEqual(
- decideRestoreTarget('B', 'B', false, true, undefined),
- { save: null, restore: 'bottom' },
- );
+test('first render still loading: no restore', () => {
+ assert.deepEqual(decideRestoreTarget('A', false, undefined), { restore: null });
});
-test('switch B → A where A was unloaded when last left: do not save B against a spinner-snapshot of A', () => {
- // prevLoaded=false signals B was on the spinner branch → do NOT save its zero scrollTop.
- assert.deepEqual(
- decideRestoreTarget('B', 'A', false, true, 320),
- { save: null, restore: 'saved' },
- );
+test('cold open: loading transition then loaded → restore to bottom', () => {
+ assert.deepEqual(decideRestoreTarget('A', false, undefined), { restore: null });
+ assert.deepEqual(decideRestoreTarget('A', true, undefined), { restore: 'bottom' });
});
-test('deselect chat (next is null): no save (cant write null key), no restore', () => {
- assert.deepEqual(
- decideRestoreTarget('A', null, true, false, undefined),
- { save: null, restore: null },
- );
+test('returning to a chat with a saved position restores it (never bottom-jumps)', () => {
+ // The scroll listener saves the live scrollTop continuously, so a round trip A → B → A finds A's
+ // real last position in the map and restores it exactly.
+ assert.deepEqual(decideRestoreTarget('A', true, 250), { restore: 'saved' });
+});
+
+test('a saved position of 0 is still a saved position (top of thread is a real place)', () => {
+ assert.deepEqual(decideRestoreTarget('A', true, 0), { restore: 'saved' });
+});
+
+test('deselect chat (next is null): no restore', () => {
+ assert.deepEqual(decideRestoreTarget(null, false, undefined), { restore: null });
});
diff --git a/dashboard/src/hooks/useChatScrollPosition.ts b/dashboard/src/hooks/useChatScrollPosition.ts
index 9d5c6cd48..1cbdcfb2a 100644
--- a/dashboard/src/hooks/useChatScrollPosition.ts
+++ b/dashboard/src/hooks/useChatScrollPosition.ts
@@ -1,53 +1,39 @@
-import { useCallback, useLayoutEffect, useRef, type RefObject } from 'react';
+import { useCallback, useEffect, useLayoutEffect, useRef, type RefObject } from 'react';
import { decideScroll, type ScrollDirection } from '../utils/scrollDecision.ts';
/**
- * Decide what to do with the scroll container on a chat switch or load-resolve.
+ * Decide the restore target on a chat switch or load-resolve.
*
* Inputs:
- * - prevChatId: chat we are LEAVING (or null if first render)
* - nextChatId: chat we are ENTERING (or null if no chat selected)
- * - prevLoaded: was the previous chat's content rendered when we last ran?
* - isLoaded: is the next chat's content rendered now?
* - savedScrollTop: previously-saved scrollTop for nextChatId (or undefined)
*
- * Output: { save: 'previous' | null, restore: 'saved' | 'bottom' | null }
- * - save: instructs the hook to write the CURRENT scrollTop into the
- * map under prevChatId BEFORE doing the restore
- * - restore: instructs the hook to write scrollTop = (the saved value)
- * or = scrollHeight (bottom); null means do nothing
+ * Output: { restore: 'saved' | 'bottom' | null }
+ * - restore: 'saved' = write scrollTop = the saved value; 'bottom' = scrollHeight;
+ * null = do nothing (still loading / deselected).
+ *
+ * NOTE: there is deliberately no "save the leaving chat's scrollTop" step here. A layout effect
+ * runs AFTER React has already swapped the container's content to the NEW chat, so a post-swap
+ * read captures the NEW content's (possibly clamped) scrollTop, not the leaving chat's position —
+ * saving then restores the returning chat to the TOP. Instead the scroll listener saves the live
+ * scrollTop continuously (see below), so the map always holds each chat's last REAL position.
*
* This is a pure function so it can be unit-tested without React.
*/
export interface RestoreDecision {
- save: 'previous' | null;
restore: 'saved' | 'bottom' | null;
}
export function decideRestoreTarget(
- prevChatId: string | null,
nextChatId: string | null,
- prevLoaded: boolean,
isLoaded: boolean,
savedScrollTop: number | undefined,
): RestoreDecision {
- // Only save the previous chat's scrollTop when we're switching to ANOTHER
- // chat (not when deselecting back to nothing) and when its content was
- // actually rendered (not a spinner snapshot).
- const save: 'previous' | null =
- prevChatId !== null &&
- nextChatId !== null &&
- prevChatId !== nextChatId &&
- prevLoaded
- ? 'previous'
- : null;
-
const restore: 'saved' | 'bottom' | null =
- nextChatId !== null && isLoaded
- ? savedScrollTop !== undefined ? 'saved' : 'bottom'
- : null;
+ nextChatId !== null && isLoaded ? (savedScrollTop !== undefined ? 'saved' : 'bottom') : null;
- return { save, restore };
+ return { restore };
}
/**
@@ -63,67 +49,149 @@ export function decideRestoreTarget(
* - On message append: `onMessageAppended(direction)` snapshots the geometry
* BEFORE the new message is committed, then defers the scroll-to-bottom (if
* any) to the next frame so the new message is already in the DOM.
+ * - Pinned-to-bottom: media (`<img>`/`<video>`) has no intrinsic size before it
+ * decodes, so the container's scrollHeight GROWS after the initial restore —
+ * silently un-bottoming the view (the thread looks like it "opened at the
+ * top"). While pinned, each `onMediaLoad` re-pins to the bottom; the pin
+ * releases as soon as the USER scrolls away from the bottom (and re-arms when
+ * they scroll back), so late-decoding media never yanks a reading user.
*
* Mount the returned `containerRef` on the scroll container (the `.room-messages`
* div in Chats.tsx). The Map of saved positions lives in a ref so it doesn't
* trigger renders and is garbage-collected when the host component unmounts.
*/
+
+/** Distance from the bottom (px) within which the user still counts as "at the bottom". */
+const BOTTOM_PIN_THRESHOLD_PX = 24;
+
+/** Pure geometry check, exported for tests: is the viewport (nearly) at the container's bottom? */
+export function isNearBottom(scrollTop: number, scrollHeight: number, clientHeight: number): boolean {
+ return scrollHeight - scrollTop - clientHeight <= BOTTOM_PIN_THRESHOLD_PX;
+}
+
export function useChatScrollPosition(
activeChatId: string | null,
isLoaded: boolean,
): {
containerRef: RefObject<HTMLDivElement | null>;
onMessageAppended: (direction: ScrollDirection) => void;
+ onMediaLoad: () => void;
} {
const containerRef = useRef<HTMLDivElement | null>(null);
const scrollMap = useRef<Map<string, number>>(new Map());
const prevChatIdRef = useRef<string | null>(null);
- const prevLoadedRef = useRef<boolean>(false);
+ const pinnedRef = useRef<boolean>(true);
+ // A 'saved' restore writes scrollTop BEFORE media decodes — the browser clamps the write to the
+ // still-short scrollHeight and the thread lands at the top. The saved value lives here and is
+ // re-applied on every media decode until the user scrolls (any genuine scroll cancels it).
+ const pendingRestoreRef = useRef<number | null>(null);
+ // Marks our own writes so the scroll listener can skip them (a genuine user scroll both updates
+ // the pin state / position map AND cancels pendingRestore; our writes must do neither).
+ const programmaticWriteRef = useRef<boolean>(false);
+
+ const writeScrollTop = useCallback((el: HTMLDivElement, top: number) => {
+ const before = el.scrollTop;
+ programmaticWriteRef.current = true;
+ el.scrollTop = top;
+ // No scroll event fires when the value doesn't change (or clamps to the same value) — don't
+ // leave the flag set to swallow the next genuine user scroll.
+ if (el.scrollTop === before) programmaticWriteRef.current = false;
+ }, []);
+
+ const pinToBottom = useCallback(
+ (el: HTMLDivElement) => {
+ writeScrollTop(el, el.scrollHeight);
+ pinnedRef.current = true;
+ },
+ [writeScrollTop],
+ );
+
+ // Track pin state from scroll geometry: any scroll that lands at the bottom (ours or the user's)
+ // pins; any scroll away (only ever the user's) unpins. The SAME listener saves the visible
+ // chat's scrollTop on every genuine user scroll, so the per-chat position map always holds the
+ // last REAL user position — saving at switch time would read post-swap (clamped) geometry and
+ // restore garbage.
+ // NOTE: an effect without a dep array re-runs on EVERY render, and React runs the previous
+ // cleanup first — so the listener must be (re)attached unconditionally each run.
+ useEffect(() => {
+ const el = containerRef.current;
+ if (!el) return undefined;
+ const onScroll = () => {
+ if (programmaticWriteRef.current) {
+ programmaticWriteRef.current = false;
+ return;
+ }
+ // A genuine user scroll: cancels any pending restore, then updates pin + position map.
+ pendingRestoreRef.current = null;
+ pinnedRef.current = isNearBottom(el.scrollTop, el.scrollHeight, el.clientHeight);
+ const visibleChatId = prevChatIdRef.current;
+ if (visibleChatId) scrollMap.current.set(visibleChatId, el.scrollTop);
+ };
+ el.addEventListener('scroll', onScroll, { passive: true });
+ return () => el.removeEventListener('scroll', onScroll);
+ });
useLayoutEffect(() => {
- const prev = prevChatIdRef.current;
const next = activeChatId;
const el = containerRef.current;
- const prevLoaded = prevLoadedRef.current;
+ // A new restore decision supersedes any pending one (it belongs to a different chat/visit).
+ pendingRestoreRef.current = null;
- const decision = decideRestoreTarget(
- prev,
- next,
- prevLoaded,
- isLoaded,
- next !== null ? scrollMap.current.get(next) : undefined,
- );
+ const decision = decideRestoreTarget(next, isLoaded, next !== null ? scrollMap.current.get(next) : undefined);
if (el) {
- if (decision.save === 'previous' && prev !== null) {
- scrollMap.current.set(prev, el.scrollTop);
- }
if (decision.restore === 'saved' && next !== null) {
const saved = scrollMap.current.get(next);
- if (saved !== undefined) el.scrollTop = saved;
+ if (saved !== undefined) {
+ pendingRestoreRef.current = saved; // re-applied on media loads until the user scrolls
+ writeScrollTop(el, saved);
+ pinnedRef.current = false; // a saved spot is (almost always) not the bottom
+ }
} else if (decision.restore === 'bottom') {
- el.scrollTop = el.scrollHeight;
+ pinToBottom(el);
}
}
prevChatIdRef.current = next;
- prevLoadedRef.current = isLoaded;
- }, [activeChatId, isLoaded]);
+ }, [activeChatId, isLoaded, pinToBottom, writeScrollTop]);
- const onMessageAppended = useCallback((direction: ScrollDirection) => {
- const el = containerRef.current;
- if (!el) return;
- const action = decideScroll(direction, {
- scrollTop: el.scrollTop,
- scrollHeight: el.scrollHeight,
- clientHeight: el.clientHeight,
- });
- if (action === 'preserve') return;
+ const onMessageAppended = useCallback(
+ (direction: ScrollDirection) => {
+ const el = containerRef.current;
+ if (!el) return;
+ const action = decideScroll(direction, {
+ scrollTop: el.scrollTop,
+ scrollHeight: el.scrollHeight,
+ clientHeight: el.clientHeight,
+ });
+ if (action === 'preserve') return;
+ requestAnimationFrame(() => {
+ const cur = containerRef.current;
+ if (cur) pinToBottom(cur);
+ });
+ },
+ [pinToBottom],
+ );
+
+ // Media has no layout box before it decodes. While pinned, each decode re-pins to the bottom;
+ // while a 'saved' restore is pending, each decode RE-APPLIES the saved scrollTop (the first write
+ // was clamped to the pre-decode scrollHeight). A user scroll clears both, so late-decoding media
+ // never yanks a reading user.
+ const onMediaLoad = useCallback(() => {
+ const pending = pendingRestoreRef.current;
+ if (pending !== null) {
+ requestAnimationFrame(() => {
+ const cur = containerRef.current;
+ if (cur && pendingRestoreRef.current !== null) writeScrollTop(cur, pending);
+ });
+ return;
+ }
+ if (!pinnedRef.current) return;
requestAnimationFrame(() => {
const cur = containerRef.current;
- if (cur) cur.scrollTop = cur.scrollHeight;
+ if (cur && pinnedRef.current) pinToBottom(cur);
});
- }, []);
+ }, [pinToBottom, writeScrollTop]);
- return { containerRef, onMessageAppended };
+ return { containerRef, onMessageAppended, onMediaLoad };
}
diff --git a/dashboard/src/hooks/useTheme.ts b/dashboard/src/hooks/useTheme.ts
index 476e355a1..6eefa498f 100644
--- a/dashboard/src/hooks/useTheme.ts
+++ b/dashboard/src/hooks/useTheme.ts
@@ -1,38 +1,21 @@
import { useState, useEffect, useCallback } from 'react';
export type Theme = 'light' | 'dark' | 'system';
-export type ThemePalette = 'openwa' | 'blue' | 'graphite' | 'indigo' | 'amber' | 'rose' | 'teal';
const THEME_KEY = 'openwa_theme';
-const PALETTE_KEY = 'openwa_palette';
-
-export const paletteOptions: Array<{ value: ThemePalette; label: string; color: string }> = [
- { value: 'openwa', label: 'OpenWA', color: '#25d366' },
- { value: 'blue', label: 'Blue', color: '#2563eb' },
- { value: 'graphite', label: 'Graphite', color: '#64748b' },
- { value: 'indigo', label: 'Indigo', color: '#4f46e5' },
- { value: 'amber', label: 'Amber', color: '#d97706' },
- { value: 'rose', label: 'Rose', color: '#e11d48' },
- { value: 'teal', label: 'Teal', color: '#0d9488' },
-];
+// Legacy key from the removed palette picker (pre-0.9.0). Cleaned up on mount so old installs
+// don't carry dead state; the picker was dropped for being hard to maintain and off-brand.
+const LEGACY_PALETTE_KEY = 'openwa_palette';
function isTheme(value: string | null): value is Theme {
return value === 'light' || value === 'dark' || value === 'system';
}
-function isPalette(value: string | null): value is ThemePalette {
- return paletteOptions.some(option => option.value === value);
-}
-
export function useTheme() {
const [theme, setThemeState] = useState<Theme>(() => {
const saved = localStorage.getItem(THEME_KEY);
return isTheme(saved) ? saved : 'system';
});
- const [palette, setPaletteState] = useState<ThemePalette>(() => {
- const saved = localStorage.getItem(PALETTE_KEY);
- return isPalette(saved) ? saved : 'openwa';
- });
const applyTheme = useCallback((newTheme: Theme) => {
const root = document.documentElement;
@@ -45,28 +28,21 @@ export function useTheme() {
}
}, []);
- const applyPalette = useCallback((newPalette: ThemePalette) => {
- document.documentElement.setAttribute('data-palette', newPalette);
- }, []);
-
useEffect(() => {
applyTheme(theme);
localStorage.setItem(THEME_KEY, theme);
}, [theme, applyTheme]);
+ // One-time cleanup of the removed palette picker's storage + document attribute.
useEffect(() => {
- applyPalette(palette);
- localStorage.setItem(PALETTE_KEY, palette);
- }, [palette, applyPalette]);
+ localStorage.removeItem(LEGACY_PALETTE_KEY);
+ document.documentElement.removeAttribute('data-palette');
+ }, []);
const setTheme = useCallback((newTheme: Theme) => {
setThemeState(newTheme);
}, []);
- const setPalette = useCallback((newPalette: ThemePalette) => {
- setPaletteState(newPalette);
- }, []);
-
const toggleTheme = useCallback(() => {
setThemeState(prev => {
if (prev === 'light') return 'dark';
@@ -79,5 +55,5 @@ export function useTheme() {
const resolvedTheme =
theme === 'system' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme;
- return { theme, setTheme, toggleTheme, resolvedTheme, palette, setPalette, paletteOptions };
+ return { theme, setTheme, toggleTheme, resolvedTheme };
}
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index dea808b0e..203a23735 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -63,7 +63,7 @@
"label": "المظهر: {{value}}",
"appearance": "المظهر",
"mode": "الوضع",
- "palette": "لوحة الألوان"
+ "toggleTo": "التبديل إلى {{value}}"
},
"nav": {
"dashboard": "لوحة التحكم",
@@ -570,29 +570,6 @@
"subtitle": "تهيئة إعدادات الخادم وقاعدة البيانات والذاكرة المؤقتة والتخزين والمحرك",
"saveConfig": "حفظ الإعدادات",
"saving": "جارٍ الحفظ...",
- "server": {
- "title": "إعدادات الخادم",
- "production": "إنتاج",
- "development": "تطوير",
- "environment": "البيئة",
- "domain": "النطاق",
- "apiPort": "منفذ API",
- "dashboardPort": "منفذ لوحة التحكم",
- "corsOrigins": "مصادر CORS",
- "corsPlaceholder": "* أو مصادر مفصولة بفاصلة",
- "publicApiUrl": "رابط API العام (اختياري)",
- "publicDashboardUrl": "رابط لوحة التحكم العامة (اختياري)"
- },
- "webhook": {
- "title": "الويب هوك وحد التحميل",
- "settings": "إعدادات الويب هوك",
- "timeout": "المهلة (مللي ثانية)",
- "maxRetries": "أقصى عدد للمحاولات",
- "retryDelay": "تأخير إعادة المحاولة (مللي ثانية)",
- "rateLimit": "حد التحميل",
- "window": "نافذة الوقت (ثوانٍ)",
- "maxReq": "أقصى عدد طلبات لكل نافذة"
- },
"database": {
"title": "إعدادات قاعدة البيانات",
"sqlite": "SQLite",
@@ -615,7 +592,6 @@
},
"engine": {
"title": "محرك واتساب",
- "subtitle": "اختر محرك اتصال واتساب وقم بتهيئته.",
"builtIn": "مدمج",
"headless": "الوضع بدون واجهة",
"headlessDesc": "تشغيل المتصفح بدون واجهة مرئية (موصى به للإنتاج).",
@@ -715,35 +691,21 @@
"title": "الإضافات",
"subtitle": "ثبّت الإضافات وكوّنها وأدِرها",
"refresh": "تحديث",
- "engineCard": "محرك واتساب النشط",
- "running": "يعمل",
- "supportedFeatures": "الميزات المدعومة:",
"builtIn": "مدمج",
"noDescription": "لا يوجد وصف متاح",
- "required": "مطلوب",
- "active": "نشط",
- "activate": "تفعيل",
"enable": "تمكين",
"disable": "تعطيل",
"healthCheck": "فحص الصحة",
"configure": "إعداد",
- "available": "متاحة",
"install": "تثبيت إضافة",
"uninstall": "إزالة",
"uninstallConfirm": "إزالة \"{{name}}\"؟ سيؤدي ذلك إلى حذف ملفاتها.",
- "engineSwitchHint": "عيّنها كمحرك نشط في الإعدادات، ثم أعد التشغيل",
"empty": {
"title": "لم يتم العثور على إضافات",
"description": "ثبّت إضافات لتوسيع وظائف OpenWA"
},
"config": {
"title": "إعداد {{name}}",
- "restartNotice": "تتطلب التغييرات إعادة تشغيل الخادم لتصبح فعّالة",
- "engineType": "نوع المحرك",
- "headless": "الوضع غير المرئي",
- "headlessDesc": "تشغيل المتصفح بدون واجهة مرئية (موصى به للإنتاج)",
- "sessionDataPath": "مسار بيانات الجلسة",
- "browserArgs": "مُعطيات المتصفح",
"noOptions": "لا توجد خيارات إعداد لهذه الإضافة",
"uiHandshakeError": "لم تتم تهيئة واجهة إعداد الإضافة. استخدم نموذج الإعدادات أدناه إن كان متاحًا.",
"save": "حفظ الإعدادات",
@@ -752,7 +714,6 @@
"tabSessions": "الجلسات"
},
"rail": {
- "engine": "المحرك النشط",
"enabled": "مُمكَّنة",
"installed": "مُثبَّتة",
"active": "الإضافات النشطة",
diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.json
index 50611eb57..753e9f06c 100644
--- a/dashboard/src/i18n/locales/en.json
+++ b/dashboard/src/i18n/locales/en.json
@@ -63,7 +63,7 @@
"label": "Theme: {{value}}",
"appearance": "Appearance",
"mode": "Mode",
- "palette": "Palette"
+ "toggleTo": "Switch to {{value}}"
},
"nav": {
"dashboard": "Dashboard",
@@ -566,29 +566,6 @@
"subtitle": "Configure server, database, cache, storage, and engine settings",
"saveConfig": "Save Configuration",
"saving": "Saving...",
- "server": {
- "title": "Server Configuration",
- "production": "Production",
- "development": "Development",
- "environment": "Environment",
- "domain": "Domain",
- "apiPort": "API Port",
- "dashboardPort": "Dashboard Port",
- "corsOrigins": "CORS Origins",
- "corsPlaceholder": "* or comma-separated origins",
- "publicApiUrl": "Public API URL (optional)",
- "publicDashboardUrl": "Public Dashboard URL (optional)"
- },
- "webhook": {
- "title": "Webhook & Rate Limiting",
- "settings": "Webhook Settings",
- "timeout": "Timeout (ms)",
- "maxRetries": "Max Retries",
- "retryDelay": "Retry Delay (ms)",
- "rateLimit": "Rate Limiting",
- "window": "Time Window (seconds)",
- "maxReq": "Max Requests per Window"
- },
"database": {
"title": "Database Configuration",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "WhatsApp Engine",
- "subtitle": "Choose and configure the WhatsApp connection engine.",
"builtIn": "Built-in",
"headless": "Headless Mode",
"headlessDesc": "Run the browser without a visible UI (recommended for production).",
@@ -711,35 +687,21 @@
"title": "Plugins",
"subtitle": "Install, configure, and manage extensions",
"refresh": "Refresh",
- "engineCard": "Active WhatsApp Engine",
- "running": "Running",
- "supportedFeatures": "Supported Features:",
"builtIn": "Built-in",
"noDescription": "No description available",
- "required": "Required",
- "active": "Active",
- "activate": "Activate",
"enable": "Enable",
"disable": "Disable",
"healthCheck": "Health Check",
"configure": "Configure",
- "available": "Available",
"install": "Install plugin",
"uninstall": "Uninstall",
"uninstallConfirm": "Uninstall \"{{name}}\"? This deletes its files.",
- "engineSwitchHint": "To switch the active engine, set ENGINE_TYPE in the environment and restart the server",
"empty": {
"title": "No plugins installed",
"description": "Install a plugin to extend what OpenWA can do."
},
"config": {
"title": "Configure {{name}}",
- "restartNotice": "Changes require server restart to take effect",
- "engineType": "Engine Type",
- "headless": "Headless Mode",
- "headlessDesc": "Run browser without visible UI (recommended for production)",
- "sessionDataPath": "Session Data Path",
- "browserArgs": "Browser Arguments",
"noOptions": "No configuration options available for this plugin",
"uiHandshakeError": "The plugin configuration UI did not initialize. Use the schema form below if available.",
"save": "Save Configuration",
@@ -748,7 +710,6 @@
"tabSessions": "Sessions"
},
"rail": {
- "engine": "Active engine",
"enabled": "enabled",
"installed": "installed",
"active": "Active plugins",
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index 1ad630788..62b97ea91 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -63,7 +63,7 @@
"label": "Tema: {{value}}",
"appearance": "Apariencia",
"mode": "Modo",
- "palette": "Paleta"
+ "toggleTo": "Cambiar a {{value}}"
},
"nav": {
"dashboard": "Panel",
@@ -566,29 +566,6 @@
"subtitle": "Configura el servidor, base de datos, caché, almacenamiento y motor",
"saveConfig": "Guardar configuración",
"saving": "Guardando...",
- "server": {
- "title": "Configuración del servidor",
- "production": "Producción",
- "development": "Desarrollo",
- "environment": "Entorno",
- "domain": "Dominio",
- "apiPort": "Puerto API",
- "dashboardPort": "Puerto del panel",
- "corsOrigins": "Orígenes CORS",
- "corsPlaceholder": "* o varios orígenes separados por comas",
- "publicApiUrl": "URL pública de la API (opcional)",
- "publicDashboardUrl": "URL pública del panel (opcional)"
- },
- "webhook": {
- "title": "Webhook y límite de velocidad",
- "settings": "Configuración de webhook",
- "timeout": "Tiempo de espera (ms)",
- "maxRetries": "Máximo de reintentos",
- "retryDelay": "Retardo entre reintentos (ms)",
- "rateLimit": "Límite de velocidad",
- "window": "Ventana de tiempo (segundos)",
- "maxReq": "Máximo de peticiones por ventana"
- },
"database": {
"title": "Configuración de la base de datos",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "Motor de WhatsApp",
- "subtitle": "Elige y configura el motor de conexión de WhatsApp.",
"builtIn": "Integrado",
"headless": "Modo headless",
"headlessDesc": "Ejecuta el navegador sin interfaz visible (recomendado para producción).",
@@ -711,35 +687,21 @@
"title": "Plugins",
"subtitle": "Instala, configura y gestiona extensiones",
"refresh": "Actualizar",
- "engineCard": "Motor de WhatsApp activo",
- "running": "En ejecución",
- "supportedFeatures": "Funciones compatibles:",
"builtIn": "Integrado",
"noDescription": "Sin descripción disponible",
- "required": "Obligatorio",
- "active": "Activo",
- "activate": "Activar",
"enable": "Habilitar",
"disable": "Deshabilitar",
"healthCheck": "Comprobación de salud",
"configure": "Configurar",
- "available": "Disponible",
"install": "Instalar plugin",
"uninstall": "Desinstalar",
"uninstallConfirm": "¿Desinstalar \"{{name}}\"? Esto elimina sus archivos.",
- "engineSwitchHint": "Establécelo como el motor activo en Ajustes y luego reinicia",
"empty": {
"title": "No se encontraron plugins",
"description": "Instala plugins para ampliar la funcionalidad de OpenWA"
},
"config": {
"title": "Configurar {{name}}",
- "restartNotice": "Los cambios requieren reiniciar el servidor para aplicarse",
- "engineType": "Tipo de motor",
- "headless": "Modo sin cabeza",
- "headlessDesc": "Ejecutar el navegador sin interfaz visible (recomendado para producción)",
- "sessionDataPath": "Ruta de datos de sesión",
- "browserArgs": "Argumentos del navegador",
"noOptions": "No hay opciones de configuración disponibles para este plugin",
"uiHandshakeError": "La interfaz de configuración del plugin no se inició. Usa el formulario inferior si está disponible.",
"save": "Guardar configuración",
@@ -748,7 +710,6 @@
"tabSessions": "Sesiones"
},
"rail": {
- "engine": "Motor activo",
"enabled": "habilitado",
"installed": "instalado",
"active": "Plugins activos",
diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.json
index 3410d63f8..be7ecbd88 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -63,7 +63,7 @@
"label": "Thème : {{value}}",
"appearance": "Apparence",
"mode": "Mode",
- "palette": "Palette"
+ "toggleTo": "Passer à {{value}}"
},
"nav": {
"dashboard": "Tableau de bord",
@@ -566,29 +566,6 @@
"subtitle": "Configurez les paramètres du serveur, de la base de données, du cache, du stockage et du moteur",
"saveConfig": "Enregistrer la configuration",
"saving": "Enregistrement...",
- "server": {
- "title": "Configuration du serveur",
- "production": "Production",
- "development": "Développement",
- "environment": "Environnement",
- "domain": "Domaine",
- "apiPort": "Port API",
- "dashboardPort": "Port du tableau de bord",
- "corsOrigins": "Origines CORS",
- "corsPlaceholder": "* ou origines séparées par des virgules",
- "publicApiUrl": "URL publique de l'API (optionnel)",
- "publicDashboardUrl": "URL publique du tableau de bord (optionnel)"
- },
- "webhook": {
- "title": "Webhook & Limitation de débit",
- "settings": "Paramètres du webhook",
- "timeout": "Délai d'attente (ms)",
- "maxRetries": "Tentatives max",
- "retryDelay": "Délai entre les tentatives (ms)",
- "rateLimit": "Limitation de débit",
- "window": "Fenêtre de temps (secondes)",
- "maxReq": "Requêtes max par fenêtre"
- },
"database": {
"title": "Configuration de la base de données",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "Moteur WhatsApp",
- "subtitle": "Choisissez et configurez le moteur de connexion WhatsApp.",
"builtIn": "Intégré",
"headless": "Mode headless",
"headlessDesc": "Exécuter le navigateur sans interface visible (recommandé en production).",
@@ -711,35 +687,21 @@
"title": "Plugins",
"subtitle": "Installez, configurez et gérez les extensions",
"refresh": "Actualiser",
- "engineCard": "Moteur WhatsApp actif",
- "running": "En cours d'exécution",
- "supportedFeatures": "Fonctionnalités supportées :",
"builtIn": "Intégré",
"noDescription": "Aucune description disponible",
- "required": "Requis",
- "active": "Actif",
- "activate": "Activer",
"enable": "Activer",
"disable": "Désactiver",
"healthCheck": "Bilan de santé",
"configure": "Configurer",
- "available": "Disponible",
"install": "Installer le plugin",
"uninstall": "Désinstaller",
"uninstallConfirm": "Désinstaller « {{name}} » ? Cela supprime ses fichiers.",
- "engineSwitchHint": "Définissez-le comme moteur actif dans les Paramètres, puis redémarrez",
"empty": {
"title": "Aucun plugin trouvé",
"description": "Installez des plugins pour étendre les fonctionnalités d'OpenWA"
},
"config": {
"title": "Configurer {{name}}",
- "restartNotice": "Les modifications nécessitent un redémarrage du serveur pour prendre effet",
- "engineType": "Type de moteur",
- "headless": "Mode sans tête (Headless)",
- "headlessDesc": "Exécuter le navigateur sans interface visible (recommandé pour la production)",
- "sessionDataPath": "Chemin des données de session",
- "browserArgs": "Arguments du navigateur",
"noOptions": "Aucune option de configuration disponible pour ce plugin",
"uiHandshakeError": "L’interface de configuration du plugin ne s’est pas initialisée. Utilisez le formulaire ci-dessous s’il est disponible.",
"save": "Enregistrer la configuration",
@@ -748,7 +710,6 @@
"tabSessions": "Sessions"
},
"rail": {
- "engine": "Moteur actif",
"enabled": "activé",
"installed": "installé",
"active": "Plugins actifs",
diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.json
index 6df0766b2..322d2bcf7 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -63,7 +63,7 @@
"label": "ערכת נושא: {{value}}",
"appearance": "מראה",
"mode": "מצב",
- "palette": "לוח צבעים"
+ "toggleTo": "עבור ל{{value}}"
},
"nav": {
"dashboard": "דאשבורד",
@@ -567,29 +567,6 @@
"subtitle": "הגדרת השרת, מסד נתונים, מטמון, אחסון ומנוע WhatsApp",
"saveConfig": "שמירת תצורה",
"saving": "שומר...",
- "server": {
- "title": "הגדרות שרת",
- "production": "ייצור",
- "development": "פיתוח",
- "environment": "סביבה",
- "domain": "דומיין",
- "apiPort": "פורט API",
- "dashboardPort": "פורט דאשבורד",
- "corsOrigins": "מקורות CORS",
- "corsPlaceholder": "* או רשימה מופרדת בפסיקים",
- "publicApiUrl": "כתובת API ציבורית (אופציונלי)",
- "publicDashboardUrl": "כתובת דאשבורד ציבורית (אופציונלי)"
- },
- "webhook": {
- "title": "Webhooks והגבלת קצב",
- "settings": "הגדרות Webhook",
- "timeout": "זמן קצוב (ms)",
- "maxRetries": "ניסיונות מקסימליים",
- "retryDelay": "השהיה בין ניסיונות (ms)",
- "rateLimit": "הגבלת קצב",
- "window": "חלון זמן (שניות)",
- "maxReq": "מקסימום בקשות בחלון"
- },
"database": {
"title": "הגדרות מסד נתונים",
"sqlite": "SQLite",
@@ -612,7 +589,6 @@
},
"engine": {
"title": "מנוע WhatsApp",
- "subtitle": "בחר והגדר את מנוע החיבור של WhatsApp.",
"builtIn": "מובנה",
"headless": "מצב ללא ממשק",
"headlessDesc": "הרצת הדפדפן ללא ממשק גלוי (מומלץ לסביבת ייצור).",
@@ -712,35 +688,21 @@
"title": "תוספים",
"subtitle": "התקנה, הגדרה וניהול של הרחבות",
"refresh": "רענון",
- "engineCard": "מנוע WhatsApp פעיל",
- "running": "פועל",
- "supportedFeatures": "תכונות נתמכות:",
"builtIn": "מובנה",
"noDescription": "אין תיאור זמין",
- "required": "נדרש",
- "active": "פעיל",
- "activate": "הפעלה",
"enable": "הפעלה",
"disable": "השבתה",
"healthCheck": "בדיקת תקינות",
"configure": "הגדרה",
- "available": "זמינים",
"install": "התקנת תוסף",
"uninstall": "הסרה",
"uninstallConfirm": "להסיר את \"{{name}}\"? פעולה זו תמחק את הקבצים שלו.",
- "engineSwitchHint": "יש להגדיר כמנוע הפעיל בהגדרות ולאחר מכן לאתחל",
"empty": {
"title": "לא נמצאו תוספים",
"description": "ניתן להתקין תוספים כדי להרחיב את היכולות של OpenWA"
},
"config": {
"title": "הגדרת {{name}}",
- "restartNotice": "השינויים דורשים אתחול שרת כדי להיכנס לתוקף",
- "engineType": "סוג מנוע",
- "headless": "מצב Headless",
- "headlessDesc": "הרצת דפדפן ללא ממשק גרפי (מומלץ לייצור)",
- "sessionDataPath": "נתיב נתוני Session",
- "browserArgs": "ארגומנטים של הדפדפן",
"noOptions": "אין אפשרויות הגדרה זמינות עבור תוסף זה",
"uiHandshakeError": "ממשק הגדרת התוסף לא אותחל. השתמשו בטופס שלמטה אם הוא זמין.",
"save": "שמירת תצורה",
@@ -749,7 +711,6 @@
"tabSessions": "Sessions"
},
"rail": {
- "engine": "מנוע פעיל",
"enabled": "מופעלים",
"installed": "מותקנים",
"active": "תוספים פעילים",
diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.json
index 526aaa70c..af3a39d31 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -63,7 +63,7 @@
"label": "Tema: {{value}}",
"appearance": "Aspetto",
"mode": "Modalità",
- "palette": "Tavolozza"
+ "toggleTo": "Passa a {{value}}"
},
"nav": {
"dashboard": "Dashboard",
@@ -566,29 +566,6 @@
"subtitle": "Configura le impostazioni del server, del database, della cache, dell'archiviazione e del motore",
"saveConfig": "Salva Configurazione",
"saving": "Salvataggio...",
- "server": {
- "title": "Configurazione Server",
- "production": "Produzione",
- "development": "Sviluppo",
- "environment": "Ambiente",
- "domain": "Dominio",
- "apiPort": "Porta API",
- "dashboardPort": "Porta Dashboard",
- "corsOrigins": "Origini CORS",
- "corsPlaceholder": "* o origini separate da virgola",
- "publicApiUrl": "URL API Pubblico (opzionale)",
- "publicDashboardUrl": "URL Dashboard Pubblico (opzionale)"
- },
- "webhook": {
- "title": "Webhook e Limitazione Frequenza",
- "settings": "Impostazioni Webhook",
- "timeout": "Timeout (ms)",
- "maxRetries": "Tentativi Massimi",
- "retryDelay": "Ritardo Tentativi (ms)",
- "rateLimit": "Limitazione Frequenza (Rate Limiting)",
- "window": "Finestra Temporale (secondi)",
- "maxReq": "Richieste Massime per Finestra"
- },
"database": {
"title": "Configurazione Database",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "Motore WhatsApp",
- "subtitle": "Scegli e configura il motore di connessione di WhatsApp.",
"builtIn": "Integrato",
"headless": "Modalità headless",
"headlessDesc": "Esegui il browser senza interfaccia visibile (consigliato per la produzione).",
@@ -711,35 +687,21 @@
"title": "Plugin",
"subtitle": "Installa, configura e gestisci le estensioni",
"refresh": "Aggiorna",
- "engineCard": "Motore WhatsApp Attivo",
- "running": "In esecuzione",
- "supportedFeatures": "Funzionalità Supportate:",
"builtIn": "Integrato",
"noDescription": "Nessuna descrizione disponibile",
- "required": "Richiesto",
- "active": "Attivo",
- "activate": "Attiva",
"enable": "Abilita",
"disable": "Disabilita",
"healthCheck": "Controllo dello Stato (Health Check)",
"configure": "Configura",
- "available": "Disponibili",
"install": "Installa plugin",
"uninstall": "Disinstalla",
"uninstallConfirm": "Disinstallare \"{{name}}\"? Questa operazione ne elimina i file.",
- "engineSwitchHint": "Imposta come motore attivo nelle Impostazioni, poi riavvia",
"empty": {
"title": "Nessun Plugin Trovato",
"description": "Installa i plugin per estendere le funzionalità di OpenWA"
},
"config": {
"title": "Configura {{name}}",
- "restartNotice": "Le modifiche richiedono il riavvio del server per avere effetto",
- "engineType": "Tipo di Motore",
- "headless": "Modalità Headless",
- "headlessDesc": "Esegui il browser senza interfaccia grafica visibile (consigliato in produzione)",
- "sessionDataPath": "Percorso Dati Sessione",
- "browserArgs": "Argomenti del Browser",
"noOptions": "Nessuna opzione di configurazione disponibile per questo plugin",
"uiHandshakeError": "L’interfaccia di configurazione del plugin non si è inizializzata. Usa il modulo sottostante, se disponibile.",
"save": "Salva Configurazione",
@@ -748,7 +710,6 @@
"tabSessions": "Sessioni"
},
"rail": {
- "engine": "Motore attivo",
"enabled": "abilitati",
"installed": "installati",
"active": "Plugin attivi",
diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.json
index 8bbb10987..27fc4978b 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -63,7 +63,7 @@
"label": "테마: {{value}}",
"appearance": "화면 모드",
"mode": "모드",
- "palette": "팔레트"
+ "toggleTo": "{{value}}(으)로 전환"
},
"nav": {
"dashboard": "대시보드",
@@ -566,29 +566,6 @@
"subtitle": "서버, 데이터베이스, 캐시, 스토리지, 엔진 설정을 구성하세요",
"saveConfig": "설정 저장",
"saving": "저장하는 중...",
- "server": {
- "title": "서버 설정",
- "production": "프로덕션",
- "development": "개발",
- "environment": "환경",
- "domain": "도메인",
- "apiPort": "API 포트",
- "dashboardPort": "대시보드 포트",
- "corsOrigins": "CORS 오리진",
- "corsPlaceholder": "* 또는 쉼표로 구분된 오리진",
- "publicApiUrl": "공개 API URL (선택 사항)",
- "publicDashboardUrl": "공개 대시보드 URL (선택 사항)"
- },
- "webhook": {
- "title": "웹훅 및 속도 제한",
- "settings": "웹훅 설정",
- "timeout": "제한 시간 (ms)",
- "maxRetries": "최대 재시도 횟수",
- "retryDelay": "재시도 지연 (ms)",
- "rateLimit": "속도 제한",
- "window": "시간 윈도우 (초)",
- "maxReq": "윈도우당 최대 요청 수"
- },
"database": {
"title": "데이터베이스 설정",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "WhatsApp 엔진",
- "subtitle": "WhatsApp 연결 엔진을 선택하고 구성하세요.",
"builtIn": "내장",
"headless": "헤드리스 모드",
"headlessDesc": "브라우저 UI 없이 실행합니다 (프로덕션에 권장).",
@@ -711,35 +687,21 @@
"title": "플러그인",
"subtitle": "확장 기능을 설치, 구성, 관리하세요",
"refresh": "새로고침",
- "engineCard": "활성 WhatsApp 엔진",
- "running": "실행 중",
- "supportedFeatures": "지원하는 기능:",
"builtIn": "내장",
"noDescription": "설명 없음",
- "required": "필수",
- "active": "활성",
- "activate": "활성화",
"enable": "사용",
"disable": "사용 안 함",
"healthCheck": "상태 확인",
"configure": "구성",
- "available": "사용 가능",
"install": "플러그인 설치",
"uninstall": "제거",
"uninstallConfirm": "\"{{name}}\"을(를) 제거할까요? 관련 파일이 모두 삭제됩니다.",
- "engineSwitchHint": "활성 엔진을 변경하려면 환경 변수에 ENGINE_TYPE을 설정하고 서버를 재시작하세요",
"empty": {
"title": "설치된 플러그인이 없습니다",
"description": "OpenWA의 기능을 확장하려면 플러그인을 설치하세요."
},
"config": {
"title": "{{name}} 구성",
- "restartNotice": "변경 사항을 적용하려면 서버를 재시작해야 합니다",
- "engineType": "엔진 유형",
- "headless": "헤드리스 모드",
- "headlessDesc": "브라우저 UI 없이 실행 (프로덕션에 권장)",
- "sessionDataPath": "세션 데이터 경로",
- "browserArgs": "브라우저 인수",
"noOptions": "이 플러그인에 사용할 수 있는 구성 옵션이 없습니다",
"uiHandshakeError": "플러그인 설정 UI가 초기화되지 않았습니다. 사용 가능한 경우 아래 스키마 양식을 이용하세요.",
"save": "설정 저장",
@@ -748,7 +710,6 @@
"tabSessions": "세션"
},
"rail": {
- "engine": "활성 엔진",
"enabled": "사용 중",
"installed": "설치됨",
"active": "활성 플러그인",
diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.json
index 04e9841fe..796099459 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -63,7 +63,7 @@
"label": "Tema: {{value}}",
"appearance": "Aparência",
"mode": "Modo",
- "palette": "Paleta"
+ "toggleTo": "Mudar para {{value}}"
},
"nav": {
"dashboard": "Painel",
@@ -566,29 +566,6 @@
"subtitle": "Configure o servidor, banco de dados, cache, armazenamento e motor",
"saveConfig": "Salvar configuração",
"saving": "Salvando...",
- "server": {
- "title": "Configuração do servidor",
- "production": "Produção",
- "development": "Desenvolvimento",
- "environment": "Ambiente",
- "domain": "Domínio",
- "apiPort": "Porta da API",
- "dashboardPort": "Porta do painel",
- "corsOrigins": "Origens CORS",
- "corsPlaceholder": "* ou várias origens separadas por vírgula",
- "publicApiUrl": "URL pública da API (opcional)",
- "publicDashboardUrl": "URL pública do painel (opcional)"
- },
- "webhook": {
- "title": "Webhook e limite de requisições",
- "settings": "Configuração de webhook",
- "timeout": "Tempo limite (ms)",
- "maxRetries": "Máximo de tentativas",
- "retryDelay": "Intervalo entre tentativas (ms)",
- "rateLimit": "Limite de requisições",
- "window": "Janela de tempo (segundos)",
- "maxReq": "Máximo de requisições por janela"
- },
"database": {
"title": "Configuração do banco de dados",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "Motor do WhatsApp",
- "subtitle": "Escolha e configure o motor de conexão do WhatsApp.",
"builtIn": "Integrado",
"headless": "Modo headless",
"headlessDesc": "Execute o navegador sem interface visível (recomendado para produção).",
@@ -711,35 +687,21 @@
"title": "Plugins",
"subtitle": "Instale, configure e gerencie extensões",
"refresh": "Atualizar",
- "engineCard": "Motor do WhatsApp ativo",
- "running": "Em execução",
- "supportedFeatures": "Funcionalidades suportadas:",
"builtIn": "Integrado",
"noDescription": "Sem descrição disponível",
- "required": "Obrigatório",
- "active": "Ativo",
- "activate": "Ativar",
"enable": "Habilitar",
"disable": "Desabilitar",
"healthCheck": "Verificação de saúde",
"configure": "Configurar",
- "available": "Disponível",
"install": "Instalar plugin",
"uninstall": "Desinstalar",
"uninstallConfirm": "Desinstalar \"{{name}}\"? Isso remove seus arquivos.",
- "engineSwitchHint": "Defina-o como motor ativo nas Configurações e reinicie",
"empty": {
"title": "Nenhum plugin encontrado",
"description": "Instale plugins para ampliar a funcionalidade do OpenWA"
},
"config": {
"title": "Configurar {{name}}",
- "restartNotice": "As alterações requerem reiniciar o servidor para serem aplicadas",
- "engineType": "Tipo de motor",
- "headless": "Modo headless",
- "headlessDesc": "Executar o navegador sem interface visível (recomendado para produção)",
- "sessionDataPath": "Caminho dos dados da sessão",
- "browserArgs": "Argumentos do navegador",
"noOptions": "Não há opções de configuração disponíveis para este plugin",
"uiHandshakeError": "A interface de configuração do plugin não foi iniciada. Use o formulário abaixo, se disponível.",
"save": "Salvar configuração",
@@ -748,7 +710,6 @@
"tabSessions": "Sessões"
},
"rail": {
- "engine": "Motor ativo",
"enabled": "habilitado",
"installed": "instalado",
"active": "Plugins ativos",
diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.json
index 7695fcd86..24d337af3 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -63,7 +63,7 @@
"label": "థీమ్: {{value}}",
"appearance": "రూపం",
"mode": "మోడ్",
- "palette": "రంగుల పలక"
+ "toggleTo": "{{value}}కి మారండి"
},
"nav": {
"dashboard": "డ్యాష్‌బోర్డ్",
@@ -566,29 +566,6 @@
"subtitle": "సర్వర్, డేటాబేస్, క్యాషే, స్టోరేజ్ మరియు ఇంజిన్ సెట్టింగ్‌లను కాన్ఫిగర్ చేయండి",
"saveConfig": "కాన్ఫిగరేషన్‌ను సేవ్ చేయి",
"saving": "సేవ్ చేస్తోంది...",
- "server": {
- "title": "సర్వర్ కాన్ఫిగరేషన్",
- "production": "ప్రొడక్షన్",
- "development": "డెవలప్‌మెంట్",
- "environment": "ఎన్విరాన్మెంట్",
- "domain": "డొమైన్",
- "apiPort": "API పోర్ట్",
- "dashboardPort": "డ్యాష్‌బోర్డ్ పోర్ట్",
- "corsOrigins": "CORS ఆరిజిన్స్",
- "corsPlaceholder": "* లేదా కామాతో వేరు చేయబడిన ఆరిజిన్స్",
- "publicApiUrl": "పబ్లిక్ API URL (ఐచ్ఛికం)",
- "publicDashboardUrl": "పబ్లిక్ డ్యాష్‌బోర్డ్ URL (ఐచ్ఛికం)"
- },
- "webhook": {
- "title": "వెబ్‌హుక్ & రేట్ లిమిటింగ్",
- "settings": "వెబ్‌హుక్ సెట్టింగ్స్",
- "timeout": "టైమౌట్ (ms)",
- "maxRetries": "గరిష్ట రీట్రైలు",
- "retryDelay": "రీట్రై ఆలస్యం (ms)",
- "rateLimit": "రేట్ లిమిటింగ్",
- "window": "సమయ విండో (సెకన్లు)",
- "maxReq": "ఒక విండోకు గరిష్ట రిక్వెస్ట్‌లు"
- },
"database": {
"title": "డేటాబేస్ కాన్ఫిగరేషన్",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "WhatsApp ఇంజిన్",
- "subtitle": "WhatsApp కనెక్షన్ ఇంజిన్‌ను ఎంచుకొని కాన్ఫిగర్ చేయండి.",
"builtIn": "అంతర్నిర్మితం",
"headless": "హెడ్‌లెస్ మోడ్",
"headlessDesc": "కనిపించే UI లేకుండా బ్రౌజర్‌ను అమలు చేయండి (ఉత్పత్తికి సిఫార్సు చేయబడింది).",
@@ -711,35 +687,21 @@
"title": "ప్లగిన్స్",
"subtitle": "ఎక్స్‌టెన్షన్‌లను ఇన్‌స్టాల్, కాన్ఫిగర్ మరియు నిర్వహించండి",
"refresh": "రిఫ్రెష్",
- "engineCard": "యాక్టివ్ వాట్సాప్ ఇంజిన్",
- "running": "నడుస్తోంది",
- "supportedFeatures": "మద్దతు ఉన్న ఫీచర్లు:",
"builtIn": "ఇన్-బిల్ట్",
"noDescription": "ఎలాంటి వివరణ అందుబాటులో లేదు",
- "required": "అవసరం",
- "active": "యాక్టివ్",
- "activate": "యాక్టివేట్ చేయి",
"enable": "ప్రారంభించు",
"disable": "నిలిపివేయి",
"healthCheck": "హెల్త్ చెక్",
"configure": "కాన్ఫిగర్ చేయి",
- "available": "అందుబాటులో ఉంది",
"install": "ప్లగిన్‌ను ఇన్‌స్టాల్ చేయి",
"uninstall": "అన్‌ఇన్‌స్టాల్ చేయి",
"uninstallConfirm": "\"{{name}}\"ను అన్‌ఇన్‌స్టాల్ చేయాలా? ఇది దాని ఫైళ్లను తొలగిస్తుంది.",
- "engineSwitchHint": "సెట్టింగ్‌లలో దీన్ని యాక్టివ్ ఇంజిన్‌గా సెట్ చేసి, ఆపై రీస్టార్ట్ చేయండి",
"empty": {
"title": "ఎలాంటి ప్లగిన్స్ కనుగొనబడలేదు",
"description": "OpenWA కార్యాచరణను విస్తరించడానికి ప్లగిన్లను ఇన్‌స్టాల్ చేయండి"
},
"config": {
"title": "{{name}} కాన్ఫిగర్ చేయి",
- "restartNotice": "మార్పులు అమలులోకి రావడానికి సర్వర్ రీస్టార్ట్ అవసరం",
- "engineType": "ఇంజిన్ రకం",
- "headless": "హెడ్‌లెస్ మోడ్",
- "headlessDesc": "కనిపించే UI లేకుండా బ్రౌజర్‌ను రన్ చేయి (ప్రొడక్షన్ కోసం సిఫార్సు చేయబడింది)",
- "sessionDataPath": "సెషన్ డేటా పాత్",
- "browserArgs": "బ్రౌజర్ ఆర్గుమెంట్స్",
"noOptions": "ఈ ప్లగిన్ కోసం ఎలాంటి కాన్ఫిగరేషన్ ఆప్షన్లు అందుబాటులో లేవు",
"uiHandshakeError": "ప్లగిన్ కాన్ఫిగరేషన్ UI ప్రారంభం కాలేదు. అందుబాటులో ఉంటే దిగువ స్కీమా ఫారమ్‌ను ఉపయోగించండి.",
"save": "కాన్ఫిగరేషన్‌ను సేవ్ చేయి",
@@ -748,7 +710,6 @@
"tabSessions": "సెషన్‌లు"
},
"rail": {
- "engine": "యాక్టివ్ ఇంజిన్",
"enabled": "ప్రారంభించబడింది",
"installed": "ఇన్‌స్టాల్ చేయబడింది",
"active": "యాక్టివ్ ప్లగిన్స్",
diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.json
index d96c60493..1bd263823 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -63,7 +63,7 @@
"label": "主题:{{value}}",
"appearance": "外观",
"mode": "模式",
- "palette": "调色板"
+ "toggleTo": "切换到{{value}}"
},
"nav": {
"dashboard": "仪表盘",
@@ -566,29 +566,6 @@
"subtitle": "配置服务器、数据库、缓存、存储和引擎设置",
"saveConfig": "保存配置",
"saving": "正在保存...",
- "server": {
- "title": "服务器配置",
- "production": "生产",
- "development": "开发",
- "environment": "环境",
- "domain": "域名",
- "apiPort": "API 端口",
- "dashboardPort": "仪表盘端口",
- "corsOrigins": "CORS 来源",
- "corsPlaceholder": "* 或用逗号分隔的来源",
- "publicApiUrl": "公共 API URL(可选)",
- "publicDashboardUrl": "公共仪表盘 URL(可选)"
- },
- "webhook": {
- "title": "Webhook 和速率限制",
- "settings": "Webhook 设置",
- "timeout": "超时(毫秒)",
- "maxRetries": "最大重试次数",
- "retryDelay": "重试延迟(毫秒)",
- "rateLimit": "速率限制",
- "window": "时间窗口(秒)",
- "maxReq": "每个窗口最大请求数"
- },
"database": {
"title": "数据库配置",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "WhatsApp 引擎",
- "subtitle": "选择并配置 WhatsApp 连接引擎。",
"builtIn": "内置",
"headless": "无头模式",
"headlessDesc": "在没有可见界面的情况下运行浏览器(推荐用于生产环境)。",
@@ -711,35 +687,21 @@
"title": "插件",
"subtitle": "安装、配置和管理扩展",
"refresh": "刷新",
- "engineCard": "当前 WhatsApp 引擎",
- "running": "运行中",
- "supportedFeatures": "支持的功能:",
"builtIn": "内置",
"noDescription": "没有可用描述",
- "required": "必需",
- "active": "活跃",
- "activate": "激活",
"enable": "启用",
"disable": "禁用",
"healthCheck": "健康检查",
"configure": "配置",
- "available": "可用",
"install": "安装插件",
"uninstall": "卸载",
"uninstallConfirm": "卸载“{{name}}”?这将删除其文件。",
- "engineSwitchHint": "在设置中将其设为活动引擎,然后重启",
"empty": {
"title": "未找到插件",
"description": "安装插件以扩展 OpenWA 功能"
},
"config": {
"title": "配置 {{name}}",
- "restartNotice": "更改需要重启服务器后才会生效",
- "engineType": "引擎类型",
- "headless": "无头模式",
- "headlessDesc": "运行不显示界面的浏览器(推荐用于生产环境)",
- "sessionDataPath": "会话数据路径",
- "browserArgs": "浏览器参数",
"noOptions": "此插件没有可用配置项",
"uiHandshakeError": "插件配置界面未初始化。如有可用的架构表单,请使用下方表单。",
"save": "保存配置",
@@ -748,7 +710,6 @@
"tabSessions": "会话"
},
"rail": {
- "engine": "活动引擎",
"enabled": "已启用",
"installed": "已安装",
"active": "活跃插件",
diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.json
index d6b769363..cd5ae4be0 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -63,7 +63,7 @@
"label": "主題:{{value}}",
"appearance": "外觀",
"mode": "模式",
- "palette": "調色板"
+ "toggleTo": "切換到{{value}}"
},
"nav": {
"dashboard": "控制面板",
@@ -566,29 +566,6 @@
"subtitle": "設定伺服器、資料庫、快取、儲存空間和引擎設定",
"saveConfig": "儲存設定",
"saving": "正在儲存...",
- "server": {
- "title": "伺服器設定",
- "production": "生產",
- "development": "開發",
- "environment": "環境",
- "domain": "網域",
- "apiPort": "API 連接埠",
- "dashboardPort": "控制面板連接埠",
- "corsOrigins": "CORS 來源",
- "corsPlaceholder": "* 或以逗號分隔的來源",
- "publicApiUrl": "公開 API URL(選填)",
- "publicDashboardUrl": "公開控制面板 URL(選填)"
- },
- "webhook": {
- "title": "Webhook 及速率限制",
- "settings": "Webhook 設定",
- "timeout": "逾時(毫秒)",
- "maxRetries": "最大重試次數",
- "retryDelay": "重試延遲(毫秒)",
- "rateLimit": "速率限制",
- "window": "時間視窗(秒)",
- "maxReq": "每個視窗最大請求數"
- },
"database": {
"title": "資料庫設定",
"sqlite": "SQLite",
@@ -611,7 +588,6 @@
},
"engine": {
"title": "WhatsApp 引擎",
- "subtitle": "選擇並設定 WhatsApp 連線引擎。",
"builtIn": "內置",
"headless": "無頭模式",
"headlessDesc": "在沒有可見介面的情況下執行瀏覽器(建議用於生產環境)。",
@@ -711,35 +687,21 @@
"title": "外掛",
"subtitle": "安裝、設定和管理擴充功能",
"refresh": "重新整理",
- "engineCard": "目前 WhatsApp 引擎",
- "running": "執行中",
- "supportedFeatures": "支援功能:",
"builtIn": "內置",
"noDescription": "沒有可用描述",
- "required": "必需",
- "active": "活躍",
- "activate": "啟用",
"enable": "啟用",
"disable": "停用",
"healthCheck": "健康檢查",
"configure": "設定",
- "available": "可用",
"install": "安裝外掛",
"uninstall": "解除安裝",
"uninstallConfirm": "解除安裝「{{name}}」?此操作會刪除其檔案。",
- "engineSwitchHint": "在「設定」中設為使用中的引擎,然後重新啟動",
"empty": {
"title": "找不到外掛",
"description": "安裝外掛以擴展 OpenWA 功能"
},
"config": {
"title": "設定 {{name}}",
- "restartNotice": "變更需要重新啟動伺服器後才會生效",
- "engineType": "引擎類型",
- "headless": "無頭模式",
- "headlessDesc": "執行不顯示介面的瀏覽器(建議用於生產環境)",
- "sessionDataPath": "工作階段資料路徑",
- "browserArgs": "瀏覽器參數",
"noOptions": "此外掛沒有可用設定選項",
"uiHandshakeError": "外掛設定介面未初始化。如有可用的結構表單,請使用下方表單。",
"save": "儲存設定",
@@ -748,7 +710,6 @@
"tabSessions": "工作階段"
},
"rail": {
- "engine": "使用中的引擎",
"enabled": "已啟用",
"installed": "已安裝",
"active": "活躍外掛",
diff --git a/dashboard/src/index.css b/dashboard/src/index.css
index 63f37f4ee..275ae8404 100644
--- a/dashboard/src/index.css
+++ b/dashboard/src/index.css
@@ -390,10 +390,6 @@ code {
text-align: left;
}
-[dir='rtl'] .page-header__top {
- flex-direction: row-reverse;
-}
-
/* Toast container — slide in from the opposite side */
[dir='rtl'] .toast-container {
right: auto;
diff --git a/dashboard/src/main.tsx b/dashboard/src/main.tsx
index 0a27bc376..a4987a48d 100644
--- a/dashboard/src/main.tsx
+++ b/dashboard/src/main.tsx
@@ -1,11 +1,19 @@
-import { StrictMode } from 'react'
-import { createRoot } from 'react-dom/client'
-import './i18n'
-import './index.css'
-import App from './App.tsx'
+import { StrictMode } from 'react';
+import { createRoot } from 'react-dom/client';
+import './i18n';
+import './index.css';
+import App from './App.tsx';
+
+// Apply the stored theme BEFORE first paint: useTheme() only runs inside Layout, so standalone
+// routes (Login) otherwise flash the OS theme on reload even when the user explicitly picked one.
+// Mirrors applyTheme: an explicit choice sets data-theme; system/absent leaves it to the media query.
+const storedTheme = localStorage.getItem('openwa_theme');
+if (storedTheme === 'light' || storedTheme === 'dark') {
+ document.documentElement.setAttribute('data-theme', storedTheme);
+}
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
-)
+);
diff --git a/dashboard/src/pages/ApiKeys.css b/dashboard/src/pages/ApiKeys.css
index 1a4cd5c57..957e33586 100644
--- a/dashboard/src/pages/ApiKeys.css
+++ b/dashboard/src/pages/ApiKeys.css
@@ -1,22 +1,16 @@
-.api-keys-page{
+.api-keys-page {
padding: 2rem;
width: 100%;
box-sizing: border-box;
}
-.api-keys-page .page-header{
+.api-keys-page .page-header {
margin-bottom: 2rem;
}
-.api-keys-page .header-content{
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
/* H1 inherited from global */
-.api-keys-page .btn-primary{
+.api-keys-page .btn-primary {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -31,17 +25,17 @@
transition: background 0.2s;
}
-.api-keys-page .btn-primary:hover{
+.api-keys-page .btn-primary:hover {
background: var(--primary-hover);
}
-.api-keys-page .api-keys-content{
+.api-keys-page .api-keys-content {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
-.api-keys-page .keys-table-container{
+.api-keys-page .keys-table-container {
background: var(--bg-white);
border-radius: 12px;
box-shadow: var(--shadow-sm);
@@ -50,14 +44,14 @@
overflow-x: auto;
}
-.api-keys-page .keys-table{
+.api-keys-page .keys-table {
width: 100%;
font-size: 0.875rem;
border-collapse: collapse;
}
/* Table header and row styling */
-.api-keys-page .keys-table thead tr.table-row.header th{
+.api-keys-page .keys-table thead tr.table-row.header th {
background: var(--bg-light);
font-size: 0.7rem;
font-weight: 700;
@@ -69,41 +63,41 @@
text-align: left;
}
-.api-keys-page .keys-table tbody tr.table-row td{
+.api-keys-page .keys-table tbody tr.table-row td {
padding: 1.125rem 1.5rem;
border-bottom: 1px solid var(--border);
vertical-align: middle;
}
-.api-keys-page .keys-table tbody tr.table-row:last-child td{
+.api-keys-page .keys-table tbody tr.table-row:last-child td {
border-bottom: none;
}
-.api-keys-page .keys-table tbody tr.table-row:hover{
+.api-keys-page .keys-table tbody tr.table-row:hover {
background: rgba(37, 211, 102, 0.05);
}
-.api-keys-page .keys-table tbody tr.table-row:nth-child(even){
+.api-keys-page .keys-table tbody tr.table-row:nth-child(even) {
background: rgba(148, 163, 184, 0.08);
}
-.api-keys-page .keys-table tbody tr.table-row:nth-child(even):hover{
+.api-keys-page .keys-table tbody tr.table-row:nth-child(even):hover {
background: rgba(37, 211, 102, 0.05);
}
-.api-keys-page .name-cell{
+.api-keys-page .name-cell {
font-weight: 500;
color: var(--text-primary);
white-space: nowrap;
}
-.api-keys-page .key-cell{
+.api-keys-page .key-cell {
display: flex;
align-items: center;
gap: 0.5rem;
}
-.api-keys-page .key-cell code{
+.api-keys-page .key-cell code {
font-size: 0.8125rem;
color: var(--text-secondary);
background: var(--bg-light);
@@ -113,7 +107,7 @@
white-space: nowrap;
}
-.api-keys-page .icon-btn-sm{
+.api-keys-page .icon-btn-sm {
padding: 0.25rem;
background: transparent;
border: none;
@@ -123,17 +117,11 @@
flex-shrink: 0;
}
-.api-keys-page .icon-btn-sm:hover{
+.api-keys-page .icon-btn-sm:hover {
color: var(--text-primary);
}
-.api-keys-page .permissions-cell{
- display: flex;
- flex-wrap: wrap;
- gap: 0.25rem;
-}
-
-.api-keys-page .permission-badge{
+.api-keys-page .permission-badge {
font-size: 0.6875rem;
padding: 0.25rem 0.5rem;
background: rgba(59, 130, 246, 0.12);
@@ -143,25 +131,18 @@
white-space: nowrap;
}
-.api-keys-page .permission-badge:first-child:last-child{
+.api-keys-page .permission-badge:first-child:last-child {
background: rgba(37, 211, 102, 0.1);
color: var(--primary);
}
-.api-keys-page .rate-limit{
- font-family: monospace;
- font-size: 0.8125rem;
- color: var(--text-secondary);
- white-space: nowrap;
-}
-
-.api-keys-page .actions-cell{
+.api-keys-page .actions-cell {
display: flex;
gap: 0.25rem;
justify-content: flex-end;
}
-.api-keys-page .icon-btn{
+.api-keys-page .icon-btn {
padding: 0.5rem;
background: transparent;
border: 1px solid var(--border);
@@ -172,18 +153,18 @@
flex-shrink: 0;
}
-.api-keys-page .icon-btn:hover{
+.api-keys-page .icon-btn:hover {
background: var(--bg-light);
color: var(--text-primary);
}
-.api-keys-page .icon-btn.danger:hover{
+.api-keys-page .icon-btn.danger:hover {
background: rgba(239, 68, 68, 0.12);
border-color: rgba(239, 68, 68, 0.3);
color: var(--error);
}
-.api-keys-page .permissions-reference{
+.api-keys-page .permissions-reference {
background: var(--bg-white);
border-radius: 12px;
padding: 1.5rem;
@@ -191,18 +172,18 @@
border: 1px solid var(--border);
}
-.api-keys-page .permissions-reference h3{
+.api-keys-page .permissions-reference h3 {
/* Inherits from H3 */
margin-bottom: 1rem;
}
-.api-keys-page .permissions-list{
+.api-keys-page .permissions-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 0.75rem;
}
-.api-keys-page .perm-item{
+.api-keys-page .perm-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
@@ -211,7 +192,7 @@
border-radius: var(--radius);
}
-.api-keys-page .perm-item code{
+.api-keys-page .perm-item code {
font-size: 0.8125rem;
color: var(--primary);
background: rgba(37, 211, 102, 0.1);
@@ -220,13 +201,13 @@
width: fit-content;
}
-.api-keys-page .perm-item span{
+.api-keys-page .perm-item span {
font-size: 0.75rem;
color: var(--text-secondary);
}
/* Empty Table State */
-.api-keys-page .empty-table-state{
+.api-keys-page .empty-table-state {
display: flex;
flex-direction: column;
align-items: center;
@@ -236,41 +217,41 @@
color: var(--text-muted);
}
-.api-keys-page .empty-table-state svg{
+.api-keys-page .empty-table-state svg {
margin-bottom: 1rem;
opacity: 0.4;
color: var(--text-muted);
}
-.api-keys-page .empty-table-state h3{
+.api-keys-page .empty-table-state h3 {
font-size: 1.125rem;
font-weight: 600;
color: var(--text-secondary);
margin: 0 0 0.5rem;
}
-.api-keys-page .empty-table-state p{
+.api-keys-page .empty-table-state p {
margin: 0;
font-size: 0.875rem;
max-width: 300px;
}
/* Confirmation Modal Styles */
-.api-keys-page .confirm-modal{
+.api-keys-page .confirm-modal {
max-width: 400px;
}
-.api-keys-page .confirm-icon-wrapper{
+.api-keys-page .confirm-icon-wrapper {
display: flex;
justify-content: center;
margin-bottom: 1rem;
}
-.api-keys-page .confirm-warning-icon{
+.api-keys-page .confirm-warning-icon {
color: var(--warning);
}
-.api-keys-page .confirm-message{
+.api-keys-page .confirm-message {
text-align: center;
color: var(--text-secondary);
font-size: 0.9375rem;
@@ -278,11 +259,11 @@
margin: 0;
}
-.api-keys-page .confirm-message strong{
+.api-keys-page .confirm-message strong {
color: var(--text-primary);
}
-.api-keys-page .btn-danger{
+.api-keys-page .btn-danger {
padding: 0.75rem 1.25rem;
background: var(--error);
color: white;
@@ -294,29 +275,41 @@
transition: background 0.2s;
}
-.api-keys-page .btn-danger:hover{
+.api-keys-page .btn-danger:hover {
background: #b91c1c;
}
/* Mobile Responsive */
+/* Status badges — must apply on DESKTOP too (they were stranded inside the mobile media query,
+ leaving every Active/Revoked badge unstyled on wide screens). */
+.api-keys-page .status-badge {
+ font-size: 0.6875rem;
+ padding: 0.25rem 0.5rem;
+ border-radius: 9999px;
+ font-weight: 600;
+}
+
+.api-keys-page .status-badge.active {
+ background: rgba(37, 211, 102, 0.1);
+ color: var(--primary);
+}
+
+.api-keys-page .status-badge.inactive {
+ background: rgba(239, 68, 68, 0.12);
+ color: var(--error);
+}
+
@media (max-width: 768px) {
- .api-keys-page{
+ .api-keys-page {
padding: 1rem;
}
- /* Header adjustments for mobile */
- .api-keys-page .header-content{
- flex-direction: column;
- align-items: stretch;
- gap: 1rem;
- }
-
- .api-keys-page .btn-primary{
+ .api-keys-page .btn-primary {
width: 100%;
justify-content: center;
}
- .api-keys-page .keys-table-container{
+ .api-keys-page .keys-table-container {
overflow-x: visible;
border: none;
background: transparent;
@@ -324,21 +317,21 @@
}
/* Switch to card layout on mobile */
- .api-keys-page .keys-table{
+ .api-keys-page .keys-table {
display: block;
}
- .api-keys-page .keys-table thead{
+ .api-keys-page .keys-table thead {
display: none;
}
- .api-keys-page .keys-table tbody{
+ .api-keys-page .keys-table tbody {
display: flex;
flex-direction: column;
gap: 1rem;
}
- .api-keys-page .keys-table tbody tr.table-row{
+ .api-keys-page .keys-table tbody tr.table-row {
display: flex;
flex-direction: column;
gap: 0.75rem;
@@ -349,22 +342,24 @@
box-shadow: var(--shadow-sm);
}
- .api-keys-page .keys-table tbody tr.table-row:hover, .api-keys-page .keys-table tbody tr.table-row:nth-child(even), .api-keys-page .keys-table tbody tr.table-row:nth-child(even):hover{
+ .api-keys-page .keys-table tbody tr.table-row:hover,
+ .api-keys-page .keys-table tbody tr.table-row:nth-child(even),
+ .api-keys-page .keys-table tbody tr.table-row:nth-child(even):hover {
background: var(--bg-white);
}
- .api-keys-page .keys-table tbody tr.table-row td{
+ .api-keys-page .keys-table tbody tr.table-row td {
padding: 0;
border-bottom: none;
display: block;
}
/* Name cell - prominent at top */
- .api-keys-page .keys-table tbody tr.table-row td:first-child{
+ .api-keys-page .keys-table tbody tr.table-row td:first-child {
order: 1;
}
- .api-keys-page .keys-table tbody tr.table-row td:first-child .name-cell{
+ .api-keys-page .keys-table tbody tr.table-row td:first-child .name-cell {
font-size: 1.125rem;
font-weight: 600;
display: block;
@@ -372,80 +367,63 @@
}
/* Key cell */
- .api-keys-page .keys-table tbody tr.table-row td:nth-child(2){
+ .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) {
order: 2;
}
- .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) .key-cell{
+ .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) .key-cell {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
- .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) .key-cell code{
+ .api-keys-page .keys-table tbody tr.table-row td:nth-child(2) .key-cell code {
font-size: 0.75rem;
word-break: break-all;
white-space: normal;
}
/* Role & Status - wrapper for badges */
- .api-keys-page .keys-table tbody tr.table-row td:nth-child(3), .api-keys-page .keys-table tbody tr.table-row td:nth-child(4){
+ .api-keys-page .keys-table tbody tr.table-row td:nth-child(3),
+ .api-keys-page .keys-table tbody tr.table-row td:nth-child(4) {
display: inline-block;
order: 3;
}
- .api-keys-page .keys-table tbody tr.table-row td:nth-child(3){
+ .api-keys-page .keys-table tbody tr.table-row td:nth-child(3) {
margin-right: 0.5rem;
}
- /* Status badges styling */
- .api-keys-page .status-badge{
- font-size: 0.6875rem;
- padding: 0.25rem 0.5rem;
- border-radius: 9999px;
- font-weight: 600;
- }
-
- .api-keys-page .status-badge.active{
- background: rgba(37, 211, 102, 0.1);
- color: var(--primary);
- }
-
- .api-keys-page .status-badge.inactive{
- background: rgba(239, 68, 68, 0.12);
- color: var(--error);
- }
-
/* Actions cell - bottom with separator */
- .api-keys-page .keys-table tbody tr.table-row td:last-child{
+ .api-keys-page .keys-table tbody tr.table-row td:last-child {
order: 5;
margin-top: 0.5rem;
padding-top: 0.75rem;
border-top: 1px solid var(--border);
}
- .api-keys-page .keys-table tbody tr.table-row td:last-child .actions-cell{
+ .api-keys-page .keys-table tbody tr.table-row td:last-child .actions-cell {
justify-content: flex-start;
gap: 0.5rem;
}
/* Permissions reference mobile */
- .api-keys-page .permissions-reference{
+ .api-keys-page .permissions-reference {
padding: 1rem;
}
- .api-keys-page .permissions-reference h3{
+ .api-keys-page .permissions-reference h3 {
font-size: 0.9375rem;
}
}
@media (max-width: 480px) {
- .api-keys-page .permissions-list{
+ .api-keys-page .permissions-list {
grid-template-columns: 1fr;
}
- .api-keys-page{
+ .api-keys-page {
padding: 0.75rem;
}
}
diff --git a/dashboard/src/pages/Chats.css b/dashboard/src/pages/Chats.css
index 2e3ce2d86..5c5664d4a 100644
--- a/dashboard/src/pages/Chats.css
+++ b/dashboard/src/pages/Chats.css
@@ -1,4 +1,4 @@
-.chats-page{
+.chats-page {
padding: 2rem;
width: 100%;
height: calc(100vh - 4rem);
@@ -7,7 +7,7 @@
box-sizing: border-box;
}
-.chats-page .chats-layout{
+.chats-page .chats-layout {
display: flex;
flex: 1;
background: var(--bg-white);
@@ -22,7 +22,7 @@
/* =============================================================================
SIDEBAR: Left Column
============================================================================= */
-.chats-page .chats-sidebar{
+.chats-page .chats-sidebar {
width: 320px;
border-right: 1px solid var(--border);
display: flex;
@@ -31,7 +31,7 @@
flex-shrink: 0;
}
-.chats-page .sidebar-header-box{
+.chats-page .sidebar-header-box {
padding: 1.25rem;
border-bottom: 1px solid var(--border);
display: flex;
@@ -39,13 +39,13 @@
gap: 1rem;
}
-.chats-page .session-select-group{
+.chats-page .session-select-group {
display: flex;
flex-direction: column;
gap: 0.375rem;
}
-.chats-page .session-selector{
+.chats-page .session-selector {
width: 100%;
padding: 0.625rem 0.75rem;
border: 1px solid var(--border);
@@ -59,13 +59,13 @@
transition: all 0.2s;
}
-.chats-page .session-selector:focus{
+.chats-page .session-selector:focus {
border-color: var(--primary);
background: var(--bg-white);
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
-.chats-page .chat-search-input{
+.chats-page .chat-search-input {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -75,12 +75,12 @@
border-radius: var(--radius, 8px);
}
-.chats-page .chat-search-input svg{
+.chats-page .chat-search-input svg {
color: var(--text-muted);
flex-shrink: 0;
}
-.chats-page .chat-search-input input{
+.chats-page .chat-search-input input {
flex: 1;
border: none;
background: none;
@@ -89,7 +89,7 @@
outline: none;
}
-.chats-page .chats-list{
+.chats-page .chats-list {
flex: 1;
overflow-y: auto;
display: flex;
@@ -97,20 +97,24 @@
}
/* Custom Scrollbar for chats list */
-.chats-page .chats-list::-webkit-scrollbar, .chats-page .room-messages::-webkit-scrollbar{
+.chats-page .chats-list::-webkit-scrollbar,
+.chats-page .room-messages::-webkit-scrollbar {
width: 6px;
}
-.chats-page .chats-list::-webkit-scrollbar-thumb, .chats-page .room-messages::-webkit-scrollbar-thumb{
+.chats-page .chats-list::-webkit-scrollbar-thumb,
+.chats-page .room-messages::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
-.chats-page .chats-list::-webkit-scrollbar-track, .chats-page .room-messages::-webkit-scrollbar-track{
+.chats-page .chats-list::-webkit-scrollbar-track,
+.chats-page .room-messages::-webkit-scrollbar-track {
background: transparent;
}
-.chats-page .chats-list-loading, .chats-page .chats-list-empty{
+.chats-page .chats-list-loading,
+.chats-page .chats-list-empty {
display: flex;
flex-direction: column;
align-items: center;
@@ -121,7 +125,7 @@
gap: 0.5rem;
}
-.chats-page .chat-item-card{
+.chats-page .chat-item-card {
display: flex;
align-items: center;
gap: 0.75rem;
@@ -132,15 +136,15 @@
user-select: none;
}
-.chats-page .chat-item-card:hover{
+.chats-page .chat-item-card:hover {
background: var(--bg-light);
}
-.chats-page .chat-item-card.active{
+.chats-page .chat-item-card.active {
background: rgba(34, 197, 94, 0.08);
}
-.chats-page .chat-avatar{
+.chats-page .chat-avatar {
width: 44px;
height: 44px;
border-radius: 50%;
@@ -153,13 +157,13 @@
flex-shrink: 0;
}
-.chats-page .chat-item-card.active .chat-avatar{
+.chats-page .chat-item-card.active .chat-avatar {
background: var(--bg-white);
color: var(--primary);
border-color: rgba(34, 197, 94, 0.3);
}
-.chats-page .chat-item-info{
+.chats-page .chat-item-info {
flex: 1;
display: flex;
flex-direction: column;
@@ -167,13 +171,13 @@
min-width: 0; /* Ensures text truncation works */
}
-.chats-page .chat-item-top{
+.chats-page .chat-item-top {
display: flex;
justify-content: space-between;
align-items: baseline;
}
-.chats-page .chat-item-name{
+.chats-page .chat-item-name {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-primary);
@@ -182,19 +186,19 @@
text-overflow: ellipsis;
}
-.chats-page .chat-item-time{
+.chats-page .chat-item-time {
font-size: 0.75rem;
color: var(--text-muted);
- white-shrink: 0;
+ flex-shrink: 0;
}
-.chats-page .chat-item-bottom{
+.chats-page .chat-item-bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
-.chats-page .chat-item-snippet{
+.chats-page .chat-item-snippet {
font-size: 0.8125rem;
color: var(--text-muted);
white-space: nowrap;
@@ -203,12 +207,12 @@
max-width: 180px;
}
-.chats-page .chat-item-snippet .no-message{
+.chats-page .chat-item-snippet .no-message {
font-style: italic;
opacity: 0.6;
}
-.chats-page .chat-unread-badge{
+.chats-page .chat-unread-badge {
background: var(--primary);
color: white;
font-size: 0.75rem;
@@ -223,14 +227,14 @@
/* =============================================================================
CHAT ROOM: Right Column
============================================================================= */
-.chats-page .chats-room{
+.chats-page .chats-room {
flex: 1;
display: flex;
flex-direction: column;
background: var(--bg-light);
}
-.chats-page .chats-room-placeholder{
+.chats-page .chats-room-placeholder {
flex: 1;
display: flex;
flex-direction: column;
@@ -241,13 +245,13 @@
color: var(--text-muted);
}
-.chats-page .placeholder-icon{
+.chats-page .placeholder-icon {
margin-bottom: 1.5rem;
opacity: 0.3;
color: var(--text-secondary);
}
-.chats-page .chats-room-placeholder h2{
+.chats-page .chats-room-placeholder h2 {
font-size: 1.25rem;
font-weight: 600;
color: var(--text-primary);
@@ -257,20 +261,20 @@
margin: 0 0 0.375rem;
}
-.chats-page .chats-room-placeholder p{
+.chats-page .chats-room-placeholder p {
font-size: 0.9375rem;
max-width: 380px;
margin: 0;
}
-.chats-page .room-container{
+.chats-page .room-container {
flex: 1;
display: flex;
flex-direction: column;
height: 100%;
}
-.chats-page .room-header{
+.chats-page .room-header {
height: 70px;
background: var(--bg-white);
border-bottom: 1px solid var(--border);
@@ -282,7 +286,7 @@
}
/* Back-to-list control: only needed in the single-pane mobile layout; hidden on the two-pane desktop. */
-.chats-page .room-back{
+.chats-page .room-back {
display: none;
align-items: center;
justify-content: center;
@@ -300,12 +304,12 @@
flex-shrink: 0;
}
-.chats-page .room-back:hover{
+.chats-page .room-back:hover {
background: var(--bg-light);
color: var(--text-primary);
}
-.chats-page .room-avatar{
+.chats-page .room-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
@@ -317,20 +321,20 @@
color: var(--text-secondary);
}
-.chats-page .room-contact-info h3{
+.chats-page .room-contact-info h3 {
font-size: 1rem;
font-weight: 600;
color: var(--text-primary);
margin: 0;
}
-.chats-page .room-contact-info span{
+.chats-page .room-contact-info span {
font-size: 0.75rem;
color: var(--text-muted);
font-family: monospace;
}
-.chats-page .room-messages{
+.chats-page .room-messages {
flex: 1;
padding: 1.5rem;
overflow-y: auto;
@@ -341,7 +345,7 @@
background-size: 24px 24px;
}
-.chats-page .messages-loading{
+.chats-page .messages-loading {
display: flex;
flex-direction: column;
align-items: center;
@@ -352,7 +356,7 @@
gap: 0.75rem;
}
-.chats-page .messages-empty{
+.chats-page .messages-empty {
display: flex;
flex-direction: column;
align-items: center;
@@ -365,20 +369,20 @@
padding: 2rem;
}
-.chats-page .message-bubble-wrapper{
+.chats-page .message-bubble-wrapper {
display: flex;
width: 100%;
}
-.chats-page .message-bubble-wrapper.incoming{
+.chats-page .message-bubble-wrapper.incoming {
justify-content: flex-start;
}
-.chats-page .message-bubble-wrapper.outgoing{
+.chats-page .message-bubble-wrapper.outgoing {
justify-content: flex-end;
}
-.chats-page .message-bubble{
+.chats-page .message-bubble {
max-width: 100%;
padding: 0.625rem 0.875rem 0.375rem;
border-radius: 12px;
@@ -388,31 +392,31 @@
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
-.chats-page .message-bubble.incoming{
+.chats-page .message-bubble.incoming {
background: var(--bg-white);
color: var(--text-primary);
border-bottom-left-radius: 2px;
border: 1px solid var(--border);
}
-.chats-page .message-bubble.outgoing{
+.chats-page .message-bubble.outgoing {
background: #d9fdd3; /* Soft WhatsApp Green */
color: #111b21;
border-bottom-right-radius: 2px;
}
/* Dark theme outgoing chat bubble override */
-.chats-page [data-theme='dark'] .message-bubble.outgoing{
+[data-theme='dark'] .chats-page .message-bubble.outgoing {
background: #005c4b; /* Dark WhatsApp Green */
color: #e9edef;
}
-.chats-page .message-text{
+.chats-page .message-text {
word-break: break-word;
white-space: pre-wrap;
}
-.chats-page .message-meta{
+.chats-page .message-meta {
display: flex;
align-items: center;
justify-content: flex-end;
@@ -420,36 +424,36 @@
margin-top: 0.25rem;
}
-.chats-page .message-time{
+.chats-page .message-time {
font-size: 0.6875rem;
color: var(--text-muted);
}
-.chats-page .message-status-icon{
+.chats-page .message-status-icon {
font-size: 0.75rem;
}
-.chats-page .message-status-icon.read{
+.chats-page .message-status-icon.read {
color: #53bdeb; /* WhatsApp blue checks */
}
/* =============================================================================
INPUT BAR: Bottom Footer
============================================================================= */
-.chats-page .room-input-footer{
+.chats-page .room-input-footer {
background: var(--bg-white);
border-top: 1px solid var(--border);
padding: 1rem 1.5rem;
box-sizing: border-box;
}
-.chats-page .input-form{
+.chats-page .input-form {
display: flex;
gap: 0.75rem;
align-items: center;
}
-.chats-page .message-text-input{
+.chats-page .message-text-input {
flex: 1;
padding: 0.75rem 1rem;
border: 1px solid var(--border);
@@ -462,36 +466,41 @@
box-sizing: border-box;
}
-.chats-page .message-text-input:focus{
+.chats-page .message-text-input:focus {
border-color: var(--primary);
background: var(--bg-white);
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
-.chats-page .btn-send-message{
+.chats-page .btn-send-message {
display: flex;
align-items: center;
justify-content: center;
- width: 44px;
- height: 44px;
+ width: 48px;
+ height: 48px;
background: var(--primary);
border: none;
border-radius: 50%;
color: white;
cursor: pointer;
- transition: background 0.2s, transform 0.1s;
+ transition:
+ background 0.2s,
+ transform 0.1s;
flex-shrink: 0;
box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
-.chats-page .btn-send-message:hover:not(:disabled){
+.chats-page .btn-send-message:hover:not(:disabled) {
background: var(--primary-hover);
transform: scale(1.05);
}
-.chats-page .btn-send-message:disabled{
- background: var(--border);
- color: var(--text-muted);
+.chats-page .btn-send-message:disabled {
+ /* Keep the brand silhouette readable while clearly inactive — a bare gray-on-gray glyph
+ reads as "no button here" rather than "send, disabled". */
+ background: var(--primary);
+ color: #fff;
+ opacity: 0.55;
cursor: not-allowed;
box-shadow: none;
}
@@ -499,7 +508,8 @@
/* =============================================================================
GENERAL CHATS STYLES & ERROR STATES
============================================================================= */
-.chats-page .chats-loading-container, .chats-page .chats-error-state{
+.chats-page .chats-loading-container,
+.chats-page .chats-error-state {
display: flex;
flex-direction: column;
align-items: center;
@@ -515,25 +525,25 @@
flex: 1;
}
-.chats-page .chats-error-state h3{
+.chats-page .chats-error-state h3 {
font-size: 1.25rem;
margin: 1rem 0 0.5rem;
color: var(--text-primary);
}
-.chats-page .chats-error-state p{
+.chats-page .chats-error-state p {
font-size: 0.9375rem;
max-width: 450px;
margin: 0;
color: var(--text-muted);
}
-.chats-page .text-warn{
+.chats-page .text-warn {
color: #ea580c;
}
/* Real-time connection-lost banner */
-.chats-page .chats-reconnect-banner{
+.chats-page .chats-reconnect-banner {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -545,14 +555,14 @@
font-size: 0.875rem;
}
-.chats-page .chats-reconnect-banner button{
+.chats-page .chats-reconnect-banner button {
margin-left: auto;
}
/* =============================================================================
ATTACHMENT PREVIEW & EMOJI PICKER
============================================================================= */
-.chats-page .btn-input-accessory{
+.chats-page .btn-input-accessory {
background: transparent;
border: none;
color: var(--text-secondary);
@@ -566,17 +576,17 @@
flex-shrink: 0;
}
-.chats-page .btn-input-accessory:hover{
+.chats-page .btn-input-accessory:hover {
background: var(--bg-light);
color: var(--text-primary);
}
-.chats-page .btn-input-accessory.active{
+.chats-page .btn-input-accessory.active {
background: rgba(34, 197, 94, 0.1);
color: var(--primary);
}
-.chats-page .attachment-preview-banner{
+.chats-page .attachment-preview-banner {
background: var(--bg-white);
border-top: 1px solid var(--border);
padding: 0.75rem 1.5rem;
@@ -586,7 +596,7 @@
box-sizing: border-box;
}
-.chats-page .preview-thumbnail{
+.chats-page .preview-thumbnail {
width: 48px;
height: 48px;
object-fit: cover;
@@ -594,7 +604,7 @@
border: 1px solid var(--border);
}
-.chats-page .preview-file-icon{
+.chats-page .preview-file-icon {
width: 48px;
height: 48px;
background: var(--bg-light);
@@ -606,14 +616,14 @@
font-size: 1.5rem;
}
-.chats-page .preview-file-info{
+.chats-page .preview-file-info {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
}
-.chats-page .preview-filename{
+.chats-page .preview-filename {
font-size: 0.875rem;
font-weight: 600;
color: var(--text-primary);
@@ -622,12 +632,12 @@
text-overflow: ellipsis;
}
-.chats-page .preview-filesize{
+.chats-page .preview-filesize {
font-size: 0.75rem;
color: var(--text-muted);
}
-.chats-page .btn-remove-attachment{
+.chats-page .btn-remove-attachment {
background: transparent;
border: none;
color: var(--text-muted);
@@ -640,12 +650,12 @@
transition: all 0.2s;
}
-.chats-page .btn-remove-attachment:hover{
+.chats-page .btn-remove-attachment:hover {
background: rgba(239, 68, 68, 0.12);
color: var(--error);
}
-.chats-page .chats-emoji-picker{
+.chats-page .chats-emoji-picker {
background: var(--bg-white);
border-top: 1px solid var(--border);
padding: 0.75rem 1.5rem;
@@ -654,13 +664,13 @@
overflow-y: auto;
}
-.chats-page .emoji-grid{
+.chats-page .emoji-grid {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
-.chats-page .emoji-btn{
+.chats-page .emoji-btn {
background: transparent;
border: none;
font-size: 1.25rem;
@@ -673,12 +683,12 @@
justify-content: center;
}
-.chats-page .emoji-btn:hover{
+.chats-page .emoji-btn:hover {
background: var(--bg-light);
transform: scale(1.15);
}
-.chats-page .message-bubble.media-type{
+.chats-page .message-bubble.media-type {
border-top-left-radius: 12px;
border-top-right-radius: 12px;
}
@@ -687,42 +697,42 @@
RESPONSIVENESS
============================================================================= */
@media (max-width: 768px) {
- .chats-page{
+ .chats-page {
padding: 1rem;
height: auto;
}
-
- .chats-page .chats-layout{
+
+ .chats-page .chats-layout {
flex-direction: column;
height: calc(100vh - 7rem);
}
/* Single-pane on mobile: the list and the open conversation each take the full panel
instead of being squeezed into one short stacked column. */
- .chats-page .chats-sidebar{
+ .chats-page .chats-sidebar {
width: 100%;
height: 100%;
border-right: none;
}
- .chats-page .chats-room{
+ .chats-page .chats-room {
height: 100%;
}
/* Opening a chat replaces the list with the thread; the back button returns to the list. */
- .chats-page .chats-layout.has-active-chat .chats-sidebar{
+ .chats-page .chats-layout.has-active-chat .chats-sidebar {
display: none;
}
- .chats-page .chats-layout:not(.has-active-chat) .chats-room{
+ .chats-page .chats-layout:not(.has-active-chat) .chats-room {
display: none;
}
- .chats-page .room-back{
+ .chats-page .room-back {
display: inline-flex;
}
- .chats-page .room-header{
+ .chats-page .room-header {
height: 60px;
}
}
@@ -730,7 +740,7 @@
/* =============================================================================
MEDIA RENDERING STYLES
============================================================================= */
-.chats-page .chat-image-media{
+.chats-page .chat-image-media {
max-width: 100%;
max-height: 250px;
border-radius: 8px;
@@ -741,13 +751,13 @@
}
.chats-page .message-media-omitted {
- color: var(--color-text-muted, #888);
+ color: var(--text-muted);
font-style: italic;
font-size: 0.9em;
margin-bottom: 0.25rem;
}
-.chats-page .chat-video-media{
+.chats-page .chat-video-media {
max-width: 100%;
max-height: 250px;
border-radius: 8px;
@@ -755,13 +765,13 @@
margin-bottom: 0.5rem;
}
-.chats-page .chat-audio-media{
+.chats-page .chat-audio-media {
max-width: 100%;
display: block;
margin-bottom: 0.5rem;
}
-.chats-page .chat-document-media{
+.chats-page .chat-document-media {
display: inline-flex;
align-items: center;
gap: 0.5rem;
@@ -778,23 +788,23 @@
word-break: break-all;
}
-.chats-page .chat-document-media:hover{
+.chats-page .chat-document-media:hover {
background: var(--border);
}
-.chats-page [data-theme='dark'] .chat-document-media{
+[data-theme='dark'] .chats-page .chat-document-media {
background: #202c33;
border-color: #2f3b43;
}
-.chats-page .message-bubble.media-type{
+.chats-page .message-bubble.media-type {
padding: 0.5rem;
}
/* =============================================================================
HOVER MENU, REPLIES, REACTIONS, AND DELETIONS
============================================================================= */
-.chats-page .message-bubble-container{
+.chats-page .message-bubble-container {
position: relative;
display: flex;
align-items: center;
@@ -802,16 +812,16 @@
max-width: 70%;
}
-.chats-page .message-bubble-wrapper.outgoing .message-bubble-container{
+.chats-page .message-bubble-wrapper.outgoing .message-bubble-container {
flex-direction: row-reverse;
}
-.chats-page .message-bubble-wrapper.incoming .message-bubble-container{
+.chats-page .message-bubble-wrapper.incoming .message-bubble-container {
flex-direction: row;
}
/* Hover Menu */
-.chats-page .message-actions-menu{
+.chats-page .message-actions-menu {
display: none;
align-items: center;
gap: 0.25rem;
@@ -823,11 +833,11 @@
z-index: 5;
}
-.chats-page .message-bubble-container:hover .message-actions-menu{
+.chats-page .message-bubble-container:hover .message-actions-menu {
display: flex;
}
-.chats-page .action-btn{
+.chats-page .action-btn {
background: transparent;
border: none;
color: var(--text-muted);
@@ -840,22 +850,22 @@
transition: all 0.15s ease;
}
-.chats-page .action-btn:hover{
+.chats-page .action-btn:hover {
background: var(--bg-light);
color: var(--text-primary);
}
-.chats-page .action-btn.delete-btn:hover{
+.chats-page .action-btn.delete-btn:hover {
color: var(--error);
background: rgba(239, 68, 68, 0.12);
}
/* Reaction Quick Popover */
-.chats-page .reaction-trigger-wrapper{
+.chats-page .reaction-trigger-wrapper {
position: relative;
}
-.chats-page .reaction-quick-popover{
+.chats-page .reaction-quick-popover {
display: none;
position: absolute;
bottom: 100%;
@@ -863,7 +873,7 @@
transform: translateX(-50%) translateY(-6px);
background: var(--bg-white);
border: 1px solid var(--border);
- box-shadow: 0 4px 12px rgba(0,0,0,0.15);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
border-radius: 24px;
padding: 0.375rem 0.625rem;
gap: 0.375rem;
@@ -871,7 +881,7 @@
white-space: nowrap;
}
-.chats-page .reaction-quick-popover::after{
+.chats-page .reaction-quick-popover::after {
content: '';
position: absolute;
top: 100%;
@@ -881,11 +891,11 @@
background: transparent;
}
-.chats-page .reaction-trigger-wrapper:hover .reaction-quick-popover{
+.chats-page .reaction-trigger-wrapper:hover .reaction-quick-popover {
display: flex;
}
-.chats-page .reaction-quick-popover button{
+.chats-page .reaction-quick-popover button {
background: transparent;
border: none;
font-size: 1.25rem;
@@ -894,12 +904,12 @@
transition: transform 0.1s ease;
}
-.chats-page .reaction-quick-popover button:hover{
+.chats-page .reaction-quick-popover button:hover {
transform: scale(1.3);
}
/* Reactions Badge */
-.chats-page .message-reactions-badge{
+.chats-page .message-reactions-badge {
position: absolute;
bottom: -12px;
background: var(--bg-white);
@@ -916,26 +926,26 @@
user-select: none;
}
-.chats-page .message-bubble-wrapper.outgoing .message-reactions-badge{
+.chats-page .message-bubble-wrapper.outgoing .message-reactions-badge {
right: 12px;
}
-.chats-page .message-bubble-wrapper.incoming .message-reactions-badge{
+.chats-page .message-bubble-wrapper.incoming .message-reactions-badge {
left: 12px;
}
-.chats-page .reaction-emoji-span{
+.chats-page .reaction-emoji-span {
font-size: 0.8125rem;
}
-.chats-page .reactions-count-span{
+.chats-page .reactions-count-span {
font-weight: 600;
color: var(--text-secondary);
margin-left: 2px;
}
/* Quoted Box inside Bubble */
-.chats-page .message-quote-box{
+.chats-page .message-quote-box {
background: rgba(0, 0, 0, 0.04);
border-left: 4px solid var(--primary);
border-radius: 4px;
@@ -946,16 +956,16 @@
cursor: pointer;
}
-.chats-page .message-bubble.outgoing .message-quote-box{
+.chats-page .message-bubble.outgoing .message-quote-box {
background: rgba(0, 0, 0, 0.05);
border-left-color: #008069;
}
-.chats-page [data-theme='dark'] .message-quote-box{
+[data-theme='dark'] .chats-page .message-quote-box {
background: rgba(255, 255, 255, 0.08);
}
-.chats-page .quote-body{
+.chats-page .quote-body {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -963,7 +973,7 @@
}
/* Replying Preview Banner above Input Footer */
-.chats-page .replying-preview-banner{
+.chats-page .replying-preview-banner {
background: var(--bg-white);
border-top: 1px solid var(--border);
padding: 0.75rem 1.5rem;
@@ -974,7 +984,7 @@
box-sizing: border-box;
}
-.chats-page .replying-preview-content{
+.chats-page .replying-preview-content {
flex: 1;
border-left: 4px solid var(--primary);
padding-left: 0.75rem;
@@ -983,13 +993,13 @@
min-width: 0;
}
-.chats-page .replying-to-title{
+.chats-page .replying-to-title {
font-size: 0.8125rem;
font-weight: 700;
color: var(--primary);
}
-.chats-page .replying-to-body{
+.chats-page .replying-to-body {
font-size: 0.875rem;
color: var(--text-secondary);
white-space: nowrap;
@@ -997,7 +1007,7 @@
text-overflow: ellipsis;
}
-.chats-page .btn-close-reply{
+.chats-page .btn-close-reply {
background: transparent;
border: none;
color: var(--text-muted);
@@ -1010,18 +1020,20 @@
transition: all 0.2s;
}
-.chats-page .btn-close-reply:hover{
+.chats-page .btn-close-reply:hover {
background: var(--bg-light);
color: var(--text-primary);
}
/* Revoked / Deleted message type */
-.chats-page .message-bubble.revoked-type{
+.chats-page .message-bubble.revoked-type {
font-style: italic;
opacity: 0.6;
}
-.chats-page [data-theme='dark'] .message-actions-menu, .chats-page [data-theme='dark'] .reaction-quick-popover, .chats-page [data-theme='dark'] .message-reactions-badge{
+[data-theme='dark'] .chats-page .message-actions-menu,
+[data-theme='dark'] .chats-page .reaction-quick-popover,
+[data-theme='dark'] .chats-page .message-reactions-badge {
background: #202c33;
border-color: #2f3b43;
}
@@ -1029,7 +1041,7 @@
/* Inline code inside a message body. */
.chats-page .message-text code,
.chats-page .quote-body code {
- background: var(--surface-2, rgba(255, 255, 255, 0.08));
+ background: var(--bg-light);
padding: 0.1em 0.35em;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
@@ -1038,7 +1050,7 @@
/* Code block. */
.chats-page .message-text pre {
- background: var(--surface-2, rgba(255, 255, 255, 0.08));
+ background: var(--bg-light);
padding: 0.5em 0.75em;
border-radius: 6px;
margin: 0.25em 0;
@@ -1054,4 +1066,3 @@
.chats-page .chat-image-media {
cursor: zoom-in;
}
-
diff --git a/dashboard/src/pages/Chats.tsx b/dashboard/src/pages/Chats.tsx
index 03d9a963c..338646263 100644
--- a/dashboard/src/pages/Chats.tsx
+++ b/dashboard/src/pages/Chats.tsx
@@ -29,6 +29,7 @@ import {
import {
applyMessageEdit,
mergeDeliveryStatus,
+ mergeOrAppend,
findRevokedIndex,
type ChatMessageView,
} from '../utils/chatMessages';
@@ -38,11 +39,7 @@ import { useRole } from '../hooks/useRole';
import { useToast } from '../components/Toast';
import { PageHeader } from '../components/PageHeader';
import { GlobalSearch } from '../components/GlobalSearch';
-import {
- useChatMessages,
- useChatMessagesActions,
- messagesQueryKey,
-} from '../hooks/useChatMessages';
+import { useChatMessages, useChatMessagesActions, messagesQueryKey } from '../hooks/useChatMessages';
import { useChatScrollPosition } from '../hooks/useChatScrollPosition';
import MessageBody from '../components/chats/MessageBody';
import MediaLightbox, { type LightboxItem } from '../components/chats/MediaLightbox';
@@ -137,11 +134,33 @@ export function Chats() {
// chat has any message (doesn't toggle per append) and covers both the
// first-fetch resolution and a WS-driven first message on a previously-empty
// chat. `loadingMessages` alone would miss the latter case.
- const { containerRef: messagesContainerRef, onMessageAppended } =
- useChatScrollPosition(activeChat?.id ?? null, messages.length > 0);
+ const {
+ containerRef: messagesContainerRef,
+ onMessageAppended,
+ onMediaLoad,
+ } = useChatScrollPosition(activeChat?.id ?? null, messages.length > 0);
// Popular emojis
- const popularEmojis = ['😀', '😂', '👍', '❤️', '🔥', '👏', '🙏', '🎉', '💡', '🤔', '😅', '😍', '😊', '😭', '😎', '😜', '🚀', '✨'];
+ const popularEmojis = [
+ '😀',
+ '😂',
+ '👍',
+ '❤️',
+ '🔥',
+ '👏',
+ '🙏',
+ '🎉',
+ '💡',
+ '🤔',
+ '😅',
+ '😍',
+ '😊',
+ '😭',
+ '😎',
+ '😜',
+ '🚀',
+ '✨',
+ ];
// 1. Fetch available connected sessions on mount
useEffect(() => {
@@ -290,9 +309,7 @@ export function Chats() {
});
for (const [key, list] of caches) {
if (!list) continue;
- const idx = list.findIndex(
- m => m.id === event.messageId || m.waMessageId === event.messageId,
- );
+ const idx = list.findIndex(m => m.id === event.messageId || m.waMessageId === event.messageId);
if (idx === -1) continue;
const target = list[idx];
// Backend now sends the neutral delivery status directly (no engine-specific ack codes).
@@ -318,9 +335,7 @@ export function Chats() {
});
for (const [key, list] of caches) {
if (!list) continue;
- const idx = list.findIndex(
- m => m.id === event.messageId || m.waMessageId === event.messageId,
- );
+ const idx = list.findIndex(m => m.id === event.messageId || m.waMessageId === event.messageId);
if (idx === -1) continue;
const target = list[idx];
const next = list.slice();
@@ -683,21 +698,26 @@ export function Chats() {
// Race guard: the realtime `message.sent` echo can arrive before this response and already
// append the message by its real WA id (the dedup at receive time misses because the
- // optimistic placeholder still carries the temp id). If so, drop the placeholder instead of
- // renaming it — otherwise both the echo and the renamed temp render as duplicate bubbles.
+ // optimistic placeholder still carries the temp id). If so, fold the placeholder INTO the
+ // echo's row via mergeOrAppend instead of just dropping it — the echo carries no media
+ // payload (engine parity marker), so dropping the placeholder would erase the attachment's
+ // base64 and leave a bare "📎 Media" bubble until the next refetch.
const sendKey = messagesQueryKey(selectedSessionId, activeChat.id);
queryClient.setQueryData<ChatMessageView[]>(sendKey, (prev = []) => {
- const echoAlreadyAdded = prev.some(
- m => m.id === result.messageId || m.waMessageId === result.messageId,
- );
+ const reconciled: ChatMessageView = {
+ ...tempMessage,
+ id: result.messageId,
+ waMessageId: result.messageId,
+ status: 'sent',
+ };
+ const echoAlreadyAdded = prev.some(m => m.id === result.messageId || m.waMessageId === result.messageId);
if (echoAlreadyAdded) {
- return prev.filter(m => m.id !== tempId);
+ return mergeOrAppend(
+ prev.filter(m => m.id !== tempId),
+ reconciled,
+ );
}
- return prev.map(m =>
- m.id === tempId
- ? { ...m, id: result.messageId, waMessageId: result.messageId, status: 'sent' }
- : m,
- );
+ return prev.map(m => (m.id === tempId ? reconciled : m));
});
// Update sidebar chat list (move active chat to the top with the new snippet)
@@ -706,9 +726,7 @@ export function Chats() {
if (chatIndex === -1) return prevChats;
const updatedChats = [...prevChats];
const target = { ...updatedChats[chatIndex] };
- target.lastMessage = currentAttachment
- ? `[${currentAttachment.mimetype.split('/')[0]}]`
- : textToSend;
+ target.lastMessage = currentAttachment ? `[${currentAttachment.mimetype.split('/')[0]}]` : textToSend;
target.timestamp = Math.floor(Date.now() / 1000);
updatedChats.splice(chatIndex, 1);
updatedChats.unshift(target);
@@ -775,11 +793,7 @@ export function Chats() {
<PageHeader
title={t('nav.chats')}
subtitle={t('chats.subtitle')}
- actions={
- sessions.length > 0 && (
- <GlobalSearch currentSessionId={selectedSessionId} onHit={handleSearchHit} />
- )
- }
+ actions={sessions.length > 0 && <GlobalSearch currentSessionId={selectedSessionId} onHit={handleSearchHit} />}
/>
{/* Real-time connection permanently dropped — let the user re-establish it instead of
@@ -805,8 +819,7 @@ export function Chats() {
<h3>{t('chats.noSessionsTitle')}</h3>
<p>
<Trans i18nKey="chats.noSessionsDesc">
- Please connect a WhatsApp session from the <strong>Sessions</strong> menu first to use the chat
- feature.
+ Please connect a WhatsApp session from the <strong>Sessions</strong> menu first to use the chat feature.
</Trans>
</p>
</div>
@@ -863,18 +876,14 @@ export function Chats() {
className={`chat-item-card ${isActive ? 'active' : ''}`}
onClick={() => setActiveChat(chat)}
>
- <div className="chat-avatar">
- {chat.isGroup ? <Users size={20} /> : <User size={20} />}
- </div>
+ <div className="chat-avatar">{chat.isGroup ? <Users size={20} /> : <User size={20} />}</div>
<div className="chat-item-info">
<div className="chat-item-top">
<span className="chat-item-name" title={chat.name || chat.id}>
{chat.name || chat.id.split('@')[0]}
</span>
- {chat.timestamp && (
- <span className="chat-item-time">{formatChatTime(chat.timestamp)}</span>
- )}
+ {chat.timestamp && <span className="chat-item-time">{formatChatTime(chat.timestamp)}</span>}
</div>
<div className="chat-item-bottom">
<span className="chat-item-snippet" title={formatLastMessageSnippet(chat)}>
@@ -882,9 +891,7 @@ export function Chats() {
<span className="no-message">{t('chats.noMessageYet')}</span>
)}
</span>
- {chat.unreadCount > 0 && (
- <span className="chat-unread-badge">{chat.unreadCount}</span>
- )}
+ {chat.unreadCount > 0 && <span className="chat-unread-badge">{chat.unreadCount}</span>}
</div>
</div>
</div>
@@ -903,9 +910,7 @@ export function Chats() {
<button className="room-back" onClick={() => setActiveChat(null)} aria-label={t('common.back')}>
<ArrowLeft size={20} />
</button>
- <div className="room-avatar">
- {activeChat.isGroup ? <Users size={20} /> : <User size={20} />}
- </div>
+ <div className="room-avatar">{activeChat.isGroup ? <Users size={20} /> : <User size={20} />}</div>
<div className="room-contact-info">
<h3>{activeChat.name || activeChat.id.split('@')[0]}</h3>
<span>{activeChat.id}</span>
@@ -952,6 +957,7 @@ export function Chats() {
<img
src={thumb}
alt=""
+ onLoad={onMediaLoad}
style={{ maxWidth: 220, borderRadius: 8, display: 'block', marginBottom: 4 }}
/>
)}
@@ -990,6 +996,7 @@ export function Chats() {
src={mediaSrc}
alt={mediaInfo.filename || t('chats.media.image')}
className="chat-image-media"
+ onLoad={onMediaLoad}
onClick={() => {
const idx = imageMedia.findIndex(x => x.id === msg.id);
if (idx >= 0) setLightboxIndex(idx);
@@ -1000,7 +1007,12 @@ export function Chats() {
case 'video':
return (
<div className="message-media-video">
- <video src={mediaSrc} controls className="chat-video-media" />
+ <video
+ src={mediaSrc}
+ controls
+ className="chat-video-media"
+ onLoadedData={onMediaLoad}
+ />
</div>
);
case 'audio':
@@ -1046,10 +1058,7 @@ export function Chats() {
{/* Quoted message display */}
{msg.metadata?.quotedMessage && (
<div className="message-quote-box">
- <MessageBody
- text={msg.metadata.quotedMessage.body}
- className="quote-body"
- />
+ <MessageBody text={msg.metadata.quotedMessage.body} className="quote-body" />
</div>
)}
@@ -1063,9 +1072,7 @@ export function Chats() {
msg.body &&
(!mediaInfo || msg.body !== mediaInfo.filename) &&
msg.type !== 'location' &&
- msg.type !== 'call' && (
- <MessageBody text={msg.body} className="message-text" />
- )
+ msg.type !== 'call' && <MessageBody text={msg.body} className="message-text" />
)}
<div className="message-meta">
@@ -1092,9 +1099,7 @@ export function Chats() {
</span>
))}
{Object.keys(reactions).length > 1 && (
- <span className="reactions-count-span">
- {Object.keys(reactions).length}
- </span>
+ <span className="reactions-count-span">{Object.keys(reactions).length}</span>
)}
</div>
)}
@@ -1122,11 +1127,7 @@ export function Chats() {
</button>
<div className="reaction-quick-popover">
{['👍', '❤️', '😂', '😮', '😢', '🙏'].map(emoji => (
- <button
- key={emoji}
- type="button"
- onClick={() => handleReactMessage(msg, emoji)}
- >
+ <button key={emoji} type="button" onClick={() => handleReactMessage(msg, emoji)}>
{emoji}
</button>
))}
@@ -1175,12 +1176,7 @@ export function Chats() {
<div className="chats-emoji-picker">
<div className="emoji-grid">
{popularEmojis.map(emoji => (
- <button
- key={emoji}
- type="button"
- className="emoji-btn"
- onClick={() => handleEmojiClick(emoji)}
- >
+ <button key={emoji} type="button" className="emoji-btn" onClick={() => handleEmojiClick(emoji)}>
{emoji}
</button>
))}
@@ -1255,7 +1251,7 @@ export function Chats() {
className="btn-send-message"
aria-label={t('chats.send')}
>
- {sending ? <Loader2 className="animate-spin" size={18} /> : <Send size={18} />}
+ {sending ? <Loader2 className="animate-spin" size={24} /> : <Send size={24} strokeWidth={2.5} />}
</button>
</form>
</footer>
diff --git a/dashboard/src/pages/Dashboard.css b/dashboard/src/pages/Dashboard.css
index d82920a93..efd23eb95 100644
--- a/dashboard/src/pages/Dashboard.css
+++ b/dashboard/src/pages/Dashboard.css
@@ -1,22 +1,16 @@
-.dashboard{
+.dashboard {
padding: 2rem;
width: 100%;
box-sizing: border-box;
}
-.dashboard .page-header{
+.dashboard .page-header {
margin-bottom: 2rem;
}
-.dashboard .header-title{
- display: flex;
- align-items: center;
- gap: 1rem;
-}
-
/* H1 inherited from global */
-.dashboard .status-badge{
+.dashboard .status-badge {
padding: 0.375rem 0.75rem;
border-radius: 9999px;
font-size: 0.6875rem;
@@ -25,12 +19,17 @@
letter-spacing: 0.025em;
}
-.dashboard .status-badge.connected{
+.dashboard .status-badge.connected {
background: rgba(37, 211, 102, 0.1);
color: var(--primary);
}
-.dashboard .stats-grid{
+.dashboard .status-badge.disconnected {
+ background: var(--bg-light);
+ color: var(--text-muted);
+}
+
+.dashboard .stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1.5rem;
@@ -38,7 +37,22 @@
width: 100%;
}
-.dashboard .stat-card{
+/* Collapse the 4-up tile grid to 2 columns on iPad Mini portrait (768px wide) and other narrow
+ viewports so the tiles don't squeeze into thin slivers. Falls back to a single column on phones. */
+@media (max-width: 1024px) {
+ .dashboard .stats-grid {
+ grid-template-columns: repeat(2, 1fr);
+ gap: 1rem;
+ }
+}
+
+@media (max-width: 480px) {
+ .dashboard .stats-grid {
+ grid-template-columns: 1fr;
+ }
+}
+
+.dashboard .stat-card {
position: relative;
background: var(--bg-white);
border-radius: 12px;
@@ -52,25 +66,38 @@
box-shadow 0.2s ease;
}
-.dashboard .stat-card:hover{
+.dashboard .stat-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
-.dashboard .stat-header{
+.dashboard .stat-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
-.dashboard .stat-icon{
+.dashboard .stat-icon {
color: var(--text-muted);
position: relative;
z-index: 2;
}
-.dashboard .stat-label{
+.dashboard .stat-watermark {
+ position: absolute;
+ right: -10px;
+ bottom: -15px;
+ width: 96px;
+ height: 96px;
+ opacity: 0.04;
+ color: var(--text-primary);
+ transform: rotate(-15deg);
+ pointer-events: none;
+ z-index: 1;
+}
+
+.dashboard .stat-label {
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
@@ -80,7 +107,7 @@
z-index: 2;
}
-.dashboard .stat-value{
+.dashboard .stat-value {
font-size: 2rem;
font-weight: 700;
color: var(--text-primary);
@@ -88,7 +115,7 @@
z-index: 2;
}
-.dashboard .stat-detail{
+.dashboard .stat-detail {
font-size: 0.75rem;
line-height: 1.35;
margin-top: 0.5rem;
@@ -97,7 +124,7 @@
z-index: 2;
}
-.dashboard .sessions-section{
+.dashboard .sessions-section {
background: var(--bg-white);
border-radius: 12px;
padding: 1.5rem;
@@ -107,7 +134,7 @@
box-sizing: border-box;
}
-.dashboard .section-header{
+.dashboard .section-header {
display: flex;
justify-content: space-between;
align-items: center;
@@ -116,19 +143,20 @@
/* H2 inherited from global */
-.dashboard .section-subtitle{
+.dashboard .section-subtitle {
font-size: 0.875rem;
color: var(--text-muted);
}
-.dashboard .sessions-table{
+.dashboard .sessions-table {
display: flex;
flex-direction: column;
width: 100%;
font-size: 0.875rem;
}
-.dashboard .sessions-table .table-header, .dashboard .sessions-table .table-row{
+.dashboard .sessions-table .table-header,
+.dashboard .sessions-table .table-row {
display: grid;
grid-template-columns: 140px 200px 140px 1fr 180px;
gap: 1rem;
@@ -136,7 +164,7 @@
align-items: center;
}
-.dashboard .sessions-table .table-header{
+.dashboard .sessions-table .table-header {
background: var(--bg-light);
border-radius: var(--radius) var(--radius) 0 0;
font-size: 0.7rem;
@@ -147,29 +175,29 @@
border-bottom: 1px solid var(--border);
}
-.dashboard .sessions-table .table-row{
+.dashboard .sessions-table .table-row {
border-bottom: 1px solid var(--border);
}
-.dashboard .sessions-table .table-row:last-child{
+.dashboard .sessions-table .table-row:last-child {
border-bottom: none;
}
-.dashboard .session-info-cell{
+.dashboard .session-info-cell {
display: flex;
flex-direction: column;
gap: 0.125rem;
min-width: 0;
}
-.dashboard .session-id{
+.dashboard .session-id {
font-family: 'JetBrains Mono', monospace;
font-size: 0.8125rem;
color: var(--text-primary);
white-space: nowrap;
}
-.dashboard .session-name{
+.dashboard .session-name {
font-size: 0.75rem;
color: var(--text-muted);
white-space: nowrap;
@@ -178,13 +206,13 @@
max-width: 140px;
}
-.dashboard .phone{
+.dashboard .phone {
color: var(--text-primary);
font-size: 0.8125rem;
white-space: nowrap;
}
-.dashboard .status-pill{
+.dashboard .status-pill {
display: inline-block;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
@@ -193,39 +221,39 @@
width: fit-content;
}
-.dashboard .status-pill.ready{
+.dashboard .status-pill.ready {
background: rgba(37, 211, 102, 0.1);
color: var(--primary);
}
.dashboard .status-pill.connecting,
-.dashboard .status-pill.authenticating{
+.dashboard .status-pill.authenticating {
background: rgba(245, 158, 11, 0.15);
color: var(--warning);
}
-.dashboard .status-pill.disconnected{
+.dashboard .status-pill.disconnected {
background: var(--bg-light);
color: var(--text-muted);
}
-.dashboard .status-pill.failed{
+.dashboard .status-pill.failed {
background: rgba(239, 68, 68, 0.15);
color: var(--error);
}
-.dashboard .last-active{
+.dashboard .last-active {
color: var(--text-secondary);
font-size: 0.875rem;
}
-.dashboard .actions{
+.dashboard .actions {
display: flex;
gap: 0.5rem;
justify-content: flex-end;
}
-.dashboard .btn-sm{
+.dashboard .btn-sm {
padding: 0.375rem 0.75rem;
font-size: 0.75rem;
font-weight: 500;
@@ -237,46 +265,46 @@
color: var(--text-secondary);
}
-.dashboard .btn-sm:hover{
+.dashboard .btn-sm:hover {
background: var(--bg-white);
border-color: var(--text-muted);
}
-.dashboard .btn-sm.danger{
+.dashboard .btn-sm.danger {
color: var(--error);
border-color: rgba(239, 68, 68, 0.3);
background: rgba(239, 68, 68, 0.12);
}
-.dashboard .btn-sm.danger:hover{
+.dashboard .btn-sm.danger:hover {
background: rgba(239, 68, 68, 0.18);
}
@media (max-width: 1200px) {
- .dashboard .stats-grid{
+ .dashboard .stats-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
- .dashboard{
+ .dashboard {
padding: 1rem;
}
- .dashboard .stats-grid{
+ .dashboard .stats-grid {
grid-template-columns: 1fr;
gap: 1rem;
}
- .dashboard .stat-value{
+ .dashboard .stat-value {
font-size: 1.5rem;
}
- .dashboard .sessions-section{
+ .dashboard .sessions-section {
padding: 1rem;
}
- .dashboard .section-header{
+ .dashboard .section-header {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
@@ -284,11 +312,11 @@
}
/* Convert table to card layout on mobile */
- .dashboard .sessions-table .table-header{
+ .dashboard .sessions-table .table-header {
display: none;
}
- .dashboard .sessions-table .table-row{
+ .dashboard .sessions-table .table-row {
display: flex;
flex-direction: column;
gap: 0.5rem;
@@ -296,34 +324,34 @@
border-bottom: 1px solid var(--border);
}
- .dashboard .sessions-table .table-row:last-child{
+ .dashboard .sessions-table .table-row:last-child {
border-bottom: none;
}
- .dashboard .session-info-cell{
+ .dashboard .session-info-cell {
order: 1;
}
- .dashboard .session-id{
+ .dashboard .session-id {
font-size: 0.9375rem;
font-weight: 600;
}
- .dashboard .phone{
+ .dashboard .phone {
order: 2;
}
- .dashboard .status-pill{
+ .dashboard .status-pill {
order: 3;
}
- .dashboard .last-active{
+ .dashboard .last-active {
order: 4;
font-size: 0.75rem;
color: var(--text-muted);
}
- .dashboard .actions{
+ .dashboard .actions {
order: 5;
justify-content: flex-start;
padding-top: 0.5rem;
@@ -332,13 +360,7 @@
}
@media (max-width: 480px) {
- .dashboard{
+ .dashboard {
padding: 0.75rem;
}
-
- .dashboard .header-title{
- flex-direction: column;
- align-items: flex-start;
- gap: 0.5rem;
- }
}
diff --git a/dashboard/src/pages/Dashboard.tsx b/dashboard/src/pages/Dashboard.tsx
index e3ca4072f..36b670f9f 100644
--- a/dashboard/src/pages/Dashboard.tsx
+++ b/dashboard/src/pages/Dashboard.tsx
@@ -32,11 +32,8 @@ export function Dashboard() {
const messagesToday = overview ? overview.messages.today.sent + overview.messages.today.received : '—';
const totalMessages = overview ? overview.messages.sent + overview.messages.received : '—';
const loading = loadingSessions;
- const error = sessionsError instanceof Error
- ? sessionsError.message
- : sessionsError
- ? t('dashboard.loadError')
- : null;
+ const error =
+ sessionsError instanceof Error ? sessionsError.message : sessionsError ? t('dashboard.loadError') : null;
const webhookCount = webhooks.length;
const handleDisconnect = async (id: string) => {
@@ -87,7 +84,9 @@ export function Dashboard() {
if (error) {
return (
<div className="dashboard" style={{ padding: '2rem' }}>
- <div style={{ background: 'rgba(239, 68, 68, 0.12)', padding: '1rem', borderRadius: '8px', color: 'var(--error)' }}>
+ <div
+ style={{ background: 'rgba(239, 68, 68, 0.12)', padding: '1rem', borderRadius: '8px', color: 'var(--error)' }}
+ >
{t('dashboard.errorPrefix', { message: error })}
</div>
</div>
@@ -109,6 +108,7 @@ export function Dashboard() {
<div className="stats-grid">
{statsCards.map(({ label, value, icon: Icon, detail }) => (
<div key={label} className="stat-card">
+ <Icon className="stat-watermark" />
<div className="stat-header">
<span className="stat-label">{label}</span>
<Icon size={20} className="stat-icon" />
diff --git a/dashboard/src/pages/Infrastructure.css b/dashboard/src/pages/Infrastructure.css
index 8a9709fe7..cab899b22 100644
--- a/dashboard/src/pages/Infrastructure.css
+++ b/dashboard/src/pages/Infrastructure.css
@@ -1,29 +1,23 @@
-.infrastructure-page{
+.infrastructure-page {
padding: 2rem;
width: 100%;
box-sizing: border-box;
}
-.infrastructure-page .page-header{
+.infrastructure-page .page-header {
margin-bottom: 2rem;
}
/* H1 inherited from global */
-.infrastructure-page .page-subtitle{
- margin: 0;
- font-size: 0.9375rem;
- color: var(--text-secondary);
-}
-
-.infrastructure-page .infra-sections{
+.infrastructure-page .infra-sections {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
width: 100%;
}
-.infrastructure-page .infra-card{
+.infrastructure-page .infra-card {
background: var(--bg-white);
border-radius: 12px;
padding: 1.5rem;
@@ -33,11 +27,7 @@
box-sizing: border-box;
}
-.infrastructure-page .infra-card.full-width{
- grid-column: 1 / -1;
-}
-
-.infrastructure-page .card-header{
+.infrastructure-page .card-header {
display: flex;
justify-content: space-between;
align-items: center;
@@ -46,21 +36,21 @@
border-bottom: 1px solid var(--border);
}
-.infrastructure-page .header-left{
+.infrastructure-page .header-left {
display: flex;
align-items: center;
gap: 0.75rem;
}
-.infrastructure-page .header-left svg{
+.infrastructure-page .header-left svg {
color: var(--primary);
}
-.infrastructure-page .card-header h2{
+.infrastructure-page .card-header h2 {
margin: 0;
}
-.infrastructure-page .status-indicator{
+.infrastructure-page .status-indicator {
display: flex;
align-items: center;
gap: 0.375rem;
@@ -70,38 +60,30 @@
border-radius: 9999px;
}
-.infrastructure-page .status-indicator.connected{
+.infrastructure-page .status-indicator.connected {
background: rgba(37, 211, 102, 0.1);
color: var(--primary);
}
-.infrastructure-page .status-indicator.disconnected{
+.infrastructure-page .status-indicator.disconnected {
background: rgba(239, 68, 68, 0.12);
color: var(--error);
}
-.infrastructure-page .status-indicator.sqlite{
+.infrastructure-page .status-indicator.sqlite {
background: rgba(59, 130, 246, 0.12);
color: var(--info);
}
-.infrastructure-page .warning-badge{
- font-size: 0.75rem;
- padding: 0.375rem 0.75rem;
- background: rgba(245, 158, 11, 0.15);
- color: var(--warning);
- border-radius: 6px;
-}
-
/* Radio Group */
-.infrastructure-page .radio-group{
+.infrastructure-page .radio-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
margin-bottom: 1.5rem;
}
-.infrastructure-page .radio-option{
+.infrastructure-page .radio-option {
display: flex;
flex-direction: column;
gap: 0.25rem;
@@ -112,36 +94,36 @@
transition: all 0.2s;
}
-.infrastructure-page .radio-option:hover{
+.infrastructure-page .radio-option:hover {
border-color: var(--text-muted);
}
-.infrastructure-page .radio-option.selected{
+.infrastructure-page .radio-option.selected {
border-color: var(--primary);
background: rgba(37, 211, 102, 0.05);
}
-.infrastructure-page .radio-option input{
+.infrastructure-page .radio-option input {
display: none;
}
-.infrastructure-page .radio-option span{
+.infrastructure-page .radio-option span {
font-weight: 600;
color: var(--text-primary);
}
-.infrastructure-page .radio-option small{
+.infrastructure-page .radio-option small {
font-size: 0.75rem;
color: var(--text-secondary);
}
/* Watermark Icon */
-.infrastructure-page .radio-option{
+.infrastructure-page .radio-option {
position: relative;
overflow: hidden;
}
-.infrastructure-page .watermark-icon{
+.infrastructure-page .watermark-icon {
position: absolute;
right: -15px;
bottom: -15px;
@@ -153,40 +135,40 @@
transition: all 0.3s ease;
}
-.infrastructure-page .radio-option:hover .watermark-icon{
+.infrastructure-page .radio-option:hover .watermark-icon {
opacity: 0.25;
transform: rotate(-12deg) scale(1.05);
}
-.infrastructure-page .radio-option.selected .watermark-icon{
+.infrastructure-page .radio-option.selected .watermark-icon {
opacity: 0.3;
transform: rotate(-12deg) scale(1.1);
}
/* Form Styles */
-.infrastructure-page .config-form{
+.infrastructure-page .config-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
-.infrastructure-page .form-row{
+.infrastructure-page .form-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
}
-.infrastructure-page .form-row .form-group.small{
+.infrastructure-page .form-row .form-group.small {
max-width: 120px;
}
-.infrastructure-page .form-group{
+.infrastructure-page .form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
-.infrastructure-page .form-group label{
+.infrastructure-page .form-group label {
font-size: 0.7rem;
font-weight: 700;
text-transform: uppercase;
@@ -194,7 +176,8 @@
color: var(--text-secondary);
}
-.infrastructure-page .form-group input, .infrastructure-page .form-group select{
+.infrastructure-page .form-group input,
+.infrastructure-page .form-group select {
padding: 0.75rem 1rem;
font-size: 0.9375rem;
border: 1px solid var(--border);
@@ -203,58 +186,59 @@
transition: border-color 0.2s;
}
-.infrastructure-page .form-group input:focus, .infrastructure-page .form-group select:focus{
+.infrastructure-page .form-group input:focus,
+.infrastructure-page .form-group select:focus {
outline: none;
border-color: var(--primary);
}
-.infrastructure-page .form-group small{
+.infrastructure-page .form-group small {
font-size: 0.75rem;
color: var(--text-muted);
opacity: 0.85;
}
/* Toggle */
-.infrastructure-page .toggle-row{
+.infrastructure-page .toggle-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 0;
}
-.infrastructure-page .toggle-info{
+.infrastructure-page .toggle-info {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
-.infrastructure-page .toggle-info span{
+.infrastructure-page .toggle-info span {
font-size: 0.9375rem;
font-weight: 500;
color: var(--text-primary);
}
-.infrastructure-page .toggle-info small{
+.infrastructure-page .toggle-info small {
font-size: 0.75rem;
font-weight: 400;
color: var(--text-muted); /* Slate 500 */
opacity: 0.85;
}
-.infrastructure-page .toggle-switch{
+.infrastructure-page .toggle-switch {
position: relative;
width: 48px;
height: 26px;
cursor: pointer;
}
-.infrastructure-page .toggle-switch input{
+.infrastructure-page .toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
-.infrastructure-page .toggle-slider{
+.infrastructure-page .toggle-slider {
position: absolute;
top: 0;
left: 0;
@@ -265,7 +249,7 @@
transition: all 0.2s;
}
-.infrastructure-page .toggle-slider::before{
+.infrastructure-page .toggle-slider::before {
content: '';
position: absolute;
width: 20px;
@@ -278,152 +262,96 @@
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
-.infrastructure-page .toggle-switch input:checked + .toggle-slider{
+.infrastructure-page .toggle-switch input:checked + .toggle-slider {
background: var(--primary);
}
-.infrastructure-page .toggle-switch input:checked + .toggle-slider::before{
+.infrastructure-page .toggle-switch input:checked + .toggle-slider::before {
transform: translateX(22px);
}
-/* Migrations Section */
-.infrastructure-page .migrations-section{
- margin-top: 1.5rem;
- padding-top: 1.5rem;
- border-top: 1px solid var(--border);
-}
-
-.infrastructure-page .migrations-section h3{
- margin: 0 0 1rem;
- font-size: 0.9375rem;
- font-weight: 600;
- color: var(--text-primary);
-}
-
-.infrastructure-page .migrations-list{
- background: var(--bg-light);
- border-radius: var(--radius);
- padding: 0.5rem;
- margin-bottom: 1rem;
-}
-
-.infrastructure-page .migration-item{
- display: grid;
- grid-template-columns: 24px 1fr auto;
- gap: 0.75rem;
- padding: 0.625rem 0.75rem;
- align-items: center;
-}
-
-.infrastructure-page .migration-status{
- font-size: 0.875rem;
-}
-
-.infrastructure-page .migration-item.completed .migration-status{
- color: var(--primary);
-}
-
-.infrastructure-page .migration-item.pending .migration-status{
- color: var(--text-muted);
-}
-
-.infrastructure-page .migration-name{
- font-size: 0.875rem;
- color: var(--text-primary);
-}
-
-.infrastructure-page .migration-date{
- font-size: 0.75rem;
- color: var(--text-muted);
-}
-
-.infrastructure-page .migration-actions{
- display: flex;
- gap: 0.75rem;
-}
-
/* Queue Stats */
-.infrastructure-page .queue-stats{
+.infrastructure-page .queue-stats {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
}
-.infrastructure-page .queue-stats h3{
+.infrastructure-page .queue-stats h3 {
margin: 0 0 1rem;
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-primary);
}
-.infrastructure-page .stats-row{
+.infrastructure-page .stats-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
margin-bottom: 1rem;
}
-.infrastructure-page .queue-stat-card{
+.infrastructure-page .queue-stat-card {
background: var(--bg-light);
padding: 1rem;
border-radius: var(--radius);
}
-.infrastructure-page .queue-stat-card h4{
+.infrastructure-page .queue-stat-card h4 {
margin: 0 0 0.75rem;
font-size: 0.8125rem;
font-weight: 600;
color: var(--text-secondary);
}
-.infrastructure-page .stat-values{
+.infrastructure-page .stat-values {
display: flex;
gap: 1.5rem;
}
-.infrastructure-page .stat-item{
+.infrastructure-page .stat-item {
display: flex;
flex-direction: column;
gap: 0.125rem;
}
-.infrastructure-page .stat-item .value{
+.infrastructure-page .stat-item .value {
font-size: 1.25rem;
font-weight: 700;
}
-.infrastructure-page .stat-item .label{
+.infrastructure-page .stat-item .label {
font-size: 0.6875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
-.infrastructure-page .stat-item.pending .value{
+.infrastructure-page .stat-item.pending .value {
color: var(--warning);
}
-.infrastructure-page .stat-item.pending .label{
+.infrastructure-page .stat-item.pending .label {
color: var(--warning);
}
-.infrastructure-page .stat-item.completed .value{
+.infrastructure-page .stat-item.completed .value {
color: var(--primary);
}
-.infrastructure-page .stat-item.completed .label{
+.infrastructure-page .stat-item.completed .label {
color: var(--primary);
}
-.infrastructure-page .stat-item.failed .value{
+.infrastructure-page .stat-item.failed .value {
color: var(--error);
}
-.infrastructure-page .stat-item.failed .label{
+.infrastructure-page .stat-item.failed .label {
color: var(--error);
}
-.infrastructure-page .queue-actions{
+.infrastructure-page .queue-actions {
display: flex;
gap: 0.75rem;
}
/* Buttons */
-.infrastructure-page .btn-primary{
+.infrastructure-page .btn-primary {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -438,16 +366,16 @@
transition: background 0.2s;
}
-.infrastructure-page .btn-primary:hover{
+.infrastructure-page .btn-primary:hover {
background: var(--primary-hover);
}
-.infrastructure-page .btn-primary.large{
+.infrastructure-page .btn-primary.large {
padding: 0.875rem 1.5rem;
font-size: 1rem;
}
-.infrastructure-page .btn-outline{
+.infrastructure-page .btn-outline {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -462,31 +390,12 @@
transition: all 0.2s;
}
-.infrastructure-page .btn-outline:hover{
+.infrastructure-page .btn-outline:hover {
background: var(--bg-light);
}
-.infrastructure-page .btn-danger-outline{
- display: flex;
- align-items: center;
- gap: 0.5rem;
- padding: 0.625rem 1rem;
- background: transparent;
- color: var(--error);
- border: 1px solid var(--error);
- border-radius: var(--radius);
- font-size: 0.875rem;
- font-weight: 500;
- cursor: pointer;
- transition: all 0.2s;
-}
-
-.infrastructure-page .btn-danger-outline:hover{
- background: rgba(239, 68, 68, 0.12);
-}
-
/* Footer */
-.infrastructure-page .page-footer{
+.infrastructure-page .page-footer {
margin-top: 2rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
@@ -496,151 +405,127 @@
/* Responsive */
@media (max-width: 900px) {
- .infrastructure-page .infra-sections{
+ .infrastructure-page .infra-sections {
grid-template-columns: 1fr;
}
- .infrastructure-page{
+ .infrastructure-page {
padding: 1rem;
}
- .infrastructure-page .radio-group{
+ .infrastructure-page .radio-group {
grid-template-columns: 1fr;
}
- .infrastructure-page .form-row{
+ .infrastructure-page .form-row {
grid-template-columns: 1fr;
}
- .infrastructure-page .stats-row{
+ .infrastructure-page .stats-row {
grid-template-columns: 1fr;
}
/* Card header mobile layout */
- .infrastructure-page .card-header{
+ .infrastructure-page .card-header {
flex-wrap: wrap;
gap: 0.75rem;
}
- .infrastructure-page .header-left{
+ .infrastructure-page .header-left {
flex: 1;
min-width: 0;
}
- .infrastructure-page .header-left h2{
+ .infrastructure-page .header-left h2 {
font-size: 0.9375rem;
line-height: 1.3;
}
/* Status badge mobile - prevent shrinking */
- .infrastructure-page .status-indicator{
+ .infrastructure-page .status-indicator {
flex-shrink: 0;
white-space: nowrap;
font-size: 0.75rem;
padding: 0.25rem 0.625rem;
}
- /* Warning badge mobile */
- .infrastructure-page .warning-badge{
- flex-shrink: 0;
- white-space: nowrap;
- font-size: 0.6875rem;
- padding: 0.25rem 0.5rem;
- }
-
/* Toggle row mobile - prevent switch from being cut off */
- .infrastructure-page .toggle-row{
+ .infrastructure-page .toggle-row {
gap: 1rem;
}
- .infrastructure-page .toggle-info{
+ .infrastructure-page .toggle-info {
flex: 1;
min-width: 0;
}
- .infrastructure-page .toggle-switch{
+ .infrastructure-page .toggle-switch {
flex-shrink: 0;
}
/* Queue actions stack on mobile */
- .infrastructure-page .queue-actions{
+ .infrastructure-page .queue-actions {
flex-direction: column;
}
- .infrastructure-page .queue-actions button{
+ .infrastructure-page .queue-actions button {
justify-content: center;
}
}
@media (max-width: 768px) {
- .infrastructure-page{
+ .infrastructure-page {
padding: 0.75rem;
}
- .infrastructure-page .infra-card{
+ .infrastructure-page .infra-card {
padding: 1rem;
}
- .infrastructure-page .form-row .form-group.small{
+ .infrastructure-page .form-row .form-group.small {
max-width: none;
}
- .infrastructure-page .form-group input, .infrastructure-page .form-group select{
+ .infrastructure-page .form-group input,
+ .infrastructure-page .form-group select {
font-size: 0.875rem;
padding: 0.625rem 0.875rem;
}
- .infrastructure-page .migration-item{
- grid-template-columns: 24px 1fr;
- gap: 0.5rem;
- }
-
- .infrastructure-page .migration-date{
- grid-column: 2;
- }
-
- .infrastructure-page .migration-actions{
- flex-direction: column;
- }
-
- .infrastructure-page .migration-actions button{
- justify-content: center;
- }
-
- .infrastructure-page .stat-values{
+ .infrastructure-page .stat-values {
gap: 1rem;
}
- .infrastructure-page .stat-item .value{
+ .infrastructure-page .stat-item .value {
font-size: 1rem;
}
- .infrastructure-page .page-footer{
+ .infrastructure-page .page-footer {
justify-content: stretch;
}
- .infrastructure-page .page-footer button{
+ .infrastructure-page .page-footer button {
width: 100%;
justify-content: center;
}
}
-.infrastructure-page .engine-web-version{
+.infrastructure-page .engine-web-version {
margin: 0.5rem 0 0;
font-size: 0.8125rem;
color: var(--text-secondary);
}
-.infrastructure-page .engine-web-version code{
+.infrastructure-page .engine-web-version code {
font-size: 0.8125rem;
background: var(--bg-subtle, rgba(127, 127, 127, 0.1));
padding: 0.05rem 0.35rem;
border-radius: 4px;
}
-.infrastructure-page .engine-web-version .muted{
+.infrastructure-page .engine-web-version .muted {
color: var(--text-muted);
}
-.infrastructure-page .env-pin-note{
+.infrastructure-page .env-pin-note {
display: flex;
align-items: center;
gap: 0.4rem;
@@ -648,11 +533,11 @@
font-size: 0.8125rem;
color: var(--warning, #b45309);
}
-.infrastructure-page .env-pin-note svg{
+.infrastructure-page .env-pin-note svg {
flex-shrink: 0;
}
-.infrastructure-page .migration-warning{
+.infrastructure-page .migration-warning {
display: flex;
gap: 0.6rem;
text-align: left;
@@ -663,18 +548,18 @@
border: 1px solid rgba(245, 158, 11, 0.35);
color: var(--text-primary);
}
-.infrastructure-page .migration-warning svg{
+.infrastructure-page .migration-warning svg {
flex-shrink: 0;
color: var(--warning, #d97706);
margin-top: 0.1rem;
}
-.infrastructure-page .migration-warning p{
+.infrastructure-page .migration-warning p {
margin: 0.25rem 0 0.6rem;
font-size: 0.8125rem;
color: var(--text-secondary);
}
-.infrastructure-page .data-migration-row{
+.infrastructure-page .data-migration-row {
display: flex;
align-items: center;
justify-content: space-between;
@@ -684,18 +569,18 @@
border-top: 1px solid var(--border);
flex-wrap: wrap;
}
-.infrastructure-page .data-migration-row small{
+.infrastructure-page .data-migration-row small {
display: block;
color: var(--text-muted);
font-size: 0.75rem;
margin-top: 0.15rem;
}
-.infrastructure-page .data-migration-actions{
+.infrastructure-page .data-migration-actions {
display: flex;
gap: 0.5rem;
}
.infrastructure-page .data-migration-actions .btn-sm,
-.infrastructure-page .migration-warning .btn-sm{
+.infrastructure-page .migration-warning .btn-sm {
display: inline-flex;
align-items: center;
gap: 0.35rem;
diff --git a/dashboard/src/pages/Login.css b/dashboard/src/pages/Login.css
index 6bcaeb6df..9a9010f85 100644
--- a/dashboard/src/pages/Login.css
+++ b/dashboard/src/pages/Login.css
@@ -1,4 +1,4 @@
-.login-container{
+.login-container {
min-height: 100vh;
width: 100%;
display: flex;
@@ -14,7 +14,7 @@
bottom: 0;
}
-.login-container .login-card{
+.login-container .login-card {
background: var(--bg-white);
border-radius: 12px;
box-shadow: var(--shadow-lg);
@@ -24,7 +24,7 @@
text-align: center;
}
-.login-container .login-logo{
+.login-container .login-logo {
display: flex;
flex-direction: column;
align-items: center;
@@ -33,19 +33,19 @@
margin-bottom: 1.5rem;
}
-.login-container .logo-icon{
+.login-container .logo-icon {
width: 127px;
height: 127px;
object-fit: contain;
}
-.login-container .version-info{
+.login-container .version-info {
font-size: 0.75rem;
color: var(--text-muted);
font-weight: 500;
}
-.login-container .login-language{
+.login-container .login-language {
display: flex;
align-items: center;
gap: 0.6rem;
@@ -58,45 +58,33 @@
background: var(--bg-white);
}
-.login-container .login-language svg{
+.login-container .login-language svg {
flex-shrink: 0;
}
-.login-container .login-language .custom-select{
+.login-container .login-language .custom-select {
flex: 1;
min-width: 0;
}
-.login-container .login-language:focus-within{
+.login-container .login-language:focus-within {
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}
-.login-container .login-title{
- font-size: 1.75rem;
- font-weight: 600;
- color: var(--text-primary);
- margin: 0 0 0.5rem;
-}
-
-.login-container .login-subtitle{
- color: var(--text-secondary);
- margin: 0 0 2rem;
-}
-
-.login-container .login-form{
+.login-container .login-form {
text-align: left;
}
-.login-container [dir="rtl"] .login-form{
+.login-container [dir='rtl'] .login-form {
text-align: right;
}
-.login-container .input-group{
+.login-container .input-group {
margin-bottom: 1.5rem;
}
-.login-container .input-group label{
+.login-container .input-group label {
display: block;
font-size: 0.875rem;
font-weight: 500;
@@ -104,11 +92,11 @@
margin-bottom: 0.5rem;
}
-.login-container .input-wrapper{
+.login-container .input-wrapper {
position: relative;
}
-.login-container .input-wrapper input{
+.login-container .input-wrapper input {
width: 100%;
padding: 0.75rem 3rem 0.75rem 1rem;
font-size: 1rem;
@@ -120,17 +108,17 @@
box-shadow 0.2s;
}
-.login-container .input-wrapper input:focus{
+.login-container .input-wrapper input:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}
-.login-container .input-wrapper input.error{
+.login-container .input-wrapper input.error {
border-color: var(--error);
}
-.login-container .toggle-visibility{
+.login-container .toggle-visibility {
position: absolute;
right: 0.75rem;
top: 50%;
@@ -142,18 +130,18 @@
padding: 0.25rem;
}
-.login-container .toggle-visibility:hover{
+.login-container .toggle-visibility:hover {
color: var(--text-secondary);
}
-.login-container .error-message{
+.login-container .error-message {
display: block;
color: var(--error);
font-size: 0.875rem;
margin-top: 0.5rem;
}
-.login-container .connect-btn{
+.login-container .connect-btn {
width: 100%;
padding: 0.875rem 1.5rem;
font-size: 1rem;
@@ -166,32 +154,32 @@
transition: background 0.2s;
}
-.login-container .connect-btn:hover:not(:disabled){
+.login-container .connect-btn:hover:not(:disabled) {
background: var(--primary-hover);
}
-.login-container .connect-btn:disabled{
+.login-container .connect-btn:disabled {
opacity: 0.7;
cursor: not-allowed;
}
-.login-container .login-help{
+.login-container .login-help {
margin-top: 1.5rem;
font-size: 0.875rem;
color: var(--text-secondary);
}
-.login-container .login-help a{
+.login-container .login-help a {
color: var(--primary);
text-decoration: none;
font-weight: 500;
}
-.login-container .login-help a:hover{
+.login-container .login-help a:hover {
text-decoration: underline;
}
-.login-container .login-footer{
+.login-container .login-footer {
margin-top: 2rem;
display: flex;
flex-direction: column;
@@ -202,61 +190,52 @@
text-align: center;
}
-.login-container .login-footer .github-link{
+.login-container .login-footer .github-link {
color: var(--text-muted);
transition: color 0.2s;
}
-.login-container .login-footer .github-link:hover{
+.login-container .login-footer .github-link:hover {
color: var(--primary);
}
-.login-container .login-footer a{
+.login-container .login-footer a {
color: var(--text-muted);
font-size: 0.75rem;
text-decoration: none;
}
-.login-container .login-footer a:hover{
+.login-container .login-footer a:hover {
color: var(--text-secondary);
}
/* Mobile Responsive */
@media (max-width: 480px) {
- .login-container{
+ .login-container {
padding: 1rem;
}
- .login-container .login-card{
+ .login-container .login-card {
padding: 2rem 1.5rem;
border-radius: 10px;
}
- .login-container .logo-icon{
+ .login-container .logo-icon {
width: 80px;
height: 80px;
}
- .login-container .login-title{
- font-size: 1.375rem;
- }
-
- .login-container .login-subtitle{
- font-size: 0.875rem;
- margin-bottom: 1.5rem;
- }
-
- .login-container .input-wrapper input{
+ .login-container .input-wrapper input {
padding: 0.625rem 2.5rem 0.625rem 0.875rem;
font-size: 0.9375rem;
}
- .login-container .connect-btn{
+ .login-container .connect-btn {
padding: 0.75rem 1.25rem;
font-size: 0.9375rem;
}
- .login-container .login-help{
+ .login-container .login-help {
font-size: 0.8125rem;
}
}
diff --git a/dashboard/src/pages/Login.tsx b/dashboard/src/pages/Login.tsx
index 62f31e0c1..cf2e9d132 100644
--- a/dashboard/src/pages/Login.tsx
+++ b/dashboard/src/pages/Login.tsx
@@ -62,7 +62,9 @@ export function Login({ onLogin }: LoginProps) {
<span className="version-info">
{t('login.version', {
version: __APP_VERSION__,
- date: new Date(__BUILD_TIME__).toLocaleDateString(),
+ // ISO date (YYYYMMDD) so the format is stable across locales/regions instead of the
+ // locale-dependent toLocaleDateString() which renders differently per browser region.
+ date: new Date(__BUILD_TIME__).toISOString().slice(0, 10).replace(/-/g, ''),
})}
</span>
</div>
@@ -108,11 +110,7 @@ export function Login({ onLogin }: LoginProps) {
<p className="login-help">
{t('login.help')}{' '}
- <a
- href="https://github.com/rmyndharis/OpenWA/blob/main/docs/01-project-overview.md"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <a href="https://docs.open-wa.org" target="_blank" rel="noopener noreferrer">
{t('login.viewDocs')}
</a>
</p>
diff --git a/dashboard/src/pages/Logs.css b/dashboard/src/pages/Logs.css
index 4967b6a20..21995acde 100644
--- a/dashboard/src/pages/Logs.css
+++ b/dashboard/src/pages/Logs.css
@@ -1,22 +1,16 @@
-.logs-page{
+.logs-page {
padding: 2rem;
width: 100%;
box-sizing: border-box;
}
-.logs-page .page-header{
+.logs-page .page-header {
margin-bottom: 1.5rem;
}
-.logs-page .header-content{
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
/* H1 inherited from global */
-.logs-page .btn-secondary{
+.logs-page .btn-secondary {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -31,17 +25,17 @@
transition: all 0.2s;
}
-.logs-page .btn-secondary:hover{
+.logs-page .btn-secondary:hover {
background: var(--bg-light);
}
-.logs-page .filters-bar{
+.logs-page .filters-bar {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
}
-.logs-page .search-input{
+.logs-page .search-input {
display: flex;
align-items: center;
gap: 0.75rem;
@@ -53,11 +47,11 @@
border-radius: var(--radius);
}
-.logs-page .search-input svg{
+.logs-page .search-input svg {
color: var(--text-muted);
}
-.logs-page .search-input input{
+.logs-page .search-input input {
flex: 1;
border: none;
background: none;
@@ -65,11 +59,11 @@
color: var(--text-primary);
}
-.logs-page .search-input input:focus{
+.logs-page .search-input input:focus {
outline: none;
}
-.logs-page .filter-group{
+.logs-page .filter-group {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -79,15 +73,15 @@
border-radius: var(--radius);
}
-.logs-page .filter-group svg{
+.logs-page .filter-group svg {
color: var(--text-muted);
}
-.logs-page .filter-group .custom-select{
+.logs-page .filter-group .custom-select {
flex: 1;
}
-.logs-page .logs-table-container{
+.logs-page .logs-table-container {
background: var(--bg-white);
border-radius: 12px;
box-shadow: var(--shadow-sm);
@@ -95,7 +89,7 @@
overflow-x: auto;
}
-.logs-page .logs-table{
+.logs-page .logs-table {
display: flex;
flex-direction: column;
width: 100%;
@@ -103,7 +97,7 @@
}
/* Unified row styling - same class for header and data */
-.logs-page .logs-table .table-row{
+.logs-page .logs-table .table-row {
display: grid;
grid-template-columns: 180px 200px 150px 150px 150px 1fr 120px;
gap: 1rem;
@@ -112,11 +106,11 @@
border-bottom: 1px solid var(--border);
}
-.logs-page .logs-table .table-row:last-child{
+.logs-page .logs-table .table-row:last-child {
border-bottom: none;
}
-.logs-page .logs-table .table-row.header{
+.logs-page .logs-table .table-row.header {
background: var(--bg-light);
font-size: 0.7rem;
font-weight: 700;
@@ -126,37 +120,37 @@
border-bottom: 1px solid var(--border);
}
-.logs-page .logs-table .table-row:not(.header):hover{
+.logs-page .logs-table .table-row:not(.header):hover {
background: rgba(37, 211, 102, 0.05);
}
-.logs-page .timestamp{
+.logs-page .timestamp {
font-family: monospace;
font-size: 0.8125rem;
color: var(--text-muted);
white-space: nowrap;
}
-.logs-page .action{
+.logs-page .action {
font-weight: 600;
color: var(--text-primary);
font-size: 0.8125rem;
white-space: nowrap;
}
-.logs-page .api-key{
+.logs-page .api-key {
font-family: monospace;
font-size: 0.8125rem;
white-space: nowrap;
}
-.logs-page .ip{
+.logs-page .ip {
font-family: monospace;
font-size: 0.8125rem;
white-space: nowrap;
}
-.logs-page .details{
+.logs-page .details {
font-size: 0.875rem;
color: var(--text-secondary);
overflow: hidden;
@@ -164,7 +158,7 @@
white-space: nowrap;
}
-.logs-page .severity-badge{
+.logs-page .severity-badge {
display: inline-block;
padding: 0.25rem 0.625rem;
border-radius: 6px;
@@ -175,26 +169,26 @@
white-space: nowrap;
}
-.logs-page .logs-table .table-row > span:last-child{
+.logs-page .logs-table .table-row > span:last-child {
justify-self: end;
}
-.logs-page .severity-badge.info{
+.logs-page .severity-badge.info {
background: rgba(59, 130, 246, 0.12);
color: var(--info);
}
-.logs-page .severity-badge.warn{
+.logs-page .severity-badge.warn {
background: rgba(245, 158, 11, 0.15);
color: var(--warning);
}
-.logs-page .severity-badge.error{
+.logs-page .severity-badge.error {
background: rgba(239, 68, 68, 0.12);
color: var(--error);
}
-.logs-page .pagination{
+.logs-page .pagination {
display: flex;
justify-content: center;
align-items: center;
@@ -202,7 +196,7 @@
margin-top: 1.5rem;
}
-.logs-page .pagination button{
+.logs-page .pagination button {
padding: 0.5rem 1rem;
font-size: 0.875rem;
background: var(--bg-white);
@@ -213,33 +207,33 @@
transition: all 0.2s;
}
-.logs-page .pagination button:hover:not(:disabled){
+.logs-page .pagination button:hover:not(:disabled) {
background: var(--bg-light);
}
-.logs-page .pagination button:disabled{
+.logs-page .pagination button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
-.logs-page .page-numbers{
+.logs-page .page-numbers {
display: flex;
gap: 0.25rem;
}
-.logs-page .page-numbers button{
+.logs-page .page-numbers button {
min-width: 36px;
padding: 0.5rem;
}
-.logs-page .page-numbers button.active{
+.logs-page .page-numbers button.active {
background: var(--primary);
border-color: var(--primary);
color: white;
}
/* Empty Table State */
-.logs-page .empty-table-state{
+.logs-page .empty-table-state {
display: flex;
flex-direction: column;
align-items: center;
@@ -249,20 +243,20 @@
color: var(--text-muted);
}
-.logs-page .empty-table-state svg{
+.logs-page .empty-table-state svg {
margin-bottom: 1rem;
opacity: 0.4;
color: var(--text-muted);
}
-.logs-page .empty-table-state h3{
+.logs-page .empty-table-state h3 {
font-size: 1.125rem;
font-weight: 600;
color: var(--text-secondary);
margin: 0 0 0.5rem;
}
-.logs-page .empty-table-state p{
+.logs-page .empty-table-state p {
margin: 0;
font-size: 0.875rem;
max-width: 300px;
@@ -270,44 +264,44 @@
/* Mobile Responsive */
@media (max-width: 768px) {
- .logs-page{
+ .logs-page {
padding: 1rem;
}
- .logs-page .filters-bar{
+ .logs-page .filters-bar {
flex-direction: column;
gap: 0.75rem;
}
- .logs-page .search-input{
+ .logs-page .search-input {
max-width: none;
}
- .logs-page .filter-group{
+ .logs-page .filter-group {
width: 100%;
justify-content: space-between;
}
- .logs-page .filter-group .custom-select{
+ .logs-page .filter-group .custom-select {
flex: 1;
}
- .logs-page .logs-table-container{
+ .logs-page .logs-table-container {
overflow-x: visible;
border: none;
background: transparent;
box-shadow: none;
}
- .logs-page .logs-table{
+ .logs-page .logs-table {
display: block;
}
- .logs-page .logs-table .table-row.header{
+ .logs-page .logs-table .table-row.header {
display: none;
}
- .logs-page .logs-table .table-row:not(.header){
+ .logs-page .logs-table .table-row:not(.header) {
display: flex;
flex-direction: column;
align-items: flex-start;
@@ -322,18 +316,18 @@
}
/* Cells inherit centering from the desktop grid; force a left-aligned, scannable card. */
- .logs-page .logs-table .table-row:not(.header) > span{
+ .logs-page .logs-table .table-row:not(.header) > span {
width: 100%;
justify-content: flex-start;
text-align: left;
}
- .logs-page .logs-table .table-row:not(.header):hover{
+ .logs-page .logs-table .table-row:not(.header):hover {
background: var(--bg-white);
}
/* Action label prominent at top */
- .logs-page .logs-table .table-row .action{
+ .logs-page .logs-table .table-row .action {
font-size: 0.9375rem;
font-weight: 600;
order: 1;
@@ -341,40 +335,42 @@
}
/* Timestamp secondary */
- .logs-page .logs-table .table-row .timestamp{
+ .logs-page .logs-table .table-row .timestamp {
order: 2;
font-size: 0.75rem;
}
/* Session, API Key, IP - inline info */
- .logs-page .logs-table .table-row > span:nth-child(3), .logs-page .logs-table .table-row > span:nth-child(4), .logs-page .logs-table .table-row > span:nth-child(5){
+ .logs-page .logs-table .table-row > span:nth-child(3),
+ .logs-page .logs-table .table-row > span:nth-child(4),
+ .logs-page .logs-table .table-row > span:nth-child(5) {
display: none;
}
/* Severity badge stays visible */
- .logs-page .logs-table .table-row > span:last-child{
+ .logs-page .logs-table .table-row > span:last-child {
order: 3;
justify-self: flex-start;
}
- .logs-page .pagination{
+ .logs-page .pagination {
flex-wrap: wrap;
gap: 0.5rem;
}
- .logs-page .pagination button{
+ .logs-page .pagination button {
padding: 0.5rem 0.75rem;
font-size: 0.8125rem;
}
- .logs-page .page-numbers button{
+ .logs-page .page-numbers button {
min-width: 32px;
padding: 0.5rem 0.25rem;
}
}
@media (max-width: 480px) {
- .logs-page{
+ .logs-page {
padding: 0.75rem;
}
}
diff --git a/dashboard/src/pages/MessageTester.css b/dashboard/src/pages/MessageTester.css
index 6978c1761..3246a929f 100644
--- a/dashboard/src/pages/MessageTester.css
+++ b/dashboard/src/pages/MessageTester.css
@@ -1,27 +1,28 @@
-.message-tester{
+.message-tester {
padding: 2rem;
width: 100%;
box-sizing: border-box;
}
-.message-tester .page-header{
+.message-tester .page-header {
margin-bottom: 2rem;
}
/* H1 inherited from global */
-.message-tester .page-header p{
+.message-tester .page-header p {
margin: 0;
font-size: 0.9375rem;
color: var(--text-secondary);
}
-.message-tester .tester-panels{
+.message-tester .tester-panels {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
}
-.message-tester .compose-panel, .message-tester .response-panel{
+.message-tester .compose-panel,
+.message-tester .response-panel {
background: var(--bg-white);
border-radius: 12px;
padding: 1.5rem;
@@ -29,16 +30,17 @@
border: 1px solid var(--border);
}
-.message-tester .compose-panel h2, .message-tester .response-panel h2{
+.message-tester .compose-panel h2,
+.message-tester .response-panel h2 {
/* Inherits from H2 */
margin-bottom: 1.5rem;
}
-.message-tester .form-group{
+.message-tester .form-group {
margin-bottom: 1.25rem;
}
-.message-tester .form-group label{
+.message-tester .form-group label {
display: block;
font-size: 0.7rem;
font-weight: 700;
@@ -48,7 +50,9 @@
margin-bottom: 0.5rem;
}
-.message-tester .form-group input, .message-tester .form-group select, .message-tester .form-group textarea{
+.message-tester .form-group input,
+.message-tester .form-group select,
+.message-tester .form-group textarea {
width: 100%;
padding: 0.75rem 1rem;
font-size: 0.9375rem;
@@ -58,31 +62,33 @@
transition: border-color 0.2s;
}
-.message-tester .form-group input:focus, .message-tester .form-group select:focus, .message-tester .form-group textarea:focus{
+.message-tester .form-group input:focus,
+.message-tester .form-group select:focus,
+.message-tester .form-group textarea:focus {
outline: none;
border-color: var(--primary);
}
-.message-tester .form-group textarea{
+.message-tester .form-group textarea {
resize: vertical;
min-height: 100px;
}
-.message-tester .form-group .hint{
+.message-tester .form-group .hint {
display: block;
font-size: 0.75rem;
color: var(--text-muted);
margin-top: 0.375rem;
}
-.message-tester .toggle-group{
+.message-tester .toggle-group {
display: flex;
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}
-.message-tester .toggle-group button{
+.message-tester .toggle-group button {
flex: 1;
padding: 0.625rem 1rem;
font-size: 0.875rem;
@@ -94,16 +100,16 @@
color: var(--text-secondary);
}
-.message-tester .toggle-group button:first-child{
+.message-tester .toggle-group button:first-child {
border-right: 1px solid var(--border);
}
-.message-tester .toggle-group button.active{
+.message-tester .toggle-group button.active {
background: var(--primary);
color: white;
}
-.message-tester .send-btn{
+.message-tester .send-btn {
display: flex;
align-items: center;
justify-content: center;
@@ -120,16 +126,16 @@
transition: background 0.2s;
}
-.message-tester .send-btn:hover:not(:disabled){
+.message-tester .send-btn:hover:not(:disabled) {
background: var(--primary-hover);
}
-.message-tester .send-btn:disabled{
+.message-tester .send-btn:disabled {
opacity: 0.7;
cursor: not-allowed;
}
-.message-tester .response-status{
+.message-tester .response-status {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -140,62 +146,63 @@
margin-bottom: 1rem;
}
-.message-tester .response-status.success{
+.message-tester .response-status.success {
background: rgba(37, 211, 102, 0.1);
color: var(--primary);
}
-.message-tester .response-status.error{
+.message-tester .response-status.error {
background: rgba(239, 68, 68, 0.12);
color: var(--error);
}
-.message-tester .response-details{
+.message-tester .response-details {
margin-bottom: 1rem;
}
-.message-tester .detail-row{
+.message-tester .detail-row {
display: flex;
justify-content: space-between;
padding: 0.625rem 0;
border-bottom: 1px solid var(--border);
}
-.message-tester .detail-row:last-child{
+.message-tester .detail-row:last-child {
border-bottom: none;
}
-.message-tester .detail-label{
+.message-tester .detail-label {
font-size: 0.875rem;
color: var(--text-secondary);
}
-.message-tester .detail-value{
+.message-tester .detail-value {
font-size: 0.875rem;
color: var(--text-primary);
font-weight: 500;
}
-.message-tester .detail-value.mono{
+.message-tester .detail-value.mono {
font-family: monospace;
}
-.message-tester .response-json{
- background: #1E293B;
+.message-tester .response-json {
+ background: #1e293b;
+ border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1rem;
overflow-x: auto;
}
-.message-tester .response-json pre{
+.message-tester .response-json pre {
margin: 0;
- color: #E2E8F0;
+ color: #e2e8f0;
font-size: 0.8125rem;
font-family: 'JetBrains Mono', monospace;
white-space: pre-wrap;
}
-.message-tester .response-empty{
+.message-tester .response-empty {
display: flex;
align-items: center;
justify-content: center;
@@ -204,12 +211,12 @@
border-radius: var(--radius);
}
-.message-tester .response-empty p{
+.message-tester .response-empty p {
color: var(--text-muted);
margin: 0;
}
-.message-tester .browse-btn{
+.message-tester .browse-btn {
display: inline-flex;
align-items: center;
gap: 0.375rem;
@@ -224,12 +231,12 @@
transition: all 0.2s;
}
-.message-tester .browse-btn:hover{
+.message-tester .browse-btn:hover {
border-color: var(--primary);
color: var(--primary);
}
-.message-tester .file-selected{
+.message-tester .file-selected {
display: flex;
align-items: center;
justify-content: space-between;
@@ -240,7 +247,7 @@
border-radius: var(--radius);
}
-.message-tester .file-name{
+.message-tester .file-name {
font-size: 0.875rem;
color: var(--text-primary);
overflow: hidden;
@@ -248,7 +255,7 @@
white-space: nowrap;
}
-.message-tester .remove-file-btn{
+.message-tester .remove-file-btn {
display: inline-flex;
align-items: center;
gap: 0.25rem;
@@ -262,33 +269,34 @@
white-space: nowrap;
}
-.message-tester .remove-file-btn:hover{
+.message-tester .remove-file-btn:hover {
text-decoration: underline;
}
@media (max-width: 1000px) {
- .message-tester .tester-panels{
+ .message-tester .tester-panels {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
- .message-tester{
+ .message-tester {
padding: 1rem;
}
- .message-tester .compose-panel, .message-tester .response-panel{
+ .message-tester .compose-panel,
+ .message-tester .response-panel {
padding: 1rem;
}
- .message-tester .toggle-group{
+ .message-tester .toggle-group {
flex-wrap: wrap;
border: none;
gap: 0.5rem;
overflow: visible;
}
- .message-tester .toggle-group button{
+ .message-tester .toggle-group button {
min-width: 0;
padding: 0.5rem 0.875rem;
font-size: 0.8125rem;
@@ -296,16 +304,18 @@
border-radius: 6px;
}
- .message-tester .toggle-group button.active{
+ .message-tester .toggle-group button.active {
border-color: var(--primary) !important;
}
- .message-tester .send-btn{
+ .message-tester .send-btn {
font-size: 0.9375rem;
padding: 0.75rem 1rem;
}
- .message-tester .form-group input, .message-tester .form-group select, .message-tester .form-group textarea{
+ .message-tester .form-group input,
+ .message-tester .form-group select,
+ .message-tester .form-group textarea {
font-size: 0.875rem;
padding: 0.625rem 0.75rem;
}
diff --git a/dashboard/src/pages/Plugins.css b/dashboard/src/pages/Plugins.css
index 6b0f7c189..83bb74175 100644
--- a/dashboard/src/pages/Plugins.css
+++ b/dashboard/src/pages/Plugins.css
@@ -1,95 +1,18 @@
-.plugins-page{
+.plugins-page {
padding: 2rem;
width: 100%;
box-sizing: border-box;
}
-/* Engine Card */
-.plugins-page .engine-card{
- background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
- border: 1px solid rgba(34, 197, 94, 0.2);
- border-radius: 12px;
- padding: 1.5rem;
- margin-bottom: 2rem;
-}
-
-.plugins-page .engine-header{
- display: flex;
- align-items: center;
- justify-content: space-between;
-}
-
-.plugins-page .engine-info{
- display: flex;
- align-items: center;
- gap: 1rem;
-}
-
-.plugins-page .engine-icon-wrapper{
- width: 48px;
- height: 48px;
- background: rgba(34, 197, 94, 0.15);
- border-radius: 12px;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.plugins-page .engine-icon-wrapper svg{
- color: #22c55e;
-}
-
-.plugins-page .engine-title{
- font-size: 1.125rem;
- font-weight: 600;
- color: var(--text-primary);
- margin: 0 0 0.25rem 0;
- text-transform: none;
- letter-spacing: normal;
-}
-
-.plugins-page .engine-name{
- font-size: 0.875rem;
- color: #22c55e;
-}
-
-.plugins-page .engine-features{
- margin-top: 1rem;
- padding-top: 1rem;
- border-top: 1px solid rgba(34, 197, 94, 0.15);
-}
-
-.plugins-page .features-label{
- font-size: 0.75rem;
- color: var(--text-secondary);
- margin-bottom: 0.5rem;
- text-transform: uppercase;
- letter-spacing: 0.05em;
-}
-
-.plugins-page .features-list{
- display: flex;
- flex-wrap: wrap;
- gap: 0.5rem;
-}
-
-.plugins-page .feature-tag{
- padding: 0.25rem 0.5rem;
- background: rgba(34, 197, 94, 0.1);
- color: #22c55e;
- border-radius: 4px;
- font-size: 0.75rem;
-}
-
/* Plugins Grid */
-.plugins-page .plugins-grid{
+.plugins-page .plugins-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1.5rem;
}
/* Plugin Card */
-.plugins-page .plugin-card{
+.plugins-page .plugin-card {
background: var(--bg-white);
border: 1px solid var(--border);
border-radius: 12px;
@@ -99,12 +22,12 @@
box-shadow 0.2s;
}
-.plugins-page .plugin-card:hover{
+.plugins-page .plugin-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
-.plugins-page .plugin-card-header{
+.plugins-page .plugin-card-header {
padding: 1.25rem 1.25rem 1rem;
display: flex;
align-items: center;
@@ -112,14 +35,14 @@
gap: 0.5rem;
}
-.plugins-page .plugin-info{
+.plugins-page .plugin-info {
display: flex;
align-items: center;
gap: 0.75rem;
min-width: 0;
}
-.plugins-page .plugin-icon-wrapper{
+.plugins-page .plugin-icon-wrapper {
width: 42px;
height: 42px;
background: var(--bg-light);
@@ -130,43 +53,37 @@
flex-shrink: 0;
}
-.plugins-page .plugin-icon-wrapper svg{
+.plugins-page .plugin-icon-wrapper svg {
color: var(--text-secondary);
}
/* Calm, low-saturation type tints on the icon only — no loud gradient header, no alarming red. */
-.plugins-page .type-engine .plugin-icon-wrapper{
- background: rgba(34, 197, 94, 0.12);
-}
-.plugins-page .type-engine .plugin-icon-wrapper svg{
- color: #16a34a;
-}
-.plugins-page .type-extension .plugin-icon-wrapper{
+.plugins-page .type-extension .plugin-icon-wrapper {
background: rgba(99, 102, 241, 0.12);
}
-.plugins-page .type-extension .plugin-icon-wrapper svg{
+.plugins-page .type-extension .plugin-icon-wrapper svg {
color: #6366f1;
}
-.plugins-page .type-storage .plugin-icon-wrapper{
+.plugins-page .type-storage .plugin-icon-wrapper {
background: rgba(13, 148, 136, 0.12);
}
-.plugins-page .type-storage .plugin-icon-wrapper svg{
+.plugins-page .type-storage .plugin-icon-wrapper svg {
color: #0d9488;
}
-.plugins-page .type-queue .plugin-icon-wrapper{
+.plugins-page .type-queue .plugin-icon-wrapper {
background: rgba(217, 119, 6, 0.12);
}
-.plugins-page .type-queue .plugin-icon-wrapper svg{
+.plugins-page .type-queue .plugin-icon-wrapper svg {
color: #d97706;
}
-.plugins-page .type-auth .plugin-icon-wrapper{
+.plugins-page .type-auth .plugin-icon-wrapper {
background: rgba(147, 51, 234, 0.12);
}
-.plugins-page .type-auth .plugin-icon-wrapper svg{
+.plugins-page .type-auth .plugin-icon-wrapper svg {
color: #9333ea;
}
-.plugins-page .plugin-name{
+.plugins-page .plugin-name {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-primary);
@@ -178,12 +95,12 @@
text-overflow: ellipsis;
}
-.plugins-page .plugin-version{
+.plugins-page .plugin-version {
font-size: 0.75rem;
color: var(--text-muted);
}
-.plugins-page .plugin-builtin-badge{
+.plugins-page .plugin-builtin-badge {
padding: 0.1875rem 0.5rem;
background: var(--bg-light);
color: var(--text-muted);
@@ -197,73 +114,73 @@
flex-shrink: 0;
}
-.plugins-page .plugin-card-body{
+.plugins-page .plugin-card-body {
padding: 1.25rem;
}
-.plugins-page .plugin-description{
+.plugins-page .plugin-description {
color: var(--text-secondary);
font-size: 0.875rem;
margin-bottom: 1rem;
line-height: 1.5;
}
-.plugins-page .plugin-status-row{
+.plugins-page .plugin-status-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
}
-.plugins-page .plugin-status{
+.plugins-page .plugin-status {
display: flex;
align-items: center;
gap: 0.5rem;
}
-.plugins-page .status-dot{
+.plugins-page .status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
-.plugins-page .status-dot.enabled{
+.plugins-page .status-dot.enabled {
background: #22c55e;
}
-.plugins-page .status-dot.disabled{
+.plugins-page .status-dot.disabled {
background: #eab308;
}
-.plugins-page .status-dot.error{
+.plugins-page .status-dot.error {
background: #ef4444;
}
-.plugins-page .status-dot.installed{
+.plugins-page .status-dot.installed {
background: #64748b;
}
-.plugins-page .status-text{
+.plugins-page .status-text {
font-size: 0.875rem;
color: var(--text-primary);
text-transform: capitalize;
}
-.plugins-page .plugin-type-label{
+.plugins-page .plugin-type-label {
font-size: 0.625rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
}
-.plugins-page .plugin-provides{
+.plugins-page .plugin-provides {
display: flex;
flex-wrap: wrap;
gap: 0.375rem;
margin-bottom: 1rem;
}
-.plugins-page .provides-tag{
+.plugins-page .provides-tag {
padding: 0.25rem 0.5rem;
background: var(--bg-light);
color: var(--text-secondary);
@@ -271,7 +188,7 @@
border-radius: 4px;
}
-.plugins-page .plugin-error{
+.plugins-page .plugin-error {
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.2);
border-radius: 6px;
@@ -279,12 +196,12 @@
margin-bottom: 1rem;
}
-.plugins-page .plugin-error-text{
+.plugins-page .plugin-error-text {
color: #ef4444;
font-size: 0.75rem;
}
-.plugins-page .plugin-actions{
+.plugins-page .plugin-actions {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -292,7 +209,7 @@
border-top: 1px solid var(--border);
}
-.plugins-page .btn-toggle{
+.plugins-page .btn-toggle {
flex: 1;
display: flex;
align-items: center;
@@ -308,75 +225,33 @@
/* Positive action (Enable / Activate): the one solid brand-green CTA, so an action never reads
the same as the passive "Active" state below. */
-.plugins-page .btn-toggle.enable{
+.plugins-page .btn-toggle.enable {
background: var(--primary, #25d366);
border: 1px solid var(--primary, #25d366);
color: #fff;
}
-.plugins-page .btn-toggle.enable:hover{
+.plugins-page .btn-toggle.enable:hover {
background: #16a34a;
border-color: #16a34a;
}
-.plugins-page .btn-toggle.disable{
+.plugins-page .btn-toggle.disable {
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3);
color: #ef4444;
}
-.plugins-page .btn-toggle.disable:hover{
+.plugins-page .btn-toggle.disable:hover {
background: rgba(239, 68, 68, 0.2);
}
-.plugins-page .btn-toggle:disabled{
+.plugins-page .btn-toggle:disabled {
opacity: 0.5;
cursor: not-allowed;
}
-/* Passive states (Active / Required) are NOT actions — render them as quiet neutral chips, with
- only a small green check as the "it's on" signal, so they're clearly distinct from the green CTA. */
-.plugins-page .btn-required{
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 0.5rem;
- padding: 0.625rem 1rem;
- background: var(--bg-light);
- border: 1px solid var(--border);
- color: var(--text-muted);
- font-size: 0.875rem;
- font-weight: 600;
- border-radius: 8px;
- cursor: default;
-}
-
-.plugins-page .btn-required svg{
- color: var(--text-muted);
-}
-
-.plugins-page .btn-active{
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 0.5rem;
- padding: 0.625rem 1rem;
- background: var(--bg-light);
- border: 1px solid var(--border);
- color: var(--text-secondary);
- font-size: 0.875rem;
- font-weight: 500;
- border-radius: 8px;
- cursor: default;
-}
-
-.plugins-page .btn-active svg{
- color: #16a34a;
-}
-
-.plugins-page .btn-action{
+.plugins-page .btn-action {
width: 36px;
height: 36px;
display: flex;
@@ -390,60 +265,47 @@
padding: 0;
}
-.plugins-page .btn-action:hover{
+.plugins-page .btn-action:hover {
background: var(--bg-white);
border-color: var(--text-muted);
}
-.plugins-page .btn-action svg{
+.plugins-page .btn-action svg {
color: var(--text-secondary);
}
/* Empty State */
-.plugins-page .empty-state{
+.plugins-page .empty-state {
text-align: center;
padding: 4rem 2rem;
}
-.plugins-page .empty-state svg{
+.plugins-page .empty-state svg {
color: var(--text-muted);
margin-bottom: 1rem;
}
-.plugins-page .empty-state h3{
+.plugins-page .empty-state h3 {
font-size: 1.25rem;
color: var(--text-secondary);
margin-bottom: 0.5rem;
}
-.plugins-page .empty-state p{
+.plugins-page .empty-state p {
color: var(--text-muted);
}
/* Config Modal */
-.plugins-page .config-modal{
+.plugins-page .config-modal {
max-width: 640px;
width: 90%;
}
-.plugins-page .config-info-banner{
- display: flex;
- align-items: center;
- gap: 0.5rem;
- padding: 0.75rem 1rem;
- background: rgba(251, 191, 36, 0.1);
- border: 1px solid rgba(251, 191, 36, 0.3);
- border-radius: 8px;
- margin-bottom: 1.5rem;
- color: var(--warning);
- font-size: 0.875rem;
-}
-
-.plugins-page .config-form .form-group{
+.plugins-page .config-form .form-group {
margin-bottom: 1.25rem;
}
-.plugins-page .config-form .form-group label{
+.plugins-page .config-form .form-group label {
display: block;
font-size: 0.875rem;
font-weight: 600;
@@ -451,7 +313,9 @@
margin-bottom: 0.5rem;
}
-.plugins-page .config-form .form-group input, .plugins-page .config-form .form-group select, .plugins-page .config-form .form-group textarea{
+.plugins-page .config-form .form-group input,
+.plugins-page .config-form .form-group select,
+.plugins-page .config-form .form-group textarea {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid var(--border);
@@ -462,13 +326,15 @@
box-sizing: border-box;
}
-.plugins-page .config-form .form-group textarea{
+.plugins-page .config-form .form-group textarea {
font-family: inherit;
resize: vertical;
min-height: 4.5rem;
}
-.plugins-page .config-form .form-group input:focus, .plugins-page .config-form .form-group select:focus, .plugins-page .config-form .form-group textarea:focus{
+.plugins-page .config-form .form-group input:focus,
+.plugins-page .config-form .form-group select:focus,
+.plugins-page .config-form .form-group textarea:focus {
outline: none;
border-color: var(--primary);
background: var(--bg-white);
@@ -476,7 +342,7 @@
}
/* Nested object — a bordered group of sub-fields. */
-.plugins-page .config-form .config-fieldset{
+.plugins-page .config-form .config-fieldset {
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.75rem 1rem 0.25rem;
@@ -484,7 +350,7 @@
min-width: 0;
}
-.plugins-page .config-form .config-fieldset > legend{
+.plugins-page .config-form .config-fieldset > legend {
font-size: 0.8125rem;
font-weight: 600;
color: var(--text-secondary);
@@ -492,11 +358,11 @@
}
/* Array-of-rows — repeating rows with add/remove. */
-.plugins-page .config-form .config-array{
+.plugins-page .config-form .config-array {
margin-bottom: 1.25rem;
}
-.plugins-page .config-form .config-array > label{
+.plugins-page .config-form .config-array > label {
display: block;
font-size: 0.875rem;
font-weight: 600;
@@ -504,21 +370,21 @@
margin-bottom: 0.5rem;
}
-.plugins-page .config-form .config-array-row{
+.plugins-page .config-form .config-array-row {
display: flex;
align-items: flex-start;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
-.plugins-page .config-form .config-array-row-body{
+.plugins-page .config-form .config-array-row-body {
flex: 1;
min-width: 0;
border-left: 2px solid var(--border);
padding-left: 0.75rem;
}
-.plugins-page .config-form .config-array-remove{
+.plugins-page .config-form .config-array-remove {
display: inline-flex;
align-items: center;
justify-content: center;
@@ -531,13 +397,13 @@
transition: all 0.2s;
}
-.plugins-page .config-form .config-array-remove:hover{
+.plugins-page .config-form .config-array-remove:hover {
background: var(--danger, #e5484d);
color: #fff;
border-color: var(--danger, #e5484d);
}
-.plugins-page .config-form .config-array-add{
+.plugins-page .config-form .config-array-add {
display: inline-flex;
align-items: center;
gap: 0.35rem;
@@ -552,13 +418,13 @@
transition: all 0.2s;
}
-.plugins-page .config-form .config-array-add:hover{
+.plugins-page .config-form .config-array-add:hover {
border-color: var(--primary);
color: var(--primary);
}
/* Sandboxed-iframe config editor (B-full). */
-.plugins-page .plugin-config-ui-frame{
+.plugins-page .plugin-config-ui-frame {
display: block;
width: 100%;
border: 1px solid var(--border);
@@ -566,7 +432,7 @@
background: var(--bg-white);
}
-.plugins-page .config-ui-status{
+.plugins-page .config-ui-status {
display: flex;
align-items: center;
justify-content: center;
@@ -574,13 +440,13 @@
color: var(--text-muted);
}
-.plugins-page .config-ui-error{
+.plugins-page .config-ui-error {
padding: 1rem;
text-align: center;
color: var(--danger, #e5484d);
}
-.plugins-page .config-form .form-group small{
+.plugins-page .config-form .form-group small {
display: block;
margin-top: 0.4rem;
font-size: 0.75rem;
@@ -588,11 +454,11 @@
line-height: 1.4;
}
-.plugins-page .config-form .form-group .required-mark{
+.plugins-page .config-form .form-group .required-mark {
color: var(--danger, #e5484d);
}
-.plugins-page .toggle-group{
+.plugins-page .toggle-group {
display: flex;
align-items: center;
justify-content: space-between;
@@ -601,22 +467,22 @@
border-radius: 8px;
}
-.plugins-page .toggle-info{
+.plugins-page .toggle-info {
flex: 1;
}
-.plugins-page .toggle-info label{
+.plugins-page .toggle-info label {
display: block !important;
margin-bottom: 0.25rem !important;
}
-.plugins-page .toggle-info small{
+.plugins-page .toggle-info small {
display: block;
font-size: 0.75rem;
color: var(--text-muted);
}
-.plugins-page .toggle-switch{
+.plugins-page .toggle-switch {
position: relative;
display: inline-block;
width: 48px;
@@ -624,13 +490,13 @@
flex-shrink: 0;
}
-.plugins-page .toggle-switch input{
+.plugins-page .toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
-.plugins-page .toggle-slider{
+.plugins-page .toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
@@ -642,7 +508,7 @@
border-radius: 26px;
}
-.plugins-page .toggle-slider:before{
+.plugins-page .toggle-slider:before {
position: absolute;
content: '';
height: 20px;
@@ -655,25 +521,25 @@
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
-.plugins-page .toggle-switch input:checked + .toggle-slider{
+.plugins-page .toggle-switch input:checked + .toggle-slider {
background-color: var(--primary, #22c55e);
}
-.plugins-page .toggle-switch input:checked + .toggle-slider:before{
+.plugins-page .toggle-switch input:checked + .toggle-slider:before {
transform: translateX(22px);
}
-.plugins-page .no-config{
+.plugins-page .no-config {
text-align: center;
padding: 2rem;
color: var(--text-muted);
}
-.plugins-page .no-config p{
+.plugins-page .no-config p {
margin-top: 1rem;
}
-.plugins-page .btn-primary{
+.plugins-page .btn-primary {
padding: 0.75rem 1.5rem;
background: var(--primary, #22c55e);
color: white;
@@ -688,40 +554,62 @@
gap: 0.5rem;
}
-.plugins-page .btn-primary:hover{
+.plugins-page .btn-primary:hover {
background: #16a34a;
}
-.plugins-page .btn-primary:disabled{
+.plugins-page .btn-primary:disabled {
+ opacity: 0.6;
+ cursor: not-allowed;
+}
+
+/* Update action in the catalog — visually distinct from a fresh Install (which stays the primary
+ green). "Update available" means a newer version exists; differentiating it (amber) tells the
+ operator at a glance which rows need upgrading vs. which are fresh installs, instead of every
+ action button reading identically. Mirrors .btn-primary's metrics so the catalog rows stay aligned. */
+.plugins-page .btn-update {
+ padding: 0.75rem 1.5rem;
+ background: #f59e0b;
+ color: white;
+ border: none;
+ border-radius: 8px;
+ font-size: 0.9375rem;
+ font-weight: 600;
+ cursor: pointer;
+ transition: all 0.2s;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.plugins-page .btn-update:hover {
+ background: #d97706;
+}
+
+.plugins-page .btn-update:disabled {
opacity: 0.6;
cursor: not-allowed;
}
/* Responsive */
@media (max-width: 768px) {
- .plugins-page{
+ .plugins-page {
padding: 1rem;
}
- .plugins-page .plugins-grid{
+ .plugins-page .plugins-grid {
grid-template-columns: 1fr;
}
-
- .plugins-page .engine-header{
- flex-direction: column;
- align-items: flex-start;
- gap: 1rem;
- }
}
/* ── Two-column control layout: status rail + plugin catalog ─────────────── */
-.plugins-page .plugins-layout{
+.plugins-page .plugins-layout {
display: flex;
gap: 1.5rem;
align-items: flex-start;
}
-.plugins-page .plugins-rail{
+.plugins-page .plugins-rail {
flex: 0 0 280px;
position: sticky;
top: 1.5rem;
@@ -734,12 +622,12 @@
padding: 1.25rem;
}
-.plugins-page .plugins-main{
+.plugins-page .plugins-main {
flex: 1 1 auto;
min-width: 0;
}
-.plugins-page .rail-label{
+.plugins-page .rail-label {
font-size: 0.6875rem;
font-weight: 600;
text-transform: uppercase;
@@ -748,48 +636,12 @@
margin-bottom: 0.625rem;
}
-.plugins-page .rail-engine{
- display: flex;
- align-items: center;
- gap: 0.625rem;
-}
-
-.plugins-page .rail-engine-icon{
- width: 34px;
- height: 34px;
- display: flex;
- align-items: center;
- justify-content: center;
- background: rgba(34, 197, 94, 0.12);
- color: #16a34a;
- border-radius: 8px;
- flex-shrink: 0;
-}
-
-.plugins-page .rail-engine-meta{
- display: flex;
- flex-direction: column;
- min-width: 0;
- flex: 1;
-}
-
-.plugins-page .rail-engine-name{
- font-weight: 600;
- font-size: 0.875rem;
- color: var(--text-primary);
-}
-
-.plugins-page .rail-engine-lib{
- font-size: 0.75rem;
- color: var(--text-muted);
-}
-
-.plugins-page .rail-stats{
+.plugins-page .rail-stats {
display: flex;
gap: 0.75rem;
}
-.plugins-page .rail-stat{
+.plugins-page .rail-stat {
flex: 1;
background: var(--bg-light);
border-radius: 8px;
@@ -797,7 +649,7 @@
text-align: center;
}
-.plugins-page .rail-stat-num{
+.plugins-page .rail-stat-num {
display: block;
font-size: 1.25rem;
font-weight: 700;
@@ -805,14 +657,14 @@
line-height: 1.2;
}
-.plugins-page .rail-stat-label{
+.plugins-page .rail-stat-label {
font-size: 0.6875rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
}
-.plugins-page .rail-active-list{
+.plugins-page .rail-active-list {
list-style: none;
margin: 0;
padding: 0;
@@ -821,13 +673,13 @@
gap: 0.5rem;
}
-.plugins-page .rail-active-item{
+.plugins-page .rail-active-item {
display: flex;
align-items: center;
gap: 0.5rem;
}
-.plugins-page .rail-active-name{
+.plugins-page .rail-active-name {
font-size: 0.8125rem;
color: var(--text-primary);
flex: 1;
@@ -836,54 +688,65 @@
white-space: nowrap;
}
-.plugins-page .rail-active-type{
+.plugins-page .rail-active-type {
font-size: 0.625rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
}
-.plugins-page .rail-empty{
+.plugins-page .rail-empty {
font-size: 0.8125rem;
color: var(--text-muted);
}
-/* Engine that isn't the active one — non-actionable (switch via Settings + restart) */
-.plugins-page .btn-available{
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 0.5rem;
- padding: 0.625rem 1rem;
- background: var(--bg-light);
- border: 1px dashed var(--border);
- color: var(--text-muted);
- font-size: 0.875rem;
- font-weight: 500;
- border-radius: 8px;
- cursor: default;
-}
-
/* Uninstall icon button — neutral, red on hover */
-.plugins-page .btn-action-danger:hover{
+.plugins-page .btn-action-danger:hover {
background: rgba(239, 68, 68, 0.1);
border-color: rgba(239, 68, 68, 0.3);
}
-.plugins-page .btn-action-danger:hover svg{
+.plugins-page .btn-action-danger:hover svg {
color: #ef4444;
}
/* Install modal */
-.plugins-page .install-hint{
+.plugins-page .install-hint {
font-size: 0.875rem;
color: var(--text-secondary);
line-height: 1.5;
margin-bottom: 1rem;
}
-.plugins-page .install-drop{
+/* Sub-hint (marketplace teaser) under the upload drop — lighter + tighter so it reads as a pointer,
+ not a second paragraph. */
+.plugins-page .install-hint-sub {
+ margin-top: 0.75rem;
+ margin-bottom: 0;
+ font-size: 0.8125rem;
+ color: var(--text-muted);
+}
+
+/* Inline "Catalog" link inside the sub-hint — looks like a link, not a button, so it doesn't compete
+ with the tab strip above or the footer actions. */
+.plugins-page .install-inline-link {
+ display: inline;
+ padding: 0;
+ background: none;
+ border: none;
+ color: var(--primary, #22c55e);
+ font: inherit;
+ font-weight: 600;
+ cursor: pointer;
+ text-decoration: underline;
+ text-underline-offset: 2px;
+}
+
+.plugins-page .install-inline-link:hover {
+ filter: brightness(1.1);
+}
+
+.plugins-page .install-drop {
display: flex;
flex-direction: column;
align-items: center;
@@ -898,29 +761,29 @@
text-align: center;
}
-.plugins-page .install-drop:hover{
+.plugins-page .install-drop:hover {
border-color: var(--primary, #25d366);
color: var(--text-secondary);
}
-.plugins-page .install-drop.has-file{
+.plugins-page .install-drop.has-file {
border-style: solid;
border-color: var(--primary, #25d366);
color: var(--text-primary);
background: rgba(34, 197, 94, 0.05);
}
-.plugins-page .install-drop-name{
+.plugins-page .install-drop-name {
font-size: 0.875rem;
word-break: break-all;
}
@media (max-width: 860px) {
- .plugins-page .plugins-layout{
+ .plugins-page .plugins-layout {
flex-direction: column;
}
- .plugins-page .plugins-rail{
+ .plugins-page .plugins-rail {
flex-basis: auto;
width: 100%;
position: static;
@@ -931,7 +794,7 @@
/* Segmented pill tab control — shared shape for the install (Upload/Catalog) and
config (Configuration/Sessions) modal tabs. Replaces the old flat green underline. */
.plugins-page .install-tabs,
-.plugins-page .config-modal .modal-tabs{
+.plugins-page .config-modal .modal-tabs {
display: inline-flex;
align-self: center;
gap: 2px;
@@ -942,8 +805,46 @@
border-radius: 10px;
}
+/* When the tabs sit INSIDE the install modal header (between the title and the close button), drop
+ the standalone-row margins so they don't push the title up / leave a gap. Pin them to the true
+ horizontal center of the header with absolute positioning — justify-content:space-between only
+ centers them approximately because the title (left) and close button (right) have different widths,
+ leaving the pill visibly off-center. The header carries position:relative so this is self-contained. */
+.plugins-page .install-modal-header .install-tabs {
+ margin: 0;
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+}
+
+/* Three-item header (title + tabs + close). Position:relative anchors the absolutely-centered pill;
+ flex-wrap keeps it from overflowing horizontally on a narrow viewport (mobile bottom-sheet width),
+ wrapping to a second row instead. */
+.plugins-page .install-modal-header {
+ position: relative;
+ flex-wrap: wrap;
+ row-gap: 0.75rem;
+}
+
+.plugins-page .install-modal-header h2 {
+ min-width: 0;
+ /* Truncate an over-long title rather than collide with the tabs; the modal title is short by
+ design ("Install a plugin"), so this only ever bites an unusually long translation. */
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+/* Equal-width tabs so "Upload .zip" and "Catalog" don't read as mismatched lengths. Both get the
+ same min-width + flex:1 1 0 so they share the pill's width equally regardless of label length. */
+.plugins-page .install-tab {
+ flex: 1 1 0;
+ min-width: 128px;
+}
+
.plugins-page .install-tab,
-.plugins-page .config-modal .modal-tab{
+.plugins-page .config-modal .modal-tab {
display: inline-flex;
align-items: center;
justify-content: center;
@@ -956,38 +857,56 @@
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
- transition: background 0.15s ease, color 0.15s ease;
+ transition:
+ background 0.18s ease,
+ color 0.18s ease,
+ box-shadow 0.18s ease,
+ transform 0.18s ease;
}
+/* Active tab: a clear, primary-tinted treatment instead of the near-invisible white-on-light it had
+ before. The tint + colored text + lifted shadow + tiny scale make the selected tab read at a glance,
+ and the transition on background/color/box-shadow/transform above animates the swap smoothly. */
.plugins-page .install-tab.active,
-.plugins-page .config-modal .modal-tab.active{
- background: var(--bg-white);
+.plugins-page .config-modal .modal-tab.active {
+ background: var(--primary, #22c55e);
+ color: #fff;
+ box-shadow:
+ 0 1px 2px rgba(0, 0, 0, 0.08),
+ 0 4px 12px color-mix(in srgb, var(--primary, #22c55e) 35%, transparent);
+ transform: translateY(-1px);
+}
+
+/* Keep the inactive tabs legible against the pill's light track and give them a hover affordance so
+ it's obvious they're clickable before the active treatment snaps in. */
+.plugins-page .install-tab:not(.active):hover,
+.plugins-page .config-modal .modal-tab:not(.active):hover {
+ background: color-mix(in srgb, var(--primary, #22c55e) 12%, transparent);
color: var(--text-primary);
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
/* Sessions tab */
-.plugins-page .sessions-tab{
+.plugins-page .sessions-tab {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
-.plugins-page .sessions-section > h3{
+.plugins-page .sessions-section > h3 {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-primary);
margin: 0 0 0.25rem;
}
-.plugins-page .sessions-section > small{
+.plugins-page .sessions-section > small {
display: block;
color: var(--text-muted);
font-size: 0.75rem;
margin-bottom: 0.75rem;
}
-.plugins-page .sessions-radio{
+.plugins-page .sessions-radio {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -997,7 +916,7 @@
cursor: pointer;
}
-.plugins-page .sessions-checklist{
+.plugins-page .sessions-checklist {
display: flex;
flex-direction: column;
gap: 0.25rem;
@@ -1006,7 +925,7 @@
overflow-y: auto;
}
-.plugins-page .sessions-check{
+.plugins-page .sessions-check {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -1015,13 +934,13 @@
cursor: pointer;
}
-.plugins-page .sessions-empty{
+.plugins-page .sessions-empty {
margin: 0.25rem 0 0.75rem 1.5rem;
font-size: 0.8125rem;
color: var(--text-muted);
}
-.plugins-page .sessions-select{
+.plugins-page .sessions-select {
width: 100%;
padding: 0.6rem 0.85rem;
border: 1px solid var(--border);
@@ -1032,14 +951,14 @@
box-sizing: border-box;
}
-.plugins-page .sessions-override-actions{
+.plugins-page .sessions-override-actions {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
margin-top: 0.5rem;
}
-.plugins-page .catalog-empty{
+.plugins-page .catalog-empty {
display: flex;
align-items: center;
justify-content: center;
@@ -1049,12 +968,12 @@
font-size: 0.875rem;
}
-.plugins-page .catalog-error{
+.plugins-page .catalog-error {
flex-wrap: wrap;
color: var(--danger, #dc2626);
}
-.plugins-page .catalog-search{
+.plugins-page .catalog-search {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -1065,7 +984,7 @@
color: var(--text-muted);
}
-.plugins-page .catalog-search input{
+.plugins-page .catalog-search input {
flex: 1;
border: none;
background: transparent;
@@ -1074,7 +993,7 @@
color: var(--text-primary);
}
-.plugins-page .catalog-list{
+.plugins-page .catalog-list {
display: flex;
flex-direction: column;
gap: 8px;
@@ -1082,7 +1001,7 @@
overflow-y: auto;
}
-.plugins-page .catalog-row{
+.plugins-page .catalog-row {
display: flex;
align-items: center;
justify-content: space-between;
@@ -1092,27 +1011,27 @@
border-radius: 8px;
}
-.plugins-page .catalog-row-info{
+.plugins-page .catalog-row-info {
min-width: 0;
}
-.plugins-page .catalog-row-name{
+.plugins-page .catalog-row-name {
font-weight: 600;
}
-.plugins-page .catalog-row-version{
+.plugins-page .catalog-row-version {
color: var(--text-secondary, #6b7280);
font-weight: 400;
font-size: 0.85em;
}
-.plugins-page .catalog-row-desc{
+.plugins-page .catalog-row-desc {
color: var(--text-secondary, #6b7280);
font-size: 0.85rem;
margin-top: 2px;
}
-.plugins-page .catalog-row-meta{
+.plugins-page .catalog-row-meta {
display: flex;
align-items: center;
gap: 8px;
@@ -1121,15 +1040,15 @@
color: var(--text-secondary, #6b7280);
}
-.plugins-page .catalog-badge.update{
+.plugins-page .catalog-badge.update {
color: var(--primary, #25d366);
}
-.plugins-page .catalog-row-action{
+.plugins-page .catalog-row-action {
flex-shrink: 0;
}
-.plugins-page .catalog-installed{
+.plugins-page .catalog-installed {
display: inline-flex;
align-items: center;
gap: 6px;
diff --git a/dashboard/src/pages/Plugins.tsx b/dashboard/src/pages/Plugins.tsx
index c466142bc..e0776b720 100644
--- a/dashboard/src/pages/Plugins.tsx
+++ b/dashboard/src/pages/Plugins.tsx
@@ -576,13 +576,47 @@ export default function Plugins() {
void queryClient.invalidateQueries({ queryKey: queryKeys.plugins });
};
+ // Required-config gate: a plugin whose schema declares required fields that are still unset fails
+ // INSIDE the sandbox with a raw "<id>: <field> is required" error and flips the card to ERROR.
+ // Open the config modal instead so the user completes the fields first — cures the whole class
+ // (after-hours `schedule`/`awayMessage`, faq-bot `rules`, any catalog plugin with required fields).
+ const missingRequiredConfig = (plugin: Plugin): string[] => {
+ const props = plugin.configSchema?.properties ?? {};
+ return Object.entries(props)
+ .filter(
+ ([key, field]) =>
+ field.required === true &&
+ (plugin.config[key] === undefined || plugin.config[key] === null || plugin.config[key] === ''),
+ )
+ .map(([key]) => key);
+ };
+
const handleToggle = async (plugin: Plugin) => {
+ if (plugin.status !== 'enabled') {
+ const missing = missingRequiredConfig(plugin);
+ if (missing.length > 0) {
+ toast.warning(
+ t('plugins.toasts.configRequiredTitle', 'Configuration required'),
+ t(
+ 'plugins.toasts.configRequiredDesc',
+ `Fill in the required field(s) before enabling: ${missing.join(', ')}`,
+ ),
+ );
+ handleOpenConfig(plugin);
+ return;
+ }
+ }
setActionLoading(plugin.id);
try {
if (plugin.status === 'enabled') {
await pluginsApi.disable(plugin.id);
} else {
- await pluginsApi.enable(plugin.id);
+ const res = await pluginsApi.enable(plugin.id);
+ // The endpoint reports lifecycle failures as 200 + {success:false} — surface them instead
+ // of silently refetching (the user would otherwise think the click did nothing).
+ if (!res.success) {
+ toast.warning(t('plugins.toasts.enableFailedTitle', 'Enable failed'), res.message);
+ }
}
refetchAll();
} catch (err) {
@@ -932,26 +966,26 @@ export default function Plugins() {
{showInstallModal && (
<div className="modal-overlay" onClick={() => setShowInstallModal(false)}>
<div className="modal install-modal" onClick={e => e.stopPropagation()}>
- <div className="modal-header">
+ <div className="modal-header install-modal-header">
<h2>{t('plugins.installModal.title', 'Install a plugin')}</h2>
+ <div className="install-tabs">
+ <button
+ className={`install-tab${installMode === 'upload' ? ' active' : ''}`}
+ onClick={() => setInstallMode('upload')}
+ >
+ <Upload size={15} /> {t('plugins.installModal.tabUpload', 'Upload .zip')}
+ </button>
+ <button
+ className={`install-tab${installMode === 'catalog' ? ' active' : ''}`}
+ onClick={() => setInstallMode('catalog')}
+ >
+ <Globe size={15} /> {t('plugins.installModal.tabCatalog', 'Catalog')}
+ </button>
+ </div>
<button className="btn-icon" onClick={() => setShowInstallModal(false)}>
<X size={20} />
</button>
</div>
- <div className="install-tabs">
- <button
- className={`install-tab${installMode === 'upload' ? ' active' : ''}`}
- onClick={() => setInstallMode('upload')}
- >
- <Upload size={15} /> {t('plugins.installModal.tabUpload', 'Upload .zip')}
- </button>
- <button
- className={`install-tab${installMode === 'catalog' ? ' active' : ''}`}
- onClick={() => setInstallMode('catalog')}
- >
- <Globe size={15} /> {t('plugins.installModal.tabCatalog', 'Catalog')}
- </button>
- </div>
{installMode === 'upload' ? (
<>
@@ -974,6 +1008,15 @@ export default function Plugins() {
{installFile ? installFile.name : t('plugins.installModal.choose', 'Choose a .zip file…')}
</span>
</label>
+ {/* Point first-time users at the Catalog tab — otherwise the marketplace is invisible
+ and an operator only ever discovers plugins by hearing about one out-of-band. */}
+ <p className="install-hint install-hint-sub">
+ {t('plugins.installModal.catalogTeaser', 'Looking for plugins?')}{' '}
+ <button type="button" className="install-inline-link" onClick={() => setInstallMode('catalog')}>
+ {t('plugins.installModal.tabCatalog', 'Catalog')}
+ </button>{' '}
+ {t('plugins.installModal.catalogTeaserSuffix', 'browses the official marketplace.')}
+ </p>
</div>
<div className="modal-footer">
<button className="btn-secondary" onClick={() => setShowInstallModal(false)} disabled={installing}>
@@ -1059,7 +1102,7 @@ export default function Plugins() {
{entry.installed ? (
entry.updateAvailable ? (
<button
- className="btn-primary"
+ className="btn-update"
disabled={installingId !== null || !entry.download}
onClick={() => void handleUpdateFromCatalog(entry)}
>
diff --git a/dashboard/src/pages/Sessions.css b/dashboard/src/pages/Sessions.css
index 982297560..a3da32a9c 100644
--- a/dashboard/src/pages/Sessions.css
+++ b/dashboard/src/pages/Sessions.css
@@ -9,14 +9,6 @@
width: 100%;
}
-.sessions-page .header-content {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 1rem;
- width: 100%;
-}
-
/* H1 inherited from global */
.sessions-page .btn-primary {
@@ -261,12 +253,6 @@
flex: 1;
}
- .sessions-page .header-content {
- flex-direction: column;
- align-items: stretch;
- gap: 1rem;
- }
-
.sessions-page .btn-primary {
width: 100%;
justify-content: center;
@@ -321,6 +307,11 @@
width: 90%;
max-width: 480px;
animation: slideUp 0.3s ease;
+ /* Match the global modal: cap height + flex column so the body scrolls with header/footer pinned —
+ long content (QR + instructions) no longer pushes actions off-screen. */
+ display: flex;
+ flex-direction: column;
+ max-height: 90vh;
overflow: hidden;
}
@@ -364,6 +355,9 @@
.sessions-page .modal-body {
padding: 1.5rem;
+ /* Scroll the body (not the whole card) so the pinned header/footer stay visible. */
+ overflow-y: auto;
+ flex: 1 1 auto;
}
.sessions-page .modal-body > label {
diff --git a/dashboard/src/pages/Sessions.tsx b/dashboard/src/pages/Sessions.tsx
index 4192559fc..1ca9a7051 100644
--- a/dashboard/src/pages/Sessions.tsx
+++ b/dashboard/src/pages/Sessions.tsx
@@ -67,6 +67,11 @@ export function Sessions() {
}, [sessions]);
const { isConnected, subscribe } = useWebSocket({
+ onQRCode: useCallback((event: { sessionId: string; qrCode: string }) => {
+ // Fill the open QR modal straight from the push — the REST endpoint 400s BY DESIGN until a QR
+ // exists, so fetching it eagerly just spams the console with expected failures.
+ setQrData(prev => (prev && prev.sessionId === event.sessionId ? { ...prev, qrCode: event.qrCode } : prev));
+ }, []),
onSessionStatus: useCallback(
(event: { sessionId: string; status: string }) => {
const prev = sessionsRef.current.find(s => s.id === event.sessionId);
@@ -119,6 +124,9 @@ export function Sessions() {
currentSessionName.current = '';
return;
}
+ // Poll only while a QR actually exists to refresh (qr_ready): before that the endpoint 400s
+ // by design (the engine hasn't produced one), and the WS session.qr push covers first display.
+ if (currentSession?.status !== 'qr_ready') return;
try {
const qr = await sessionApi.getQR(sessionId);
setQrData({ sessionId, sessionName: currentSessionName.current, qrCode: qr.qrCode });
@@ -144,7 +152,6 @@ export function Sessions() {
},
[fetchSessions],
);
-
useEffect(() => {
if (qrData) {
currentSessionName.current = qrData.sessionName;
@@ -259,13 +266,18 @@ export function Sessions() {
// even before Chromium has finished initializing.
setQrData({ sessionId: id, sessionName, qrCode: '' });
currentSessionName.current = sessionName;
- try {
- const qr = await sessionApi.getQR(id);
- setQrData({ sessionId: id, sessionName, qrCode: qr.qrCode });
- } catch (err) {
- console.error('Failed to get QR:', err);
- // Do not clear qrData here — keep the loading modal open so the
- // polling interval (every 5 s) retries until the QR becomes available.
+ // Eager-fetch only when a QR already exists (qr_ready): before that the endpoint 400s BY DESIGN
+ // (the engine hasn't produced one), and the WS session.qr push + gated 5s poll deliver it
+ // without spamming the console with expected failures.
+ if (session?.status === 'qr_ready') {
+ try {
+ const qr = await sessionApi.getQR(id);
+ setQrData({ sessionId: id, sessionName, qrCode: qr.qrCode });
+ } catch (err) {
+ console.error('Failed to get QR:', err);
+ // Do not clear qrData here — keep the loading modal open so the
+ // polling interval (every 5 s) retries until the QR becomes available.
+ }
}
};
@@ -312,7 +324,8 @@ export function Sessions() {
statusFilter === 'all' ||
(statusFilter === 'active' && s.status === 'ready') ||
(statusFilter === 'inactive' && ['created', 'idle', 'disconnected', 'failed'].includes(s.status)) ||
- (statusFilter === 'connecting' && ['initializing', 'connecting', 'authenticating', 'qr_ready'].includes(s.status));
+ (statusFilter === 'connecting' &&
+ ['initializing', 'connecting', 'authenticating', 'qr_ready'].includes(s.status));
return matchesSearch && matchesStatus;
});
diff --git a/dashboard/src/pages/Templates.css b/dashboard/src/pages/Templates.css
index a5c751a22..f7e1d5dac 100644
--- a/dashboard/src/pages/Templates.css
+++ b/dashboard/src/pages/Templates.css
@@ -1,24 +1,27 @@
-.templates-page{
+.templates-page {
width: 100%;
padding: 2rem;
overflow-x: hidden;
}
-.templates-page .templates-loading, .templates-page .templates-loading-inline, .templates-page .templates-empty-page, .templates-page .templates-empty-list{
+.templates-page .templates-loading,
+.templates-page .templates-loading-inline,
+.templates-page .templates-empty-page,
+.templates-page .templates-empty-list {
display: flex;
align-items: center;
justify-content: center;
}
-.templates-page .templates-loading{
+.templates-page .templates-loading {
min-height: 400px;
}
-.templates-page .templates-session-select{
+.templates-page .templates-session-select {
min-width: 240px;
}
-.templates-page .templates-workspace{
+.templates-page .templates-workspace {
display: grid;
grid-template-columns: minmax(260px, 320px) minmax(420px, 1fr) minmax(280px, 360px);
min-height: calc(100vh - 180px);
@@ -29,19 +32,23 @@
overflow: hidden;
}
-.templates-page .templates-library, .templates-page .template-editor, .templates-page .template-preview{
+.templates-page .templates-library,
+.templates-page .template-editor,
+.templates-page .template-preview {
min-width: 0;
min-height: 0;
}
-.templates-page .templates-library{
+.templates-page .templates-library {
display: flex;
flex-direction: column;
border-right: 1px solid var(--border);
background: var(--bg-light);
}
-.templates-page .templates-library-header, .templates-page .template-editor-header, .templates-page .template-preview-header{
+.templates-page .templates-library-header,
+.templates-page .template-editor-header,
+.templates-page .template-preview-header {
display: flex;
align-items: center;
justify-content: space-between;
@@ -51,7 +58,9 @@
border-bottom: 1px solid var(--border);
}
-.templates-page .templates-library-header h2, .templates-page .template-editor-header h2, .templates-page .template-preview-header h2{
+.templates-page .templates-library-header h2,
+.templates-page .template-editor-header h2,
+.templates-page .template-preview-header h2 {
margin: 0;
color: var(--text-secondary);
font-size: 0.75rem;
@@ -60,25 +69,74 @@
letter-spacing: 0.05em;
}
-.templates-page .templates-library-header span, .templates-page .template-editor-header p, .templates-page .template-preview-header span{
+.templates-page .templates-library-header span,
+.templates-page .template-editor-header p,
+.templates-page .template-preview-header span {
display: block;
margin-top: 0.25rem;
color: var(--text-muted);
font-size: 0.8125rem;
}
-.templates-page .template-editor-header p{
+.templates-page .template-editor-header p {
margin-bottom: 0;
}
-.templates-page .templates-new-btn{
+/* btn-primary/btn-secondary were undefined on this page — both action buttons fell back to
+ near-browser-default styling. Mirrors the Plugins/Logs button styles for design-system parity.
+ Placed BEFORE .templates-new-btn (equal specificity) so its smaller metrics still win on the
+ header button. */
+.templates-page .btn-primary {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ padding: 0.75rem 1.5rem;
+ background: var(--primary, #22c55e);
+ color: #fff;
+ border: none;
+ border-radius: 8px;
+ font-size: 0.9375rem;
+ font-weight: 600;
+ cursor: pointer;
+ transition: all 0.2s;
+}
+
+.templates-page .btn-primary:hover:not(:disabled) {
+ background: var(--primary-hover, #16a34a);
+}
+
+.templates-page .btn-primary:disabled {
+ opacity: 0.45;
+ cursor: not-allowed;
+}
+
+.templates-page .btn-secondary {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ padding: 0.75rem 1.25rem;
+ background: var(--bg-white);
+ color: var(--text-primary);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ font-size: 0.9375rem;
+ font-weight: 500;
+ cursor: pointer;
+ transition: all 0.2s;
+}
+
+.templates-page .btn-secondary:hover:not(:disabled) {
+ background: var(--bg-light);
+}
+
+.templates-page .templates-new-btn {
min-height: 36px;
padding: 0.5rem 0.75rem;
font-size: 0.8125rem;
white-space: nowrap;
}
-.templates-page .templates-search{
+.templates-page .templates-search {
display: grid;
grid-template-columns: 18px minmax(0, 1fr);
align-items: center;
@@ -91,7 +149,7 @@
color: var(--text-muted);
}
-.templates-page .templates-search input{
+.templates-page .templates-search input {
width: 100%;
padding: 0;
border: 0;
@@ -101,7 +159,7 @@
font-size: 0.875rem;
}
-.templates-page .template-list{
+.templates-page .template-list {
display: flex;
flex: 1;
flex-direction: column;
@@ -109,7 +167,7 @@
padding: 0 0.5rem 1rem;
}
-.templates-page .template-list-item{
+.templates-page .template-list-item {
display: flex;
flex-direction: column;
align-items: stretch;
@@ -123,17 +181,17 @@
text-align: left;
}
-.templates-page .template-list-item:hover{
+.templates-page .template-list-item:hover {
border-color: var(--border);
background: var(--bg-white);
}
-.templates-page .template-list-item.selected{
+.templates-page .template-list-item.selected {
border-color: var(--primary);
background: var(--primary-soft);
}
-.templates-page .template-list-title{
+.templates-page .template-list-title {
overflow: hidden;
color: var(--text-primary);
font-size: 0.9375rem;
@@ -142,7 +200,7 @@
white-space: nowrap;
}
-.templates-page .template-list-body{
+.templates-page .template-list-body {
display: -webkit-box;
overflow: hidden;
color: var(--text-secondary);
@@ -152,7 +210,7 @@
-webkit-line-clamp: 2;
}
-.templates-page .template-list-meta{
+.templates-page .template-list-meta {
overflow: hidden;
color: var(--text-muted);
font-family: 'JetBrains Mono', ui-monospace, monospace;
@@ -161,19 +219,20 @@
white-space: nowrap;
}
-.templates-page .template-editor{
+.templates-page .template-editor {
display: flex;
flex-direction: column;
background: var(--bg-white);
}
-.templates-page .template-header-actions, .templates-page .template-editor-actions{
+.templates-page .template-header-actions,
+.templates-page .template-editor-actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
-.templates-page .template-form{
+.templates-page .template-form {
display: flex;
flex: 1;
flex-direction: column;
@@ -182,26 +241,29 @@
overflow-y: auto;
}
-.templates-page .template-message-fields{
+.templates-page .template-message-fields {
display: grid;
grid-template-rows: auto minmax(240px, 1fr) auto;
gap: 1rem;
flex: 1;
}
-.templates-page .template-form .form-group{
+.templates-page .template-form .form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
-.templates-page .template-form label, .templates-page .placeholder-list label > span{
+.templates-page .template-form label,
+.templates-page .placeholder-list label > span {
color: var(--text-secondary);
font-size: 0.8125rem;
font-weight: 700;
}
-.templates-page .template-form input, .templates-page .template-form textarea, .templates-page .placeholder-list input{
+.templates-page .template-form input,
+.templates-page .template-form textarea,
+.templates-page .placeholder-list input {
width: 100%;
border: 1px solid var(--border);
border-radius: 8px;
@@ -210,11 +272,12 @@
font-size: 0.9375rem;
}
-.templates-page .template-form input, .templates-page .placeholder-list input{
+.templates-page .template-form input,
+.templates-page .placeholder-list input {
padding: 0.8125rem 0.875rem;
}
-.templates-page .template-form textarea{
+.templates-page .template-form textarea {
flex: 1;
min-height: 240px;
padding: 0.875rem;
@@ -222,30 +285,32 @@
resize: vertical;
}
-.templates-page .template-form input:focus, .templates-page .template-form textarea:focus, .templates-page .placeholder-list input:focus{
+.templates-page .template-form input:focus,
+.templates-page .template-form textarea:focus,
+.templates-page .placeholder-list input:focus {
outline: none;
border-color: var(--primary);
background: var(--bg-white);
box-shadow: 0 0 0 3px var(--primary-soft);
}
-.templates-page .body-field{
+.templates-page .body-field {
min-height: 0;
}
-.templates-page .template-editor-actions{
+.templates-page .template-editor-actions {
justify-content: flex-end;
padding-top: 0.25rem;
}
-.templates-page .template-preview{
+.templates-page .template-preview {
display: flex;
flex-direction: column;
border-left: 1px solid var(--border);
background: var(--bg-light);
}
-.templates-page .template-preview-header span{
+.templates-page .template-preview-header span {
display: inline-flex;
align-items: center;
justify-content: center;
@@ -260,11 +325,11 @@
font-weight: 700;
}
-.templates-page .template-preview-message{
+.templates-page .template-preview-message {
padding: 1rem;
}
-.templates-page .template-preview-message pre{
+.templates-page .template-preview-message pre {
min-height: 220px;
max-height: 360px;
margin: 0;
@@ -281,37 +346,39 @@
word-break: break-word;
}
-.templates-page .template-variable-panel{
+.templates-page .template-variable-panel {
flex: 1;
overflow-y: auto;
padding: 0 1rem 1rem;
}
-.templates-page .placeholder-list{
+.templates-page .placeholder-list {
display: flex;
flex-direction: column;
gap: 0.875rem;
}
-.templates-page .placeholder-list label{
+.templates-page .placeholder-list label {
display: flex;
flex-direction: column;
gap: 0.375rem;
}
-.templates-page .placeholder-list label > span{
+.templates-page .placeholder-list label > span {
color: var(--primary);
font-family: 'JetBrains Mono', ui-monospace, monospace;
}
-.templates-page .template-muted{
+.templates-page .template-muted {
margin: 0;
color: var(--text-secondary);
font-size: 0.875rem;
line-height: 1.5;
}
-.templates-page .templates-loading-inline, .templates-page .templates-empty-list, .templates-page .templates-empty-page{
+.templates-page .templates-loading-inline,
+.templates-page .templates-empty-list,
+.templates-page .templates-empty-page {
min-height: 220px;
flex-direction: column;
gap: 0.75rem;
@@ -320,30 +387,32 @@
text-align: center;
}
-.templates-page .templates-empty-list.compact{
+.templates-page .templates-empty-list.compact {
min-height: 140px;
}
-.templates-page .templates-empty-page{
+.templates-page .templates-empty-page {
border: 1px solid var(--border);
border-radius: 8px;
background: var(--bg-white);
box-shadow: var(--shadow-sm);
}
-.templates-page .templates-empty-list h3, .templates-page .templates-empty-page h3{
+.templates-page .templates-empty-list h3,
+.templates-page .templates-empty-page h3 {
margin: 0;
color: var(--text-secondary);
}
-.templates-page .templates-empty-list p, .templates-page .templates-empty-page p{
+.templates-page .templates-empty-list p,
+.templates-page .templates-empty-page p {
max-width: 340px;
margin: 0;
color: var(--text-secondary);
font-size: 0.875rem;
}
-.templates-page .icon-btn{
+.templates-page .icon-btn {
display: inline-flex;
align-items: center;
justify-content: center;
@@ -356,18 +425,18 @@
color: var(--text-secondary);
}
-.templates-page .icon-btn:hover{
+.templates-page .icon-btn:hover {
background: var(--bg-light);
color: var(--text-primary);
}
-.templates-page .icon-btn.danger:hover{
+.templates-page .icon-btn.danger:hover {
border-color: rgba(239, 68, 68, 0.3);
background: rgba(239, 68, 68, 0.12);
color: var(--error);
}
-.templates-page .btn-danger{
+.templates-page .btn-danger {
display: inline-flex;
align-items: center;
gap: 0.5rem;
@@ -380,11 +449,11 @@
font-weight: 600;
}
-.templates-page .btn-danger:hover{
+.templates-page .btn-danger:hover {
background: #b91c1c;
}
-.templates-page .toast{
+.templates-page .toast {
position: fixed;
top: 1.5rem;
right: 1.5rem;
@@ -399,19 +468,19 @@
font-weight: 500;
}
-.templates-page .toast.success{
+.templates-page .toast.success {
border: 1px solid rgba(37, 211, 102, 0.3);
background: rgba(37, 211, 102, 0.12);
color: var(--success);
}
-.templates-page .toast.error{
+.templates-page .toast.error {
border: 1px solid rgba(239, 68, 68, 0.3);
background: rgba(239, 68, 68, 0.12);
color: var(--error);
}
-.templates-page .toast-close{
+.templates-page .toast-close {
display: inline-flex;
align-items: center;
justify-content: center;
@@ -424,16 +493,16 @@
opacity: 0.7;
}
-.templates-page .toast-close:hover{
+.templates-page .toast-close:hover {
opacity: 1;
}
@media (max-width: 1280px) {
- .templates-page .templates-workspace{
+ .templates-page .templates-workspace {
grid-template-columns: 280px minmax(380px, 1fr);
}
- .templates-page .template-preview{
+ .templates-page .template-preview {
grid-column: 1 / -1;
display: grid;
grid-template-columns: 1fr 320px;
@@ -441,57 +510,63 @@
border-left: 0;
}
- .templates-page .template-preview-header{
+ .templates-page .template-preview-header {
grid-column: 1 / -1;
}
- .templates-page .template-variable-panel{
+ .templates-page .template-variable-panel {
padding-top: 1rem;
}
}
@media (max-width: 900px) {
- .templates-page{
+ .templates-page {
padding: 1rem;
}
- .templates-page .templates-session-select{
+ .templates-page .templates-session-select {
min-width: 0;
width: 100%;
}
- .templates-page .templates-workspace{
+ .templates-page .templates-workspace {
display: flex;
flex-direction: column;
min-height: auto;
}
- .templates-page .templates-library{
+ .templates-page .templates-library {
max-height: 360px;
border-right: 0;
border-bottom: 1px solid var(--border);
}
- .templates-page .template-editor-header, .templates-page .templates-library-header, .templates-page .template-preview-header{
+ .templates-page .template-editor-header,
+ .templates-page .templates-library-header,
+ .templates-page .template-preview-header {
min-height: auto;
}
- .templates-page .template-preview{
+ .templates-page .template-preview {
display: flex;
}
}
@media (max-width: 640px) {
- .templates-page .templates-library-header, .templates-page .template-editor-header, .templates-page .template-editor-actions{
+ .templates-page .templates-library-header,
+ .templates-page .template-editor-header,
+ .templates-page .template-editor-actions {
flex-direction: column;
align-items: stretch;
}
- .templates-page .template-header-actions{
+ .templates-page .template-header-actions {
justify-content: flex-end;
}
- .templates-page .template-form, .templates-page .template-preview-message, .templates-page .template-variable-panel{
+ .templates-page .template-form,
+ .templates-page .template-preview-message,
+ .templates-page .template-variable-panel {
padding: 1rem;
}
}
diff --git a/dashboard/src/pages/Webhooks.css b/dashboard/src/pages/Webhooks.css
index cdea3d2c1..e29809dca 100644
--- a/dashboard/src/pages/Webhooks.css
+++ b/dashboard/src/pages/Webhooks.css
@@ -1,4 +1,4 @@
-.webhooks-page{
+.webhooks-page {
padding: 2rem;
width: 100%;
box-sizing: border-box;
@@ -6,35 +6,31 @@
}
/* Webhook create/edit modal: roomier than the default 480px (filters need width). */
-.webhooks-page .modal:not(.modal-sm){
+.webhooks-page .modal:not(.modal-sm) {
max-width: 640px;
}
/* Consistent vertical rhythm between top-level form blocks in the webhook modals.
Direct-child only, so nested FilterBuilder inputs/selects are untouched. */
-.webhooks-page .modal-body > input, .webhooks-page .modal-body > select, .webhooks-page .modal-body > .event-tags{
+.webhooks-page .modal-body > input,
+.webhooks-page .modal-body > select,
+.webhooks-page .modal-body > .event-tags {
margin-bottom: 0.75rem;
}
-.webhooks-page .modal-body > .event-tags{
+.webhooks-page .modal-body > .event-tags {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
-.webhooks-page .page-header{
+.webhooks-page .page-header {
margin-bottom: 2rem;
}
-.webhooks-page .header-content{
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
/* H1 inherited from global */
-.webhooks-page .btn-primary{
+.webhooks-page .btn-primary {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -49,28 +45,28 @@
transition: background 0.2s;
}
-.webhooks-page .btn-primary:hover{
+.webhooks-page .btn-primary:hover {
background: var(--primary-hover);
}
-.webhooks-page .webhooks-content{
+.webhooks-page .webhooks-content {
display: grid;
grid-template-columns: 1fr 280px;
gap: 1.5rem;
}
-.webhooks-page .webhooks-list-container{
+.webhooks-page .webhooks-list-container {
width: 100%;
min-width: 0;
}
-.webhooks-page .webhooks-card-list{
+.webhooks-page .webhooks-card-list {
display: flex;
flex-direction: column;
gap: 1rem;
}
-.webhooks-page .webhook-card{
+.webhooks-page .webhook-card {
background: var(--bg-white);
border-radius: 12px;
box-shadow: var(--shadow-sm);
@@ -79,11 +75,11 @@
transition: box-shadow 0.2s;
}
-.webhooks-page .webhook-card:hover{
+.webhooks-page .webhook-card:hover {
box-shadow: var(--shadow-md);
}
-.webhooks-page .webhook-card-header{
+.webhooks-page .webhook-card-header {
display: flex;
align-items: center;
justify-content: space-between;
@@ -93,7 +89,7 @@
gap: 1rem;
}
-.webhooks-page .webhook-url-row{
+.webhooks-page .webhook-url-row {
display: flex;
align-items: center;
gap: 0.625rem;
@@ -101,12 +97,12 @@
min-width: 0;
}
-.webhooks-page .webhook-url-icon{
+.webhooks-page .webhook-url-icon {
color: var(--primary);
flex-shrink: 0;
}
-.webhooks-page .webhook-url{
+.webhooks-page .webhook-url {
font-size: 0.8125rem;
font-weight: 500;
color: var(--text-primary);
@@ -118,30 +114,30 @@
font-family: 'JetBrains Mono', monospace;
}
-.webhooks-page .webhook-card-actions{
+.webhooks-page .webhook-card-actions {
display: flex;
gap: 0.375rem;
flex-shrink: 0;
}
-.webhooks-page .webhook-card-body{
+.webhooks-page .webhook-card-body {
padding: 1rem 1.25rem;
overflow: hidden;
}
-.webhooks-page .webhook-meta{
+.webhooks-page .webhook-meta {
display: flex;
gap: 2rem;
margin-bottom: 0.875rem;
}
-.webhooks-page .webhook-meta-item{
+.webhooks-page .webhook-meta-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
-.webhooks-page .webhook-meta-label{
+.webhooks-page .webhook-meta-label {
font-size: 0.6875rem;
font-weight: 700;
text-transform: uppercase;
@@ -149,19 +145,19 @@
color: var(--text-secondary);
}
-.webhooks-page .webhook-meta-value{
+.webhooks-page .webhook-meta-value {
font-size: 0.875rem;
font-weight: 500;
color: var(--text-primary);
}
-.webhooks-page .webhook-events{
+.webhooks-page .webhook-events {
display: flex;
flex-direction: column;
gap: 0.375rem;
}
-.webhooks-page .empty-table-state{
+.webhooks-page .empty-table-state {
display: flex;
flex-direction: column;
align-items: center;
@@ -171,32 +167,32 @@
color: var(--text-muted);
}
-.webhooks-page .empty-table-state svg{
+.webhooks-page .empty-table-state svg {
margin-bottom: 1rem;
opacity: 0.4;
color: var(--text-muted);
}
-.webhooks-page .empty-table-state h3{
+.webhooks-page .empty-table-state h3 {
font-size: 1.125rem;
font-weight: 600;
color: var(--text-secondary);
margin: 0 0 0.5rem;
}
-.webhooks-page .empty-table-state p{
+.webhooks-page .empty-table-state p {
margin: 0;
font-size: 0.875rem;
max-width: 300px;
}
-.webhooks-page .events-cell{
+.webhooks-page .events-cell {
display: flex;
flex-wrap: wrap;
gap: 0.375rem;
}
-.webhooks-page .event-tag{
+.webhooks-page .event-tag {
font-size: 0.75rem;
padding: 0.25rem 0.625rem;
background: rgba(37, 211, 102, 0.15);
@@ -211,7 +207,7 @@
}
/* Modal event tags - clickable (webhooks only) */
-.webhooks-page .modal-body .event-tag{
+.webhooks-page .modal-body .event-tag {
font-size: 0.8125rem;
padding: 0.5rem 0.75rem;
background: var(--bg-light);
@@ -225,12 +221,12 @@
gap: 0.375rem;
}
-.webhooks-page .modal-body .event-tag:hover{
+.webhooks-page .modal-body .event-tag:hover {
border-color: var(--primary);
color: var(--primary);
}
-.webhooks-page .modal-body .event-tag.selected{
+.webhooks-page .modal-body .event-tag.selected {
background: var(--primary);
color: white;
border-color: var(--primary);
@@ -242,27 +238,27 @@
}
/* Ensure modal event tags have proper unselected & selected styles in dark mode */
-.webhooks-page [data-theme='dark'] .modal-body .event-tag,
+[data-theme='dark'] .webhooks-page .modal-body .event-tag,
:root:not([data-theme='light']) .webhooks-page .modal-body .event-tag {
background: var(--bg-light);
color: var(--text-secondary);
border-color: var(--border);
}
-.webhooks-page [data-theme='dark'] .modal-body .event-tag:hover,
+[data-theme='dark'] .webhooks-page .modal-body .event-tag:hover,
:root:not([data-theme='light']) .webhooks-page .modal-body .event-tag:hover {
border-color: var(--primary);
color: var(--primary);
}
-.webhooks-page [data-theme='dark'] .modal-body .event-tag.selected,
+[data-theme='dark'] .webhooks-page .modal-body .event-tag.selected,
:root:not([data-theme='light']) .webhooks-page .modal-body .event-tag.selected {
background: var(--primary);
color: white;
border-color: var(--primary);
}
-.webhooks-page .filter-badge{
+.webhooks-page .filter-badge {
display: inline-flex;
align-items: center;
gap: 0.25rem;
@@ -276,19 +272,20 @@
border: 1px solid var(--border);
}
-.webhooks-page .filter-badge-interactive{
+.webhooks-page .filter-badge-interactive {
position: relative;
cursor: default;
outline: none;
}
-.webhooks-page .filter-badge-interactive:hover, .webhooks-page .filter-badge-interactive:focus-visible{
+.webhooks-page .filter-badge-interactive:hover,
+.webhooks-page .filter-badge-interactive:focus-visible {
border-color: var(--primary);
color: var(--text-primary);
}
/* Fixed-positioned (escapes the card's overflow:hidden); coordinates set inline from the badge rect. */
-.webhooks-page .filter-popover{
+.webhooks-page .filter-popover {
position: fixed;
z-index: 100;
min-width: 200px;
@@ -306,7 +303,7 @@
cursor: default;
}
-.webhooks-page .filter-popover-title{
+.webhooks-page .filter-popover-title {
font-size: 0.65rem;
font-weight: 700;
text-transform: uppercase;
@@ -315,18 +312,18 @@
margin-bottom: 0.125rem;
}
-.webhooks-page .filter-popover-row{
+.webhooks-page .filter-popover-row {
font-size: 0.78rem;
color: var(--text-primary);
word-break: break-word;
}
-.webhooks-page .filter-popover-row + .filter-popover-row{
+.webhooks-page .filter-popover-row + .filter-popover-row {
padding-top: 0.25rem;
border-top: 1px solid var(--border);
}
-.webhooks-page .status-badge{
+.webhooks-page .status-badge {
display: inline-flex;
align-items: center;
gap: 0.375rem;
@@ -338,7 +335,7 @@
width: fit-content;
}
-.webhooks-page .status-badge::before{
+.webhooks-page .status-badge::before {
content: '';
width: 6px;
height: 6px;
@@ -347,17 +344,17 @@
flex-shrink: 0;
}
-.webhooks-page .status-badge.active{
+.webhooks-page .status-badge.active {
background: rgba(37, 211, 102, 0.15);
color: var(--primary);
}
-.webhooks-page .status-badge.inactive{
+.webhooks-page .status-badge.inactive {
background: var(--bg-light);
color: var(--text-muted);
}
-.webhooks-page .icon-btn{
+.webhooks-page .icon-btn {
padding: 0.5rem;
background: transparent;
border: 1px solid var(--border);
@@ -368,18 +365,18 @@
flex-shrink: 0;
}
-.webhooks-page .icon-btn:hover{
+.webhooks-page .icon-btn:hover {
background: var(--bg-light);
color: var(--text-primary);
}
-.webhooks-page .icon-btn.danger:hover{
+.webhooks-page .icon-btn.danger:hover {
background: rgba(239, 68, 68, 0.12);
border-color: rgba(239, 68, 68, 0.3);
color: var(--error);
}
-.webhooks-page .events-reference{
+.webhooks-page .events-reference {
background: var(--bg-white);
border-radius: 12px;
padding: 1.5rem;
@@ -388,7 +385,7 @@
height: fit-content;
}
-.webhooks-page .events-reference h3{
+.webhooks-page .events-reference h3 {
font-size: 1rem;
font-weight: 700;
color: var(--text-primary);
@@ -397,19 +394,19 @@
letter-spacing: normal;
}
-.webhooks-page .events-list{
+.webhooks-page .events-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
-.webhooks-page .event-item{
+.webhooks-page .event-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
-.webhooks-page .event-item code{
+.webhooks-page .event-item code {
font-size: 0.8125rem;
color: var(--primary);
background: rgba(37, 211, 102, 0.1);
@@ -418,134 +415,134 @@
width: fit-content;
}
-.webhooks-page .event-item span{
+.webhooks-page .event-item span {
font-size: 0.8125rem;
color: var(--text-secondary);
line-height: 1.4;
}
/* Dark mode - explicit theme */
-.webhooks-page [data-theme='dark'] .event-tag{
+[data-theme='dark'] .webhooks-page .event-tag {
color: #4ade80;
background: rgba(37, 211, 102, 0.2);
border-color: rgba(37, 211, 102, 0.35);
}
-.webhooks-page [data-theme='dark'] .status-badge.active{
+[data-theme='dark'] .webhooks-page .status-badge.active {
color: #4ade80;
background: rgba(37, 211, 102, 0.2);
}
-.webhooks-page [data-theme='dark'] .webhook-url{
+[data-theme='dark'] .webhooks-page .webhook-url {
color: #e2e8f0;
}
-.webhooks-page [data-theme='dark'] .webhook-meta-label{
+[data-theme='dark'] .webhooks-page .webhook-meta-label {
color: #94a3b8;
}
-.webhooks-page [data-theme='dark'] .webhook-meta-value{
+[data-theme='dark'] .webhooks-page .webhook-meta-value {
color: #e2e8f0;
}
/* Dark mode - system preference */
@media (prefers-color-scheme: dark) {
- :root:not([data-theme='light']) .webhooks-page .event-tag{
+ :root:not([data-theme='light']) .webhooks-page .event-tag {
color: #4ade80;
background: rgba(37, 211, 102, 0.2);
border-color: rgba(37, 211, 102, 0.35);
}
- :root:not([data-theme='light']) .webhooks-page .status-badge.active{
+ :root:not([data-theme='light']) .webhooks-page .status-badge.active {
color: #4ade80;
background: rgba(37, 211, 102, 0.2);
}
- :root:not([data-theme='light']) .webhooks-page .webhook-url{
+ :root:not([data-theme='light']) .webhooks-page .webhook-url {
color: #e2e8f0;
}
- :root:not([data-theme='light']) .webhooks-page .webhook-meta-label{
+ :root:not([data-theme='light']) .webhooks-page .webhook-meta-label {
color: #94a3b8;
}
- :root:not([data-theme='light']) .webhooks-page .webhook-meta-value{
+ :root:not([data-theme='light']) .webhooks-page .webhook-meta-value {
color: #e2e8f0;
}
}
/* Responsive */
@media (max-width: 1024px) {
- .webhooks-page .webhooks-content{
+ .webhooks-page .webhooks-content {
grid-template-columns: 1fr;
}
- .webhooks-page .events-reference{
+ .webhooks-page .events-reference {
display: none;
}
}
@media (max-width: 768px) {
- .webhooks-page{
+ .webhooks-page {
padding: 1rem;
}
- .webhooks-page .webhooks-content{
+ .webhooks-page .webhooks-content {
grid-template-columns: 1fr;
}
- .webhooks-page .webhook-card{
+ .webhooks-page .webhook-card {
overflow: hidden;
}
- .webhooks-page .webhook-card-header{
+ .webhooks-page .webhook-card-header {
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
padding: 0.875rem 1rem;
}
- .webhooks-page .webhook-url-row{
+ .webhooks-page .webhook-url-row {
width: 100%;
min-width: 0;
}
- .webhooks-page .webhook-url{
+ .webhooks-page .webhook-url {
font-size: 0.75rem;
}
- .webhooks-page .webhook-card-actions{
+ .webhooks-page .webhook-card-actions {
width: 100%;
justify-content: flex-end;
}
- .webhooks-page .webhook-card-body{
+ .webhooks-page .webhook-card-body {
padding: 0.875rem 1rem;
}
- .webhooks-page .webhook-meta{
+ .webhooks-page .webhook-meta {
flex-direction: column;
gap: 0.75rem;
}
- .webhooks-page .webhook-meta-value{
+ .webhooks-page .webhook-meta-value {
font-size: 0.8125rem;
word-break: break-all;
}
- .webhooks-page .events-cell{
+ .webhooks-page .events-cell {
flex-wrap: wrap;
gap: 0.375rem;
}
- .webhooks-page .event-tag{
+ .webhooks-page .event-tag {
font-size: 0.6875rem;
padding: 0.2rem 0.5rem;
}
}
/* Toast Notification */
-.webhooks-page .toast{
+.webhooks-page .toast {
position: fixed;
top: 1.5rem;
right: 1.5rem;
@@ -572,19 +569,19 @@
}
}
-.webhooks-page .toast.success{
+.webhooks-page .toast.success {
background: rgba(37, 211, 102, 0.12);
border: 1px solid rgba(37, 211, 102, 0.3);
color: var(--success);
}
-.webhooks-page .toast.error{
+.webhooks-page .toast.error {
background: rgba(239, 68, 68, 0.12);
border: 1px solid rgba(239, 68, 68, 0.3);
color: var(--error);
}
-.webhooks-page .toast-close{
+.webhooks-page .toast-close {
background: transparent;
border: none;
padding: 0.25rem;
@@ -593,12 +590,12 @@
color: inherit;
}
-.webhooks-page .toast-close:hover{
+.webhooks-page .toast-close:hover {
opacity: 1;
}
/* Danger Button */
-.webhooks-page .btn-danger{
+.webhooks-page .btn-danger {
display: flex;
align-items: center;
gap: 0.5rem;
@@ -613,23 +610,23 @@
transition: background 0.2s;
}
-.webhooks-page .btn-danger:hover{
+.webhooks-page .btn-danger:hover {
background: #b91c1c;
}
/* Small Modal Variant */
-.webhooks-page .modal.modal-sm{
+.webhooks-page .modal.modal-sm {
max-width: 400px;
}
/* Disabled button */
-.webhooks-page .icon-btn:disabled{
+.webhooks-page .icon-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Animate spin for loading */
-.webhooks-page .animate-spin{
+.webhooks-page .animate-spin {
animation: spin 1s linear infinite;
}
@@ -643,7 +640,7 @@
}
/* Toggle Switch */
-.webhooks-page .toggle-group{
+.webhooks-page .toggle-group {
display: flex;
align-items: center;
gap: 1rem;
@@ -653,25 +650,25 @@
border-radius: var(--radius);
}
-.webhooks-page .toggle-label{
+.webhooks-page .toggle-label {
font-weight: 500;
color: var(--text-primary);
}
-.webhooks-page .toggle-switch{
+.webhooks-page .toggle-switch {
position: relative;
display: inline-block;
width: 48px;
height: 26px;
}
-.webhooks-page .toggle-switch input{
+.webhooks-page .toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
-.webhooks-page .toggle-slider{
+.webhooks-page .toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
@@ -683,7 +680,7 @@
border-radius: 26px;
}
-.webhooks-page .toggle-slider::before{
+.webhooks-page .toggle-slider::before {
position: absolute;
content: '';
height: 20px;
@@ -696,23 +693,23 @@
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
-.webhooks-page .toggle-switch input:checked + .toggle-slider{
+.webhooks-page .toggle-switch input:checked + .toggle-slider {
background-color: var(--primary);
}
-.webhooks-page .toggle-switch input:checked + .toggle-slider::before{
+.webhooks-page .toggle-switch input:checked + .toggle-slider::before {
transform: translateX(22px);
}
-.webhooks-page .toggle-status{
+.webhooks-page .toggle-status {
font-size: 0.875rem;
font-weight: 500;
}
-.webhooks-page .toggle-status.active{
+.webhooks-page .toggle-status.active {
color: var(--primary);
}
-.webhooks-page .toggle-status.inactive{
+.webhooks-page .toggle-status.inactive {
color: var(--text-muted);
}
diff --git a/dashboard/src/services/api.ts b/dashboard/src/services/api.ts
index e463dabfc..2e9192415 100644
--- a/dashboard/src/services/api.ts
+++ b/dashboard/src/services/api.ts
@@ -709,27 +709,20 @@ export const infraApi = {
// Data migration: export all Data-DB tables (call while still on the OLD database, before switching),
// then import after the switch + restart. Used by the DB-switch migration guard so data isn't lost.
exportData: () =>
- request<{ exportedAt: string; dataDbType: string; tables: Record<string, unknown[]>; counts: Record<string, number> }>(
- '/infra/export-data',
- ),
+ request<{
+ exportedAt: string;
+ dataDbType: string;
+ tables: Record<string, unknown[]>;
+ counts: Record<string, number>;
+ }>('/infra/export-data'),
importData: (tables: Record<string, unknown[]>) =>
- request<{ imported: boolean; counts?: Record<string, number>; message?: string; warnings?: string[] }>('/infra/import-data', {
- method: 'POST',
- body: JSON.stringify({ tables }),
- }),
-};
-
-// =============================================================================
-// Settings API
-// =============================================================================
-
-export const settingsApi = {
- get: () => request<Settings>('/settings'),
- update: (settings: Partial<Settings>) =>
- request<Settings>('/settings', {
- method: 'PUT',
- body: JSON.stringify(settings),
- }),
+ request<{ imported: boolean; counts?: Record<string, number>; message?: string; warnings?: string[] }>(
+ '/infra/import-data',
+ {
+ method: 'POST',
+ body: JSON.stringify({ tables }),
+ },
+ ),
};
// =============================================================================
@@ -758,7 +751,10 @@ export interface PluginConfigSchema {
properties: Record<string, PluginConfigField>;
}
-export interface PluginI18nText { title?: string; description?: string }
+export interface PluginI18nText {
+ title?: string;
+ description?: string;
+}
export interface PluginI18nLocale {
name?: string;
description?: string;
diff --git a/dashboard/src/utils/chatMessages.test.ts b/dashboard/src/utils/chatMessages.test.ts
index 298dcdbcd..8406fc45b 100644
--- a/dashboard/src/utils/chatMessages.test.ts
+++ b/dashboard/src/utils/chatMessages.test.ts
@@ -83,12 +83,14 @@ test('mergeChatMessages: returns ascending by timestamp (oldest first, newest la
const older = mapEngineHistoryMessage(hist({ id: 'a', timestamp: 1000 }));
const newer = mapEngineHistoryMessage(hist({ id: 'b', timestamp: 2000 }));
const merged = mergeChatMessages([], [newer, older]);
- assert.deepEqual(merged.map(m => m.id), ['a', 'b']);
+ assert.deepEqual(
+ merged.map(m => m.id),
+ ['a', 'b'],
+ );
});
import {
mergeOrAppend,
- replaceMessageById,
updateMessageById,
removeMessageById,
findRevokedIndex,
@@ -143,6 +145,45 @@ test('mergeOrAppend keeps existing metadata when the incoming copy carries none'
assert.deepEqual(after[0].metadata, { media: { mimetype: 'image/png' } });
});
+test('mergeOrAppend: an omitted-media echo does NOT clobber the copy holding the payload', () => {
+ // The optimistic send bubble holds the only base64 copy; the engine's own-send echo carries just
+ // `{media: {omitted: true}}` (no data). Replacing wholesale would blank the sent image.
+ const optimistic = msg({
+ id: 'm-1',
+ type: 'image',
+ metadata: { media: { mimetype: 'image/png', filename: 'a.png', data: 'BASE64' } },
+ });
+ const echo = msg({
+ id: 'm-1',
+ type: 'image',
+ metadata: { media: { mimetype: 'image/png', omitted: true, sizeBytes: 1234 } },
+ });
+ const after = mergeOrAppend([optimistic], echo);
+ assert.equal(after.length, 1);
+ assert.equal(after[0].metadata?.media?.data, 'BASE64');
+ assert.equal(after[0].metadata?.media?.omitted, undefined);
+});
+
+test('mergeOrAppend: incoming media WITH a payload replaces the existing marker', () => {
+ const before = [msg({ id: 'm-1', type: 'image', metadata: { media: { mimetype: 'image/png', omitted: true } } })];
+ const live = msg({
+ id: 'm-1',
+ type: 'image',
+ metadata: { media: { mimetype: 'image/png', data: 'FRESH' } },
+ });
+ const after = mergeOrAppend(before, live);
+ assert.equal(after[0].metadata?.media?.data, 'FRESH');
+});
+
+test('mergeOrAppend: an echo with undefined leaves keeps the existing quote/call fields', () => {
+ // The WS mapper builds metadata as `{media, quotedMessage, call}` with undefined leaves — those
+ // must not erase fields the existing copy has (a wholesale spread would overwrite with undefined).
+ const before = [msg({ id: 'm-1', metadata: { quotedMessage: { id: 'q-1', body: 'quoted' } } })];
+ const echo = msg({ id: 'm-1', metadata: { media: undefined } });
+ const after = mergeOrAppend(before, echo);
+ assert.deepEqual(after[0].metadata, { quotedMessage: { id: 'q-1', body: 'quoted' } });
+});
+
test('mergeOrAppend dedupes a live WS message against its DB copy (id != id but same waMessageId)', () => {
// DB-persisted copy: id = UUID, waMessageId = WA serialized id.
const dbCopy = msg({ id: 'uuid-1', waMessageId: '[email protected]_WA1', body: 'persisted' });
@@ -160,25 +201,11 @@ test('mergeOrAppend does not mutate the input array', () => {
assert.equal(before.length, 1);
});
-test('replaceMessageById swaps the entry with matching id', () => {
- const before = [msg({ id: 'temp-1', status: 'pending' }), msg({ id: 'm-2' })];
- const after = replaceMessageById(before, 'temp-1', msg({ id: 'real-1', status: 'sent' }));
- assert.equal(after.length, 2);
- assert.equal(after[0].id, 'real-1');
- assert.equal(after[0].status, 'sent');
-});
-
-test('replaceMessageById is a no-op when oldId is not present', () => {
- const before = [msg({ id: 'm-1' })];
- const after = replaceMessageById(before, 'missing', msg({ id: 'real' }));
- assert.deepEqual(after, before);
-});
-
test('updateMessageById applies a partial patch by id', () => {
const before = [msg({ id: 'm-1', status: 'pending' })];
const after = updateMessageById(before, 'm-1', { status: 'failed' });
assert.equal(after[0].status, 'failed');
- assert.equal(after[0].body, 'hello'); // other fields unchanged
+ assert.equal(after[0].body, 'hello'); // other fields unchanged
});
test('updateMessageById is a no-op when id is not present', () => {
diff --git a/dashboard/src/utils/chatMessages.ts b/dashboard/src/utils/chatMessages.ts
index d70b8d4ab..88ea1d7a7 100644
--- a/dashboard/src/utils/chatMessages.ts
+++ b/dashboard/src/utils/chatMessages.ts
@@ -76,18 +76,48 @@ export function mergeDeliveryStatus(
return DELIVERY_RANK[incoming] >= DELIVERY_RANK[current] ? incoming : current;
}
+/**
+ * Merge two metadata bags field-by-field. The incoming copy wins per field only when it actually
+ * carries a value — a live `message.sent` echo is built as `{media, quotedMessage, call}` with
+ * undefined leaves, and a wholesale `incoming ?? existing` swap would wipe the optimistic bubble's
+ * quote/call. Media has one extra rule: an incoming marker WITHOUT the payload (the engine's
+ * own-send echo and the media-less history fetch both emit `{media: {omitted: true}}` with no
+ * `data`) must not clobber an existing copy holding the real base64 — the optimistic send bubble is
+ * the only copy with the payload until a refetch, and the cache is staleTime: Infinity.
+ */
+function mergeMessageMetadata(
+ existing: ChatMessageView['metadata'],
+ incoming: ChatMessageView['metadata'],
+): ChatMessageView['metadata'] {
+ if (!incoming) return existing;
+ if (!existing) return incoming;
+ const media = (() => {
+ if (!incoming.media) return existing.media;
+ if (!existing.media) return incoming.media;
+ if (existing.media.data && !incoming.media.data) return existing.media;
+ return incoming.media;
+ })();
+ const merged: NonNullable<ChatMessageView['metadata']> = {};
+ if (media) merged.media = media;
+ const quotedMessage = incoming.quotedMessage ?? existing.quotedMessage;
+ if (quotedMessage) merged.quotedMessage = quotedMessage;
+ const reactions = incoming.reactions ?? existing.reactions;
+ if (reactions) merged.reactions = reactions;
+ const call = incoming.call ?? existing.call;
+ if (call) merged.call = call;
+ return Object.keys(merged).length > 0 ? merged : undefined;
+}
+
/**
* Append `incoming` to `list`. If an entry with the same identity exists, replace it in place.
* Identity uses the same `waMessageId ?? id` key as mergeChatMessages — a DB row (id=UUID,
* waMessageId=WA id) and a live WS message (id=WA id) for the same WhatsApp message must dedupe,
* not double-add. On replace, the delivery status only advances (a replayed lower `sent` echo can't
- * downgrade a delivered/read row) and existing metadata is kept when the incoming copy carries none.
+ * downgrade a delivered/read row) and metadata is merged per field (a payload-less echo can't erase
+ * the existing media/quote — see mergeMessageMetadata).
* Returns a new array — does not mutate the input.
*/
-export function mergeOrAppend(
- list: ChatMessageView[],
- incoming: ChatMessageView,
-): ChatMessageView[] {
+export function mergeOrAppend(list: ChatMessageView[], incoming: ChatMessageView): ChatMessageView[] {
const idx = list.findIndex(m => msgKey(m) === msgKey(incoming));
if (idx === -1) return [...list, incoming];
const existing = list[idx];
@@ -95,26 +125,11 @@ export function mergeOrAppend(
next[idx] = {
...incoming,
status: mergeDeliveryStatus(existing.status, incoming.status) ?? incoming.status,
- metadata: incoming.metadata ?? existing.metadata,
+ metadata: mergeMessageMetadata(existing.metadata, incoming.metadata),
};
return next;
}
-/**
- * Swap the entry whose id === `oldId` with `replacement`. No-op if not found.
- */
-export function replaceMessageById(
- list: ChatMessageView[],
- oldId: string,
- replacement: ChatMessageView,
-): ChatMessageView[] {
- const idx = list.findIndex(m => m.id === oldId);
- if (idx === -1) return list;
- const next = list.slice();
- next[idx] = replacement;
- return next;
-}
-
/**
* Apply a partial patch to the entry whose id matches. No-op if not found.
*/
@@ -133,10 +148,7 @@ export function updateMessageById(
/**
* Filter out the entry with the matching id. No-op if not found.
*/
-export function removeMessageById(
- list: ChatMessageView[],
- id: string,
-): ChatMessageView[] {
+export function removeMessageById(list: ChatMessageView[], id: string): ChatMessageView[] {
if (!list.some(m => m.id === id)) return list;
return list.filter(m => m.id !== id);
}
@@ -156,15 +168,9 @@ export function removeMessageById(
* are keyed differently. `revokedId` is guarded because an undefined one would otherwise match a row
* whose `waMessageId` is also undefined.
*/
-export function findRevokedIndex(
- list: ChatMessageView[],
- event: { id: string; revokedId?: string },
-): number {
- const matches = (m: ChatMessageView, candidate: string): boolean =>
- m.id === candidate || m.waMessageId === candidate;
- return list.findIndex(
- m => matches(m, event.id) || (event.revokedId !== undefined && matches(m, event.revokedId)),
- );
+export function findRevokedIndex(list: ChatMessageView[], event: { id: string; revokedId?: string }): number {
+ const matches = (m: ChatMessageView, candidate: string): boolean => m.id === candidate || m.waMessageId === candidate;
+ return list.findIndex(m => matches(m, event.id) || (event.revokedId !== undefined && matches(m, event.revokedId)));
}
/**
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 30147f51e..24c89a5c2 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -51,6 +51,11 @@ services:
- XDG_CONFIG_HOME=/tmp/.config
- XDG_CACHE_HOME=/tmp/.cache
- LOG_LEVEL=${LOG_LEVEL:-info}
+ # Restart-resilience: auto-start previously authenticated sessions on boot. The liveness
+ # watchdog (#798) only covers a RUNNING container — a `compose down/up` or rebuild kills every
+ # engine, and without this flag sessions sit at `disconnected` until started by hand. Default
+ # ON for the dev compose (single-operator box); the app-level default stays OFF.
+ - AUTO_START_SESSIONS=${AUTO_START_SESSIONS:-true}
- DATABASE_TYPE=${DATABASE_TYPE:-sqlite}
- DATABASE_NAME=${DATABASE_NAME:-}
- DATABASE_SYNCHRONIZE=${DATABASE_SYNCHRONIZE:-true}
diff --git a/docs/17-dashboard-design.md b/docs/17-dashboard-design.md
index 782c42f97..49b34efa1 100644
--- a/docs/17-dashboard-design.md
+++ b/docs/17-dashboard-design.md
@@ -95,8 +95,8 @@ a non-admin hitting the path falls through to the `*` redirect.
```
> There is **no Settings page** and no `/sessions/:id`, `/sessions/:id/chat`, or `/webhooks/:id`
-> route. Theme (light/dark/system) and color-palette selection live in a popover menu in the sidebar
-> footer (`Layout.tsx`), persisted client-side by the `useTheme` hook.
+> route. Theme (light/dark/system) is a one-click toggle in the sidebar footer (`Layout.tsx`),
+> persisted client-side by the `useTheme` hook.
## 17.3 Wireframes
@@ -343,7 +343,7 @@ a non-admin hitting the path falls through to the `*` redirect.
## 17.4 Component Library
-> **No component framework is installed.** shadcn/ui is *not* adopted — there is no `npx shadcn`
+> **No component framework is installed.** shadcn/ui is _not_ adopted — there is no `npx shadcn`
> init, no `components/ui/` directory, no `cn()` utility, and no `@/components` import alias. The
> wireframes above are design intent; the implementation is hand-written.
@@ -352,15 +352,15 @@ a non-admin hitting the path falls through to the `*` redirect.
The UI is built from a small set of project-specific components under `dashboard/src/components/`,
each with a colocated CSS file. There is no design-system package to pull from.
-| Component | File | Responsibility |
-| --- | --- | --- |
-| `Layout` | `components/Layout.tsx` | App shell: collapsible sidebar nav, mobile drawer, language menu, theme/palette popover, logout, live version badge |
-| `ToastProvider` / `useToast` | `components/Toast.tsx` | Context-based toast notifications (success/error/warning/info) with de-dup keys |
-| `PageHeader` | `components/PageHeader.tsx` | Shared page title / subtitle / badge / actions header |
-| `DashboardCharts` | `components/DashboardCharts.tsx` | `recharts`-based message-volume / activity charts on the Dashboard |
-| `FilterBuilder` | `components/FilterBuilder.tsx` | Visual condition builder for webhook event filters |
-| `ErrorBoundary` | `components/ErrorBoundary.tsx` | Top-level React error boundary wrapping the whole app |
-| `GithubIcon` | `components/GithubIcon.tsx` | Inline brand SVG |
+| Component | File | Responsibility |
+| ---------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
+| `Layout` | `components/Layout.tsx` | App shell: collapsible sidebar nav, mobile drawer, language menu, light/dark theme toggle, logout, live version badge |
+| `ToastProvider` / `useToast` | `components/Toast.tsx` | Context-based toast notifications (success/error/warning/info) with de-dup keys |
+| `PageHeader` | `components/PageHeader.tsx` | Shared page title / subtitle / badge / actions header |
+| `DashboardCharts` | `components/DashboardCharts.tsx` | `recharts`-based message-volume / activity charts on the Dashboard |
+| `FilterBuilder` | `components/FilterBuilder.tsx` | Visual condition builder for webhook event filters |
+| `ErrorBoundary` | `components/ErrorBoundary.tsx` | Top-level React error boundary wrapping the whole app |
+| `GithubIcon` | `components/GithubIcon.tsx` | Inline brand SVG |
Pages live under `dashboard/src/pages/`, each as a `*.tsx` + `*.css` pair (e.g. `Sessions.tsx` +
`Sessions.css`). Pages are lazy-loaded in `App.tsx` via `React.lazy` + `Suspense`.
@@ -401,7 +401,7 @@ library — those visuals are composed directly with `div`s and the page's own C
There is **no Zustand store** (and no global client-state library). Server data is owned by
**TanStack Query** (`@tanstack/react-query`); the only other shared state is two small React Context
-providers — `useRole` (the authenticated key's role) and `useTheme` (mode + palette, persisted to
+providers — `useRole` (the authenticated key's role) and `useTheme` (mode, persisted to
`localStorage`).
### API client — raw payloads, no `{ data }` envelope
@@ -436,10 +436,9 @@ async function request<T>(endpoint: string, options: RequestInit = {}): Promise<
}
export const sessionApi = {
- list: () => request<Session[]>('/sessions'), // bare array
+ list: () => request<Session[]>('/sessions'), // bare array
get: (id: string) => request<Session>(`/sessions/${id}`),
- create: (name: string) =>
- request<Session>('/sessions', { method: 'POST', body: JSON.stringify({ name }) }),
+ create: (name: string) => request<Session>('/sessions', { method: 'POST', body: JSON.stringify({ name }) }),
delete: (id: string) => request<void>(`/sessions/${id}`, { method: 'DELETE' }),
// QR returns a raw { qrCode, status } object — not { qr, expiresAt }, and there is no expiry timer.
getQR: (id: string) => request<{ qrCode: string; status: string }>(`/sessions/${id}/qr`),
@@ -492,7 +491,7 @@ Real-time updates use **socket.io** (`socket.io-client`), not a raw browser `Web
`${VITE_WS_URL || window.location.origin}/events` — same-origin by default; `VITE_WS_URL` only
overrides it for split-origin deployments.
- **API key via the socket.io `auth` payload (and an `X-API-Key` header for proxies), deliberately
- *not* in the query string** — a key in the handshake URL would leak into access logs / `Referer`.
+ _not_ in the query string** — a key in the handshake URL would leak into access logs / `Referer`.
- **Reconnection is socket.io's built-in mechanism** — `reconnectionAttempts: 5`,
`reconnectionDelay: 1000` — not a hand-rolled `setTimeout(connect, 3000)`. When all attempts are
exhausted the manager fires `reconnect_failed`; the hook surfaces that as `connectionFailed` so the
@@ -510,7 +509,7 @@ import { io, Socket } from 'socket.io-client';
const SOCKET_URL = import.meta.env.VITE_WS_URL || window.location.origin;
interface ServerEventEnvelope {
- type: string; // 'event'
+ type: string; // 'event'
timestamp: string;
payload?: { event: string; sessionId: string; data: Record<string, unknown> };
}
@@ -529,11 +528,14 @@ export function useWebSocket(events: WebSocketEvents = {}) {
reconnection: true,
reconnectionAttempts: 5,
reconnectionDelay: 1000,
- auth: { apiKey }, // key in the handshake auth, NOT the URL
- extraHeaders: { 'X-API-Key': apiKey }, // header copy for proxies
+ auth: { apiKey }, // key in the handshake auth, NOT the URL
+ extraHeaders: { 'X-API-Key': apiKey }, // header copy for proxies
});
- socketRef.current.on('connect', () => { setIsConnected(true); setConnectionFailed(false); });
+ socketRef.current.on('connect', () => {
+ setIsConnected(true);
+ setConnectionFailed(false);
+ });
socketRef.current.on('disconnect', () => setIsConnected(false));
socketRef.current.io.on('reconnect_failed', () => setConnectionFailed(true));
}, []);
@@ -559,7 +561,9 @@ export function useWebSocket(events: WebSocketEvents = {}) {
}
};
socket?.on('message', handle);
- return () => { socket?.off('message', handle); };
+ return () => {
+ socket?.off('message', handle);
+ };
}, [connect, events]);
return { isConnected, connectionFailed, reconnect, subscribe, unsubscribe };
@@ -569,26 +573,23 @@ export function useWebSocket(events: WebSocketEvents = {}) {
## 17.7 Theme Configuration
Theming is **not** shadcn HSL design tokens. It is a plain `useTheme` hook (`src/hooks/useTheme.ts`)
-that toggles two attributes on `<html>` and lets the CSS do the rest. The values are persisted to
-`localStorage` under `openwa_theme` and `openwa_palette`:
+that toggles one attribute on `<html>` and lets the CSS do the rest. The value is persisted to
+`localStorage` under `openwa_theme`:
- **Mode** — `light | dark | system`. `system` removes `data-theme` so a `prefers-color-scheme`
media query in the global CSS takes over; otherwise `data-theme="light|dark"` is set explicitly.
-- **Palette** — one of seven accent palettes (`openwa`, `blue`, `graphite`, `indigo`, `amber`,
- `rose`, `teal`), applied as `data-palette="…"`. Each palette is a set of CSS custom properties
- scoped to that attribute selector.
-The mode/palette pickers render in the sidebar footer popover (`Layout.tsx`); there is no
-`ThemeProvider` context wrapper — it's a hook consumed directly where needed.
+The sidebar footer button toggles light ↔ dark directly (resolving `system` first); there is no
+picker popover and no `ThemeProvider` context wrapper — it's a hook consumed directly where needed.
+An earlier accent-palette picker (seven palettes via `data-palette`) was removed for
+maintainability; the legacy `openwa_palette` storage key and the attribute are cleaned up on load.
```typescript
// src/hooks/useTheme.ts (abridged)
export type Theme = 'light' | 'dark' | 'system';
-export type ThemePalette = 'openwa' | 'blue' | 'graphite' | 'indigo' | 'amber' | 'rose' | 'teal';
export function useTheme() {
const [theme, setTheme] = useState<Theme>(/* localStorage 'openwa_theme' ?? 'system' */);
- const [palette, setPalette] = useState<ThemePalette>(/* localStorage 'openwa_palette' ?? 'openwa' */);
useEffect(() => {
const root = document.documentElement;
@@ -597,25 +598,20 @@ export function useTheme() {
localStorage.setItem('openwa_theme', theme);
}, [theme]);
- useEffect(() => {
- document.documentElement.setAttribute('data-palette', palette);
- localStorage.setItem('openwa_palette', palette);
- }, [palette]);
-
- return { theme, setTheme, palette, setPalette, /* resolvedTheme, paletteOptions, ... */ };
+ return { theme, setTheme /* toggleTheme, resolvedTheme */ };
}
```
-The actual colors live in the global CSS as variables keyed off `[data-theme]` / `[data-palette]` —
-e.g. `:root { --color-accent: #25d366; } [data-palette='blue'] { --color-accent: #2563eb; }` — so
-switching mode or palette is a single attribute write with no re-render of the tree.
+The actual colors live in the global CSS as variables keyed off `[data-theme]` —
+e.g. `:root { --color-accent: #25d366; } [data-theme='dark'] { --color-accent: #25d366; }` — so
+switching mode is a single attribute write with no re-render of the tree.
## 17.8 Build & Deployment
### Vite Configuration
The dev server listens on **2886** and proxies `/api` to the API on `2785`. The WebSocket proxy is
-on **`/socket.io`** (socket.io's transport path) with `ws: true` — *not* `/ws`. There is no `@`
+on **`/socket.io`** (socket.io's transport path) with `ws: true` — _not_ `/ws`. There is no `@`
import alias and no custom `manualChunks`/Radix vendor split; code-splitting is handled by the
per-page `React.lazy` imports in `App.tsx`. The build-time version (`__APP_VERSION__`) is injected
from `package.json` via `define`.
@@ -627,9 +623,9 @@ import { resolve } from 'node:path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
-const { version: pkgVersion } = JSON.parse(
- readFileSync(resolve(process.cwd(), 'package.json'), 'utf-8'),
-) as { version: string };
+const { version: pkgVersion } = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf-8')) as {
+ version: string;
+};
export default defineConfig({
plugins: [react()],
diff --git a/src/common/services/request-context.ts b/src/common/services/request-context.ts
index 2ed4c3ff4..eac6f88af 100644
--- a/src/common/services/request-context.ts
+++ b/src/common/services/request-context.ts
@@ -1,11 +1,23 @@
/**
- * Per-request async context (today: the X-Request-ID), propagated to every log line and audit
- * record produced while handling a request. Backed by a dedicated AsyncLocalStorage instance —
- * independent of the existing plugin/hook ALS instances (multiple ALS instances coexist fine).
+ * Per-request async context, propagated to every log line and audit record produced while handling a
+ * request. Today it carries the X-Request-ID plus the resolved API key and client IP, so audit log
+ * rows are stamped with who made the call and from where WITHOUT every controller having to thread
+ * `@CurrentApiKey()` + `req.ip` into each `auditService.log*()` call (most call sites legitimately
+ * don't know the key — they fire from deep inside services). Backed by a dedicated AsyncLocalStorage
+ * instance — independent of the existing plugin/hook ALS instances (multiple ALS instances coexist fine).
*/
import { AsyncLocalStorage } from 'node:async_hooks';
-const requestContextStorage = new AsyncLocalStorage<{ requestId: string }>();
+export interface RequestContext {
+ requestId: string;
+ /** The API key that authenticated this request, if any (@Public routes have none). */
+ apiKeyId?: string;
+ apiKeyName?: string;
+ /** The real client IP (ProxyAwareThrottlerGuard's notion, honoring TRUSTED_PROXIES). */
+ ipAddress?: string;
+}
+
+const requestContextStorage = new AsyncLocalStorage<RequestContext>();
/** Run `fn` (and every async continuation it starts) with `requestId` as the active context. */
export function runWithRequestId<T>(requestId: string, fn: () => T): T {
@@ -16,3 +28,24 @@ export function runWithRequestId<T>(requestId: string, fn: () => T): T {
export function getRequestId(): string | undefined {
return requestContextStorage.getStore()?.requestId;
}
+
+/**
+ * Stamp the resolved API key + client IP into the active request context so downstream audit log
+ * writes (which typically happen inside services without DI access to the key) can attribute the
+ * action. No-op outside a request scope (e.g. worker/cron), so callers don't need to guard. The
+ * guard/middleware call this once they've resolved the key; services never need to.
+ */
+export function setRequestActor(actor: { apiKeyId?: string; apiKeyName?: string; ipAddress?: string }): void {
+ const store = requestContextStorage.getStore();
+ if (!store) return; // not in a request scope — nothing to stamp
+ if (actor.apiKeyId !== undefined) store.apiKeyId = actor.apiKeyId;
+ if (actor.apiKeyName !== undefined) store.apiKeyName = actor.apiKeyName;
+ if (actor.ipAddress !== undefined) store.ipAddress = actor.ipAddress;
+}
+
+/** The active request's resolved actor (API key + IP), or `undefined` outside a request scope. */
+export function getRequestActor(): { apiKeyId?: string; apiKeyName?: string; ipAddress?: string } | undefined {
+ const store = requestContextStorage.getStore();
+ if (!store) return undefined;
+ return { apiKeyId: store.apiKeyId, apiKeyName: store.apiKeyName, ipAddress: store.ipAddress };
+}
diff --git a/src/engine/adapters/baileys.adapter.ts b/src/engine/adapters/baileys.adapter.ts
index 902effbeb..0e09ad0fb 100644
--- a/src/engine/adapters/baileys.adapter.ts
+++ b/src/engine/adapters/baileys.adapter.ts
@@ -238,7 +238,7 @@ export class BaileysAdapter implements IWhatsAppEngine {
previous.ev.removeAllListeners('chats.update');
previous.ev.removeAllListeners('messaging-history.set');
previous.ev.removeAllListeners('lid-mapping.update');
- previous.end(undefined);
+ void previous.end(undefined);
} catch {
// end() may already have run from Baileys' own close handler — a safe no-op.
}
@@ -469,7 +469,7 @@ export class BaileysAdapter implements IWhatsAppEngine {
clearTimeout(this.reconnectTimer);
this.reconnectTimer = undefined;
}
- this.sock?.end(undefined);
+ void this.sock?.end(undefined);
this.sock = null;
this.setStatus(EngineStatus.DISCONNECTED);
return Promise.resolve();
@@ -487,7 +487,7 @@ export class BaileysAdapter implements IWhatsAppEngine {
this.logger.warn('Baileys logout failed; ending socket', {
error: err instanceof Error ? err.message : String(err),
});
- this.sock?.end(undefined);
+ void this.sock?.end(undefined);
}
this.sock = null;
this.setStatus(EngineStatus.DISCONNECTED);
@@ -519,7 +519,7 @@ export class BaileysAdapter implements IWhatsAppEngine {
clearTimeout(this.reconnectTimer);
this.reconnectTimer = undefined;
}
- this.sock?.end(undefined);
+ void this.sock?.end(undefined);
this.sock = null;
this.setStatus(EngineStatus.DISCONNECTED);
return Promise.resolve();
diff --git a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts b/src/engine/adapters/whatsapp-web-js.adapter.spec.ts
index 6cb45ecd6..7e6276530 100644
--- a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts
+++ b/src/engine/adapters/whatsapp-web-js.adapter.spec.ts
@@ -1489,6 +1489,98 @@ describe('WhatsAppWebJsAdapter inbound media (MEDIA_DOWNLOAD_ENABLED=false)', ()
const msg = onMessage.mock.calls[0][0] as { call?: { video: boolean; missed: boolean } };
expect(msg.call).toEqual({ video: true, missed: true });
});
+
+ it('enriches an own-send (message_create) echo with the media payload', async () => {
+ // buildIncomingMessageBase is sync and carries no media; without enrichment a phone-composed
+ // image persists/renders as a bare 📎 marker. The echo must reuse the same capped download path
+ // as the incoming handler, so the payload lands on the outgoing row.
+ const adapter = new WhatsAppWebJsAdapter({
+ sessionId: 'sess-echo-media',
+ sessionDataPath: './data/sessions',
+ puppeteer: {},
+ });
+ const client = Object.assign(new EventEmitter(), {
+ info: { wid: { user: '628123' }, pushname: 'Tester' },
+ getState: jest.fn().mockResolvedValue(WAState.CONNECTED),
+ pupPage: { evaluate: jest.fn().mockResolvedValue(true) },
+ });
+ (adapter as unknown as { client: unknown }).client = client;
+ const onMessageCreate = jest.fn();
+ (adapter as unknown as { callbacks: unknown }).callbacks = { onMessageCreate };
+ (adapter as unknown as { setupEventHandlers: () => void }).setupEventHandlers();
+
+ const mockMsg = {
+ id: { _serialized: 'OWN_MEDIA_1' },
+ body: '',
+ type: 'image',
+ timestamp: 1700000070,
+ fromMe: true,
+ hasMedia: true,
+ _data: { mimetype: 'image/png', size: 3 },
+ downloadMedia: jest.fn().mockResolvedValue({ mimetype: 'image/png', data: 'QUJD', filename: 'a.png' }),
+ getContact: jest.fn().mockResolvedValue(null),
+ hasQuotedMsg: false,
+ };
+
+ client.emit('message_create', mockMsg);
+ // The echo runs async (media download through the limiter) — flush the chain.
+ await new Promise(r => setImmediate(r));
+ await new Promise(r => setImmediate(r));
+
+ expect(onMessageCreate).toHaveBeenCalledTimes(1);
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const msg = onMessageCreate.mock.calls[0][0] as {
+ media?: { mimetype?: string; data?: string; omitted?: boolean };
+ };
+ expect(msg.media?.mimetype).toBe('image/png');
+ expect(msg.media?.data).toBe('QUJD');
+ expect(msg.media?.omitted).toBeUndefined();
+ });
+
+ it('still emits the echo (without media) when the own-send media download fails', async () => {
+ const adapter = new WhatsAppWebJsAdapter({
+ sessionId: 'sess-echo-media-fail',
+ sessionDataPath: './data/sessions',
+ puppeteer: {},
+ });
+ const client = Object.assign(new EventEmitter(), {
+ info: { wid: { user: '628123' }, pushname: 'Tester' },
+ getState: jest.fn().mockResolvedValue(WAState.CONNECTED),
+ pupPage: { evaluate: jest.fn().mockResolvedValue(true) },
+ });
+ (adapter as unknown as { client: unknown }).client = client;
+ const onMessageCreate = jest.fn();
+ (adapter as unknown as { callbacks: unknown }).callbacks = { onMessageCreate };
+ (adapter as unknown as { setupEventHandlers: () => void }).setupEventHandlers();
+
+ const mockMsg = {
+ id: { _serialized: 'OWN_MEDIA_2' },
+ body: '',
+ type: 'image',
+ timestamp: 1700000071,
+ fromMe: true,
+ hasMedia: true,
+ _data: { mimetype: 'image/png', size: 3 },
+ downloadMedia: jest.fn().mockRejectedValue(new Error('media gone')),
+ getContact: jest.fn().mockResolvedValue(null),
+ hasQuotedMsg: false,
+ };
+
+ client.emit('message_create', mockMsg);
+ await new Promise(r => setImmediate(r));
+ await new Promise(r => setImmediate(r));
+
+ expect(onMessageCreate).toHaveBeenCalledTimes(1);
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const msg = onMessageCreate.mock.calls[0][0] as { media?: unknown };
+ // The failure is contained at the call site: the echo still fires, just without the media field
+ // (the omitted marker is synthesized downstream, in SessionService's persistence).
+ expect(msg.media).toBeUndefined();
+ });
});
describe('WhatsAppWebJsAdapter message_reaction (id resolution across WA Web builds)', () => {
diff --git a/src/engine/adapters/whatsapp-web-js.adapter.ts b/src/engine/adapters/whatsapp-web-js.adapter.ts
index 4d4380a07..0977cb713 100644
--- a/src/engine/adapters/whatsapp-web-js.adapter.ts
+++ b/src/engine/adapters/whatsapp-web-js.adapter.ts
@@ -625,11 +625,27 @@ export class WhatsAppWebJsAdapter extends EventEmitter implements IWhatsAppEngin
return;
}
- try {
- this.callbacks.onMessageCreate?.(buildIncomingMessageBase(msg));
- } catch (error) {
- this.logger.error('Error processing outgoing message', String(error));
- }
+ void (async () => {
+ const incomingMessage = buildIncomingMessageBase(msg);
+ // Enrich with the media payload through the same capped path the incoming handler uses —
+ // the base builder is sync and carries none, so a phone-sent image would otherwise persist
+ // and render as a bare 📎 marker even though the media is downloadable right here.
+ if (msg.hasMedia) {
+ try {
+ incomingMessage.media = await this.capInboundMediaFor(msg);
+ } catch (error) {
+ this.logger.warn('Own-send media download failed; emitting echo without media', {
+ msgId: msg.id?._serialized,
+ error: String(error),
+ });
+ }
+ }
+ try {
+ this.callbacks.onMessageCreate?.(incomingMessage);
+ } catch (error) {
+ this.logger.error('Error processing outgoing message', String(error));
+ }
+ })();
});
this.client.on('message_ack', (msg, ack) => {
diff --git a/src/modules/audit/audit.service.ts b/src/modules/audit/audit.service.ts
index 26ea135b2..7be66df4a 100644
--- a/src/modules/audit/audit.service.ts
+++ b/src/modules/audit/audit.service.ts
@@ -4,7 +4,7 @@ import { Repository, Between, LessThan } from 'typeorm';
import { AuditLog, AuditAction, AuditSeverity } from './entities/audit-log.entity';
import { ApiKey } from '../auth/entities/api-key.entity';
import { createLogger } from '../../common/services/logger.service';
-import { getRequestId } from '../../common/services/request-context';
+import { getRequestId, getRequestActor } from '../../common/services/request-context';
/** Upper bound on a single audit-log page, so a large `limit` can't load the whole table at once. */
export const MAX_AUDIT_PAGE_SIZE = 200;
@@ -81,16 +81,25 @@ export class AuditService implements OnModuleInit, OnModuleDestroy {
// Stamp the active request id into metadata so an audit row traces back to the same request as
// the log lines. Absent outside a request scope (so no metadata blob is created for worker/cron).
const requestId = getRequestId();
+ // Auto-attribute the row to the resolved API key + client IP from the per-request async context
+ // when the call site didn't pass them explicitly. Most call sites fire from deep services that
+ // legitimately don't have the key in scope; without this the apiKey/ipAddress columns are always
+ // blank, defeating the audit trail. Explicit context values still win (e.g. a worker that stamps
+ // a system key, or the AUTH_FAILED case which only has an IP).
+ const actor = getRequestActor();
+ const apiKeyId = context.apiKey?.id ?? actor?.apiKeyId;
+ const apiKeyName = context.apiKey?.name ?? actor?.apiKeyName;
+ const ipAddress = context.ipAddress ?? actor?.ipAddress;
const metadata =
context.metadata || requestId ? { ...(context.metadata ?? {}), ...(requestId ? { requestId } : {}) } : null;
const auditLog = this.auditRepository.create({
action,
severity,
- apiKeyId: context.apiKey?.id || null,
- apiKeyName: context.apiKey?.name || null,
+ apiKeyId: apiKeyId || null,
+ apiKeyName: apiKeyName || null,
sessionId: context.sessionId || null,
sessionName: context.sessionName || null,
- ipAddress: context.ipAddress || null,
+ ipAddress: ipAddress || null,
userAgent: context.userAgent || null,
method: context.method || null,
path: context.path || null,
diff --git a/src/modules/auth/guards/api-key.guard.ts b/src/modules/auth/guards/api-key.guard.ts
index c69ca0038..475e55aef 100644
--- a/src/modules/auth/guards/api-key.guard.ts
+++ b/src/modules/auth/guards/api-key.guard.ts
@@ -6,6 +6,7 @@ import { AuthService } from '../auth.service';
import { ApiKeyRole } from '../entities/api-key.entity';
import { REQUIRED_ROLE_KEY, PUBLIC_KEY, SESSION_SCOPED_KEY } from '../decorators/auth.decorators';
import { resolveClientIp } from '../../../common/utils/ip';
+import { setRequestActor } from '../../../common/services/request-context';
import { AuditService } from '../../audit/audit.service';
import { AuditAction } from '../../audit/entities/audit-log.entity';
@@ -34,6 +35,9 @@ export class ApiKeyGuard implements CanActivate {
// credential probing. Fire-and-forget: audit logging is best-effort and must never turn a
// 401/403 into a failure of the guard itself.
if (err instanceof UnauthorizedException || err instanceof ForbiddenException) {
+ // Stamp at least the IP so the failed-auth audit row below is attributable even though the
+ // key was never resolved. setRequestActor is a no-op outside a request scope.
+ setRequestActor({ ipAddress: this.getClientIp(request) });
void this.auditService.logWarn(AuditAction.API_KEY_AUTH_FAILED, {
ipAddress: this.getClientIp(request),
method: request.method,
@@ -82,6 +86,12 @@ export class ApiKeyGuard implements CanActivate {
// ops) reuse the already-resolved value instead of re-deriving it.
(request as Request & { clientIp?: string }).clientIp = clientIp;
+ // Stamp the resolved actor into the per-request async context so downstream audit log writes —
+ // which fire from services deep in the call stack without DI access to the key — can attribute
+ // the action to this key + IP. Without this every audit row's apiKey/ipAddress column is blank
+ // because call sites pass only { sessionId } etc.
+ setRequestActor({ apiKeyId: apiKey.id, apiKeyName: apiKey.name, ipAddress: clientIp });
+
return true;
}
diff --git a/src/modules/message/message.service.spec.ts b/src/modules/message/message.service.spec.ts
index c0f64801b..f3a2c59a3 100644
--- a/src/modules/message/message.service.spec.ts
+++ b/src/modules/message/message.service.spec.ts
@@ -59,6 +59,7 @@ describe('MessageService', () => {
save: jest.fn().mockImplementation(msg => Promise.resolve(msg)),
findOne: jest.fn().mockResolvedValue(null),
update: jest.fn().mockResolvedValue({ affected: 1 }),
+ delete: jest.fn().mockResolvedValue({ affected: 1 }),
createQueryBuilder: jest.fn(),
};
@@ -1017,4 +1018,49 @@ describe('MessageService', () => {
expect(repository.create).toHaveBeenCalledWith(expect.objectContaining({ waMessageId: '[email protected]_ABC' }));
});
});
+
+ describe('persistSentState vs the own-send echo (dedup race)', () => {
+ it('merges state onto the echo row, then drops the redundant PENDING row', async () => {
+ // The engine's message_create echo (onMessageCreate) won the insert race, so the SENT-state save
+ // collides on UNIQUE(sessionId, waMessageId). The echo row carries only a media-less marker —
+ // the merge must land status/timestamp/metadata on it BEFORE the placeholder is deleted, or the
+ // payload is lost. The send still succeeds.
+ (repository.save as jest.Mock)
+ .mockImplementationOnce(msg => Promise.resolve(msg)) // saveOutgoingMessage (PENDING)
+ .mockRejectedValueOnce(new Error('UNIQUE constraint failed: messages.sessionId, messages.waMessageId'));
+
+ const result = await service.sendText('sess-1', { chatId: '[email protected]', text: 'hi' });
+
+ expect(result.messageId).toBe('wa-msg-1'); // send reported success
+ expect(repository.update).toHaveBeenCalledWith(
+ { sessionId: 'sess-1', waMessageId: 'wa-msg-1' },
+ expect.objectContaining({ status: MessageStatus.SENT, timestamp: 1706868000 }),
+ );
+ expect(repository.delete).toHaveBeenCalledWith({ id: 'msg-uuid-1' });
+ });
+
+ it('merges the media payload onto the echo row for a media send (no data loss after reload)', async () => {
+ (repository.save as jest.Mock)
+ .mockImplementationOnce(msg => Promise.resolve(msg))
+ .mockRejectedValueOnce(new Error('UNIQUE constraint failed: messages.sessionId, messages.waMessageId'));
+
+ await service.sendImage('sess-1', { chatId: '[email protected]', base64: 'QUJD', mimetype: 'image/png' });
+
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const patch = (repository.update as jest.Mock).mock.calls[0]?.[1] as Record<string, unknown> | undefined;
+ expect((patch?.metadata as { media?: { data?: string } } | undefined)?.media?.data).toBe('QUJD');
+ expect(repository.delete).toHaveBeenCalledWith({ id: 'msg-uuid-1' });
+ });
+
+ it('does NOT delete anything on a transient (non-unique) persist error', async () => {
+ (repository.save as jest.Mock)
+ .mockImplementationOnce(msg => Promise.resolve(msg))
+ .mockRejectedValueOnce(new Error('SQLITE_BUSY: database is locked'));
+
+ const result = await service.sendText('sess-1', { chatId: '[email protected]', text: 'hi' });
+
+ expect(result.messageId).toBe('wa-msg-1'); // transient persist faults never fail the send
+ expect(repository.delete).not.toHaveBeenCalled();
+ });
+ });
});
diff --git a/src/modules/message/message.service.ts b/src/modules/message/message.service.ts
index b2edfb145..99692a715 100644
--- a/src/modules/message/message.service.ts
+++ b/src/modules/message/message.service.ts
@@ -2,6 +2,7 @@ import { Injectable, BadRequestException, Optional } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
+import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity';
import { SessionService } from '../session/session.service';
import { SendTextMessageDto, SendMediaMessageDto, SendAudioMessageDto, MessageResponseDto } from './dto';
import { SendTemplateMessageDto } from './dto/send-template.dto';
@@ -16,6 +17,7 @@ import { SsrfBlockedError, SSRF_BLOCKED_CLIENT_MESSAGE } from '../../common/secu
import { userPart } from '../../engine/identity/wa-id';
import { resolveFeatureFlags } from '../../config/feature-flags';
import { LidMappingStoreService } from '../../engine/identity/lid-mapping-store.service';
+import { isUniqueConstraintError } from '../../common/utils/unique-constraint.util';
export interface GetMessagesOptions {
chatId?: string;
@@ -580,9 +582,35 @@ export class MessageService {
try {
await this.messageRepository.save(message);
} catch (persistError) {
- this.logger.warn(`Persisting SENT state failed after a successful send (id=${result.id})`, {
- error: persistError instanceof Error ? persistError.message : String(persistError),
- });
+ if (result.id && isUniqueConstraintError(persistError)) {
+ // The engine's own-send echo (onMessageCreate) won the race and already persisted a row with
+ // this waMessageId. That row carries only a media-less marker — merge our SENT state AND our
+ // metadata (the actual media payload) onto it BEFORE dropping this redundant PENDING row, or
+ // the payload-bearing row is the one that gets deleted and the media is gone after a reload.
+ // Best-effort throughout: the send itself already succeeded.
+ this.logger.debug(
+ `Send echo already persisted ${result.id}; merging state and dropping the redundant pending row`,
+ {
+ messageId: message.id,
+ },
+ );
+ const patch: QueryDeepPartialEntity<Message> = { status: MessageStatus.SENT, timestamp: result.timestamp };
+ if (message.metadata) {
+ patch.metadata = message.metadata as QueryDeepPartialEntity<Record<string, unknown>>;
+ }
+ await this.messageRepository
+ .update({ sessionId: message.sessionId, waMessageId: result.id }, patch)
+ .catch(err =>
+ this.logger.warn(`Merging SENT state onto the echo-persisted row failed (id=${result.id})`, {
+ error: err instanceof Error ? err.message : String(err),
+ }),
+ );
+ await this.messageRepository.delete({ id: message.id }).catch(() => undefined);
+ } else {
+ this.logger.warn(`Persisting SENT state failed after a successful send (id=${result.id})`, {
+ error: persistError instanceof Error ? persistError.message : String(persistError),
+ });
+ }
}
return { messageId: result.id, timestamp: result.timestamp };
}
diff --git a/src/modules/search/providers/builtin-fts.provider.spec.ts b/src/modules/search/providers/builtin-fts.provider.spec.ts
index e2e086ccc..de1609d67 100644
--- a/src/modules/search/providers/builtin-fts.provider.spec.ts
+++ b/src/modules/search/providers/builtin-fts.provider.spec.ts
@@ -1,5 +1,4 @@
import 'reflect-metadata';
-import { BadRequestException } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { Message, MessageDirection } from '../../../modules/message/entities/message.entity';
import { Session } from '../../../modules/session/entities/session.entity';
@@ -76,13 +75,20 @@ describe('BuiltInFtsProvider (sqlite)', () => {
expect((await provider.health()).ok).toBe(true);
});
- it('maps an FTS5 syntax error to a 400 (not an unhandled 500)', async () => {
- // SQLite FTS5 treats `"`, `(`, `*` as query grammar — an unbalanced quote is a syntax error,
- // which must surface as BadRequestException (400), never a raw 500. Postgres's
- // websearch_to_tsquery is tolerant and has no equivalent failure mode.
- await expect(provider.search({ q: '"unbalanced' })).rejects.toThrow(BadRequestException);
- await expect(provider.search({ q: '*foo' })).rejects.toThrow(BadRequestException);
- await expect(provider.search({ q: '(test' })).rejects.toThrow(BadRequestException);
+ it('sanitizes FTS5 grammar characters instead of 400ing (chatIds, quotes, parens stay searchable)', async () => {
+ // User input is quoted per-token (toFts5Query), so `"`, `(`, `*`, `@` match literally — a chatId
+ // like 262813461250071@lid is a normal search term here, not a grammar error. Verified against
+ // live FTS5: `a b` and `"a" "b"` are identical (implicit AND), so multi-token semantics hold.
+ for (const q of ['"unbalanced', '*foo', '(test', '262813461250071@lid', '[email protected]']) {
+ await expect(provider.search({ q })).resolves.toMatchObject({ provider: 'builtin-fts' });
+ }
+ });
+
+ it('keeps multi-token AND semantics after quoting', async () => {
+ // Both rows carry 'hello' AND 'world'... exactly one does ('goodbye world' lacks 'hello').
+ const res = await provider.search({ q: 'hello world' });
+ expect(res.hits.length).toBe(1);
+ expect(res.hits[0].body).toBe('hello world');
});
it('treats dateFrom/dateTo as epoch-ms against a seconds timestamp column', async () => {
diff --git a/src/modules/search/providers/builtin-fts.provider.ts b/src/modules/search/providers/builtin-fts.provider.ts
index b8dd6669e..1a076eae0 100644
--- a/src/modules/search/providers/builtin-fts.provider.ts
+++ b/src/modules/search/providers/builtin-fts.provider.ts
@@ -1,4 +1,4 @@
-import { BadRequestException, Injectable, NotImplementedException } from '@nestjs/common';
+import { BadRequestException, Injectable, Logger, NotImplementedException, OnModuleInit } from '@nestjs/common';
import { InjectDataSource } from '@nestjs/typeorm';
import { DataSource } from 'typeorm';
import type { MessageType } from '../../../engine/interfaces/whatsapp-engine.interface';
@@ -35,15 +35,39 @@ type PlaceholderFn = () => string;
* so this class ONLY queries — it never writes the index. See migration 1782400000000-AddMessagesFts.
*/
@Injectable()
-export class BuiltInFtsProvider implements SearchProvider {
+export class BuiltInFtsProvider implements SearchProvider, OnModuleInit {
readonly id = 'builtin-fts';
readonly label = 'Built-in database full-text search';
+ private readonly logger = new Logger('BuiltInFtsProvider');
// OpenWA has two TypeORM connections (main: auth/audit SQLite, data: messages). Bind explicitly to
// 'data' so the provider queries the connection that owns the `messages` table + the FTS migration,
// never the default/`main` one. The bare `DataSource` type alone is ambiguous with two connections.
constructor(@InjectDataSource('data') private readonly dataSource: DataSource) {}
+ /**
+ * Self-heals the FTS schema at bootstrap so search works under DATABASE_SYNCHRONIZE=true (the dev
+ * compose and the zero-config first-boot default), where TypeORM creates the `messages` table from
+ * the entity but NEVER runs migrations — so the migration that establishes `messages_fts` /
+ * `body_ts` is skipped and search would 501 on a fresh SQLite box. This re-applies the same
+ * idempotent DDL as the migration (1782400000000-AddMessagesFts); `IF NOT EXISTS` / `IF NOT` guards
+ * make it a no-op once the schema exists, so migrations-based deployments are unaffected. Probes the
+ * result into `ftsAvailable` so the first search() / health() call doesn't re-probe.
+ */
+ async onModuleInit(): Promise<void> {
+ try {
+ this.ftsAvailable = await this.ensureFtsSchema();
+ if (this.ftsAvailable) {
+ this.logger.log('FTS index ready');
+ } else {
+ this.logger.warn('FTS index unavailable (SQLite built without FTS5); /api/search will return 501');
+ }
+ } catch (e) {
+ // Never fail boot over index creation: the route 501s cleanly via probeFts()/ensureFts() instead.
+ this.logger.error(`Failed to ensure FTS schema: ${e instanceof Error ? e.message : String(e)}`);
+ }
+ }
+
/**
* Whether the DB-native FTS schema this provider queries is present. Cached per instance after the
* first probe. The migration (1782400000000-AddMessagesFts) is what creates it; on a non-FTS5 SQLite
@@ -84,6 +108,65 @@ export class BuiltInFtsProvider implements SearchProvider {
}
}
+ /**
+ * Creates the FTS schema if missing. Mirrors migration 1782400000000-AddMessagesFts verbatim and is
+ * idempotent (every statement is `IF NOT EXISTS` / `IF NOT`), so:
+ * - migrations-based deployments: the migration has already run; this is a set of no-ops.
+ * - synchronize-based deployments (dev compose / zero-config first boot): migrations are skipped,
+ * so this is what actually brings the index up at boot. Without it search 501s on every fresh
+ * SQLite box, contradicting docs/26's "zero-config, on by default" promise.
+ * Returns true when the index is usable, false when the SQLite build lacks FTS5 (no schema left
+ * behind — the route 501s cleanly via ensureFts).
+ */
+ private async ensureFtsSchema(): Promise<boolean> {
+ const isPostgres = this.dataSource.options.type === 'postgres';
+ if (isPostgres) {
+ await this.dataSource.query(
+ `ALTER TABLE "messages" ADD COLUMN IF NOT EXISTS "body_ts" tsvector GENERATED ALWAYS AS (to_tsvector('simple', coalesce(body, ''))) STORED`,
+ );
+ await this.dataSource.query(
+ `CREATE INDEX IF NOT EXISTS "idx_messages_body_ts" ON "messages" USING GIN ("body_ts")`,
+ );
+ return true;
+ }
+ // SQLite: probe FTS5 first; skip leaving any schema if this build lacks it.
+ const fts5: unknown[] = await this.dataSource.query(`SELECT sqlite_compileoption_used('ENABLE_FTS5') AS enabled`);
+ if (!Number((fts5 as Array<{ enabled: number }>)[0]?.enabled)) return false;
+ await this.dataSource.query(
+ `CREATE VIRTUAL TABLE IF NOT EXISTS "messages_fts" USING fts5(body, content='messages', content_rowid='rowid')`,
+ );
+ // Backfill only when the FTS table is empty but messages has rows — avoids re-copying on every boot
+ // once the index is populated. `messages_fts` with 'rowid' content exposes its size via this count.
+ const sizeRow: unknown[] = await this.dataSource.query(
+ `SELECT (SELECT count(*) FROM "messages_fts") AS fts, (SELECT count(*) FROM "messages" WHERE "body" IS NOT NULL) AS msgs`,
+ );
+ const sr = (sizeRow as Array<{ fts: number; msgs: number }>)[0];
+ if (Number(sr?.fts) === 0 && Number(sr?.msgs) > 0) {
+ await this.dataSource.query(
+ `INSERT INTO "messages_fts"("rowid", "body") SELECT "rowid", "body" FROM "messages" WHERE "body" IS NOT NULL`,
+ );
+ }
+ // The three sync triggers are CREATE-OR-REPLACE by name via DROP + CREATE; idempotent on re-run.
+ await this.dataSource.query(`DROP TRIGGER IF EXISTS messages_fts_ai`);
+ await this.dataSource.query(`CREATE TRIGGER messages_fts_ai AFTER INSERT ON "messages" BEGIN
+ INSERT INTO "messages_fts"("rowid", "body") VALUES (new."rowid", new."body");
+ END`);
+ await this.dataSource.query(`DROP TRIGGER IF EXISTS messages_fts_ad`);
+ await this.dataSource.query(`CREATE TRIGGER messages_fts_ad AFTER DELETE ON "messages" BEGIN
+ INSERT INTO "messages_fts"("messages_fts", "rowid", "body") VALUES ('delete', old."rowid", old."body");
+ END`);
+ await this.dataSource.query(`DROP TRIGGER IF EXISTS messages_fts_au`);
+ // WHEN clause skips re-indexing on body-unchanged updates (acks/reactions/status) — mirrors the
+ // migration. NULL-safe via `IS NOT` so NULL↔non-NULL body transitions still fire.
+ await this.dataSource.query(
+ `CREATE TRIGGER messages_fts_au AFTER UPDATE ON "messages" WHEN OLD.body IS NOT NEW.body BEGIN
+ INSERT INTO "messages_fts"("messages_fts", "rowid", "body") VALUES ('delete', old."rowid", old."body");
+ INSERT INTO "messages_fts"("rowid", "body") VALUES (new."rowid", new."body");
+ END`,
+ );
+ return true;
+ }
+
async search(query: SearchQuery): Promise<SearchResults> {
await this.ensureFts();
const start = Date.now();
@@ -155,13 +238,27 @@ export class BuiltInFtsProvider implements SearchProvider {
return () => `$${++n}`;
}
+ /**
+ * Quote every whitespace-separated token (doubling internal quotes) so user input matches
+ * LITERALLY. SQLite FTS5 treats `"`, `(`, `)`, `*`, `@`, and bare AND/OR/NOT/NEAR as query
+ * grammar, so a raw query (`?q="hello`, `?q=262813461250071@lid`) raises a grammar error at exec
+ * time — and phone numbers / chatIds are natural search terms here. Verified against FTS5:
+ * `a b` and `"a" "b"` are semantically identical (implicit AND), so multi-token behavior is
+ * unchanged. Postgres already uses the tolerant websearch_to_tsquery and needs no equivalent.
+ */
+ private static toFts5Query(raw: string): string {
+ const tokens = raw.trim().split(/\s+/).filter(Boolean);
+ if (tokens.length === 0) return '""';
+ return tokens.map(tok => `"${tok.replace(/"/g, '""')}"`).join(' ');
+ }
+
// --- SQLite FTS5 -----------------------------------------------------------
// SQL appearance order: MATCH term -> filters -> LIMIT -> OFFSET. Params pushed in that order.
private buildSqlite(q: SearchQuery, limit: number, offset: number) {
const ph = BuiltInFtsProvider.sqlitePlaceholder;
const params: unknown[] = [];
const where: string[] = [`messages_fts MATCH ${ph()}`];
- params.push(q.q);
+ params.push(BuiltInFtsProvider.toFts5Query(q.q));
this.applyFilters(where, params, q, 'm.', ph);
const cols = `m."id", m."waMessageId" AS wa_message_id, m."sessionId" AS session_id, m."chatId" AS chat_id, m."from" AS "from", m."body", m."timestamp", m."type", m."direction", snippet(messages_fts, 0, '<mark>', '</mark>', '…', ${MAX_SNIPPET_WORDS}) AS snippet, rank AS score`;
const sql = `SELECT ${cols} FROM messages_fts JOIN messages m ON m."rowid" = messages_fts."rowid" WHERE ${where.join(' AND ')} ORDER BY rank, m."timestamp" DESC LIMIT ${ph()} OFFSET ${ph()}`;
@@ -247,7 +344,7 @@ export class BuiltInFtsProvider implements SearchProvider {
}
const ph = BuiltInFtsProvider.sqlitePlaceholder;
where.push(`messages_fts MATCH ${ph()}`);
- params.push(q.q);
+ params.push(BuiltInFtsProvider.toFts5Query(q.q));
this.applyFilters(where, params, q, 'm.', ph);
const sql = `SELECT count(*) AS n FROM messages_fts JOIN messages m ON m."rowid" = messages_fts."rowid" WHERE ${where.join(' AND ')}`;
const rows = await this.dataSource.query<CountRow[]>(sql, params);
diff --git a/src/modules/session/session.service.spec.ts b/src/modules/session/session.service.spec.ts
index 6c48a44ad..70e0867b6 100644
--- a/src/modules/session/session.service.spec.ts
+++ b/src/modules/session/session.service.spec.ts
@@ -10,7 +10,7 @@ import {
SESSION_WATCHDOG_PROBE_TIMEOUT_MS,
} from './session.service';
import { Session, SessionStatus } from './entities/session.entity';
-import { Message, MessageStatus } from '../message/entities/message.entity';
+import { Message, MessageDirection, MessageStatus } from '../message/entities/message.entity';
import { MessageBatch } from '../message/entities/message-batch.entity';
import { Webhook } from '../webhook/entities/webhook.entity';
import { Template } from '../template/entities/template.entity';
@@ -1636,19 +1636,129 @@ describe('SessionService', () => {
expect(sent[0][0]).toBe('sess-uuid-1');
});
- it('does NOT persist an outgoing (message_create) self-message to the messages table', async () => {
- // Contract lock: message_create also fires for API sends (already persisted by the REST send
- // path), so a naive save here would double-persist. Phone-composed sends are therefore
- // webhooked/emitted but not mirrored to local history; safe persistence (unique index + dedup)
- // is a separate enhancement. This guards against the omission silently changing.
+ it('persists an outgoing (message_create) self-message so phone-composed sends reach local history', async () => {
+ // message_create is the ONLY event a phone-composed send produces; persist it best-effort. The
+ // UNIQUE(sessionId, waMessageId) index dedups against the REST send path, which persists
+ // API-originated sends itself (see the unique-race test below).
const callbacks = await startAndCaptureCallbacks();
+ // Pass the message through the hook chain untouched (the default mock replaces data with {}).
+ (hookManager.execute as jest.Mock).mockImplementation((_e: string, data: unknown) =>
+ Promise.resolve({ continue: true, data }),
+ );
+ (messageRepository.insert as jest.Mock).mockClear();
callbacks.onMessageCreate!(makeMessage({ id: 'wa-out-2', from: '[email protected]', to: '[email protected]', fromMe: true }));
await flush();
- expect(dispatchedEvents('message.sent')).toHaveLength(1); // it IS webhooked/emitted
- expect(messageRepository.create).not.toHaveBeenCalled(); // but NOT persisted
- expect(messageRepository.save).not.toHaveBeenCalled();
+ expect(dispatchedEvents('message.sent')).toHaveLength(1); // webhook/WS contract unchanged
+ expect(messageRepository.insert).toHaveBeenCalledTimes(1);
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const row = (messageRepository.create as jest.Mock).mock.calls[0][0] as Partial<Message>;
+ expect(row).toMatchObject({
+ sessionId: 'sess-uuid-1',
+ waMessageId: 'wa-out-2',
+ direction: MessageDirection.OUTGOING,
+ status: MessageStatus.SENT,
+ });
+ // A winning insert also feeds plugin providers (search etc.) like any other persisted message.
+ const persistedCalls = (hookManager.execute as jest.Mock).mock.calls.filter(
+ ([ev]: unknown[]) => ev === 'message:persisted',
+ );
+ expect(persistedCalls).toHaveLength(1);
+ });
+
+ it('still dispatches (but does not double-persist) when the REST send path won the dedup race', async () => {
+ // API-originated sends fire message_create too; the REST path persists them. A UNIQUE violation
+ // here is the dedup oracle working — not an error: skip the insert + message:persisted quietly,
+ // but the webhook/WS dispatch MUST still happen (today's contract).
+ const callbacks = await startAndCaptureCallbacks();
+ (messageRepository.insert as jest.Mock).mockRejectedValueOnce(
+ new Error('UNIQUE constraint failed: messages.sessionId, messages.waMessageId'),
+ );
+
+ callbacks.onMessageCreate!(makeMessage({ id: 'wa-out-dup', from: '[email protected]', to: '[email protected]', fromMe: true }));
+ await flush();
+
+ expect(dispatchedEvents('message.sent')).toHaveLength(1);
+ const persistedCalls = (hookManager.execute as jest.Mock).mock.calls.filter(
+ ([ev]: unknown[]) => ev === 'message:persisted',
+ );
+ expect(persistedCalls).toHaveLength(0);
+ });
+
+ it('fails open on a transient insert error: message.sent still dispatches', async () => {
+ const callbacks = await startAndCaptureCallbacks();
+ (messageRepository.insert as jest.Mock).mockRejectedValueOnce(new Error('SQLITE_BUSY: database is locked'));
+
+ callbacks.onMessageCreate!(makeMessage({ id: 'wa-out-busy', from: '[email protected]', to: '[email protected]', fromMe: true }));
+ await flush();
+
+ expect(webhookService.dispatch).toHaveBeenCalledWith('sess-uuid-1', 'message.sent', expect.anything());
+ });
+
+ it('gates persist (but NOT dispatch) on STORE_EPHEMERAL_MESSAGES=false for ephemeral echoes', async () => {
+ // Unlike onMessage (which skips persist AND dispatch for ephemeral), the own-send path's dispatch
+ // is today's contract and stays; only storage honors the opt-out.
+ process.env.STORE_EPHEMERAL_MESSAGES = 'false';
+ const callbacks = await startAndCaptureCallbacks();
+ (hookManager.execute as jest.Mock).mockImplementation((_e: string, data: unknown) =>
+ Promise.resolve({ continue: true, data }),
+ );
+ (messageRepository.insert as jest.Mock).mockClear();
+
+ callbacks.onMessageCreate!(
+ makeMessage({ id: 'wa-out-eph', from: '[email protected]', to: '[email protected]', fromMe: true, ephemeralDuration: 86400 }),
+ );
+ await flush();
+
+ expect(messageRepository.insert).not.toHaveBeenCalled();
+ expect(dispatchedEvents('message.sent')).toHaveLength(1);
+ delete process.env.STORE_EPHEMERAL_MESSAGES;
+ });
+
+ it('synthesizes the omitted media marker for a media echo carrying no media (wwjs shape)', async () => {
+ // wwjs' buildIncomingMessageBase never attaches media to the own-send echo; without the marker
+ // the dashboard renders an empty bubble and the by-type stats filter would skip the row.
+ const callbacks = await startAndCaptureCallbacks();
+ (hookManager.execute as jest.Mock).mockImplementation((_e: string, data: unknown) =>
+ Promise.resolve({ continue: true, data }),
+ );
+ (messageRepository.create as jest.Mock).mockClear();
+
+ callbacks.onMessageCreate!(
+ makeMessage({ id: 'wa-out-img', from: '[email protected]', to: '[email protected]', fromMe: true, type: 'image', body: '' }),
+ );
+ await flush();
+
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const row = (messageRepository.create as jest.Mock).mock.calls[0][0] as Partial<Message>;
+ expect(row.metadata).toEqual({ media: { mimetype: '', omitted: true } });
+ });
+
+ it('passes a Baileys-style omitted marker through unchanged', async () => {
+ const callbacks = await startAndCaptureCallbacks();
+ (hookManager.execute as jest.Mock).mockImplementation((_e: string, data: unknown) =>
+ Promise.resolve({ continue: true, data }),
+ );
+ (messageRepository.create as jest.Mock).mockClear();
+ const marker = { mimetype: 'image/png', omitted: true, sizeBytes: 1234 };
+
+ callbacks.onMessageCreate!(
+ makeMessage({
+ id: 'wa-out-img2',
+ fromMe: true,
+ type: 'image',
+ body: '',
+ media: marker,
+ }),
+ );
+ await flush();
+
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const row = (messageRepository.create as jest.Mock).mock.calls[0][0] as Partial<Message>;
+ expect(row.metadata).toEqual({ media: marker });
});
it('scopes the ack status UPDATE by sessionId, not just waMessageId', async () => {
@@ -2496,6 +2606,42 @@ describe('SessionService', () => {
expect(execute).toHaveBeenCalled();
expect(messageRepository.save).not.toHaveBeenCalled(); // no longer the throwing path
});
+
+ it('synthesizes the omitted media marker for media-free history rows (no empty bubbles)', async () => {
+ // History sync maps messages media-free (footprint). A media row persisted WITHOUT the marker
+ // renders as an empty bubble in the dashboard (the DB copy wins the merge over the engine
+ // placeholder) and is skipped by the by-type stats filter.
+ const callbacks = await startAndCaptureCallbacks();
+ const execute = jest.fn().mockResolvedValue({ identifiers: [] });
+ const qb = {
+ insert: jest.fn().mockReturnThis(),
+ values: jest.fn().mockReturnThis(),
+ orIgnore: jest.fn().mockReturnThis(),
+ execute,
+ };
+ (messageRepository.createQueryBuilder as jest.Mock) = jest.fn().mockReturnValue(qb);
+ (messageRepository.find as jest.Mock).mockResolvedValue([]); // nothing pre-seen
+ (messageRepository.create as jest.Mock).mockImplementation((data: Record<string, unknown>) => ({ ...data }));
+
+ callbacks.onHistoryMessages?.([
+ {
+ id: 'h-img',
+ chatId: '[email protected]',
+ body: '',
+ type: 'image',
+ timestamp: 1,
+ fromMe: true,
+ isGroup: false,
+ },
+ ]);
+ await flush();
+
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const rows = qb.values.mock.calls[0][0] as Array<Record<string, unknown>>;
+ expect(rows[0].metadata).toEqual({ media: { mimetype: '', omitted: true } });
+ });
});
// ── persistHistoryMessages STORE_EPHEMERAL_MESSAGES guard ────────
diff --git a/src/modules/session/session.service.ts b/src/modules/session/session.service.ts
index ddfdbbe38..eb6ff3b32 100644
--- a/src/modules/session/session.service.ts
+++ b/src/modules/session/session.service.ts
@@ -53,6 +53,12 @@ import {
ackStatusTransitionFrom,
} from '../message/message-status.util';
+// Message types that carry downloadable media. Any persisted row of these types must have a media
+// marker in metadata — never NULL — or the dashboard renders an empty bubble (no placeholder) and the
+// by-type stats filter skips the row. Sources that lack the payload (wwjs own-send echo, media-free
+// history sync) get the omitted marker synthesized at the persistence chokepoints.
+const MEDIA_MESSAGE_TYPES = new Set(['image', 'video', 'audio', 'voice', 'sticker', 'document']);
+
interface ReconnectState {
attempts: number;
timer: NodeJS.Timeout | null;
@@ -676,7 +682,14 @@ export class SessionService implements OnModuleDestroy, OnModuleInit, OnApplicat
.map(x => {
const m = byId.get(x)!;
const metadata: Record<string, unknown> = {};
- if (m.media) metadata.media = m.media;
+ if (m.media) {
+ metadata.media = m.media;
+ } else if (MEDIA_MESSAGE_TYPES.has(m.type)) {
+ // History sync maps messages media-free (footprint). Without the marker the row renders
+ // as an empty bubble — the DB copy wins over the engine-history placeholder in the
+ // dashboard merge — and the by-type stats filter would skip it.
+ metadata.media = { mimetype: '', omitted: true };
+ }
if (m.quotedMessage) metadata.quotedMessage = m.quotedMessage;
if (m.call) metadata.call = m.call;
const row = this.messageRepository.create({
@@ -1002,18 +1015,89 @@ export class SessionService implements OnModuleDestroy, OnModuleInit, OnApplicat
sessionId: id,
source: 'Engine',
})
- .then(({ continue: shouldContinue, data: finalMessage }) => {
+ .then(async ({ continue: shouldContinue, data: finalMessage }) => {
if (!shouldContinue) {
return;
}
- // NOTE: unlike onMessage (incoming), this path intentionally does NOT mirror the message
- // to the `messages` table. message_create ALSO fires for API-originated sends, which the
- // REST send path already persists — saving here would double-persist them. Safe
- // persistence of phone-composed sends needs a unique (sessionId, waMessageId) index +
- // de-dup and is tracked as a separate enhancement; until then this path only webhooks/
- // emits. So local message history reflects API sends + all inbound, but not sends
- // composed on a linked phone.
+ // Persist the outgoing message so local history reflects sends composed on a linked phone
+ // (message_create is the ONLY event those produce). It also fires for API-originated sends,
+ // which the REST send path persists itself — the UNIQUE(sessionId, waMessageId) index is
+ // the atomic dedup oracle between the two writers: the loser skips its insert, and
+ // persistSentState additionally drops its redundant PENDING row when the echo won. The
+ // webhook/WS dispatch below is identical whether the insert won, lost, or failed — the
+ // message.sent contract is unchanged.
+ const outgoing: IncomingMessage = finalMessage;
+ const metadata: Record<string, unknown> = {};
+ if (outgoing.media) {
+ metadata.media = outgoing.media;
+ } else if (MEDIA_MESSAGE_TYPES.has(outgoing.type)) {
+ // The wwjs own-send echo carries no media field at all (Baileys emits an omitted
+ // marker); synthesize it so the dashboard renders the 📎 placeholder instead of an
+ // empty bubble, and the row stays countable in the by-type stats.
+ metadata.media = { mimetype: '', omitted: true };
+ }
+ if (outgoing.quotedMessage) {
+ metadata.quotedMessage = outgoing.quotedMessage;
+ }
+ if (outgoing.call) {
+ metadata.call = outgoing.call;
+ }
+
+ // The ephemeral opt-out gates STORAGE only (mirrors onMessage); the live dispatch below
+ // is today's contract and stays.
+ const mayPersist =
+ resolveFeatureFlags(this.configService).storeEphemeralMessages ||
+ !(outgoing.ephemeralDuration && outgoing.ephemeralDuration > 0);
+
+ if (mayPersist) {
+ const dbMessage = this.messageRepository.create({
+ sessionId: id,
+ // Mirror onMessage's chokepoint: an unreadable id is the empty sentinel, stored as
+ // NULL — `''` would collide on the second such message.
+ waMessageId: outgoing.id || undefined,
+ chatId: outgoing.chatId,
+ from: outgoing.from,
+ to: outgoing.to,
+ body: outgoing.body,
+ type: outgoing.type,
+ direction: MessageDirection.OUTGOING,
+ timestamp: outgoing.timestamp,
+ status: MessageStatus.SENT,
+ metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
+ });
+ // The hook chain above is async; a delete()/teardown can retire this engine while it
+ // awaits. Re-check liveness so a late continuation can't persist an orphan row
+ // (mirrors onMessage).
+ if (!this.isLiveEngine(id, engine)) return;
+ let persisted = false;
+ try {
+ const result = await this.messageRepository.insert(
+ dbMessage as unknown as QueryDeepPartialEntity<Message>,
+ );
+ Object.assign(dbMessage, result.identifiers[0] ?? {}, result.generatedMaps?.[0] ?? {});
+ persisted = true;
+ } catch (err) {
+ // Unique violation = the REST send path already persisted this API-originated send —
+ // the dedup oracle working as intended, not an error. Anything else is a real DB
+ // failure; fail open so a real send is never dropped on a transient DB fault.
+ if (!isUniqueConstraintError(err)) {
+ this.logger.error(`Failed to save outgoing message ${outgoing.id} to database`, String(err));
+ }
+ }
+ if (persisted) {
+ // Fire-and-forget, mirroring onMessage: plugin providers (search etc.) see phone-
+ // composed sends exactly like API sends.
+ void this.hookManager
+ .execute(
+ 'message:persisted',
+ { sessionId: id, message: dbMessage },
+ { sessionId: id, source: 'SessionService' },
+ )
+ .catch(() => undefined);
+ }
+ }
+
void this.webhookService.dispatch(id, 'message.sent', finalMessage);
// Emit real-time event to WebSocket clients (as message.sent, not message.received)
this.eventsGateway.emitMessageSent(id, finalMessage);
diff --git a/src/modules/stats/stats.service.spec.ts b/src/modules/stats/stats.service.spec.ts
index 53700982d..3885bfce0 100644
--- a/src/modules/stats/stats.service.spec.ts
+++ b/src/modules/stats/stats.service.spec.ts
@@ -99,6 +99,21 @@ describe('StatsService time-series + hourly activity on SQLite (end-to-end regre
expect(chat?.chatName).toBe('Alice');
});
+ it('getMessageStats byType excludes content-less system/event rows (no body AND no metadata)', async () => {
+ await ds
+ .getRepository(Session)
+ .save(ds.getRepository(Session).create({ id: 's1', name: 'n', status: SessionStatus.READY, config: {} }));
+ await seedMessage({ body: 'hello' });
+ // A media message with no caption (body '') but a metadata.media payload must still be counted —
+ // only rows empty on BOTH are excluded.
+ await seedMessage({ type: 'image', body: '', metadata: { media: { mimetype: 'image/png', data: 'x' } } });
+ // The misleading slice: an @lid privacy-user event the engine maps to `unknown` — no content at all.
+ await seedMessage({ type: 'unknown', body: '', direction: MessageDirection.INCOMING });
+
+ const stats = await service.getMessageStats('24h');
+ expect(stats.byType).toEqual({ text: 1, image: 1 });
+ });
+
it('time-series query never groups by the bare reserved word `timestamp` (Postgres-safe)', async () => {
await ds
.getRepository(Session)
diff --git a/src/modules/stats/stats.service.ts b/src/modules/stats/stats.service.ts
index 7dd64639e..b5bceee43 100644
--- a/src/modules/stats/stats.service.ts
+++ b/src/modules/stats/stats.service.ts
@@ -159,12 +159,15 @@ export class StatsService {
// Time series - using raw query for SQLite compatibility
const timeSeries = await this.getTimeSeries(since, interval);
- // By type
+ // By type. Rows with no body AND no metadata are content-less system/event rows (e.g. @lid
+ // privacy-user events the engine maps to `unknown`) — counting them would put a misleading
+ // "unknown" slice in the by-type chart, so they're excluded from the aggregation.
const byTypeRaw = await this.messageRepo
.createQueryBuilder('m')
.select('m.type', 'type')
.addSelect('COUNT(*)', 'count')
.where('m.createdAt >= :since', { since })
+ .andWhere("(m.body IS NOT NULL AND m.body != '') OR m.metadata IS NOT NULL")
.groupBy('m.type')
.getRawMany<{ type: string; count: string }>();