[Libreoffice-commits] online.git: 3 commits - loleaflet/src loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/protocol.txt
Mihai Varga
mihai.varga at collabora.com
Mon Oct 12 10:34:02 PDT 2015
loleaflet/src/control/Toolbar.js | 1 +
loleaflet/src/layer/tile/TileLayer.js | 2 +-
loolwsd/LOOLSession.cpp | 15 ++++++++-------
loolwsd/LOOLWSD.cpp | 1 +
loolwsd/protocol.txt | 2 +-
5 files changed, 12 insertions(+), 9 deletions(-)
New commits:
commit c4825f549229bb2492441a2146a337a59d9b4ac5
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Mon Oct 12 20:33:29 2015 +0300
loolwsd: allow cross origin requests
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 867be4f..bb83728 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -212,6 +212,7 @@ public:
File file(filePath);
if (file.exists())
{
+ response.set("Access-Control-Allow-Origin", "*");
response.sendFile(filePath, "application/octet-stream");
File dir(dirPath);
dir.remove(true);
commit 51505e193484b8d7e5c150017ce8a755805bd81f
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Oct 9 17:20:18 2015 +0300
add an ID parameter to the downloadas command
We need it to know wheter the user wants to download the file or just
print it, etc
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 243b24a..0beaf57 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -40,6 +40,7 @@ L.Map.include({
}
L.Socket.sendMessage('downloadas ' +
'name=' + name + ' ' +
+ 'id=0 ' +
'format=' + format + ' ' +
'options=' + options);
},
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 0b2780c..9f4a54c 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -1001,19 +1001,20 @@ void ChildProcessSession::sendTile(const char *buffer, int length, StringTokeniz
bool ChildProcessSession::downloadAs(const char *buffer, int length, StringTokenizer& tokens)
{
- std::string name, format, filterOptions;
+ std::string name, id, format, filterOptions;
- if (tokens.count() < 4 ||
- !getTokenString(tokens[1], "name", name))
+ if (tokens.count() < 5 ||
+ !getTokenString(tokens[1], "name", name) ||
+ !getTokenString(tokens[2], "id", id))
{
sendTextFrame("error: cmd=saveas kind=syntax");
return false;
}
- getTokenString(tokens[2], "format", format);
+ getTokenString(tokens[3], "format", format);
- if (getTokenString(tokens[3], "options", filterOptions)) {
- if (tokens.count() > 4) {
+ if (getTokenString(tokens[4], "options", filterOptions)) {
+ if (tokens.count() > 5) {
filterOptions += Poco::cat(std::string(" "), tokens.begin() + 4, tokens.end());
}
}
@@ -1037,7 +1038,7 @@ bool ChildProcessSession::downloadAs(const char *buffer, int length, StringToken
filterOptions.size() == 0 ? NULL : filterOptions.c_str());
sendTextFrame("downloadas: jail=" + _childId + " dir=" + tmpDir + " name=" + name +
- " port=" + std::to_string(LOOLWSD::portNumber));
+ " port=" + std::to_string(LOOLWSD::portNumber) + " id=" + id);
return true;
}
diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt
index 3c8369f..d16d38c 100644
--- a/loolwsd/protocol.txt
+++ b/loolwsd/protocol.txt
@@ -17,7 +17,7 @@ canceltiles
dropped and will not be handled. There is no guarantee of exactly
which tile: messages might still be sent back to the client.
-downloadas downloadas name=<fileName> format=<document format> options=<SkipImages, etc>
+downloadas downloadas name=<fileName> id=<id> format=<document format> options=<SkipImages, etc>
Exports the current document to the desired format and returns a download URL
commit 9dee04577641ca063baf832a52e490366a8e6f1f
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri Oct 9 17:00:37 2015 +0300
loleaflet: use the window's protocl for downloading
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 1054e73..e5c2ba3 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -271,7 +271,7 @@ L.TileLayer = L.GridLayer.extend({
var command = L.Socket.parseServerCmd(textMsg);
var parser = document.createElement('a');
parser.href = this._map.options.server;
- var url = 'http://' + parser.hostname + ':' + command.port + '/' +
+ var url = window.location.protocol + '//' + parser.hostname + ':' + command.port + '/' +
command.jail + '/' + command.dir + '/' + command.name;
this._map._fileDownloader.src = url;
},
More information about the Libreoffice-commits
mailing list