summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-07-30 15:26:05 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-09-29 09:52:21 +0200
commit8a661a1d3859d58e8a5aebda540e37dd05258528 (patch)
tree8cc78de812e019e12eded57867a9fb629323bfd8
parentccfc81dc020560c7d5287c098b85834003e8b89c (diff)
Add favIconUrl to apps in discovery
Change-Id: If164b0c0b302eb8980f51cf4622377e96ba6d5f9 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99796 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--discovery.xml6
-rw-r--r--wsd/LOOLWSD.cpp16
2 files changed, 18 insertions, 4 deletions
diff --git a/discovery.xml b/discovery.xml
index 22b284621..7612b23a9 100644
--- a/discovery.xml
+++ b/discovery.xml
@@ -3,7 +3,7 @@
<net-zone name="external-http">
<!-- Writer documents -->
- <app name="writer">
+ <app name="writer" favIconUrl="images/x-office-document.svg">
<action name="view" default="true" ext="sxw"/>
<action name="edit" default="true" ext="odt"/>
<action name="edit" default="true" ext="fodt"/>
@@ -48,7 +48,7 @@
</app>
<!-- Calc documents -->
- <app name="calc">
+ <app name="calc" favIconUrl="images/x-office-spreadsheet.svg">
<action name="view" default="true" ext="sxc"/>
<action name="edit" default="true" ext="ods"/>
<action name="edit" default="true" ext="fods"/>
@@ -75,7 +75,7 @@
</app>
<!-- Impress documents -->
- <app name="impress">
+ <app name="impress" favIconUrl="images/x-office-presentation.svg">
<action name="view" default="true" ext="sxi"/>
<action name="edit" default="true" ext="odp"/>
<action name="edit" default="true" ext="fodp"/>
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 9d89727ae..a845932fa 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3471,10 +3471,12 @@ private:
const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html");
const std::string action = "action";
+ const std::string favIconUrl = "favIconUrl";
const std::string urlsrc = "urlsrc";
const std::string rootUriValue = "%SRV_URI%";
- const std::string uriValue = rootUriValue + "/loleaflet/" LOOLWSD_VERSION_HASH "/" + loleafletHtml + '?';
+ const std::string uriBaseValue = rootUriValue + "/loleaflet/" LOOLWSD_VERSION_HASH "/";
+ const std::string uriValue = uriBaseValue + loleafletHtml + '?';
InputSource inputSrc(discoveryPath);
DOMParser parser;
@@ -3503,6 +3505,18 @@ private:
}
}
+ // turn "images/img.svg" into "http://server.tld/loleaflet/12345abcd/images/img.svg"
+ listNodes = docXML->getElementsByTagName("app");
+ for (unsigned long it = 0; it < listNodes->length(); ++it)
+ {
+ Element* elem = static_cast<Element*>(listNodes->item(it));
+
+ if (elem->hasAttribute(favIconUrl))
+ {
+ elem->setAttribute(favIconUrl, uriBaseValue + elem->getAttribute(favIconUrl));
+ }
+ }
+
const auto& proofAttribs = GetProofKeyAttributes();
if (!proofAttribs.empty())
{