| … | … | @@ -1,6 +1,6 @@ |
| 1 | 1 | { |
| 2 | 2 | "name": "atproto-bridge", |
| 3 | "version": "0.9.43", | |
| 3 | "version": "0.9.44", | |
| 4 | 4 | "description": "Stateless keyless atproto MEMBRANE \u2014 fronts self-custody hyper-proto-peers to bluesky over HTTP/WS, holds no keys and never signs. Bare-runnable. Deploy root / flat closure over the identity+repo+store+pds packages.", |
| 5 | 5 | "type": "module", |
| 6 | 6 | "main": "index.js", |
| … | … | @@ -179,9 +179,20 @@ export function createPdsServer ({ peers = null, serverDid = null, availableUser |
| 179 | 179 | case 'com.atproto.sync.listBlobs': { |
| 180 | 180 | const front = await frontIfPeer(q.get('did')) |
| 181 | 181 | if (!front) return notHere(res) |
| 182 | if (typeof front.listBlobs !== 'function') return sendErr(res, 501, 'MethodNotImplemented', 'peer does not serve list-blobs') | |
| 183 | const r = await front.listBlobs({ limit: q.get('limit'), cursor: q.get('cursor') }) | |
| 184 | if (!r || r.skipped) return sendErr(res, 501, 'MethodNotImplemented', 'peer has no blob inventory') | |
| 182 | if (typeof front.listBlobs !== 'function') return sendErr(res, 501, 'MethodNotImplemented', 'peer front too old to serve list-blobs') | |
| 183 | // ⛔ Report why, never a bare InternalError. A peer with no live RPC channel, one too old to | |
| 184 | // know the method, and a genuine fault are three different operator problems, and collapsing | |
| 185 | // them into 500 is the same silence that hid the OTA bug for four versions. | |
| 186 | let r | |
| 187 | try { | |
| 188 | r = await front.listBlobs({ limit: q.get('limit'), cursor: q.get('cursor') }) | |
| 189 | } catch (e) { | |
| 190 | const msg = (e && e.message) || String(e) | |
| 191 | console.error(JSON.stringify({ msg: 'listBlobs: peer call failed', did: q.get('did'), error: msg, code: e && e.code })) | |
| 192 | return sendErr(res, 502, 'PeerUnavailable', 'peer could not answer list-blobs: ' + msg) | |
| 193 | } | |
| 194 | if (!r || r.skipped) return sendErr(res, 501, 'MethodNotImplemented', 'peer has no blob inventory' + (r && r.skipped ? ' (' + r.skipped + ')' : '')) | |
| 195 | if (r.error) return sendErr(res, 502, 'PeerUnavailable', 'peer inventory read failed: ' + r.error) | |
| 185 | 196 | const body = { cids: r.cids || [] } |
| 186 | 197 | if (r.cursor) body.cursor = r.cursor |
| 187 | 198 | if (q.get('since')) body.sinceIgnored = true |
| … | … | @@ -127,9 +127,20 @@ export function createPdsServer ({ peers = null, serverDid = null, availableUser |
| 127 | 127 | case 'com.atproto.sync.listBlobs': { |
| 128 | 128 | const front = await frontIfPeer(q.get('did')) |
| 129 | 129 | if (!front) return notHere(res) |
| 130 | if (typeof front.listBlobs !== 'function') return sendErr(res, 501, 'MethodNotImplemented', 'peer does not serve list-blobs') | |
| 131 | const r = await front.listBlobs({ limit: q.get('limit'), cursor: q.get('cursor') }) | |
| 132 | if (!r || r.skipped) return sendErr(res, 501, 'MethodNotImplemented', 'peer has no blob inventory') | |
| 130 | if (typeof front.listBlobs !== 'function') return sendErr(res, 501, 'MethodNotImplemented', 'peer front too old to serve list-blobs') | |
| 131 | // ⛔ Report why, never a bare InternalError. A peer with no live RPC channel, one too old to | |
| 132 | // know the method, and a genuine fault are three different operator problems, and collapsing | |
| 133 | // them into 500 is the same silence that hid the OTA bug for four versions. | |
| 134 | let r | |
| 135 | try { | |
| 136 | r = await front.listBlobs({ limit: q.get('limit'), cursor: q.get('cursor') }) | |
| 137 | } catch (e) { | |
| 138 | const msg = (e && e.message) || String(e) | |
| 139 | console.error(JSON.stringify({ msg: 'listBlobs: peer call failed', did: q.get('did'), error: msg, code: e && e.code })) | |
| 140 | return sendErr(res, 502, 'PeerUnavailable', 'peer could not answer list-blobs: ' + msg) | |
| 141 | } | |
| 142 | if (!r || r.skipped) return sendErr(res, 501, 'MethodNotImplemented', 'peer has no blob inventory' + (r && r.skipped ? ' (' + r.skipped + ')' : '')) | |
| 143 | if (r.error) return sendErr(res, 502, 'PeerUnavailable', 'peer inventory read failed: ' + r.error) | |
| 133 | 144 | const body = { cids: r.cids || [] } |
| 134 | 145 | if (r.cursor) body.cursor = r.cursor |
| 135 | 146 | if (q.get('since')) body.sinceIgnored = true |