Add config value for extensions auto-update
This commit is contained in:
parent
0f5179ed2d
commit
60c22bf803
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue