summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2016-07-10 01:08:56 +0530
committerPranav Kant <pranavk@collabora.co.uk>2016-10-11 16:42:02 +0530
commit493c460ec119ed9e9be8e280eaa921eb006f0e6f (patch)
tree967eb6c88c16f7293f59aef73d4d7e4c97ae6210
parentRevert "loleaflet: Fix incorrect reference to username" (diff)
downloadonline-493c460ec119ed9e9be8e280eaa921eb006f0e6f.tar.gz
online-493c460ec119ed9e9be8e280eaa921eb006f0e6f.zip
loleaflet: Separate document URL from query params
Change-Id: I9b8381b8c0d92796aadabe0bc63e5a1b144f8b41 (cherry picked from commit 126503289613704dc490adca367bc90d35b8674f) Conflicts: loleaflet/src/core/Socket.js
-rw-r--r--loleaflet/dist/loleaflet.html12
-rw-r--r--loleaflet/src/core/Socket.js8
2 files changed, 14 insertions, 6 deletions
diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 4610a6b902..371b0c786b 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -93,7 +93,7 @@
var wopiSrc = getParameterByName('WOPISrc');
var access_token = '%ACCESS_TOKEN%';
if (wopiSrc !== '' && access_token !== '') {
- wopiSrc += '?access_token=' + access_token;
+ var wopiParams = { 'access_token': access_token }
}
var filePath = getParameterByName('file_path');
@@ -116,12 +116,20 @@
vex.dialog.alert(emptyhosturl);
}
- var docURL = wopiSrc !== '' ? wopiSrc : filePath;
+ var docURL, docParams;
+ if (wopiSrc != '') {
+ docURL = wopiSrc;
+ docParams = wopiParams;
+ } else {
+ docURL = filePath;
+ docParams = {};
+ }
document.title = title;
var map = L.map('map', {
server: host,
doc: docURL,
+ docParams: docParams,
permission: permission,
timestamp: timestamp,
documentContainer: 'document-container'
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 2c28d3bfee..4cf4ef8e24 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -9,10 +9,10 @@ L.Socket = L.Class.extend({
initialize: function (map) {
this._map = map;
try {
- var params = {
- permission: map.options.permission
- };
- this.socket = new WebSocket(map.options.server + '/lool/' + encodeURIComponent(map.options.doc + '?' + $.param(params)) + '/ws');
+ if (map.options.permission) {
+ map.options.docParams['permission'] = map.options.permission;
+ }
+ this.socket = new WebSocket(map.options.server + '/lool/' + encodeURIComponent(map.options.doc + '?' + $.param(map.options.docParams)) + '/ws');
this.socket.onerror = L.bind(this._onSocketError, this);
this.socket.onclose = L.bind(this._onSocketClose, this);
this.socket.onopen = L.bind(this._onSocketOpen, this);