ai/at
1
0

fix pds-subscriberepos-no-auth patch

This commit is contained in:
2025-12-10 13:40:27 +09:00
parent 67f6691740
commit e53fbba3bf
2 changed files with 167 additions and 8 deletions

View File

@@ -411,28 +411,54 @@ function at-repos-reset-bgs-db() {
echo "⚙️ Updating Slurp Config..."
docker exec -i $dp psql -U postgres -d bgs -c "UPDATE slurp_configs SET new_subs_disabled = false, new_pds_per_day_limit = 1000 WHERE id = 1;"
echo "🔗 Registering Trusted Domain & Resetting Repos..."
echo "🔗 Registering Trusted Domain..."
# Retry loop for addTrustedDomain as BGS might still be warming up
for i in {1..5}; do
if curl -f -X POST "https://bgs.${host}/admin/pds/addTrustedDomain?domain=${host}" -H "Authorization: Bearer ${BGS_ADMIN_KEY}"; then
echo ""
echo "✅ Trusted domain registered"
break
fi
echo "Bot failed to contact BGS (attempt $i/5)... waiting 5s"
echo "Failed to contact BGS (attempt $i/5)... waiting 5s"
sleep 5
done
echo "🔗 Requesting PDS Crawl..."
# Request BGS to crawl the PDS - this registers the PDS and starts subscription
for i in {1..5}; do
result=$(curl -s -X POST "https://bgs.${host}/admin/pds/requestCrawl" \
-H "Authorization: Bearer ${BGS_ADMIN_KEY}" \
-H "Content-Type: application/json" \
-d "{\"hostname\":\"${host}\"}" \
-w "%{http_code}" -o /dev/null)
if [ "$result" = "200" ]; then
echo "✅ PDS crawl requested successfully"
break
fi
echo "Failed to request crawl (attempt $i/5, status: $result)... waiting 5s"
sleep 5
done
echo "⏳ Waiting 5s for BGS to connect to PDS..."
sleep 5
echo "🔄 Triggering repo sync for existing users..."
for ((i=1; i<=${#handles}; i++)); do
handle=${handles[$i]}
did=`curl -sL "https://${host}/xrpc/com.atproto.repo.describeRepo?repo=${handle}" |jq -r .did`
if [ ! -z "$did" ] && [ "$did" != "null" ]; then
echo "Resetting repo: $handle ($did)"
curl -X POST "https://bgs.${host}/admin/repo/reset?did=${did}" \
-H "Authorization: Bearer ${BGS_ADMIN_KEY}"
did=$(curl -sL "https://${host}/xrpc/com.atproto.repo.describeRepo?repo=${handle}" | jq -r .did)
if [ -n "$did" ] && [ "$did" != "null" ]; then
echo " Syncing repo: $handle ($did)"
# Use takedown=false to trigger a resync without actually taking down
curl -s -X POST "https://bgs.${host}/admin/repo/takedown?did=${did}&takedown=false" \
-H "Authorization: Bearer ${BGS_ADMIN_KEY}" || true
else
echo "Skipping reset for $handle (DID not found)"
echo " Skipping $handle (DID not found)"
fi
done
echo ""
echo "✅ BGS reset complete!"
echo " PDS should now be subscribed and syncing repos."
}
function at-repos-feed-generator-start-push() {