mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
d53cbfb373
* fix(annotate): enforce archive read-only surfaces * fix(archive): close remaining read-only leaks
17 lines
495 B
TypeScript
17 lines
495 B
TypeScript
const ARCHIVE_POST_MUTATIONS = new Set([
|
|
"/api/approve",
|
|
"/api/deny",
|
|
"/api/draft",
|
|
"/api/save-notes",
|
|
"/api/upload",
|
|
]);
|
|
|
|
/**
|
|
* Return whether an HTTP request would mutate document-review state and must
|
|
* therefore be rejected by the standalone archive server.
|
|
*/
|
|
export function isArchiveDocumentMutation(method: string, pathname: string): boolean {
|
|
return (method === "POST" && ARCHIVE_POST_MUTATIONS.has(pathname))
|
|
|| (method === "DELETE" && pathname === "/api/draft");
|
|
}
|