biz/webui/cgi-bin/init.js
changed.
biz/webui/cgi-bin/util.js
changed.
biz/webui/cgi-bin/check-update.js
changed.
lib/rules/util.js
changed.
30 | 30 | mrulesTime: config.mrulesTime, |
|
31 | 31 | mvaluesClientId: config.mvaluesClientId, |
|
32 | 32 | mvaluesTime: config.mvaluesTime, |
|
33 | - | latestVersion: properties.get('latestVersion'), |
|
33 | + | latestVersion: properties.getLatestVersion('latestVersion'), |
|
34 | 34 | server: util.getServerInfo(req), |
|
35 | 35 | uploadFiles: getUploadFiles(), |
|
36 | 36 | rules: getRules(), |
30 | 30 | baseDir: config.baseDirHash, |
|
31 | 31 | username: config.username, |
|
32 | 32 | nodeVersion: process.version, |
|
33 | - | latestVersion: properties.get('latestVersion'), |
|
33 | + | latestVersion: properties.getLatestVersion('latestVersion'), |
|
34 | 34 | host: util.hostname(), |
|
35 | 35 | isWin: util.isWin, |
|
36 | 36 | port: config.port, |
27 | 27 | module.exports = function(req, res) { |
|
28 | 28 | var version = config.version; |
|
29 | 29 | var doNotShowAgainVersion = properties.get('doNotShowAgainVersion'); |
|
30 | - | var latestVersion = properties.get('latestVersion'); |
|
30 | + | var latestVersion = properties.getLatestVersion('latestVersion'); |
|
31 | 31 | ||
32 | 32 | res.json({ |
|
33 | 33 | ec: 0, |
1 | 1 | var properties = require('../../../lib/rules/util').properties; |
|
2 | 2 | ||
3 | 3 | module.exports = function(req, res) { |
|
4 | - | properties.set('doNotShowAgainVersion', properties.get('latestVersion')); |
|
4 | + | properties.set('doNotShowAgainVersion', properties.getLatestVersion('latestVersion')); |
|
5 | 5 | res.json({ec: 0, em: 'success'}); |
|
6 | 6 | }; |
|
7 | 7 |
493 | 493 | ||
494 | 494 | setTimeout(function getWhistleVersion() { |
|
495 | 495 | util.getLatestVersion(config.registry, function(ver) { |
|
496 | - | ver && propertiesStorage.setProperty('latestVersion', ver); |
|
496 | + | ver && propertiesStorage.writeFile('latestVersion', ver); |
|
497 | 497 | setTimeout(getWhistleVersion, INTERVAL); |
|
498 | 498 | }); |
|
499 | 499 | }, 1000); //等待package的信息配置更新完成 |
510 | 510 | } |
|
511 | 511 | ||
512 | 512 | exports.properties = { |
|
513 | + | getLatestVersion: function() { |
|
514 | + | var version = propertiesStorage.readFile('latestVersion'); |
|
515 | + | return typeof version === 'string' && version.length < 60 ? version : ''; |
|
516 | + | }, |
|
513 | 517 | isEnableCapture: function() { |
|
514 | 518 | if (config.multiEnv) { |
|
515 | 519 | return false; |