pull/4936/merge
Gauthier Dandele 2025-04-14 10:33:45 -04:00 committed by GitHub
commit 64e6b25e84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 1 deletions

View File

@ -647,7 +647,12 @@ RED.palette.editor = (function() {
updateAllowList = RED.utils.parseModuleList(updateAllowList);
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();
@ -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() {
initInstallTab();
editorTabs.activateTab('nodes');

View File

@ -416,6 +416,11 @@ module.exports = {
* If not set, the following default order is used:
*/
//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: {