f4a5ba7c31
A standing user-level web server (nh3-dev :8090) that renders drop-folders under ~/booth-data as ephemeral media "booths" so Claude Code sessions can surface A/B renders and smoke results to the operator, then let them self-wipe. - Scan-and-serve model, no database, no upload API — a booth is just a folder. A folder's own index.html is served verbatim; otherwise an auto-gallery of images / webm+mp4 video / audio is rendered, with <file>.txt caption sidecars folded in (labels A/B pairs). - 24h TTL from newest mtime in the tree; background sweeper wipes stale booths. - Path-traversal + symlink-escape guarded; delete via UI button or DELETE API. - FastAPI + Jinja2, runs from the checkout under systemctl --user (booth.service), alongside the other nh3-dev fleet sidecars. 15 tests, all green. - Homepage tile added (Apps -> The Booth, siteMonitor /healthz). - Harden the homepage rsync doc: exclude *.bak* and logs/ so --delete can't wipe the host's dated services.yaml backups (footgun found deploying this).
48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# booth — post media to The Booth (dead simple). A booth is just a folder under
|
|
# $BOOTH_DATA_DIR; this is sugar over mkdir/cp so you get the URL back.
|
|
#
|
|
# booth new <name> make an empty booth, print its URL
|
|
# booth add <name> <file>... copy files into a booth (creates it), print URL
|
|
# booth url <name> print a booth's URL
|
|
# booth ls list booths
|
|
# booth rm <name> wipe a booth now (TTL would eventually anyway)
|
|
#
|
|
# On a host that is NOT nh3-dev, rsync into the data dir instead, e.g.:
|
|
# rsync -a ./out/ nh3-dev:booth-data/my-run/
|
|
set -euo pipefail
|
|
|
|
DATA="${BOOTH_DATA_DIR:-$HOME/booth-data}"
|
|
URL="${BOOTH_URL:-http://10.100.10.50:8090}"
|
|
|
|
usage() { echo "usage: booth {new <name>|add <name> <file>...|url <name>|ls|rm <name>}" >&2; exit 2; }
|
|
|
|
cmd="${1:-}"; shift || true
|
|
case "$cmd" in
|
|
new)
|
|
[ $# -ge 1 ] || usage
|
|
mkdir -p -- "$DATA/$1"
|
|
echo "$URL/b/$1/"
|
|
;;
|
|
add)
|
|
[ $# -ge 2 ] || usage
|
|
name="$1"; shift
|
|
mkdir -p -- "$DATA/$name"
|
|
cp -- "$@" "$DATA/$name/"
|
|
echo "$URL/b/$name/"
|
|
;;
|
|
url)
|
|
[ $# -ge 1 ] || usage
|
|
echo "$URL/b/$1/"
|
|
;;
|
|
ls)
|
|
ls -1 -- "$DATA" 2>/dev/null || true
|
|
;;
|
|
rm)
|
|
[ $# -ge 1 ] || usage
|
|
rm -rf -- "${DATA:?}/$1"
|
|
echo "wiped $1"
|
|
;;
|
|
*) usage ;;
|
|
esac
|