mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge fc666fe13dcda17f3eaf718f6b3c8f1b2e529eac into bb01f26f068b8e083e35fdf19dc9b36f8cf67068
This commit is contained in:
commit
a92cd0c141
@ -647,7 +647,12 @@ RED.palette.editor = (function() {
|
|||||||
updateAllowList = RED.utils.parseModuleList(updateAllowList);
|
updateAllowList = RED.utils.parseModuleList(updateAllowList);
|
||||||
updateDenyList = RED.utils.parseModuleList(updateDenyList);
|
updateDenyList = RED.utils.parseModuleList(updateDenyList);
|
||||||
|
|
||||||
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("editorTheme.palette.checkForUpdates", false) === true) {
|
||||||
|
// Enable checking for updates triggered every 30 minutes
|
||||||
|
initCheckForUpdatesInterval();
|
||||||
|
}
|
||||||
|
|
||||||
createSettingsPane();
|
createSettingsPane();
|
||||||
|
|
||||||
@ -777,6 +782,35 @@ RED.palette.editor = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
refreshCatalogues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1000 * 60); // refresh every minute
|
||||||
|
}
|
||||||
|
|
||||||
function getSettingsPane() {
|
function getSettingsPane() {
|
||||||
initInstallTab();
|
initInstallTab();
|
||||||
editorTabs.activateTab('nodes');
|
editorTabs.activateTab('nodes');
|
||||||
|
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