fix: deletion should come from pds events

This commit is contained in:
Julien Calixte
2026-02-15 09:24:40 +01:00
parent efb78ff14e
commit e0e095f7e5

View File

@@ -24,26 +24,26 @@ router.get("/:did/notes", (ctx) => {
ctx.response.body = getNotesByDid(did, cursor, limit); ctx.response.body = getNotesByDid(did, cursor, limit);
}); });
router.delete("/:did/:rkey", async (ctx) => { // router.delete("/:did/:rkey", async (ctx) => {
const { did, rkey } = ctx.params; // const { did, rkey } = ctx.params;
let verifiedDid: string; // let verifiedDid: string;
try { // try {
verifiedDid = await authenticateRequest( // verifiedDid = await authenticateRequest(
ctx.request.headers.get("Authorization"), // ctx.request.headers.get("Authorization"),
); // );
} catch { // } catch {
ctx.response.status = 401; // ctx.response.status = 401;
ctx.response.body = { error: "Unauthorized" }; // ctx.response.body = { error: "Unauthorized" };
return; // return;
} // }
if (verifiedDid !== did) { // if (verifiedDid !== did) {
ctx.response.status = 403; // ctx.response.status = 403;
ctx.response.body = { error: "You can only delete your own notes" }; // ctx.response.body = { error: "You can only delete your own notes" };
return; // return;
} // }
deleteNote({ did, rkey }); // deleteNote({ did, rkey });
ctx.response.status = 204; // ctx.response.status = 204;
}) // })
const app = new Application(); const app = new Application();