diff --git a/public/css/main.css b/public/css/main.css index dbfd908..6147684 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -43,7 +43,7 @@ form>div { margin: 0.3em; } -.file_button::-webkit-file-upload-button, button, .login, .logout { +.file_button::-webkit-file-upload-button, button, .button { border-radius: 0.3em; border-width: 0em; padding: 0.5em; @@ -78,7 +78,7 @@ header { margin-right: 1em; } -.login, .logout { +.button { background-color: buttonface; text-decoration: none; color: initial; @@ -86,3 +86,11 @@ header { height: fit-content; } +.buttons { + margin: 2em; + display: flex; + justify-items: center; + align-content: center; + justify-content: center; +} + diff --git a/routes/index.js b/routes/index.js index c0902e0..1db90d9 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,5 +1,6 @@ let router = require("express").Router(); let isAuth = require("../user").isAuth; +let fs = require("fs"); router.get("/", isAuth, (req, res) => { @@ -7,7 +8,11 @@ router.get("/", isAuth, (req, res) => { if ("invalidType" in req.query) { invalidType = true; } - res.render("index", {invalidType: invalidType, session: req.session}); + res.render("index", { + invalidType: invalidType, + session: req.session, + count: fs.readdirSync("./images/").length + }); }); diff --git a/views/index.pug b/views/index.pug index 57d7986..4801ee8 100644 --- a/views/index.pug +++ b/views/index.pug @@ -6,4 +6,7 @@ block content form(method="POST", action="/upload", enctype="multipart/form-data") input.file_button(type="file", name="image", accept="image/*") button(type="submit") Upload + div.buttons + a.button(href="/list") Image List + p Actually #{count} images uploaded ! diff --git a/views/layout.pug b/views/layout.pug index 401fe1e..4c37622 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -11,8 +11,8 @@ html(lang="en") header if session.login p.hy Hy #{session.username} ! - a.logout(href="/logout") Logout + a.button(href="/logout") Logout else - a.login(href="/login") Login + a.button(href="/login") Login block content