contact messages: mail server setting, browser notifications for new messages

The mail server field is plumbing only (mailbridge URL in settings +
editor UI); actual email sending is deferred. Browser notifications:
permission is asked on the user's first send, then the visitor is
notified of admin replies while not viewing the thread and the admin of
new visitor messages while the inbox is open.
This commit is contained in:
LeoVasanko committed 2026-09-29 02:06:54 +00:00
1 parent 38b08679c6
commit f8da552cfe
8 files changed
+121 -22

No files matched your search

+12 -3
View File
@@ -13,7 +13,7 @@ existing WebSockets; there is no REST polling anywhere.
count and the `/_contact/files` upload route.
- `pagerite/data.py` — `Data.contact` (`ContactThread`/`ContactMessage`)
and the site settings (`contact_label` — which doubles as the on/off
switch — `contact_email`, `contact_subject`).
switch — `contact_email`, `contact_subject`, `contact_mailserver`).
- `pagerite/tracking.py` — the sockets the protocol rides (see below).
- `pagerite/api.py` — `/_api/settings` carries `contact_unread` (the admin
icon badge seed — the probe runs on every page load, no polling) and the
@@ -55,8 +55,17 @@ trigger buttons, no visitor corner icon, sends rejected; admins keep the
inbox for existing threads) — `contact_email` (a mailto link in the
visitor dialog: the recipient is addressed `Brand <email>`, the link
text the bare address, the subject prefilled) and `contact_subject`
(defaults to the label). Saves re-render the page in place, so button
and dialog strings update without a reload.
(defaults to the label). `contact_mailserver` is a mailbridge URL
(`smtp://user:pass@host:port`, a bare `host[:port]`, or a backend URL
like `sendgrid:API-KEY`) reserved for email notifications — the actual
sending is not implemented yet. Saves re-render the page in place, so
button and dialog strings update without a reload.
Both sides also get browser notifications (the Notification API,
`frontend/src/notify.js`): permission is asked when the user sends their
first message, then the visitor is notified of new admin replies while
not viewing the thread and the admin of new visitor messages while the
inbox is open; clicking a notification focuses the tab.
The two strings localize like titles: translations live in the
chunk-keyed `Data.trans` store (`i18n.site_string` looks them up at