From 94d26ec2a5270ca19f2e32a8381fd6e1b152c3cd Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 10 May 2021 12:25:35 +0200 Subject: Added a commit api endpoint & cleaned up a little --- app.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'app.js') diff --git a/app.js b/app.js index 51c8958..1a6f8ab 100644 --- a/app.js +++ b/app.js @@ -56,7 +56,7 @@ app.use("/:repo", async (req, res, next) => next(); }) -app.get("/:repo", (req, res, next) => +app.get("/:repo", (req, res) => { res.redirect(`/${req.params.repo}/log`); }); @@ -72,6 +72,17 @@ app.get("/:repo/:page", (req, res, next) => res.sendFile("dist/app.html", { root: __dirname }); }); +app.get("/:repo/log/:hash", (req, res, next) => +{ + const valid_hash = /^[0-9a-f]+$/; + if(!valid_hash.test(req.params.hash)) { + next(); + return; + } + res.sendFile("dist/app.html", { root: __dirname }); +}); + + app.get("/", (req, res) => { res.sendFile("dist/app.html", { root: __dirname }); -- cgit v1.2.3-18-g5258