You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by se...@apache.org on 2021/10/18 21:02:48 UTC
[openmeetings] branch
feature/OPENMEETINGS-2692-update-webapp-path-for-manifest-references
updated: OPENMEETINGS-2692 Update review comments on parsing path element.
This is an automated email from the ASF dual-hosted git repository.
sebawagner pushed a commit to branch feature/OPENMEETINGS-2692-update-webapp-path-for-manifest-references
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/feature/OPENMEETINGS-2692-update-webapp-path-for-manifest-references by this push:
new d1259e6 OPENMEETINGS-2692 Update review comments on parsing path element.
d1259e6 is described below
commit d1259e697fc8545d3f6e4f3400ab57d8a5fcc6cb
Author: Sebastian Wagner <se...@gmail.com>
AuthorDate: Tue Oct 19 10:02:33 2021 +1300
OPENMEETINGS-2692 Update review comments on parsing path element.
---
.../apache/openmeetings/util/OpenmeetingsVariables.java | 16 ++++++++++++----
.../apache/openmeetings/webservice/InfoWebService.java | 4 ++--
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java b/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
index cad96b9..b8ba523 100644
--- a/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
+++ b/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
@@ -21,9 +21,16 @@ package org.apache.openmeetings.util;
import static org.apache.wicket.csp.CSPDirectiveSrcValue.SELF;
import static org.apache.wicket.csp.CSPDirectiveSrcValue.STRICT_DYNAMIC;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.github.openjson.JSONObject;
public class OpenmeetingsVariables {
+ private static final Logger log = LoggerFactory.getLogger(OpenmeetingsVariables.class);
public static final String ATTR_CLASS = "class";
public static final String ATTR_TITLE = "title";
public static final String ATTR_DISABLED = "disabled";
@@ -249,11 +256,12 @@ public class OpenmeetingsVariables {
}
public static String getWebappPath() {
- String webappPath = baseUrl;
- if (webappPath.endsWith("/")) {
- webappPath = webappPath.substring(0, webappPath.length() - 1);
+ try {
+ return new URI(baseUrl).getPath();
+ } catch (URISyntaxException e) {
+ log.error("could not parse baseUrl", e);
}
- return webappPath.substring(webappPath.lastIndexOf("/") + 1);
+ return "";
}
public static void setBaseUrl(String url) {
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java
index 7967e1d..7b9bd42 100644
--- a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/InfoWebService.java
@@ -106,7 +106,7 @@ public class InfoWebService {
manifest.put("name", OpenmeetingsVariables.getApplicationName() + " " + Version.getVersion());
manifest.put("short_name", OpenmeetingsVariables.getApplicationName() + " " + Version.getVersion());
manifest.put("description", "Openmeetings provides video conferencing, instant messaging, white board, collaborative document editing and other groupware tools.");
- manifest.put("start_url", "/" + OpenmeetingsVariables.getWebappPath() + "/?pwa=true");
+ manifest.put("start_url", OpenmeetingsVariables.getWebappPath() + "?pwa=true");
manifest.put("scope", "/");
manifest.put("background_color", "#ffffff");
manifest.put("theme_color", "#ffffff");
@@ -123,7 +123,7 @@ public class InfoWebService {
private JSONObject generateIcon(String name, String dimension, String purpose) {
JSONObject icon = new JSONObject();
- icon.put("src", "/" + OpenmeetingsVariables.getWebappPath() + "/images/icons/" + name);
+ icon.put("src", OpenmeetingsVariables.getWebappPath() + "images/icons/" + name);
icon.put("type", "image/png");
icon.put("sizes", dimension);
icon.put("purpose", purpose);