[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loleaflet/dist loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Tue Oct 11 11:14:34 UTC 2016


 loleaflet/dist/loleaflet.html |   12 ++++++++++--
 loleaflet/src/core/Socket.js  |    8 ++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 493c460ec119ed9e9be8e280eaa921eb006f0e6f
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Sun Jul 10 01:08:56 2016 +0530

    loleaflet: Separate document URL from query params
    
    Change-Id: I9b8381b8c0d92796aadabe0bc63e5a1b144f8b41
    (cherry picked from commit 126503289613704dc490adca367bc90d35b8674f)
    
     Conflicts:
    	loleaflet/src/core/Socket.js

diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 4610a6b..371b0c7 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 2c28d3b..4cf4ef8 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);


More information about the Libreoffice-commits mailing list