wsd: exclude HostUtil from non-mobile apps
It's not used, since no external storage is supported in the apps. Change-Id: I5cf765ef3cb38dcb396318f6b9ace56bf4e127a2 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>pull/8348/head
parent
bf6174e201
commit
8d55aab329
|
@ -16,7 +16,9 @@
|
|||
#if ENABLE_FEATURE_LOCK
|
||||
#include "CommandControl.hpp"
|
||||
#endif
|
||||
#include "HostUtil.hpp"
|
||||
#if !MOBILEAPP
|
||||
#include <HostUtil.hpp>
|
||||
#endif // !MOBILEAPP
|
||||
|
||||
/* Default host used in the start test URI */
|
||||
#define COOLWSD_TEST_HOST "localhost"
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
#include <DocumentBroker.hpp>
|
||||
#include <Exceptions.hpp>
|
||||
#include <FileServer.hpp>
|
||||
#if !MOBILEAPP
|
||||
#include <HostUtil.hpp>
|
||||
#endif // !MOBILEAPP
|
||||
#include <RequestDetails.hpp>
|
||||
#include <ProxyRequestHandler.hpp>
|
||||
#include <WopiProxy.hpp>
|
||||
|
@ -382,8 +384,6 @@ getConvertToBrokerImplementation(const std::string& requestType, const std::stri
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#endif // !MOBILEAPP
|
||||
|
||||
bool ClientRequestDispatcher::allowPostFrom(const std::string& address)
|
||||
{
|
||||
static bool init = false;
|
||||
|
@ -465,6 +465,8 @@ bool ClientRequestDispatcher::allowConvertTo(const std::string& address,
|
|||
return allow;
|
||||
}
|
||||
|
||||
#endif // !MOBILEAPP
|
||||
|
||||
void ClientRequestDispatcher::onConnect(const std::shared_ptr<StreamSocket>& socket)
|
||||
{
|
||||
_id = COOLWSD::GetConnectionId();
|
||||
|
@ -1884,10 +1886,17 @@ ClientRequestDispatcher::getCapabilitiesJson(const Poco::Net::HTTPRequest& reque
|
|||
|
||||
// Can the convert-to be used?
|
||||
Poco::JSON::Object::Ptr convert_to = new Poco::JSON::Object;
|
||||
#if !MOBILEAPP
|
||||
Poco::Dynamic::Var available = allowConvertTo(socket->clientAddress(), request);
|
||||
convert_to->set("available", available);
|
||||
if (available)
|
||||
convert_to->set("endpoint", "/cool/convert-to");
|
||||
#else
|
||||
// convert-to is not supported on mobile apps as it requires wopi.
|
||||
(void)request;
|
||||
Poco::Dynamic::Var available = false;
|
||||
convert_to->set("available", available);
|
||||
#endif // MOBILEAPP
|
||||
|
||||
Poco::JSON::Object::Ptr capabilities = new Poco::JSON::Object;
|
||||
capabilities->set("convert-to", convert_to);
|
||||
|
|
|
@ -31,11 +31,6 @@ public:
|
|||
StaticFileContentCache["discovery.xml"] = getDiscoveryXML();
|
||||
}
|
||||
|
||||
/// Does this address feature in the allowed hosts list.
|
||||
static bool allowPostFrom(const std::string& address);
|
||||
|
||||
static bool allowConvertTo(const std::string& address, const Poco::Net::HTTPRequest& request);
|
||||
|
||||
private:
|
||||
/// Set the socket associated with this ResponseClient.
|
||||
void onConnect(const std::shared_ptr<StreamSocket>& socket) override;
|
||||
|
@ -52,6 +47,11 @@ private:
|
|||
void performWrites(std::size_t /*capacity*/) override {}
|
||||
|
||||
#if !MOBILEAPP
|
||||
/// Does this address feature in the allowed hosts list.
|
||||
static bool allowPostFrom(const std::string& address);
|
||||
|
||||
static bool allowConvertTo(const std::string& address, const Poco::Net::HTTPRequest& request);
|
||||
|
||||
void handleRootRequest(const RequestDetails& requestDetails,
|
||||
const std::shared_ptr<StreamSocket>& socket);
|
||||
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
|
||||
// HostUtil is only used in non-mobile apps.
|
||||
#if !MOBILEAPP
|
||||
|
||||
#include "HostUtil.hpp"
|
||||
#include <common/ConfigUtil.hpp>
|
||||
|
@ -230,4 +233,6 @@ void HostUtil::setFirstHost(const Poco::URI& uri)
|
|||
}
|
||||
}
|
||||
|
||||
#endif // !MOBILEAPP
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// HostUtil is only used in non-mobile apps.
|
||||
#if !MOBILEAPP
|
||||
|
||||
#include <Util.hpp>
|
||||
#include <Poco/URI.h>
|
||||
#include <Poco/Util/Application.h>
|
||||
|
@ -56,5 +59,6 @@ private:
|
|||
/// add host to WopiHosts
|
||||
static void addWopiHost(const std::string& host, bool allow);
|
||||
};
|
||||
#endif // !MOBILEAPP
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
Loading…
Reference in New Issue