Self-hosted multi-platform broadcast newsroom for activist collectives: publishing pipeline with group approval and DST-proof scheduling, TweetDeck-style column wall with hostile-content-safe rendering, live control room with Auto Director, bridged chat governance with polls and quorum, distributed sandboxed transcode workers, encrypted content-addressed archive, monthly analytics. MIT licensed. See README.md and docs/.
50 lines
2.8 KiB
Bash
Executable file
50 lines
2.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# sync-brand.sh — propagate the Tactical Media Broadcast Hub brand to a PeerTube instance.
|
|
# SOURCE OF TRUTH: this repo (brand assets + design tokens). Re-run after ANY brand change.
|
|
# Requires: PEERTUBE_URL (e.g. https://peertube.example.com), PEERTUBE_TOKEN (a user token with
|
|
# manage settings scope), both exported or in a .env next to this script.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/../.."
|
|
REPO_ROOT="$(pwd)/.." # infra/peertube -> repo root one level up from infra
|
|
BRAND="$REPO_ROOT/apps/web/public/brand"
|
|
[ -f "$(dirname "$0")/.env" ] && source "$(dirname "$0")/.env"
|
|
: "${PEERTUBE_URL:?export PEERTUBE_URL=https://peertube.example.com}"
|
|
: "${PEERTUBE_TOKEN:?export PEERTUBE_TOKEN=<user token with settings scope>}"
|
|
|
|
echo "→ syncing Tactical Media Broadcast Hub brand to $PEERTUBE_URL"
|
|
|
|
# 1. Instance name + short description
|
|
curl -sf -X PUT "$PEERTUBE_URL/api/v1/config/custom" \
|
|
-H "Authorization: Bearer $PEERTUBE_TOKEN" -H "Content-Type: application/json" \
|
|
-d '{"instance":{"name":"Tactical Media Broadcast Hub Live","shortDescription":"Our platform. Their feeds. No algorithm in between."}}'
|
|
|
|
# 2. Custom CSS derived from the brand tokens (warm red on black, tilted identity)
|
|
# The CSS below is the PROPAGATED COPY — when tokens change in apps/web globals.css,
|
|
# update docs/peertube-setup.md says: re-run scripts/update-brand-css.sh (or edit here + rerun sync).
|
|
css=$(cat <<'CSS'
|
|
:root { --ap-accent: #FF1610; --ap-bg: #000000; }
|
|
.custom-navbar, body { background: var(--ap-bg) !important; }
|
|
.custom-navbar .navbar-brand, .title-page { color: #fff !important; }
|
|
a, .btn-orange, .peertube-button-link { --mainColor: var(--ap-accent) !important; color: var(--ap-accent) !important; }
|
|
.btn-primary { background-color: var(--ap-accent) !important; border-color: var(--ap-accent) !important; }
|
|
CSS
|
|
)
|
|
python3 - "$css" <<'PY' | curl -sf -X PUT "$PEERTUBE_URL/api/v1/config/custom" -H "Authorization: Bearer $PEERTUBE_TOKEN" -H "Content-Type: application/json" -d @-
|
|
import json, sys, os
|
|
css = sys.argv[1]
|
|
body = {"customization": {"css": css}}
|
|
print(json.dumps(body))
|
|
PY
|
|
|
|
# 3. Logo — PeerTube takes instance banners/avatar via the config API image endpoints
|
|
# (uploads the tilted circle-A mark; fallback to avatar upload if banner endpoint differs by version)
|
|
if [ -f "$BRAND/logo.svg" ]; then
|
|
PNG=$(mktemp --suffix=.png)
|
|
convert -background none "$BRAND/logo.svg" -resize 512x512 "$PNG" 2>/dev/null || \
|
|
npx --yes sharp-cli -i "$BRAND/logo.svg" -o "$PNG" 2>/dev/null || true
|
|
[ -s "$PNG" ] && curl -sf -X POST "$PEERTUBE_URL/api/v1/config/custom/logo" \
|
|
-H "Authorization: Bearer $PEERTUBE_TOKEN" -F "image=@$PNG" || echo " (logo upload skipped — check endpoint for your PeerTube version)"
|
|
rm -f "$PNG"
|
|
fi
|
|
|
|
echo "✓ brand synced. Re-run this script after any brand change (assets or tokens) — it is idempotent."
|