fix: deletion should come from pds events
This commit is contained in:
40
server.ts
40
server.ts
@@ -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();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user