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).
- 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
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.
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.
- 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
- 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