mirror of
https://github.com/status-im/codimd.git
synced 2025-02-04 14:33:26 +00:00
Save version info in app locals
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
parent
11265238db
commit
334c81efe7
4
app.js
4
app.js
@ -206,6 +206,10 @@ app.locals.authProviders = {
|
|||||||
email: config.isEmailEnable,
|
email: config.isEmailEnable,
|
||||||
allowEmailRegister: config.allowEmailRegister
|
allowEmailRegister: config.allowEmailRegister
|
||||||
}
|
}
|
||||||
|
app.locals.versionInfo = {
|
||||||
|
latest: true,
|
||||||
|
versionItem: null
|
||||||
|
}
|
||||||
|
|
||||||
// Export/Import menu items
|
// Export/Import menu items
|
||||||
app.locals.enableDropBoxSave = config.isDropboxEnable
|
app.locals.enableDropBoxSave = config.isDropboxEnable
|
||||||
|
@ -8,8 +8,6 @@ const logger = require('../../logger')
|
|||||||
const config = require('../../config')
|
const config = require('../../config')
|
||||||
|
|
||||||
let lastCheckAt
|
let lastCheckAt
|
||||||
let latest = true
|
|
||||||
let versionItem = null
|
|
||||||
|
|
||||||
const VERSION_CHECK_ENDPOINT = 'https://evangelion.codimd.dev/'
|
const VERSION_CHECK_ENDPOINT = 'https://evangelion.codimd.dev/'
|
||||||
const CHECK_TIMEOUT = 1000 * 60 * 60 * 24 // 1 day
|
const CHECK_TIMEOUT = 1000 * 60 * 60 * 24 // 1 day
|
||||||
@ -36,8 +34,8 @@ exports.versionCheckMiddleware = async function (req, res, next) {
|
|||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
latest = data.latest
|
req.app.locals.versionInfo.latest = data.latest
|
||||||
versionItem = latest ? null : data.versionItem
|
req.app.locals.versionInfo.versionItem = req.app.locals.latest ? null : data.versionItem
|
||||||
|
|
||||||
return next()
|
return next()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -47,6 +45,3 @@ exports.versionCheckMiddleware = async function (req, res, next) {
|
|||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.versionItem = versionItem
|
|
||||||
exports.outdated = outdated
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user