[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loleaflet/debug loleaflet/reference.html loleaflet/src

Jan Holesovsky kendy at collabora.com
Thu Jan 7 03:35:08 PST 2016


 loleaflet/debug/document/document_simple_example.html |    1 +
 loleaflet/reference.html                              |   11 ++++++++++-
 loleaflet/src/layer/tile/TileLayer.js                 |    2 +-
 loleaflet/src/map/Map.js                              |    5 +++++
 4 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit d5e491aef3d882538a64e52999a550559788cd82
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Jan 7 12:32:55 2016 +0100

    loleaflet: Introduce a 'webserver' option for the http access to loolwsd.
    
    When proxying, the websocket may be hidden behind another URL, so this allows
    an explicit setting.

diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index 861b05f..bdf46cb 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -75,6 +75,7 @@
             doc: filePath,
             renderingOptions: renderingOptions,
             server: host,
+            //webserver: ..., /* by default derived from 'server' */
             permission: permission,
             timestamp: timestamp,
             documentContainer: 'document-container',
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 730fe05..52db488 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -1444,7 +1444,16 @@ unexpected behaviour.</h4>
 		<td><code><b>server</b></code></td>
 		<td><code>String</code></td>
 		<td><code><span class="literal">undefined</span></code></td>
-		<td>The server hosting loolwsd.</td>
+		<td>The websocket server hosting loolwsd using the <code>ws:</code> protocol.
+		    Example: ws://localhost:9980</td>
+	</tr>
+	<tr>
+		<td><code><b>webserver</b></code></td>
+		<td><code>String</code></td>
+		<td><code><span class="literal">undefined</span></code></td>
+		<td>The webserver access to hosting loolwsd.  Normally it is
+		    derived from 'server', but can be overridden with an own
+		    value in case of proxying.  Example: http://localhost:9980</td>
 	</tr>
 	<tr>
 		<td><code><b>permission</b></code></td>
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index f14d67c..8425cad 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -332,7 +332,7 @@ L.TileLayer = L.GridLayer.extend({
 		var parser = document.createElement('a');
 		var protocol = window.location.protocol === 'file:' ? 'http:' : window.location.protocol;
 		parser.href = this._map.options.server;
-		var url = protocol + '//' + parser.hostname + ':' + command.port + '/' +
+		var url = this._map.options.webserver + '/' +
 			command.jail + '/' + command.dir + '/' + command.name;
 
 		if (command.id === 'print') {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 9f650c0..f7f3664 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -60,6 +60,11 @@ L.Map = L.Evented.extend({
 		this._addLayers(this.options.layers);
 		L.Socket.connect(this);
 
+		if (options.webserver === undefined) {
+			var protocol = window.location.protocol === 'file:' ? 'http:' : window.location.protocol;
+			options.webserver = options.server.replace(/^ws:/i, protocol);
+		}
+
 		// Inhibit the context menu - the browser thinks that the document
 		// is just a bunch of images, hence the context menu is useless (tdf#94599)
 		this.on('contextmenu', function() {});


More information about the Libreoffice-commits mailing list