diff --git a/index.js b/index.js index ba24d49..be647d2 100644 --- a/index.js +++ b/index.js @@ -35,6 +35,8 @@ const env = {}; const { stringReplace } = require('string-replace-middleware'); require('dotenv').config(); +let packageData = JSON.parse(fs.readFileSync('package.json')); + md.use(require("markdown-it-anchor")); md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" }); 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('port', process.env.PORT || 3000); app.set('domain', process.env.DOMAIN || "keyoxide.org"); +app.set('keyoxide_version', packageData.version); app.use('/favicon.svg', express.static('favicon.svg')); @@ -52,7 +55,6 @@ app.use(stringReplace({ contentTypeFilterRegexp: /application\/javascript/, })); -app.locals.env = process.env; app.use('/', require('./routes/main')); app.use('/static', require('./routes/static')); app.use('/server', require('./routes/server')); diff --git a/views/profile.pug b/views/profile.pug index a90a001..3355d1c 100644 --- a/views/profile.pug +++ b/views/profile.pug @@ -20,7 +20,7 @@ main.container.container--profile | Generated by 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') diff --git a/views/template.base.pug b/views/template.base.pug index a7f0866..1f947a3 100644 --- a/views/template.base.pug +++ b/views/template.base.pug @@ -22,7 +22,7 @@ main.container footer p | 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 a(href='https://codeberg.org/keyoxide') Source code | -