[Libreoffice-commits] online.git: discovery.xml wsd/LOOLWSD.cpp

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 29 07:52:40 UTC 2020


 discovery.xml   |    6 +++---
 wsd/LOOLWSD.cpp |   16 +++++++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 8a661a1d3859d58e8a5aebda540e37dd05258528
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Jul 30 15:26:05 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Sep 29 09:52:21 2020 +0200

    Add favIconUrl to apps in discovery
    
    Change-Id: If164b0c0b302eb8980f51cf4622377e96ba6d5f9
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99796
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

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())
         {


More information about the Libreoffice-commits mailing list