You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/server/tasks/simple/check-version.mjs

21 lines
680 B

export async function task (payload) {
WIKI.logger.info('Checking for latest version...')
try {
const resp = await fetch('https://api.github.com/repos/requarks/wiki/releases/latest').then(r => r.json())
WIKI.logger.info(`Latest version is ${resp.tag_name}.`)
await WIKI.db.knex('settings').where('key', 'update').update({
value: {
lastCheckedAt: (new Date).toISOString(),
version: resp.tag_name,
versionDate: resp.published_at
}
})
WIKI.logger.info('Checked for latest version: [ COMPLETED ]')
} catch (err) {
WIKI.logger.error('Checking for latest version: [ FAILED ]')
WIKI.logger.error(err.message)
}
}