[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/debug loleaflet/dist loleaflet/main.js loleaflet/src wsd/FileServer.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 10 21:02:40 UTC 2018


 loleaflet/debug/document/admin.html           |    2 +-
 loleaflet/debug/document/adminAnalytics.html  |    2 +-
 loleaflet/debug/document/adminSettings.html   |    2 +-
 loleaflet/dist/admin/admin.html               |    8 ++++----
 loleaflet/dist/admin/adminAnalytics.html      |    8 ++++----
 loleaflet/dist/admin/adminHistory.html        |    8 ++++----
 loleaflet/dist/admin/adminSettings.html       |    8 ++++----
 loleaflet/dist/loleaflet.html                 |    1 +
 loleaflet/main.js                             |    1 +
 loleaflet/src/core/Socket.js                  |    2 +-
 loleaflet/src/layer/tile/TileLayer.js         |    2 +-
 loleaflet/src/map/handler/Map.FileInserter.js |    2 +-
 loleaflet/src/map/handler/Map.SlideShow.js    |    2 +-
 wsd/FileServer.cpp                            |    2 ++
 14 files changed, 27 insertions(+), 23 deletions(-)

New commits:
commit d3d635a7614fca6a1c85bb1e316414e5c46e1c40
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Sep 7 22:56:09 2018 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Sep 10 23:02:21 2018 +0200

    ServiceRoot: Add the serviceRoot to various html and js files.
    
    Change-Id: Ibd9093afa3d1f014c70328446ee42189dd0c2117
    Reviewed-on: https://gerrit.libreoffice.org/60174
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/debug/document/admin.html b/loleaflet/debug/document/admin.html
index 947fdc40b..0102aec9b 100644
--- a/loleaflet/debug/document/admin.html
+++ b/loleaflet/debug/document/admin.html
@@ -37,7 +37,7 @@
     <script>vex.defaultOptions.className = 'vex-theme-plain';</script>
     <script>
 
-	var host = 'wss://' + window.location.host + '/lool/adminws/';
+	var host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/';
 	new AdminSocketOverview(host);
 
     </script>
diff --git a/loleaflet/debug/document/adminAnalytics.html b/loleaflet/debug/document/adminAnalytics.html
index c6d9babf7..0dbb2bf7d 100644
--- a/loleaflet/debug/document/adminAnalytics.html
+++ b/loleaflet/debug/document/adminAnalytics.html
@@ -38,7 +38,7 @@
     <script src="../../dist/admin/admin-src.js"></script>
     <script>
 
-	host = 'wss://' + window.location.host + '/lool/adminws/';
+	host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/';
 	new AdminSocketAnalytics(host);
 
     </script>
diff --git a/loleaflet/debug/document/adminSettings.html b/loleaflet/debug/document/adminSettings.html
index 6c985da19..3983efc7f 100644
--- a/loleaflet/debug/document/adminSettings.html
+++ b/loleaflet/debug/document/adminSettings.html
@@ -37,7 +37,7 @@
     <script src="../../dist/admin/admin-src.js"></script>
     <script>
 
-	host = 'wss://' + window.location.host + '/lool/adminws/';
+	host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/';
 	new AdminSocketSettings(host);
 
     </script>
diff --git a/loleaflet/dist/admin/admin.html b/loleaflet/dist/admin/admin.html
index f23d510ca..a076a1749 100644
--- a/loleaflet/dist/admin/admin.html
+++ b/loleaflet/dist/admin/admin.html
@@ -15,19 +15,19 @@
       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
     <![endif]-->
-    <link rel="localizations" href="/loleaflet/dist/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
+    <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
   </head>
   <body>
-    <script src="/loleaflet/dist/admin-bundle.js"></script>
+    <script src="%SERVICE_ROOT%/loleaflet/%VERSION%/admin-bundle.js"></script>
     <!--%BRANDING_JS%-->
     <script>if (typeof brandProductName !== 'undefined') {l10nstrings.strProductName = brandProductName}</script>
     <script>document.title = l10nstrings.strProductName + ' - ' + l10nstrings.strAdminConsole</script>
     <script>
       if (window.location.protocol == "https:") {
-          var host = 'wss://' + window.location.host + '/lool/adminws/';
+          var host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/';
       }
       else {
-          host = 'ws://' + window.location.host + '/lool/adminws/';
+          host = 'ws://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/';
       }
 
       Admin.Overview(host);
diff --git a/loleaflet/dist/admin/adminAnalytics.html b/loleaflet/dist/admin/adminAnalytics.html
index 1e801fcb1..7f52c080f 100644
--- a/loleaflet/dist/admin/adminAnalytics.html
+++ b/loleaflet/dist/admin/adminAnalytics.html
@@ -15,19 +15,19 @@
       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
     <![endif]-->
-    <link rel="localizations" href="/loleaflet/dist/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
+    <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
   </head>
   <body>
-    <script src="/loleaflet/dist/admin-bundle.js"></script>
+    <script src="%SERVICE_ROOT%/loleaflet/%VERSION%/admin-bundle.js"></script>
     <!--%BRANDING_JS%-->
     <script>if (typeof brandProductName !== 'undefined') {l10nstrings.strProductName = brandProductName}</script>
     <script>document.title = l10nstrings.strProductName + ' - ' + l10nstrings.strAdminConsole</script>
     <script>
         if (window.location.protocol == "https:") {
-           host = 'wss://' + window.location.host + '/lool/adminws/'
+           host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/'
         }
         else {
-           host = 'ws://' + window.location.host + '/lool/adminws/'
+           host = 'ws://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/'
         }
 
         Admin.Analytics(host)
diff --git a/loleaflet/dist/admin/adminHistory.html b/loleaflet/dist/admin/adminHistory.html
index 7245a3d04..695f4eb53 100644
--- a/loleaflet/dist/admin/adminHistory.html
+++ b/loleaflet/dist/admin/adminHistory.html
@@ -15,20 +15,20 @@
       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
     <![endif]-->
-    <link rel="localizations" href="/loleaflet/dist/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
+    <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
 
   </head>
   <body>
-    <script src="/loleaflet/dist/admin-bundle.js"></script>
+    <script src="%SERVICE_ROOT%/loleaflet/%VERSION%/admin-bundle.js"></script>
     <!--%BRANDING_JS%-->
     <script>if (typeof brandProductName !== 'undefined') {l10nstrings.strProductName = brandProductName}</script>
     <script>document.title = l10nstrings.strProductName + ' - ' + l10nstrings.strAdminConsole</script>
     <script>
         if (window.location.protocol == "https:") {
-           host = 'wss://' + window.location.host + '/lool/adminws/'
+           host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/'
         }
         else {
-           host = 'ws://' + window.location.host + '/lool/adminws/'
+           host = 'ws://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/'
         }
 
         Admin.History(host)
diff --git a/loleaflet/dist/admin/adminSettings.html b/loleaflet/dist/admin/adminSettings.html
index c7b21879d..8cf1e33c5 100644
--- a/loleaflet/dist/admin/adminSettings.html
+++ b/loleaflet/dist/admin/adminSettings.html
@@ -15,19 +15,19 @@
       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
     <![endif]-->
-    <link rel="localizations" href="/loleaflet/dist/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
+    <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/admin-localizations.json" type="application/vnd.oftn.l10n+json"/>
   </head>
   <body>
-    <script src="/loleaflet/dist/admin-bundle.js"></script>
+    <script src="%SERVICE_ROOT%/loleaflet/%VERSION%/admin-bundle.js"></script>
     <!--%BRANDING_JS%-->
     <script>if (typeof brandProductName !== 'undefined') {l10nstrings.strProductName = brandProductName}</script>
     <script>document.title = l10nstrings.strProductName + ' - ' + l10nstrings.strAdminConsole</script>
     <script>
         if (window.location.protocol == "https:") {
-           host = 'wss://' + window.location.host + '/lool/adminws/'
+           host = 'wss://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/'
         }
         else {
-           host = 'ws://' + window.location.host + '/lool/adminws/'
+           host = 'ws://' + window.location.host + '%SERVICE_ROOT%/lool/adminws/'
         }
 
         Admin.Settings(host);
diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index ce9cdcb74..631aa3802 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -96,6 +96,7 @@
 
     <script>
       window.host = '%HOST%';
+      window.serviceRoot = '%SERVICE_ROOT%';
       window.access_token = '%ACCESS_TOKEN%';
       window.access_token_ttl = '%ACCESS_TOKEN_TTL%';
       window.access_header = '%ACCESS_HEADER%';
diff --git a/loleaflet/main.js b/loleaflet/main.js
index efbfd32ba..bff5f3d3d 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -104,6 +104,7 @@ var notWopiButIframe = getParameterByName('NotWOPIButIframe') != '';
 var map = L.map('map', {
 	server: host,
 	doc: docURL,
+	serviceRoot: serviceRoot,
 	docParams: docParams,
 	permission: permission,
 	timestamp: timestamp,
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 13bc243f6..21b0922c1 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -32,7 +32,7 @@ L.Socket = L.Class.extend({
 			wopiSrc = '?WOPISrc=' + map.options.wopiSrc + '&compat=/ws';
 		}
 
-		var websocketURI = map.options.server + '/lool/' + encodeURIComponent(map.options.doc + '?' + $.param(map.options.docParams)) + '/ws' + wopiSrc;
+		var websocketURI = map.options.server + map.options.serviceRoot + '/lool/' + encodeURIComponent(map.options.doc + '?' + $.param(map.options.docParams)) + '/ws' + wopiSrc;
 		try {
 			if (this.socket) {
 				this.close();
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index a5fa6d400..5cc13c1a2 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -546,7 +546,7 @@ L.TileLayer = L.GridLayer.extend({
 		if (map.options.wopiSrc != '') {
 			wopiSrc = '?WOPISrc=' + map.options.wopiSrc;
 		}
-		var url = this._map.options.webserver + '/' + this._map.options.urlPrefix + '/' +
+		var url = this._map.options.webserver + this._map.options.serviceRoot + '/' + this._map.options.urlPrefix + '/' +
 		    encodeURIComponent(this._map.options.doc) + '/' + command.jail + '/' + command.dir + '/' + command.name + wopiSrc;
 
 		this._map.hideBusy();
diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js
index 7b6811b03..153e821a3 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -18,7 +18,7 @@ L.Map.FileInserter = L.Handler.extend({
 		if (map.options.wopiSrc != '') {
 			wopiSrc = '?WOPISrc=' + map.options.wopiSrc;
 		}
-		this._url = map.options.webserver + '/' + map.options.urlPrefix +
+		this._url = map.options.webserver + map.options.serviceRoot + '/' + map.options.urlPrefix +
 			'/' + encodeURIComponent(map.options.doc) + '/insertfile' + wopiSrc;
 	},
 
diff --git a/loleaflet/src/map/handler/Map.SlideShow.js b/loleaflet/src/map/handler/Map.SlideShow.js
index 75668c016..00f0da812 100644
--- a/loleaflet/src/map/handler/Map.SlideShow.js
+++ b/loleaflet/src/map/handler/Map.SlideShow.js
@@ -24,7 +24,7 @@ L.Map.SlideShow = L.Handler.extend({
 
 	_onFullScreen: function () {
 		this._slideShow = L.DomUtil.create('iframe', 'leaflet-slideshow', this._map._container);
-		this._slideShow.src = this._map.options.webserver + '/loleaflet/dist/loading.html';
+		this._slideShow.src = this._map.options.webserver + this._map.options.serviceRoot + '/loleaflet/dist/loading.html';
 		if (this._slideShow.requestFullscreen) {
 			this._slideShow.requestFullscreen();
 		}
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index afd7f63af..251dd7ce9 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -812,6 +812,8 @@ void FileServerRequestHandler::preprocessAdminFile(const HTTPRequest& request,co
 
     Poco::replaceInPlace(adminFile, std::string("<!--%BRANDING_JS%-->"), brandJS);
     Poco::replaceInPlace(adminFile, std::string("<!--%FOOTER%-->"), brandFooter);
+    Poco::replaceInPlace(adminFile, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH));
+    Poco::replaceInPlace(adminFile, std::string("%SERVICE_ROOT%"), LOOLWSD::ServiceRoot);
 
     // Ask UAs to block if they detect any XSS attempt
     response.add("X-XSS-Protection", "1; mode=block");


More information about the Libreoffice-commits mailing list