Merge pull request #3771 from Erquint/no_updates_for_disabled_ext No updates for disabled extensions, unless you insist.

216c698610d2ca556c323f05e783abab7fbf0e13

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +24 -4Ignore whitespace
public/scripts/extensions.js+24 -4
@@ -794,6 +794,16 @@ async function showExtensionsDetails() {
794794 };
795795
796796 /** @type {import('./popup.js').CustomPopupButton} */
797+ const updateEnabledOnlyButton = {
798+ text: t`Update enabled only`,
799+ action: async () => {
800+ requiresReload = true;
801+ await autoUpdateExtensions(false);
802+ await popup.complete(POPUP_RESULT.AFFIRMATIVE);
803+ },
804+ };
805+
806+ /** @type {import('./popup.js').CustomPopupButton} */
797807 const sortOrderButton = {
798808 text: sortByName ? t`Sort: Display Name` : t`Sort: Loading Order`,
799809 action: async () => {
@@ -809,7 +819,7 @@ async function showExtensionsDetails() {
809819 okButton: t`Close`,
810820 wide: true,
811821 large: true,
812822 customButtons: [sortOrderButton, updateEnabledOnlyButton, updateAllButton],
813823 allowVerticalScrolling: true,
814824 onClosing: async () => {
815825 if (waitingForSave) {
@@ -1196,7 +1206,7 @@ async function checkForUpdatesManual(sortFn, abortSignal) {
11961206}
11971207
11981208/**
11991209 * Checks if there are updates available for enabled 3rd-party extensions.
12001210 * @param {boolean} force Skip nag check
12011211 * @returns {Promise<any>}
12021212 */
@@ -1218,6 +1228,11 @@ async function checkForExtensionUpdates(force) {
12181228 const promises = [];
12191229
12201230 for (const [id, manifest] of Object.entries(manifests)) {
1231+ const isDisabled = extension_settings.disabledExtensions.includes(id);
1232+ if (isDisabled) {
1233+ console.debug(`Skipping extension: ${manifest.display_name} (${id}) for non-admin user`)
1234+ continue;
1235+ }
12211236 const isGlobal = getExtensionType(id) === 'global';
12221237 if (isGlobal && !isCurrentUserAdmin) {
12231238 console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`);
@@ -1247,8 +1262,8 @@ async function checkForExtensionUpdates(force) {
12471262}
12481263
12491264/**
12501265 * Updates all enabled 3rd-party extensions that have auto-update enabled.
12511266 * @param {boolean} forceAll Force update allInclude evendisabled ifand not auto-updating
12521267 * @returns {Promise<void>}
12531268 */
12541269async function autoUpdateExtensions(forceAll) {
@@ -1260,6 +1275,11 @@ async function autoUpdateExtensions(forceAll) {
12601275 const isCurrentUserAdmin = isAdmin();
12611276 const promises = [];
12621277 for (const [id, manifest] of Object.entries(manifests)) {
1278+ const isDisabled = extension_settings.disabledExtensions.includes(id);
1279+ if (!forceAll && isDisabled) {
1280+ console.debug(`Skipping extension: ${manifest.display_name} (${id}) for non-admin user`)
1281+ continue;
1282+ }
12631283 const isGlobal = getExtensionType(id) === 'global';
12641284 if (isGlobal && !isCurrentUserAdmin) {
12651285 console.debug(`Skipping global extension: ${manifest.display_name} (${id}) for non-admin user`);