From 02c1bf7d81c5216b8f80498fa4d60df4e3653845 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 21 Jan 2021 21:06:52 +0000 Subject: [PATCH] lint: src/node/utils/UpdateCheck.js --- src/node/utils/UpdateCheck.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/node/utils/UpdateCheck.js b/src/node/utils/UpdateCheck.js index 8332ff204..cfbd9dad9 100644 --- a/src/node/utils/UpdateCheck.js +++ b/src/node/utils/UpdateCheck.js @@ -1,30 +1,29 @@ +'use strict'; const semver = require('semver'); const settings = require('./Settings'); const request = require('request'); let infos; -function loadEtherpadInformations() { - return new Promise((resolve, reject) => { - request('https://static.etherpad.org/info.json', (er, response, body) => { - if (er) return reject(er); +const loadEtherpadInformations = () => new Promise((resolve, reject) => { + request('https://static.etherpad.org/info.json', (er, response, body) => { + if (er) return reject(er); - try { - infos = JSON.parse(body); - return resolve(infos); - } catch (err) { - return reject(err); - } - }); + try { + infos = JSON.parse(body); + return resolve(infos); + } catch (err) { + return reject(err); + } }); -} +}); -exports.getLatestVersion = function () { +exports.getLatestVersion = () => { exports.needsUpdate(); return infos.latestVersion; }; -exports.needsUpdate = function (cb) { +exports.needsUpdate = (cb) => { loadEtherpadInformations().then((info) => { if (semver.gt(info.latestVersion, settings.getEpVersion())) { if (cb) return cb(true); @@ -35,7 +34,7 @@ exports.needsUpdate = function (cb) { }); }; -exports.check = function () { +exports.check = () => { exports.needsUpdate((needsUpdate) => { if (needsUpdate) { console.warn(`Update available: Download the actual version ${infos.latestVersion}`);