From 6d957bc0c39c8f336b81869bfa09b79bd209e848 Mon Sep 17 00:00:00 2001 From: adueck Date: Sun, 22 Jan 2023 21:03:11 +0500 Subject: [PATCH] oops - put auth back in front of publish --- functions/src/index.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/functions/src/index.ts b/functions/src/index.ts index 34a7280..acffc06 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -7,23 +7,23 @@ import publish from "./publish"; export const publishDictionary = functions.runWith({ timeoutSeconds: 60, memory: "2GB" -}).https.onRequest(async (req, res) => { - // lingdocsAuth( - // async (req, res: functions.Response) => { - // if (req.user.level !== "editor") { - // res.status(403).send({ ok: false, error: "403 forbidden" }); - // return; - // } - // try { +}).https.onRequest( + lingdocsAuth( + async (req, res: functions.Response) => { + if (req.user.level !== "editor") { + res.status(403).send({ ok: false, error: "403 forbidden" }); + return; + } + try { const response = await publish(); res.send(response); - // } catch (e) { - // // @ts-ignore - // res.status(500).send({ ok: false, error: e.message }); - // } - // } - // ) -}); + } catch (e) { + // @ts-ignore + res.status(500).send({ ok: false, error: e.message }); + } + } + ) +); export const submissions = functions.runWith({ timeoutSeconds: 30,