Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

Verify user is admin

Isaace7a067b358ec
diff --git a/pages/api/v1/links/archive/index.ts b/pages/api/v1/links/archive/index.ts
index b4e48253..794c201d 100644
--- a/pages/api/v1/links/archive/index.ts
+++ b/pages/api/v1/links/archive/index.ts
@@ -8,6 +8,12 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
const user = await verifyUser({ req, res });
if (!user) return;
+ const isServerAdmin = user.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1);
+
+ if (!isServerAdmin) {
+ return res.status(401).json({ response: "Permission denied." });
+ }
+
if (req.method === "PUT") {
const dataValidation = PutLinksArchiveSchema.safeParse(req.body);
if (!dataValidation.success) {