capabilities.json | 5 ----- wsd/LOOLWSD.cpp | 28 +++++++--------------------- 2 files changed, 7 insertions(+), 26 deletions(-)
New commits: commit 0c0f71ae3842e2debfafa5d14f11569182746916 Author: Jan Holesovsky <[email protected]> AuthorDate: Thu Nov 29 19:15:58 2018 +0100 Commit: Andras Timar <[email protected]> CommitDate: Fri Nov 30 13:44:32 2018 +0100 capabilities: Don't rely on existence of the file, compose it completely. Change-Id: I41588afa9f26b4a2575ee8cf7d9837cc79b31b3e Reviewed-on: https://gerrit.libreoffice.org/64302 Reviewed-by: Andras Timar <[email protected]> Tested-by: Andras Timar <[email protected]> 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 19fd798ae..e0536ecd2 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2622,31 +2622,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(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
