diff --git a/src/frontend/manage/startpage.eta.html b/src/frontend/manage/startpage.eta.html index d6da456..2237ee6 100644 --- a/src/frontend/manage/startpage.eta.html +++ b/src/frontend/manage/startpage.eta.html @@ -1,7 +1,7 @@ <%~ E.includeFile("../partials/head.eta.html", {"title": "Settings"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT"}) %>

Manage your AssetFlow instance

- +
@@ -30,5 +30,16 @@
- + <%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %> diff --git a/src/index.ts b/src/index.ts index b86bf37..ba664cd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -67,9 +67,16 @@ Sentry.init({ environment: config.global.debug ? 'development' : 'production' }); +app.locals.versionRevLong = require('child_process') +.execSync('git rev-parse HEAD') +.toString().trim() app.locals.versionRev = require('child_process') .execSync('git rev-parse --short HEAD') .toString().trim() +app.locals.versionRevLatest = require('child_process') +.execSync('git ls-remote --refs -q') +.toString().trim().split("\t")[0] +log.core.info(`Running revision ${app.locals.versionRevLong} (${app.locals.versionRevLatest} latest)`); // RequestHandler creates a separate execution context using domains, so that every // transaction/span/breadcrumb is attached to its own Hub instance diff --git a/src/routes/api/v1/version.ts b/src/routes/api/v1/version.ts index 52b285b..49c938e 100644 --- a/src/routes/api/v1/version.ts +++ b/src/routes/api/v1/version.ts @@ -2,7 +2,12 @@ import express, { Request, Response } from 'express'; function get(req: Request, res: Response) { const revision = req.app.locals.versionRev; - res.status(200).send({ version: '1.0.0', commit: revision }); + let updateAvailable = false; + if(req.app.locals.versionRevLong !== req.app.locals.versionRevLatest) { + updateAvailable = true; + } + + res.status(200).send({ version: '1.0.0', commit: revision, updateAvailable: updateAvailable }); }; export default { get };