feat: check for updates
This commit is contained in:
@@ -52,9 +52,12 @@ module.exports = {
|
||||
appconfig.port = process.env.PORT || 80
|
||||
}
|
||||
|
||||
const packageInfo = require(path.join(WIKI.ROOTPATH, 'package.json'))
|
||||
|
||||
WIKI.config = appconfig
|
||||
WIKI.data = appdata
|
||||
WIKI.version = require(path.join(WIKI.ROOTPATH, 'package.json')).version
|
||||
WIKI.version = packageInfo.version
|
||||
WIKI.releaseDate = packageInfo.releaseDate
|
||||
},
|
||||
|
||||
/**
|
||||
|
@@ -25,12 +25,11 @@ module.exports = {
|
||||
red.on('message', (channel, msg) => {
|
||||
WIKI.events.emit(channel, msg)
|
||||
})
|
||||
red.subscribe('localization', (err, count) => {
|
||||
red.subscribe('localization', 'updates', (err, count) => {
|
||||
if (err) {
|
||||
WIKI.logger.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
WIKI.logger.info('Redis Subscriber connection: [ OK ]')
|
||||
})
|
||||
return red
|
||||
}
|
||||
|
@@ -5,6 +5,25 @@ const Promise = require('bluebird')
|
||||
/* global WIKI */
|
||||
|
||||
module.exports = {
|
||||
updates: {
|
||||
channel: 'BETA',
|
||||
version: WIKI.version,
|
||||
releaseDate: WIKI.releaseDate,
|
||||
minimumVersionRequired: '2.0.0-beta.0',
|
||||
minimumNodeRequired: '10.12.0'
|
||||
},
|
||||
init() {
|
||||
// Listen for updates events
|
||||
WIKI.events.on('updates', (infoRaw) => {
|
||||
try {
|
||||
this.updates = JSON.parse(infoRaw)
|
||||
} catch (err) {
|
||||
WIKI.logger.warn('Failed to parse updates info.')
|
||||
}
|
||||
})
|
||||
|
||||
return this
|
||||
},
|
||||
/**
|
||||
* Upgrade from WIKI.js 1.x - MongoDB database
|
||||
*
|
||||
|
Reference in New Issue
Block a user