Nostr profile editor improvements #272

Merged
raucao merged 7 commits from feature/nostr-profile-fields into master 2026-11-19 20:16:23 +00:00
7 Commits
Author SHA1 Message Date
raucao be133af6fa Upload avatar and header images from the Nostr profile editor
CI / Test (pull_request) Successful in 49s
Release Drafter / Update release notes draft (pull_request) Successful in 37s
The editor gains edit affordances over the avatar and header image and an upload panel that stores the image (previewing the server-cropped result) and records it as pending. Saving the profile signs a Blossom upload token, flushes the pending images, merges the returned URLs into the kind-0 content, and keeps pending state until the publish succeeds so a retry re-flushes.
2026-11-19 21:58:12 +04:00
raucao ab3c2bffd6 Process and relay Nostr profile images server-side
Add a server-side API for avatar and header images: uploads are cropped with Vips (400x400 and 1500x500, GIFs passed through, EXIF stripped, transparency flattened to white) and stored as one pending attachment per field. Saving the profile flushes them to the configured Blossom server, authorized by a user-signed kind-24242 token whose x tags cover the stored hashes.
2026-11-19 21:58:08 +04:00
raucao 4c8525b45f Extract the CSRF token helper for the JS controllers
Four controllers each read the csrf-token meta tag themselves. Move the lookup into lib/csrf.js and import it, ahead of the profile image upload controller that also needs it.
2026-11-19 21:58:03 +04:00
raucao 0901e76dee Report and log why a Nostr event is rejected
CI / Test (pull_request) Successful in 48s
The publish endpoint collapsed every validation failure into a generic "Invalid event", making a real-world rejection impossible to diagnose. Return and log the specific reason instead: public key mismatch, non-integer created_at/kind, disallowed kind, invalid id/signature, stale created_at, content/tags too large, or a malformed request.
2026-11-19 19:27:23 +04:00
raucao 22b1e59f8d Show the Nostr profile editor error inline with the save button
CI / Test (pull_request) Successful in 50s
The save-time error (e.g. a rejected signature) sat on its own line above the button. Move it into the footer row: at the start of the line and vertically centered on desktop, and on the line above the full-width button on mobile.
2026-11-19 18:50:50 +04:00
raucao e2ff905bdb Reuse the account avatar as the Nostr profile picture fallback
When the published profile has no usable `picture` (missing, blank, or not an http(s) URL), the editor previews the account avatar and writes its public URL into the profile on save. An existing valid picture is left untouched.

The component exposes the account avatar URL to the Stimulus controller, which applies it in `content()` only when `picture` is absent or not a URL, so the preview and the published content agree.
2026-11-19 18:50:50 +04:00
raucao 4d2e0aa2b6 Add about and website fields to the Nostr profile editor
CI / Test (pull_request) Successful in 46s
The profile editor only covered display name, NIP-05 and Lightning address. Add the bio (`about`) and `website` fields, read from the existing profile and written back on save (with `website` validated as an http(s) URL).

Lay the form out in a responsive two-column grid (single column on mobile) and align the submit button with the other account settings forms. Also fix the avatar size utility (`size:28` -> `size-28`), which left the avatar unsized on small screens and let it overlap the display-name label.

Avatar and banner image editing is still to come.
2026-11-19 17:49:21 +04:00