whistle
Version:
HTTP, HTTP2, HTTPS, Websocket debugging proxy
24 lines (20 loc) • 884 B
JavaScript
var properties = require('../../../lib/rules/util').properties;
var config = require('../../../lib/config');
var common = require('../../../lib/util/common');
module.exports = function(req, res) {
var version = config.version;
var doNotShowAgainVersion = properties.get('doNotShowAgainVersion');
var latestVersion = properties.getLatestVersion('latestVersion');
var latestClientVersion = properties.getLatestVersion('latestClientVersion');
var hasNewVersion = common.compareVersion(latestVersion, version);
res.json({
ec: 0,
em: 'success',
showUpdate: !config.disableUpdateTips && hasNewVersion > 1 && common.compareVersion(latestVersion, doNotShowAgainVersion) > 1,
hasNewVersion: hasNewVersion > 0,
hasUpdater: config.hasUpdater,
version: config.version,
latestVersion: latestVersion,
latestClientVersion: latestClientVersion
});
};