Email notifications: settings UI + mail adapter #4

Open
hudson wants to merge 27 commits from email-notifications into dev
Collaborator

Adds email digest notification support to flotilla.

Two beads:

a01.12: flotilla: env, state, and email settings UI

  • New env var VITE_EMAIL_NOTIFICATION_SERVER pointing to a mailship instance
  • Extended notificationSettings with email, emailFrequency, emailAddress
  • Added emailNotificationState store
  • New Email Digest Settings card in the alerts settings page with toggle, email input, and frequency selector (daily/weekly)

a01.11: flotilla: mail adapter

  • New src/app/mail/index.ts with MailNotifications class
  • Registers with mailship via NIP-98 authenticated POST /subscription/email
  • Publishes kind 30390 NIP-9a subscription events (same relay/filter logic as push)
  • Deletes subscriptions and 30390 events on disable
  • Wired into the alerts settings save handler

Testing:

  • Requires a running mailship instance configured via VITE_EMAIL_NOTIFICATION_SERVER
  • Tested end-to-end with the mailship server running locally: registration, confirmation, event push, digest delivery all confirmed working
Adds email digest notification support to flotilla. **Two beads:** ### a01.12: flotilla: env, state, and email settings UI - New env var VITE_EMAIL_NOTIFICATION_SERVER pointing to a mailship instance - Extended notificationSettings with email, emailFrequency, emailAddress - Added emailNotificationState store - New Email Digest Settings card in the alerts settings page with toggle, email input, and frequency selector (daily/weekly) ### a01.11: flotilla: mail adapter - New src/app/mail/index.ts with MailNotifications class - Registers with mailship via NIP-98 authenticated POST /subscription/email - Publishes kind 30390 NIP-9a subscription events (same relay/filter logic as push) - Deletes subscriptions and 30390 events on disable - Wired into the alerts settings save handler **Testing:** - Requires a running mailship instance configured via VITE_EMAIL_NOTIFICATION_SERVER - Tested end-to-end with the mailship server running locally: registration, confirmation, event push, digest delivery all confirmed working
hudson added 1 commit 2026-08-20 14:55:53 +00:00
- Add VITE_EMAIL_NOTIFICATION_SERVER env var
- Extend notificationSettings with email, emailFrequency, emailAddress
- Add emailNotificationState store in push/adapters/common.ts
- New src/app/mail/index.ts with MailNotifications class:
  register/unregister with mailship via NIP-98 auth,
  publish kind 30390 NIP-9a subscription events
- Wired into alerts settings save handler
- Email Digest Settings card in alerts UI
matt approved these changes 2026-08-20 15:02:35 +00:00
matt force-pushed email-notifications from 3b8d321bd8 to fee6f565ff 2026-08-20 15:21:53 +00:00 Compare
hudson added 1 commit 2026-08-20 16:23:11 +00:00
- Add error field to EmailNotificationState type
- Set user-friendly error messages in MailNotifications.register() for:
  missing signer, missing server config, NIP-98 auth failure,
  network errors, and server errors
- Clear error on successful registration
- Show inline error banner in the email settings card
- Return early on registration failure (like push does)
- Clear error when user edits email/frequency or clicks reset
matt added 3 commits 2026-08-24 18:41:43 +00:00
Owner

I have deployed this but I'm getting an error when saving my mail preferences. I see the "Email notification server is not configured." error inline, but the colors are wrong, use the same ones as elswhere. I can confirm I set VITE_EMAIL_NOTIFICATION_SERVER in my env.

I also see an error toast "Failed to enable email notifications. Details" but the details link does nothing. There are no errors in the console log which I would expect to see. Fix these issues and I'll try again.

I have deployed this but I'm getting an error when saving my mail preferences. I see the "Email notification server is not configured." error inline, but the colors are wrong, use the same ones as elswhere. I can confirm I set VITE_EMAIL_NOTIFICATION_SERVER in my env. I also see an error toast "Failed to enable email notifications. Details" but the details link does nothing. There are no errors in the console log which I would expect to see. Fix these issues and I'll try again.
hudson added 2 commits 2026-08-25 14:34:02 +00:00
matt added 1 commit 2026-08-25 15:05:06 +00:00
Accept VITE_* build args for branding/feature overrides
Some checks failed
CI / lint-check-build (pull_request) Has been cancelled
5c027dd823
Self-hosted deployments can now pass --build-arg VITE_PLATFORM_URL,
VITE_PLATFORM_NAME, VITE_EMAIL_NOTIFICATION_SERVER, etc. to override the
tracked .env defaults at build time. Unset args fall back to .env values
via scripts/build.sh's exported-env restore.
matt added 1 commit 2026-08-27 19:09:16 +00:00
Save email notification prefs to app settings
Some checks failed
CI / lint-check-build (pull_request) Has been cancelled
dd1182cb32
matt added 1 commit 2026-08-27 19:45:11 +00:00
Send include_event tag with 30390
Some checks failed
CI / lint-check-build (pull_request) Has been cancelled
83a8bb1572
matt added 1 commit 2026-09-01 20:00:01 +00:00
Sync email settings only when changed
Some checks failed
CI / lint-check-build (pull_request) Has been cancelled
3e892d76f6
matt added 1 commit 2026-09-03 16:00:48 +00:00
Always PUT email subscription (remove GET-first lookup)
Some checks failed
CI / lint-check-build (pull_request) Has been cancelled
8047a4f084
Mailship's /subscription/email is now an idempotent PUT upsert. Drop the
lookup-before-register dance and always PUT the settings; mailship skips the
confirmation email when nothing changed or only the frequency changed.
matt added 4 commits 2026-09-03 17:04:59 +00:00
matt added 1 commit 2026-09-03 17:43:33 +00:00
debounce subscription syncing
All checks were successful
CI / lint-check-build (pull_request) Successful in 4m4s
d6f0e47edf
hudson added 1 commit 2026-09-16 17:54:40 +00:00
fix email notifications: match mailship PUT API with full-URL NIP-98 and payload tag
All checks were successful
CI / lint-check-build (pull_request) Successful in 3m19s
3981ed9608
- register(): sign makeHttpAuth with full URL (/subscription/email),
  method PUT, and serialized body so both u-tag and payload tag match
  mailship's verifyNip98Auth. Drop pubkey from request body (server
  reads it from the auth event).
- unregister(): sign makeHttpAuth with full URL (/subscription/:key)
  and method DELETE, matching mailship's u-tag expectation.

Closes PR #4
hudson added 1 commit 2026-09-16 19:13:50 +00:00
Remove signer-not-responding toast with dead Details link
Some checks failed
CI / lint-check-build (pull_request) Failing after 1m40s
1cff79dba2
hudson added 1 commit 2026-09-17 20:40:14 +00:00
Keep signer-not-responding toast; drop only the dead Details action button
All checks were successful
CI / lint-check-build (pull_request) Successful in 4m14s
ce8920123f
matt added 1 commit 2026-09-21 15:54:49 +00:00
Fix Mail.sync to only fire when the user saves, or when contents are loaded from disk
All checks were successful
CI / lint-check-build (pull_request) Successful in 4m9s
b90a20424e
matt added 1 commit 2026-09-21 20:15:24 +00:00
Fix settings hydration
All checks were successful
CI / lint-check-build (pull_request) Successful in 3m23s
63cf801ef1
matt added 1 commit 2026-09-22 17:59:37 +00:00
Email digest: GET-first restore on boot so reloads stop re-sending confirmations
All checks were successful
CI / lint-check-build (pull_request) Successful in 3m25s
609a2f65ea
Mail.sync's boot reconcile now GETs the existing subscription (NIP-98
auth) before deciding what to do. When a subscription already exists for
the pubkey with the same email and frequency, its key/callback are
restored in memory and the PUT is skipped entirely. Only a matching
subscription missing the requested params triggers a PUT, so a page
refresh of an unconfirmed address no longer makes mailship re-send a
confirmation email (previously each reload sent one).
matt added 2 commits 2026-09-23 20:37:17 +00:00
feat(settings): merge email digest schedule controls onto email-notifications
All checks were successful
CI / lint-check-build (pull_request) Successful in 3m19s
f9878fdff1
Resolves PR #5 conflict resolution: rebased the digest-schedule work (from
flotilla-fc1, built against dev) onto the email-notifications branch.

- settings.ts: add emailHour/emailMinute/emailDayOfWeek/emailTimezone to
  SettingsValues + defaults (17:00, device timezone, dayOfWeek undefined)
- alerts/+page.svelte: keep the email-notifications card (gated on
  EMAIL_NOTIFICATION_SERVER, communities warning, error state, NIP-98
  register/enable flow); add HH:MM time input + weekly day-of-week picker;
  weekly select defaults dayOfWeek to Monday; publish schedule fields via
  AppData publishSettings
- mail/index.ts: register() accepts hour/minute/dayOfWeek/timezone and PUTs
  them to mailship; enable()/sync() pass stored schedule through

Dropped dev-based duplicates: src/app/mail.ts, VITE_MAILSHIP_URL (.env +
env.ts) — the email-notifications mail adapter and
VITE_EMAIL_NOTIFICATION_SERVER are canonical. PUT contract matches mailship
PR #28: {email, frequency, hour, minute, dayOfWeek, timezone}.
Reviewed-on: #5
Reviewed-by: matt <matt@lorentz.is>
matt added 2 commits 2026-09-24 13:14:55 +00:00
Merge branch 'email-notifications' of ssh://forgejo.lorentz.is:4201/matt/flotilla into email-notifications
All checks were successful
CI / lint-check-build (pull_request) Successful in 4m16s
fbec3e1659
# Conflicts:
#	src/app/mail/index.ts
#	src/app/settings.ts
All checks were successful
CI / lint-check-build (pull_request) Successful in 4m16s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin email-notifications:email-notifications
git checkout email-notifications

Merge

Merge the changes and update on Forgejo.
git checkout dev
git merge --no-ff email-notifications
git checkout dev
git merge --ff-only email-notifications
git checkout email-notifications
git rebase dev
git checkout dev
git merge --no-ff email-notifications
git checkout dev
git merge --squash email-notifications
git checkout dev
git merge --ff-only email-notifications
git checkout dev
git merge email-notifications
git push origin dev
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: matt/flotilla#4
No description provided.