From c31fb2dadae0ae3d6c0ee984aba05cf4316d7ffd Mon Sep 17 00:00:00 2001 From: Kyohei Uto Date: Fri, 19 May 2023 04:51:07 +0900 Subject: [PATCH] Skip auth process if .env is not set in edit.tsx --- routes/edit.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/routes/edit.tsx b/routes/edit.tsx index a147319..82ca525 100644 --- a/routes/edit.tsx +++ b/routes/edit.tsx @@ -31,9 +31,12 @@ const Login = () => { export const handler: Handlers = { async GET(req, ctx) { - const cookies = getCookies(req.headers); - if (cookies.auth !== "frssco_logged_in") { - return ctx.render!({ source: "", loggedIn: false }); + // If .env is not set, the login process is skipped + if (Deno.env.get("USERNAME")) { + const cookies = getCookies(req.headers); + if (cookies.auth !== "frssco_logged_in") { + return ctx.render!({ source: "", loggedIn: false }); + } } const text = await Deno.readTextFile("feed.txt"); return ctx.render!({ source: text, loggedIn: true }); -- 2.45.2