~kyoheiu/frssco

c31fb2dadae0ae3d6c0ee984aba05cf4316d7ffd — Kyohei Uto 9 months ago 04833d4
Skip auth process if .env is not set in edit.tsx
1 files changed, 6 insertions(+), 3 deletions(-)

M routes/edit.tsx
M routes/edit.tsx => routes/edit.tsx +6 -3
@@ 31,9 31,12 @@ const Login = () => {

export const handler: Handlers<EditState> = {
  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 });