diff options
author | HampusM <hampus@hampusmat.com> | 2021-05-10 12:25:35 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-05-10 12:25:35 +0200 |
commit | 94d26ec2a5270ca19f2e32a8381fd6e1b152c3cd (patch) | |
tree | 99729ab8cc39462ab2a9408299d6dea5d1d5c93e /app.js | |
parent | 16778756fb25808a1311403590cd7d36fbbeee6c (diff) |
Added a commit api endpoint & cleaned up a little
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 }); |