From 69a93ee8d27231fc908e236ee0fc086517dd9f27 Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Sun, 4 Jan 2026 23:50:36 -0800 Subject: [PATCH] chore: remove test endpoints, clean up routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed /test/* endpoints, added proper 404 JSON response. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/pds.js | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/pds.js b/src/pds.js index 3331b64..2c7d43d 100644 --- a/src/pds.js +++ b/src/pds.js @@ -633,48 +633,6 @@ export class PersonalDataServer { async fetch(request) { const url = new URL(request.url) - if (url.pathname === '/test/cbor') { - const encoded = cborEncode({ hello: 'world', num: 42 }) - return new Response(encoded, { - headers: { 'content-type': 'application/cbor' } - }) - } - if (url.pathname === '/test/cid') { - const data = cborEncode({ test: 'data' }) - const cid = await createCid(data) - return Response.json({ cid: cidToString(cid) }) - } - if (url.pathname === '/test/tid') { - const tids = [createTid(), createTid(), createTid()] - return Response.json({ tids }) - } - if (url.pathname === '/test/schema') { - const tables = this.sql.exec(` - SELECT name FROM sqlite_master WHERE type='table' ORDER BY name - `).toArray() - return Response.json({ tables: tables.map(t => t.name) }) - } - if (url.pathname === '/test/sign') { - const kp = await generateKeyPair() - const data = new TextEncoder().encode('test message') - const key = await importPrivateKey(kp.privateKey) - const sig = await sign(key, data) - return Response.json({ - publicKey: bytesToHex(kp.publicKey), - signature: bytesToHex(sig) - }) - } - if (url.pathname === '/test/mst') { - // Insert some test records - this.sql.exec(`INSERT OR REPLACE INTO records VALUES (?, ?, ?, ?, ?)`, - 'at://did:plc:test/app.bsky.feed.post/abc', 'cid1', 'app.bsky.feed.post', 'abc', new Uint8Array([1])) - this.sql.exec(`INSERT OR REPLACE INTO records VALUES (?, ?, ?, ?, ?)`, - 'at://did:plc:test/app.bsky.feed.post/def', 'cid2', 'app.bsky.feed.post', 'def', new Uint8Array([2])) - - const mst = new MST(this.sql) - const root = await mst.computeRoot() - return Response.json({ root }) - } if (url.pathname === '/init') { const body = await request.json() if (!body.did || !body.privateKey) { @@ -777,7 +735,7 @@ export class PersonalDataServer { return new Response(null, { status: 101, webSocket: client }) } - return new Response('pds running', { status: 200 }) + return Response.json({ error: 'not found' }, { status: 404 }) } } -- 2.51.2