Files
raucao 6750c61d87 Add Nostr photo feeds and wallpaper selection
Read the curated photo feeds from wss://nostr.kosmos.org, verify events, cache originals and thumbnails, and let users pick a wallpaper from the Photos section. Nature is the default feed; City Nights is opt-in. Adds the manual publishing scripts, real event fixtures, protocol documentation, and tests with stubbed network connections.
2026-11-08 21:51:23 +04:00

94 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Entry point for the Dashtab Nostr photo publishing workflow.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib.sh"
usage() {
cat <<'EOF'
Usage: ./scripts/nostr/run.sh <command> [options]
Commands:
thumbnails Generate 480x270 JPEG thumbnails in tmp/nostr-photos/thumbs
upload-thumbnails Upload thumbnails to Kosmos Blossom (nak prompts once)
preflight Verify files, Blossom URLs, thumbnails, and attribution
build Build unsigned photo/feed event drafts
publish-photos Sign (nak prompts per photo) and publish kind-20 events
publish-feeds Sign (nak prompts per feed) and publish kind-30006 feeds
all thumbnails -> upload -> preflight -> build -> photos -> feeds
status Show current state
Options:
--force Regenerate/upload/republish even if state says done
--yes Skip confirmation prompts
--dry-run Print the nak commands without signing or publishing
--attribution-only For 'preflight': skip thumbnail checks
The curator key is never stored. nak uses --prompt-sec to ask for it in the
terminal (via /dev/tty when an event is piped through stdin). The scripts verify
the signed event pubkey matches the curator before publishing.
EOF
}
command=""
attribution_only=0
for arg in "$@"; do
case "$arg" in
--force) export FORCE=1 ;;
--yes) export ASSUME_YES=1 ;;
--dry-run) export DRY_RUN=1 ;;
--attribution-only) attribution_only=1 ;;
*)
if [[ -z "$command" ]]; then
command="$arg"
else
die "unexpected argument: $arg"
fi
;;
esac
done
command="${command:-help}"
case "$command" in
thumbnails)
"$SCRIPT_DIR/thumbnails.sh"
;;
upload-thumbnails|upload)
"$SCRIPT_DIR/upload-thumbnails.sh"
;;
preflight)
if [[ "$attribution_only" == "1" ]]; then
"$SCRIPT_DIR/preflight.sh" --attribution-only
else
"$SCRIPT_DIR/preflight.sh"
fi
;;
build|events)
"$SCRIPT_DIR/build-events.sh"
;;
publish-photos|photos)
"$SCRIPT_DIR/publish-photos.sh"
;;
publish-feeds|feeds)
"$SCRIPT_DIR/publish-feeds.sh"
;;
all)
"$SCRIPT_DIR/thumbnails.sh"
"$SCRIPT_DIR/upload-thumbnails.sh"
"$SCRIPT_DIR/preflight.sh"
"$SCRIPT_DIR/build-events.sh"
"$SCRIPT_DIR/publish-photos.sh"
"$SCRIPT_DIR/publish-feeds.sh"
;;
status)
summary
;;
help|-h|--help)
usage
;;
*)
usage
die "unknown command: $command"
;;
esac