feat: check for updates

This commit is contained in:
Nicolas Giard
2019-01-13 15:37:45 -05:00
parent 959f2ebde1
commit 63c044a09b
13 changed files with 95 additions and 15 deletions

View File

@@ -75,7 +75,7 @@ module.exports = {
},
async update(obj, args) {
if(_.some(args.pageRules, pr => {
return pr.match !== 'REGEX' || safeRegex(pr.path)
return pr.match === 'REGEX' && !safeRegex(pr.path)
})) {
throw new gql.GraphQLError('Some Page Rules contains unsafe or exponential time regex.')
}

View File

@@ -5,6 +5,7 @@ const os = require('os')
const filesize = require('filesize')
const path = require('path')
const fs = require('fs-extra')
const moment = require('moment')
/* global WIKI */
@@ -62,10 +63,10 @@ module.exports = {
}
},
latestVersion() {
return '2.0.0' // TODO
return WIKI.system.updates.version
},
latestVersionReleaseDate() {
return new Date() // TODO
return moment.utc(WIKI.system.updates.releaseDate)
},
async operatingSystem() {
let osLabel = `${os.type()} (${os.platform()}) ${os.release()} ${os.arch()}`