From 950dee968c1377fa042e8842656e048302617697 Mon Sep 17 00:00:00 2001 From: MeowcaTheoRange Date: Sat, 31 Aug 2024 02:25:09 -0500 Subject: [PATCH] get sha of current commit --- index.js | 13 ++++++++++++- views/components/footer.ejs | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 001a651..c483ec1 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,18 @@ app.locals.siteMap = [ link: "about", description: "who runs abtmtr.link?" } -] +]; +app.locals.curCommit = "0000000000"; + +async function getCurCommit() { + const curCommit = await fetch("https://git.abtmtr.link/api/v1/repos/MeowcaTheoRange/abtmtr-v13/branches/main") + .catch(() => res.status(500).send()) + .then((res) => res.json()); + + app.locals.curCommit = curCommit.commit.id.substr(0, 10); +} + +getCurCommit(); app.get('/', async (req, res) => { const statusesJson = await fetch("https://cdn.abtmtr.link/site_content/v13/statuses.json") diff --git a/views/components/footer.ejs b/views/components/footer.ejs index b84d3ed..150d30f 100644 --- a/views/components/footer.ejs +++ b/views/components/footer.ejs @@ -1,5 +1,5 @@