Something went wrong. Try again.
Items for the sister.systems pds
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041#!/usr/bin/env bashset -euo pipefail
HOST="${SDB_DEPLOY_HOST:-root@23.26.4.234}"ENDPOINT="${TANGLED_WEBHOOK_ENDPOINT:-https://items.sister.systems/api/webhooks/tangled}"
echo "[deploy] Fetching webhook secret from ${HOST}..."SECRET=$(ssh -i ~/.ssh/sdb_atproto_deploy \ -o StrictHostKeyChecking=no \ -o IdentitiesOnly=yes \ "$HOST" 'grep "^TANGLED_WEBHOOK_SECRET=" /pds/sdb.env | cut -d= -f2-')
if [ -z "$SECRET" ]; then echo 'Error: could not retrieve TANGLED_WEBHOOK_SECRET from the VPS.' >&2 exit 1fi
PAYLOAD='{"ref":"refs/heads/main","repository":{"name":"sdb-atproto"}}'
SIG=$(node -e ' const crypto = require("crypto"); const [secret, payload] = process.argv.slice(1); const sig = crypto.createHmac("sha256", secret).update(payload).digest("hex"); console.log(sig);' "$SECRET" "$PAYLOAD")
echo "[deploy] Sending webhook to ${ENDPOINT}..."STATUS=$(curl -s -o /dev/null -w '%{http_code}' \ -X POST "$ENDPOINT" \ -H 'Content-Type: application/json' \ -H 'X-Tangled-Event: push' \ -H "X-Tangled-Signature-256: sha256=${SIG}" \ -d "$PAYLOAD")
if [ "$STATUS" = "204" ]; then echo "[deploy] Webhook accepted (${STATUS})."else echo "[deploy] Webhook returned ${STATUS}." >&2 exit 1fi