Fix displaying Keyoxide version number

This commit is contained in:
Yarmo Mackenbach 2020-08-15 01:25:00 +02:00
parent 1f9b8c26a2
commit 899bcdd53f
3 changed files with 5 additions and 3 deletions

View file

@ -35,6 +35,8 @@ const env = {};
const { stringReplace } = require('string-replace-middleware'); const { stringReplace } = require('string-replace-middleware');
require('dotenv').config(); require('dotenv').config();
let packageData = JSON.parse(fs.readFileSync('package.json'));
md.use(require("markdown-it-anchor")); md.use(require("markdown-it-anchor"));
md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" }); md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" });
md.use(require('markdown-it-title')); md.use(require('markdown-it-title'));
@ -43,6 +45,7 @@ app.set('env', process.env.NODE_ENV || "production");
app.set('view engine', 'pug'); app.set('view engine', 'pug');
app.set('port', process.env.PORT || 3000); app.set('port', process.env.PORT || 3000);
app.set('domain', process.env.DOMAIN || "keyoxide.org"); app.set('domain', process.env.DOMAIN || "keyoxide.org");
app.set('keyoxide_version', packageData.version);
app.use('/favicon.svg', express.static('favicon.svg')); app.use('/favicon.svg', express.static('favicon.svg'));
@ -52,7 +55,6 @@ app.use(stringReplace({
contentTypeFilterRegexp: /application\/javascript/, contentTypeFilterRegexp: /application\/javascript/,
})); }));
app.locals.env = process.env;
app.use('/', require('./routes/main')); app.use('/', require('./routes/main'));
app.use('/static', require('./routes/static')); app.use('/static', require('./routes/static'));
app.use('/server', require('./routes/server')); app.use('/server', require('./routes/server'));

View file

@ -20,7 +20,7 @@ main.container.container--profile
| Generated by | Generated by
a(href='/') Keyoxide a(href='/') Keyoxide
| ( | (
a(href="https://codeberg.org/keyoxide/web/releases")= env.npm_package_version a(href="https://codeberg.org/keyoxide/web/releases")= settings.keyoxide_version
| ). | ).
script(src='/static/openpgp.min.js') script(src='/static/openpgp.min.js')

View file

@ -22,7 +22,7 @@ main.container
footer footer
p p
| Keyoxide | Keyoxide
a(href="https://codeberg.org/keyoxide/web/releases")= env.npm_package_version a(href="https://codeberg.org/keyoxide/web/releases")= settings.keyoxide_version
p p
a(href='https://codeberg.org/keyoxide') Source code a(href='https://codeberg.org/keyoxide') Source code
| - | -