Skip to content

Commit

Permalink
Fix bug where filtering of old angular plugins occurred in wrong section
Browse files Browse the repository at this point in the history
Signed-off-by: 1000TurquoisePogs <[email protected]>
  • Loading branch information
1000TurquoisePogs committed Aug 30, 2024
1 parent 39fb91f commit 78a2cbc
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions base/src/plugin-manager/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'");
}
Expand All @@ -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 {
Expand Down

0 comments on commit 78a2cbc

Please sign in to comment.