aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-05-10 12:25:35 +0200
committerHampusM <hampus@hampusmat.com>2021-05-10 12:25:35 +0200
commit94d26ec2a5270ca19f2e32a8381fd6e1b152c3cd (patch)
tree99729ab8cc39462ab2a9408299d6dea5d1d5c93e /app.js
parent16778756fb25808a1311403590cd7d36fbbeee6c (diff)
Added a commit api endpoint & cleaned up a little
Diffstat (limited to 'app.js')
-rw-r--r--app.js13
1 files changed, 12 insertions, 1 deletions
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 });