[Libreoffice-commits] online.git: Branch 'libreoffice-6-2' - capabilities.json wsd/LOOLWSD.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 30 12:44:36 UTC 2018
capabilities.json | 5 -----
wsd/LOOLWSD.cpp | 28 +++++++---------------------
2 files changed, 7 insertions(+), 26 deletions(-)
New commits:
commit 70bdae1aca6491df018e065916bbbcd2a42a4ef5
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:44:18 2018 +0100
capabilities: Don't rely on existence of the file, compose it completely.
Change-Id: I41588afa9f26b4a2575ee8cf7d9837cc79b31b3e
Reviewed-on: https://gerrit.libreoffice.org/64301
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
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 438004b7f..34d3ff16a 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2761,31 +2761,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