[Libreoffice-commits] online.git: loleaflet/dist wsd/FileServer.cpp

Henry Castro hcastro at collabora.com
Thu May 25 21:39:32 UTC 2017


 loleaflet/dist/loleaflet.html |   14 +-------------
 wsd/FileServer.cpp            |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit b9305d17ce5ecea66d5273de4a4bbc65d47a2b45
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu May 25 17:39:04 2017 -0400

    wsd: enable option to remove About dialog elements
    
    Change-Id: I33c351cbc7373255a22f44cb31e53f21a00869bf

diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 0d587090..3a0974ff 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -68,19 +68,7 @@
 
     <div id="toolbar-down"></div>
 
-    <div id="about-dialog" style="display:none; text-align: center;">
-      <h1 id="product-name">LibreOffice Online</h1>
-      <hr/>
-      <h3 id="product-string"></h3>
-      <p>
-        <h3>LOOLWSD</h3>
-        <div id="loolwsd-version"></div>
-      </p>
-      <p>
-        <h3>LOKit</h3>
-        <div id="lokit-version"></div>
-      </p>
-    </div>
+   %ABOUT_DIALOG%
 
     <script>
       window.host = '%HOST%';
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 18a82f5c..ba4aedf8 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -53,6 +53,15 @@ using Poco::Net::HTTPBasicCredentials;
 using Poco::StreamCopier;
 using Poco::Util::Application;
 
+static const std::string ABOUT_DIALOG =
+    "<div id=\"about-dialog\" style=\"display:none; text-align: center;\">"
+    "<h1 id=\"product-name\">LibreOffice Online</h1>"
+    "<hr/>"
+    "<h3 id=\"product-string\"></h3>"
+    "<p><h3>LOOLWSD</h3><div id=\"loolwsd-version\"></div></p>"
+    "<p><h3>LOKit</h3><div id=\"lokit-version\"></div></p>"
+    "</div>";
+
 std::map<std::string, std::pair<std::string, std::string>> FileServerRequestHandler::FileHash;
 
 bool FileServerRequestHandler::isAdminLoggedIn(const HTTPRequest& request,
@@ -484,6 +493,17 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
         }
     }
 
+    if (std::find_if(params.begin(), params.end(),
+        [](const std::pair<std::string, std::string>& query)
+        { return query.first == "disableabout" && !query.second.empty(); }) != params.end())
+    {
+        Poco::replaceInPlace(preprocess, std::string("%ABOUT_DIALOG%"), std::string());
+    }
+    else
+    {
+        Poco::replaceInPlace(preprocess, std::string("%ABOUT_DIALOG%"), ABOUT_DIALOG);
+    }
+
     Poco::replaceInPlace(preprocess, std::string("%ACCESS_TOKEN%"), escapedAccessToken);
     Poco::replaceInPlace(preprocess, std::string("%ACCESS_TOKEN_TTL%"), std::to_string(tokenTtl));
     Poco::replaceInPlace(preprocess, std::string("%HOST%"), host);


More information about the Libreoffice-commits mailing list