backward compatibility: /lool/convert-to endpoint

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I8a3930a01a18be32bee657142f872ba58383594d
This commit is contained in:
Andras Timar 2021-11-19 12:29:22 +01:00
parent dcfe16eec1
commit b6182877a8
3 changed files with 12 additions and 3 deletions

View file

@ -33,3 +33,6 @@
# Download as, Fullscreen presentation and Image upload operations
ProxyPass /cool http://127.0.0.1:9980/cool
ProxyPassReverse /cool http://127.0.0.1:9980/cool
# Compatibility with integrations that use the /lool/convert-to endpoint
ProxyPass /lool http://127.0.0.1:9980/cool
ProxyPassReverse /lool http://127.0.0.1:9980/cool

View file

@ -26,7 +26,8 @@
}
# download, presentation and image upload
location ~ ^/cool {
# we accept 'lool' to be backward compatible
location ~ ^/(c|l)ool {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}

View file

@ -2804,9 +2804,12 @@ private:
requestDetails.equals(2, "ws") && requestDetails.isWebSocket())
handleClientWsUpgrade(request, requestDetails, disposition, socket);
else if (!requestDetails.isWebSocket() && requestDetails.equals(RequestDetails::Field::Type, "cool"))
else if (!requestDetails.isWebSocket() &&
(requestDetails.equals(RequestDetails::Field::Type, "cool") ||
requestDetails.equals(RequestDetails::Field::Type, "lool")))
{
// All post requests have url prefix 'cool'.
// All post requests have url prefix 'cool', except when the prefix
// is 'lool' e.g. when integrations use the old /lool/convert-to endpoint
handlePostRequest(requestDetails, request, message, disposition, socket);
}
else
@ -3805,6 +3808,8 @@ private:
Poco::JSON::Object::Ptr convert_to = new Poco::JSON::Object;
Poco::Dynamic::Var available = allowConvertTo(socket->clientAddress(), request);
convert_to->set("available", available);
if (available)
convert_to->set("endpoint", "/cool/convert-to");
Poco::JSON::Object::Ptr capabilities = new Poco::JSON::Object;
capabilities->set("convert-to", convert_to);