From 12c244a85d68b54211a08918ea9751ede90563b4 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Thu, 30 Jul 2020 20:17:38 +0200 Subject: Minor improvements --- src/handler/fileView.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/handler/fileView.ts') diff --git a/src/handler/fileView.ts b/src/handler/fileView.ts index eb9c3a1..29bc7a9 100644 --- a/src/handler/fileView.ts +++ b/src/handler/fileView.ts @@ -1,6 +1,8 @@ import type { HandlerFunc, Context } from "https://deno.land/x/abc@master/mod.ts"; import { getFiles } from "../util/files.ts"; +import { getCurrentUser } from "../util/user.ts"; export const handlePath: HandlerFunc = async (c: Context) => { - return await c.render("./src/views/index.html", { files: await getFiles(c.path) }); -}; + if (!(await getCurrentUser(c))) return c.redirect("/user/login"); // TODO: Handle shared files + return await c.render("./src/views/index.ejs", { files: await getFiles(c) }); +} -- cgit v1.2.3