Files
2026-11-08 22:29:18 +04:00

4.6 KiB

Nostr photo publishing

Interactive scripts that generate thumbnails, upload them to Kosmos Blossom, verify creator attribution, and publish the Dashtab photo feeds to wss://nostr.kosmos.org.

The private key is never passed to the scripts, captured in a variable, or written to disk. Every signing step uses nak --prompt-sec, so nak asks for the key in your terminal. When an event is piped through stdin, nak reads the key from /dev/tty, so the event data and the prompt do not conflict.

To avoid repeated key prompts, you can export the key in your own shell for the run; the scripts never read or store it:

export NOSTR_SECRET_KEY='nsec1...'   # your shell only, never committed
./scripts/nostr/run.sh all
unset NOSTR_SECRET_KEY

The scripts still verify the signed event pubkey against the curator before publishing, so a wrong key aborts before anything is sent.

Prerequisites

  • nak in PATH (the same tool used for the originals)
  • ImageMagick (magick)
  • jq, curl, sha256sum, stat, file
  • A terminal (the key prompts need a TTY)

Workflow

cd /path/to/dashtab

# 1. Generate 480x270 JPEG thumbnails and verify the local originals
./scripts/nostr/run.sh thumbnails

# 2. Upload them to https://blossom.kosmos.org
#    nak prompts once for the Blossom upload key.
./scripts/nostr/run.sh upload-thumbnails

# 3. Verify every original, thumbnail, and attribution link
./scripts/nostr/run.sh preflight

# 4. Build unsigned photo/feed event drafts
./scripts/nostr/run.sh build

# 5. Sign and publish the five kind-20 photo events
#    nak prompts for the curator key once per photo.
./scripts/nostr/run.sh publish-photos

# 6. Sign and publish the kind-30006 feed events
#    nak prompts for the curator key once per feed.
./scripts/nostr/run.sh publish-feeds

./scripts/nostr/run.sh all runs the whole sequence.

Useful options:

./scripts/nostr/run.sh all --yes              # skip confirmation prompts
./scripts/nostr/run.sh thumbnails --force     # regenerate thumbnails
./scripts/nostr/run.sh upload-thumbnails --force
./scripts/nostr/run.sh publish-feeds --force  # republish replaceable feeds
./scripts/nostr/run.sh preflight --attribution-only
./scripts/nostr/run.sh --dry-run publish-photos
./scripts/nostr/run.sh status

What the scripts guarantee

  • Attribution is a hard gate. preflight refuses to continue unless every photo has a creator name, an HTTPS profile/source/license URL that returns HTTP 200, the creator name present on the profile and source pages, an original whose SHA-256 matches x, and a reachable image thumbnail.
  • Correct signer. After nak signs, the script checks the event's pubkey against the curator pubkey before publishing. A wrong key aborts before anything is sent.
  • No duplicates. Photo events are non-replaceable; the script skips any whose x or recorded event ID already exists on the relay. Feed events are replaceable; the script skips them when the on-relay tag content already matches the draft.
  • No secrets on disk. Only public event JSON, hashes, and IDs are stored.

State

Everything generated lives under tmp/nostr-photos/ (gitignored):

tmp/nostr-photos/
  thumbs/       generated thumbnails
  events/
    photos/     draft, signed, and published kind-20 events
    feeds/      draft, signed, and published kind-30006 events
  state/
    thumbs.json   thumbnail hashes and Blossom URLs
    photos.json   published photo event IDs
    feeds.json    published feed event IDs
    preflight.json
  logs/         nak upload output

To start over, remove tmp/nostr-photos/. The manifest itself is scripts/nostr/manifest.json and is the source of truth for the feed/photo metadata, verified creator links, and Blossom hashes.

Editing the manifest

Add a new photo by appending an entry to .photos with:

  • file, url (Blossom original), sha256, size, dim, mime
  • feed (must match a feed id)
  • title, alt, content, tags
  • creator, profile, source, license, licenseUrl, optional portfolio, originId

Then add it to the feed's order (and optionally make it the cover) and rerun the workflow. preflight will reject anything missing verified attribution.

Attribution rules

  • Nostr-native creators would get a p ... "author" tag. None of the current Unsplash creators have a verified Nostr identity, so events use origin + r.
  • origin carries {"creator", "profile", "license", "licenseUrl", "portfolio"?}.
  • Meiying Ng's Tumblr portfolio returns HTTP 403 and is omitted; her verified Unsplash profile is used instead.
  • Publishing is blocked if any link fails verification. There is no override.