Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude wrong version of angular plugins by checking entrypoint content #104

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions base/src/plugin-manager/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,31 @@ export class PluginManager {
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") == '1');
let validPlugins = allPlugins.filter((plugin) => {
if (plugin.type != 'application') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be plugin?.type if parsePluginDefinitions(result) method returns an array that has undefined values

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preferably with an error log in case plugin response text could not be parsed (may be done already upstream in PluginManager)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you dont have a plugin type, you'll fail startup.

return true;
} else {
const webContent = plugin.getWebContent();
if (webContent.framework != 'angular') {
return true;
} else {
//exclude apps incompatible with the given desktop environment, depending upon their entryPoint content.
if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint.v2)) {
1000TurquoisePogs marked this conversation as resolved.
Show resolved Hide resolved
return true;
} else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint.v3) {
1000TurquoisePogs marked this conversation as resolved.
Show resolved Hide resolved
return true;
} else {
return false;
}
}
}
});
if (!pluginType) {
resolve(allPlugins);
resolve(validPlugins);
} else {
const filtered = allPlugins.filter(plugin => plugin.getType() == pluginType)
const filtered = validPlugins.filter(plugin => plugin.getType() == pluginType)
resolve(filtered);
}
} catch (error) {
Expand Down
Loading