#!/bin/bash # Usage: ./sync.sh [bearer_token] # Examples: # ./sync.sh http://localhost:3000 # ./sync.sh https://slices-api.fly.dev # ACCESS_TOKEN= ./sync.sh https://slices-api.fly.dev if [ -z "$1" ]; then echo "Usage: $0 [bearer_token]" echo "" echo "Examples:" echo " $0 http://localhost:3000 " echo " $0 https://slices-api.fly.dev " echo " ACCESS_TOKEN= $0 https://slices-api.fly.dev" exit 1 fi API_ENDPOINT="$1" # Get bearer token from argument or environment variable if [ -n "$2" ]; then TOKEN="$2" elif [ -n "$ACCESS_TOKEN" ]; then TOKEN="$ACCESS_TOKEN" else echo "❌ Error: Bearer token is required" echo "Provide it as second argument or set ACCESS_TOKEN environment variable" exit 1 fi echo "🔄 Starting Sync..." echo "🌐 API Endpoint: $API_ENDPOINT" echo "" # Get system slice URI from environment or use default SYSTEM_SLICE_URI="${SYSTEM_SLICE_URI:-at://did:plc:bcgltzqazw5tb6k2g3ttenbj/network.slices.slice/3lymhd4jhrd2z}" echo "🎯 Syncing slice collections with specific repos" curl -s -X POST "$API_ENDPOINT/xrpc/network.slices.slice.startSync" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d "{ \"slice\": \"$SYSTEM_SLICE_URI\", \"collections\": [ \"network.slices.actor.profile\", \"network.slices.slice\", \"network.slices.lexicon\", \"network.slices.waitlist.invite\", \"network.slices.waitlist.request\" ], \"externalCollections\": [ \"app.bsky.actor.profile\" ], \"skipValidation\": true }" | jq '.' echo "" echo "✅ Sync complete!"