mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add periodic update check
This commit is contained in:
parent
83acc4836b
commit
9169ca54da
@ -583,6 +583,8 @@ RED.palette.editor = (function() {
|
|||||||
var updateAllowList = ['*'];
|
var updateAllowList = ['*'];
|
||||||
var updateDenyList = [];
|
var updateDenyList = [];
|
||||||
|
|
||||||
|
var settingsPane;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json']
|
catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json']
|
||||||
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
||||||
@ -607,6 +609,10 @@ RED.palette.editor = (function() {
|
|||||||
updateDenyList = RED.utils.parseModuleList(updateDenyList);
|
updateDenyList = RED.utils.parseModuleList(updateDenyList);
|
||||||
updateAllowed = RED.settings.get("externalModules.palette.allowUpdate",true);
|
updateAllowed = RED.settings.get("externalModules.palette.allowUpdate",true);
|
||||||
|
|
||||||
|
if (RED.settings.get("editorTheme.palette.checkForUpdates", true) === true) {
|
||||||
|
// Enable checking for updates triggered every 30 minutes
|
||||||
|
initCheckForUpdatesInterval();
|
||||||
|
}
|
||||||
|
|
||||||
createSettingsPane();
|
createSettingsPane();
|
||||||
|
|
||||||
@ -727,7 +733,34 @@ RED.palette.editor = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var settingsPane;
|
/**
|
||||||
|
* Initializes the check for updates triggered every 30 minutes.
|
||||||
|
* This interval is based on the cumulative active window time.
|
||||||
|
*/
|
||||||
|
function initCheckForUpdatesInterval() {
|
||||||
|
let activeTime = 0, lastActiveTime = Date.now();
|
||||||
|
const INTERVAL = 30 * 60; // 30min
|
||||||
|
|
||||||
|
document.addEventListener("visibilitychange", function () {
|
||||||
|
if (document.visibilityState === "visible") {
|
||||||
|
lastActiveTime = Date.now();
|
||||||
|
} else {
|
||||||
|
activeTime += (Date.now() - lastActiveTime) / 1000;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setInterval(function () {
|
||||||
|
if (document.visibilityState === "visible") {
|
||||||
|
activeTime += (Date.now() - lastActiveTime) / 1000;
|
||||||
|
lastActiveTime = Date.now();
|
||||||
|
|
||||||
|
if (activeTime >= INTERVAL) {
|
||||||
|
activeTime = 0;
|
||||||
|
getSettingsPane();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1000 * 60); // refresh every minute
|
||||||
|
}
|
||||||
|
|
||||||
function getSettingsPane() {
|
function getSettingsPane() {
|
||||||
initInstallTab();
|
initInstallTab();
|
||||||
|
5
packages/node_modules/node-red/settings.js
vendored
5
packages/node_modules/node-red/settings.js
vendored
@ -416,6 +416,11 @@ module.exports = {
|
|||||||
* If not set, the following default order is used:
|
* If not set, the following default order is used:
|
||||||
*/
|
*/
|
||||||
//categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
|
//categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To enable checking for updates every 30min when the editor is open and active.
|
||||||
|
*/
|
||||||
|
checkForUpdates: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
projects: {
|
projects: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user