From 2a9d01b9b92f8ea08847b173674bb7dedba7aa1e Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Fri, 16 Aug 2024 16:15:14 -0400 Subject: [PATCH 1/5] Exclude wrong version of angular plugins by checking entrypoint content Signed-off-by: 1000TurquoisePogs --- base/src/plugin-manager/plugin-manager.ts | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/base/src/plugin-manager/plugin-manager.ts b/base/src/plugin-manager/plugin-manager.ts index 4fd7d70..6766aa4 100644 --- a/base/src/plugin-manager/plugin-manager.ts +++ b/base/src/plugin-manager/plugin-manager.ts @@ -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') { + 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)) { + return true; + } else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint.v3) { + 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) { From 714fc04db897adda35d9b77bd788612cb587b501 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 19 Aug 2024 09:00:22 -0400 Subject: [PATCH 2/5] Implement lookup from PR 308 of zlux-app-server Signed-off-by: 1000TurquoisePogs --- base/src/plugin-manager/plugin.ts | 16 ++++++++++++++++ interface/src/index.d.ts | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/base/src/plugin-manager/plugin.ts b/base/src/plugin-manager/plugin.ts index 9f3174b..b65af8b 100644 --- a/base/src/plugin-manager/plugin.ts +++ b/base/src/plugin-manager/plugin.ts @@ -171,6 +171,22 @@ class Plugin_2 extends Plugin_1 { super(definition); } + getWebEntrypoint():string|undefined { + let entryPoints = this.webContent?.entryPoints; + if (entryPoints) { + const searchParams = new URLSearchParams(window.location.search); + const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == '1'); + if (useV2Desktop || !entryPoints['3.0']) { + return 'main.js'; + } else { + return ''+entryPoints['3.0']; + } + } else if (this.webContent) { + return 'main.js'; + } + return undefined; + } + } diff --git a/interface/src/index.d.ts b/interface/src/index.d.ts index e27bb02..bc60345 100644 --- a/interface/src/index.d.ts +++ b/interface/src/index.d.ts @@ -299,6 +299,10 @@ declare namespace ZLUX { getBasePlugin(): any; } + interface PluginV2 extends Plugin { + getWebEntryPoint():string|undefined; + } + interface ContainerPluginDefinition { getBasePlugin():Plugin; } From 07e44b86967ea616d2173ebaf7f8e3bbbf91a9ee Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Sun, 25 Aug 2024 20:34:24 +0000 Subject: [PATCH 3/5] Update plugin-manager.ts Signed-off-by: 1000TurquoisePogs --- base/src/plugin-manager/plugin-manager.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/src/plugin-manager/plugin-manager.ts b/base/src/plugin-manager/plugin-manager.ts index 6766aa4..a2fc7e6 100644 --- a/base/src/plugin-manager/plugin-manager.ts +++ b/base/src/plugin-manager/plugin-manager.ts @@ -64,7 +64,7 @@ export class PluginManager { 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'); + const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true'); let validPlugins = allPlugins.filter((plugin) => { if (plugin.type != 'application') { return true; @@ -74,9 +74,9 @@ export class PluginManager { return true; } else { //exclude apps incompatible with the given desktop environment, depending upon their entryPoint content. - if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint.v2)) { + if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint['2.0'])) { return true; - } else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint.v3) { + } else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint['3.0']) { return true; } else { return false; From fcd0aa17437230f3209ba3b847e399a3fb8f19f9 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 26 Aug 2024 12:57:03 +0000 Subject: [PATCH 4/5] Update plugin-manager.ts Signed-off-by: 1000TurquoisePogs --- base/src/plugin-manager/plugin-manager.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/src/plugin-manager/plugin-manager.ts b/base/src/plugin-manager/plugin-manager.ts index a2fc7e6..ef7df99 100644 --- a/base/src/plugin-manager/plugin-manager.ts +++ b/base/src/plugin-manager/plugin-manager.ts @@ -70,7 +70,9 @@ export class PluginManager { return true; } else { const webContent = plugin.getWebContent(); - if (webContent.framework != 'angular') { + 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. From 898decf636367996338035d60f5cea63a210c66f Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 28 Aug 2024 02:05:17 +0200 Subject: [PATCH 5/5] Update plugin.ts Signed-off-by: 1000TurquoisePogs --- base/src/plugin-manager/plugin.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/base/src/plugin-manager/plugin.ts b/base/src/plugin-manager/plugin.ts index b65af8b..8ec0a24 100644 --- a/base/src/plugin-manager/plugin.ts +++ b/base/src/plugin-manager/plugin.ts @@ -172,14 +172,14 @@ class Plugin_2 extends Plugin_1 { } getWebEntrypoint():string|undefined { - let entryPoints = this.webContent?.entryPoints; - if (entryPoints) { + let entryPoint = this.webContent?.entryPoint; + if (entryPoint) { const searchParams = new URLSearchParams(window.location.search); - const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == '1'); - if (useV2Desktop || !entryPoints['3.0']) { + const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true'); + if (useV2Desktop || !entryPoint['3.0']) { return 'main.js'; } else { - return ''+entryPoints['3.0']; + return ''+entryPoint['3.0']; } } else if (this.webContent) { return 'main.js';