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} */ /** @type {import('./popup.js').CustomPopupButton} */
const sortOrderButton = { const sortOrderButton = {
text: sortByName ? t`Sort: Display Name` : t`Sort: Loading Order`, text: sortByName ? t`Sort: Display Name` : t`Sort: Loading Order`,
@ -809,7 +819,7 @@ async function showExtensionsDetails() {
okButton: t`Close`, okButton: t`Close`,
wide: true, wide: true,
large: true, large: true,
customButtons: [sortOrderButton, updateAllButton], customButtons: [sortOrderButton, updateEnabledOnlyButton, updateAllButton],
allowVerticalScrolling: true, allowVerticalScrolling: true,
onClosing: async () => { onClosing: async () => {
if (waitingForSave) { 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 * @param {boolean} force Skip nag check
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@ -1218,6 +1228,11 @@ async function checkForExtensionUpdates(force) {
const promises = []; const promises = [];
for (const [id, manifest] of Object.entries(manifests)) { 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'; const isGlobal = getExtensionType(id) === 'global';
if (isGlobal && !isCurrentUserAdmin) { if (isGlobal && !isCurrentUserAdmin) {
console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`); 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. * Updates all enabled 3rd-party extensions that have auto-update enabled.
* @param {boolean} forceAll Force update all even if not auto-updating * @param {boolean} forceAll Include disabled and not auto-updating
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async function autoUpdateExtensions(forceAll) { async function autoUpdateExtensions(forceAll) {
@ -1260,6 +1275,11 @@ async function autoUpdateExtensions(forceAll) {
const isCurrentUserAdmin = isAdmin(); const isCurrentUserAdmin = isAdmin();
const promises = []; const promises = [];
for (const [id, manifest] of Object.entries(manifests)) { 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'; const isGlobal = getExtensionType(id) === 'global';
if (isGlobal && !isCurrentUserAdmin) { if (isGlobal && !isCurrentUserAdmin) {
console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`); console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`);