atproto user agency toolkit for individuals and groups
at main 49 lines 1.6 kB view raw
1#!/bin/bash 2# Check API responses from running node 1. 3# Usage: npm run check-api 4set -e 5 6PORTFILE="/tmp/p2pds-node1.port" 7if [ ! -f "$PORTFILE" ]; then 8 echo "Node 1 not running. Start with: npm run start:node1" 9 exit 1 10fi 11PORT=$(cat "$PORTFILE") 12BASE="http://localhost:$PORT" 13 14# Get auth token from the page 15HTML=$(curl -s "$BASE/") 16TOKEN=$(echo "$HTML" | grep -o '__P2PDS_TOKEN__="[^"]*"' | sed 's/__P2PDS_TOKEN__="//;s/"//') 17 18echo "=== Server ===" 19echo " URL: $BASE" 20echo " Token: ${TOKEN:0:16}..." 21 22echo "" 23echo "=== OAuth Status ===" 24curl -s "$BASE/oauth/status" | python3 -m json.tool 25 26echo "" 27echo "=== Overview (key fields) ===" 28curl -s -H "Authorization: Bearer $TOKEN" "$BASE/xrpc/org.p2pds.app.getOverview" | python3 -c " 29import json, sys 30d = json.load(sys.stdin) 31if 'error' in d: 32 print(' ERROR:', d.get('error'), '-', d.get('message')) 33else: 34 print(' did:', d.get('did')) 35 print(' handle:', d.get('handle')) 36 print(' replication.enabled:', d.get('replication', {}).get('enabled')) 37 tracked = d.get('replication', {}).get('trackedDids', []) 38 print(' trackedDids:', tracked) 39 sources = d.get('replication', {}).get('didSources', {}) 40 print(' didSources:', sources) 41 print(' policies:', d.get('policy', {}).get('policyCount')) 42" 43 44echo "" 45echo "=== Page HTML markers ===" 46echo " Has TOKEN: $(echo "$HTML" | grep -c '__P2PDS_TOKEN__')" 47echo " Has p2p-app: $(echo "$HTML" | grep -c '<p2p-app>')" 48echo " Has bundle: $(echo "$HTML" | grep -c 'app.js')" 49echo " Cache-Control: $(curl -sI "$BASE/" | grep -i cache-control || echo 'none')"