From 78a2cbcfb3dc798e1504ede9cfd3cbd97fd4b9d3 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Fri, 30 Aug 2024 15:04:39 -0400 Subject: [PATCH] Fix bug where filtering of old angular plugins occurred in wrong section Signed-off-by: 1000TurquoisePogs --- base/src/plugin-manager/plugin-manager.ts | 54 ++++++++++++----------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/base/src/plugin-manager/plugin-manager.ts b/base/src/plugin-manager/plugin-manager.ts index ef7df99..7948c68 100644 --- a/base/src/plugin-manager/plugin-manager.ts +++ b/base/src/plugin-manager/plugin-manager.ts @@ -36,8 +36,33 @@ export class PluginManager { } }); - /* Remove skipped plugins */ - return plugins.filter(x => x) as Plugin[]; + /* Remove skipped plugins and apps not valid for this version*/ + let filtered = plugins.filter(x => x) as Plugin[]; + const searchParams = new URLSearchParams(window.location.search); + const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true'); + return filtered.filter((plugin) => { + if (plugin.type != 'application') { + return true; + } else { + const webContent = plugin.webContent; + if (!webContent) { + return true; + } else if ((webContent.framework != 'angular') && (webContent.framework != 'angular2')) { + return true; + } else { + //exclude apps incompatible with the given desktop environment, depending upon their entryPoint content. + if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint['2.0'])) { + return true; + } else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint['3.0']) { + return true; + } else { + this.pluginsById.delete(plugin.identifier); + return false; + } + } + } + }); + } else { throw new Error("ZWED5037E - Unable to parse plugin definitions: Missing field 'pluginDefinitions'"); } @@ -62,30 +87,7 @@ export class PluginManager { case 304: try { var result = JSON.parse(this.responseText); - let allPlugins = PluginManager.parsePluginDefinitions(result); - const searchParams = new URLSearchParams(window.location.search); - const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true'); - let validPlugins = allPlugins.filter((plugin) => { - if (plugin.type != 'application') { - return true; - } else { - const webContent = plugin.getWebContent(); - if (!webContent) { - return true; - } else if ((webContent.framework != 'angular') && (webContent.framework != 'angular2')) { - return true; - } else { - //exclude apps incompatible with the given desktop environment, depending upon their entryPoint content. - if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint['2.0'])) { - return true; - } else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint['3.0']) { - return true; - } else { - return false; - } - } - } - }); + let validPlugins = PluginManager.parsePluginDefinitions(result); if (!pluginType) { resolve(validPlugins); } else {