Compare commits

..

No commits in common. "cdbd4c3c1042ff3acf08b81fdf92cce61b3ce474" and "16da321177a2313b0bf261a113ed703c094ae057" have entirely different histories.

3 changed files with 3 additions and 26 deletions

View File

@ -1,7 +1,7 @@
<%~ E.includeFile("../partials/head.eta.html", {"title": "Settings"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT"}) %> <%~ E.includeFile("../partials/head.eta.html", {"title": "Settings"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT"}) %>
<h1>Manage your AssetFlow instance</h1> <h1>Manage your AssetFlow instance</h1>
<div class="alert alert-success" role="alert" id="updateNotifier">A new version is available. <a href="https://git.project-name-here.de/Project-Name-Here/assetflow/releases" class="alert-link">Click here to update</a></div> <div class="alert alert-success" role="alert">A new version is available. <a href="#" class="alert-link">Click here to update</a></div>
<div class="container text-center"> <div class="container text-center">
<div class="row"> <div class="row">
<a class="card col m-2" href="/manage/categories"> <a class="card col m-2" href="/manage/categories">
@ -30,16 +30,5 @@
</a> </a>
</div> </div>
</div> </div>
<script>
$(document).ready(function () {
$.getJSON("/api/v1/version", function (data) {
if (data.updateAvailable) {
$("#updateNotifier").show();
// $("#updateNotifier").find(".alert-link").attr("href", data.url);
}else {
$("#updateNotifier").hide();
}
});
});
</script>
<%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %> <%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %>

View File

@ -67,16 +67,9 @@ Sentry.init({
environment: config.global.debug ? 'development' : 'production' 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') app.locals.versionRev = require('child_process')
.execSync('git rev-parse --short HEAD') .execSync('git rev-parse --short HEAD')
.toString().trim() .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 // RequestHandler creates a separate execution context using domains, so that every
// transaction/span/breadcrumb is attached to its own Hub instance // transaction/span/breadcrumb is attached to its own Hub instance

View File

@ -2,12 +2,7 @@ import express, { Request, Response } from 'express';
function get(req: Request, res: Response) { function get(req: Request, res: Response) {
const revision = req.app.locals.versionRev; const revision = req.app.locals.versionRev;
let updateAvailable = false; res.status(200).send({ version: '1.0.0', commit: revision });
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 }; export default { get };