[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/FileServer.hpp loolwsd/LOOLWSD.cpp loolwsd/loolwsd.xml.in

Andras Timar andras.timar at collabora.com
Wed May 11 14:49:32 UTC 2016


 loolwsd/FileServer.hpp |    4 +++-
 loolwsd/LOOLWSD.cpp    |    4 +++-
 loolwsd/loolwsd.xml.in |    2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 51890c97426a29e65cc56ec602bdb157ade067dd
Author: Andras Timar <andras.timar at collabora.com>
Date:   Wed May 11 16:30:05 2016 +0200

    loolwsd: enable UI customization by replacing loleaflet.html from config
    
    (cherry picked from commit 2fbcbdfa87bbefc18b0bac87988a1edc73df0cbf)

diff --git a/loolwsd/FileServer.hpp b/loolwsd/FileServer.hpp
index 6c64cd2..da09978 100644
--- a/loolwsd/FileServer.hpp
+++ b/loolwsd/FileServer.hpp
@@ -125,8 +125,10 @@ public:
                 throw Poco::FileNotFoundException("Invalid URI request: [" + requestUri.toString() + "].");
             }
 
+            const auto& config = Application::instance().config();
+            const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html");
             const std::string endPoint = requestSegments[requestSegments.size() - 1];
-            if (endPoint == "loleaflet.html")
+            if (endPoint == loleafletHtml)
             {
                 preprocessFile(request, response);
                 return;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 3151430..6a726de 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -740,9 +740,11 @@ private:
         const std::string mediaType = "text/xml";
         const std::string action = "action";
         const std::string urlsrc = "urlsrc";
+        const auto& config = Application::instance().config();
+        const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html");
         const std::string uriValue = (LOOLWSD::SSLEnabled ? "https://" : "http://") +
             (LOOLWSD::ServerName.empty() ? request.getHost() : LOOLWSD::ServerName) +
-            "/loleaflet/" LOOLWSD_VERSION_HASH "/loleaflet.html?";
+            "/loleaflet/" LOOLWSD_VERSION_HASH "/" + loleafletHtml + "?";
 
         InputSource inputSrc(discoveryPath);
         DOMParser parser;
diff --git a/loolwsd/loolwsd.xml.in b/loolwsd/loolwsd.xml.in
index 6bf4ce1..cb524a8 100644
--- a/loolwsd/loolwsd.xml.in
+++ b/loolwsd/loolwsd.xml.in
@@ -11,6 +11,8 @@
 
     <num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="1">1</num_prespawn_children>
 
+    <loleaflet_html desc="Allows UI customization by replacing the single endpoint of loleaflet.html" type="string" default="loleaflet.html">loleaflet.html</loleaflet_html>
+
     <!-- FIXME: logging cannot be set from here. Use LOOL_LOGLEVEL environment variable. LOOL_LOGLEVEL can be 0-8, or
          none (turns off logging), fatal, critical, error, warning, notice, information, debug, trace -->
     <logging>


More information about the Libreoffice-commits mailing list