No updates for disabled extensions, unless you insist.

This commit is contained in:
Gness Erquint
2025-03-27 17:27:17 +03:00
parent f4eb32c71c
commit 976d4f39e6

View File

@ -793,6 +793,16 @@ async function showExtensionsDetails() {
},
};
/** @type {import('./popup.js').CustomPopupButton} */
const updateEnabledOnlyButton = {
text: t`Update enabled only`,
action: async () => {
requiresReload = true;
await autoUpdateExtensions(false);
await popup.complete(POPUP_RESULT.AFFIRMATIVE);
},
};
/** @type {import('./popup.js').CustomPopupButton} */
const sortOrderButton = {
text: sortByName ? t`Sort: Display Name` : t`Sort: Loading Order`,
@ -809,7 +819,7 @@ async function showExtensionsDetails() {
okButton: t`Close`,
wide: true,
large: true,
customButtons: [sortOrderButton, updateAllButton],
customButtons: [sortOrderButton, updateEnabledOnlyButton, updateAllButton],
allowVerticalScrolling: true,
onClosing: async () => {
if (waitingForSave) {
@ -1196,7 +1206,7 @@ async function checkForUpdatesManual(sortFn, abortSignal) {
}
/**
* Checks if there are updates available for 3rd-party extensions.
* Checks if there are updates available for enabled 3rd-party extensions.
* @param {boolean} force Skip nag check
* @returns {Promise<any>}
*/
@ -1218,6 +1228,11 @@ async function checkForExtensionUpdates(force) {
const promises = [];
for (const [id, manifest] of Object.entries(manifests)) {
const isDisabled = extension_settings.disabledExtensions.includes(id);
if (isDisabled) {
console.debug(`Skipping extension: ${manifest.display_name} (${id}) for non-admin user`)
continue;
}
const isGlobal = getExtensionType(id) === 'global';
if (isGlobal && !isCurrentUserAdmin) {
console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`);
@ -1247,8 +1262,8 @@ async function checkForExtensionUpdates(force) {
}
/**
* Updates all 3rd-party extensions that have auto-update enabled.
* @param {boolean} forceAll Force update all even if not auto-updating
* Updates all enabled 3rd-party extensions that have auto-update enabled.
* @param {boolean} forceAll Include disabled and not auto-updating
* @returns {Promise<void>}
*/
async function autoUpdateExtensions(forceAll) {
@ -1260,6 +1275,11 @@ async function autoUpdateExtensions(forceAll) {
const isCurrentUserAdmin = isAdmin();
const promises = [];
for (const [id, manifest] of Object.entries(manifests)) {
const isDisabled = extension_settings.disabledExtensions.includes(id);
if (!forceAll && isDisabled) {
console.debug(`Skipping extension: ${manifest.display_name} (${id}) for non-admin user`)
continue;
}
const isGlobal = getExtensionType(id) === 'global';
if (isGlobal && !isCurrentUserAdmin) {
console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`);