[Libreoffice-commits] online.git: 2 commits - capabilities.json debian/control wsd/LOOLWSD.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 30 12:36:24 UTC 2018


 capabilities.json |    5 -----
 debian/control    |    2 +-
 wsd/LOOLWSD.cpp   |   28 +++++++---------------------
 3 files changed, 8 insertions(+), 27 deletions(-)

New commits:
commit 321efe3eaa32c447ac26ff30bd79c801d6c848c7
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Fri Nov 30 13:35:59 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Nov 30 13:35:59 2018 +0100

    Depend on nodejs instead, Debian 9 does not have npm package, and node-jake is very old
    
    Change-Id: Ia7ceed8dd38849575a63e96c6296c70e31509eec

diff --git a/debian/control b/debian/control
index 6966d9ed2..c5497b564 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: loolwsd
 Section: web
 Priority: optional
 Maintainer: Andras Timar <andras.timar at collabora.com>
-Build-Depends: debhelper (>= 9), dh-systemd (>= 1.3), libcap-dev, libcap2-bin, libpcre3-dev, libpng-dev, libpoco-dev (>= 1.7.5), linux-libc-dev, node-jake, npm, python-polib, python-lxml, fontconfig, libpam-dev, libcppunit-dev, pkg-config, devscripts
+Build-Depends: debhelper (>= 9), dh-systemd (>= 1.3), libcap-dev, libcap2-bin, libpcre3-dev, libpng-dev, libpoco-dev (>= 1.7.5), linux-libc-dev, nodejs, python-polib, python-lxml, fontconfig, libpam-dev, libcppunit-dev, pkg-config, devscripts
 Standards-Version: 3.9.7
 
 Package: loolwsd
commit 9168040a4dc133e3688ed31bc02a74f9459b5087
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Nov 29 19:15:58 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Nov 30 13:34:46 2018 +0100

    capabilities: Don't rely on existence of the file, compose it completely.
    
    Change-Id: I41588afa9f26b4a2575ee8cf7d9837cc79b31b3e

diff --git a/capabilities.json b/capabilities.json
deleted file mode 100644
index 32ed3801f..000000000
--- a/capabilities.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "convert-to": {
-    "available": false
-  }
-}
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index c91791d15..446db4e4b 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2769,31 +2769,17 @@ private:
     {
         std::shared_ptr<StreamSocket> socket = _socket.lock();
 
-        // http://server/hosting/capabilities
-#if defined __linux && defined MOBILEAPP
-        std::string capabilitiesPath = Path(Application::instance().commandPath()).parent().parent().toString() + "capabilities.json";
-#else
-        std::string capabilitiesPath = Path(Application::instance().commandPath()).parent().toString() + "capabilities.json";
-#endif
-        if (!File(capabilitiesPath).exists())
-        {
-            capabilitiesPath = LOOLWSD::FileServerRoot + "/capabilities.json";
-        }
-        std::ifstream ifs (capabilitiesPath.c_str(), std::ifstream::in);
-
-        if(!ifs.is_open())
-            return "";
-
-        Poco::JSON::Parser parser;
-        Poco::Dynamic::Var jsonFile = parser.parse(ifs);
-        Poco::JSON::Object::Ptr features = jsonFile.extract<Poco::JSON::Object::Ptr>();
-        Poco::JSON::Object::Ptr convert_to = features->get("convert-to").extract<Poco::JSON::Object::Ptr>();
-
+        // Can the convert-to be used?
+        Poco::JSON::Object::Ptr convert_to = new Poco::JSON::Object;
         Poco::Dynamic::Var available = allowConvertTo(socket->clientAddress(), request);
         convert_to->set("available", available);
 
+        // Compose the content of http://server/hosting/capabilities
+        Poco::JSON::Object::Ptr capabilities = new Poco::JSON::Object;
+        capabilities->set("convert-to", convert_to);
+
         std::ostringstream ostrJSON;
-        features->stringify(ostrJSON);
+        capabilities->stringify(ostrJSON);
         return ostrJSON.str();
     }
 


More information about the Libreoffice-commits mailing list