Last active
June 25, 2025 05:16
-
-
Save Corrodias/06f6c56a54cfd66af5869bee8b9a8f59 to your computer and use it in GitHub Desktop.
Unblock all users on Bluesky
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async () => { | |
| // --- 0) extract the auth token and personal repository ID | |
| let storage = JSON.parse(localStorage.getItem('BSKY_STORAGE')); | |
| let token = storage.session.currentAccount.accessJwt; | |
| let did = storage.session.currentAccount.did; | |
| console.log('🔑 found token:', token.slice(0, 20) + '…'); | |
| let headers = { | |
| 'Authorization': `Bearer ${token}`, | |
| 'Content-Type': 'application/json', | |
| }; | |
| // --- 1) page through blocks + delete them --- | |
| let cursor, total = 0; | |
| do { | |
| let listUrl = new URL('https://bsky.social/xrpc/com.atproto.repo.listRecords'); | |
| listUrl.searchParams.set('repo', did); | |
| listUrl.searchParams.set('collection','app.bsky.graph.block'); | |
| listUrl.searchParams.set('limit', '100'); | |
| if (cursor) listUrl.searchParams.set('cursor', cursor); | |
| const listRes = await fetch(listUrl, { headers }); | |
| if (!listRes.ok) throw await listRes.text(); | |
| const { records, cursor: next } = await listRes.json(); | |
| cursor = next; | |
| if (records.length === 0) break; | |
| console.log(`→ Deleting ${records.length} blocks…`); | |
| for (const rec of records) { | |
| const key = rec.uri.split('/').pop(); | |
| const delRes = await fetch( | |
| 'https://bsky.social/xrpc/com.atproto.repo.deleteRecord', | |
| { | |
| method: 'POST', | |
| headers, | |
| body: JSON.stringify({ | |
| repo: did, | |
| collection: 'app.bsky.graph.block', | |
| rkey, | |
| }), | |
| } | |
| ); | |
| if (!delRes.ok) { | |
| console.warn('✖ failed to delete', rkey, await delRes.text()); | |
| } else { | |
| total++; | |
| } | |
| // slight throttle to be polite | |
| await new Promise(r => setTimeout(r, 150)); | |
| } | |
| } while (cursor); | |
| console.log(`✅ Unblocked ${total} users!`); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment