diff --git a/default/config.yaml b/default/config.yaml index 0ff6d101f..2d760b39f 100644 --- a/default/config.yaml +++ b/default/config.yaml @@ -90,9 +90,11 @@ whitelistImportDomains: ## headers: ## User-Agent: "Googlebot/2.1 (+http://www.google.com/bot.html)" requestOverrides: [] -# -- PLUGIN CONFIGURATION -- +# -- EXTENSIONS CONFIGURATION -- # Enable UI extensions enableExtensions: true +# Automatically update extensions when a release version changes +enableExtensionsAutoUpdate: true # Extension settings extras: # Disables automatic model download from HuggingFace diff --git a/public/script.js b/public/script.js index 15f719857..b3e15111f 100644 --- a/public/script.js +++ b/public/script.js @@ -416,6 +416,7 @@ export const event_types = { GENERATION_STOPPED: 'generation_stopped', GENERATION_ENDED: 'generation_ended', EXTENSIONS_FIRST_LOAD: 'extensions_first_load', + EXTENSION_SETTINGS_LOADED: 'extension_settings_loaded', SETTINGS_LOADED: 'settings_loaded', SETTINGS_UPDATED: 'settings_updated', GROUP_UPDATED: 'group_updated', @@ -6517,9 +6518,10 @@ export async function getSettings() { selected_button = settings.selected_button; if (data.enable_extensions) { + const enableAutoUpdate = Boolean(data.enable_extensions_auto_update); const isVersionChanged = settings.currentVersion !== currentVersion; - await loadExtensionSettings(settings, isVersionChanged); - eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED); + await loadExtensionSettings(settings, isVersionChanged, enableAutoUpdate); + await eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED); } firstRun = !!settings.firstRun; diff --git a/public/scripts/extensions.js b/public/scripts/extensions.js index 8abf64bc3..ac300984b 100644 --- a/public/scripts/extensions.js +++ b/public/scripts/extensions.js @@ -822,16 +822,17 @@ export async function installExtension(url) { const response = await request.json(); toastr.success(`Extension "${response.display_name}" by ${response.author} (version ${response.version}) has been installed successfully!`, 'Extension installation successful'); console.debug(`Extension "${response.display_name}" has been installed successfully at ${response.extensionPath}`); - await loadExtensionSettings({}, false); - eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED); + await loadExtensionSettings({}, false, false); + await eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED); } /** * Loads extension settings from the app settings. * @param {object} settings App Settings * @param {boolean} versionChanged Is this a version change? + * @param {boolean} enableAutoUpdate Enable auto-update */ -async function loadExtensionSettings(settings, versionChanged) { +async function loadExtensionSettings(settings, versionChanged, enableAutoUpdate) { if (settings.extension_settings) { Object.assign(extension_settings, settings.extension_settings); } @@ -842,11 +843,11 @@ async function loadExtensionSettings(settings, versionChanged) { $('#extensions_notify_updates').prop('checked', extension_settings.notifyUpdates); // Activate offline extensions - eventSource.emit(event_types.EXTENSIONS_FIRST_LOAD); + await eventSource.emit(event_types.EXTENSIONS_FIRST_LOAD); extensionNames = await discoverExtensions(); manifests = await getManifests(extensionNames); - if (versionChanged) { + if (versionChanged && enableAutoUpdate) { await autoUpdateExtensions(false); } diff --git a/src/endpoints/settings.js b/src/endpoints/settings.js index 24986b6b0..301d2ae79 100644 --- a/src/endpoints/settings.js +++ b/src/endpoints/settings.js @@ -9,6 +9,7 @@ const { jsonParser } = require('../express-common'); const { getAllUserHandles, getUserDirectories } = require('../users'); const ENABLE_EXTENSIONS = getConfigValue('enableExtensions', true); +const ENABLE_EXTENSIONS_AUTO_UPDATE = getConfigValue('enableExtensionsAutoUpdate', true); const ENABLE_ACCOUNTS = getConfigValue('enableUserAccounts', false); // 10 minutes @@ -268,6 +269,7 @@ router.post('/get', jsonParser, (request, response) => { instruct, context, enable_extensions: ENABLE_EXTENSIONS, + enable_extensions_auto_update: ENABLE_EXTENSIONS_AUTO_UPDATE, enable_accounts: ENABLE_ACCOUNTS, }); });