[Libreoffice-commits] online.git: 5 commits - loleaflet/admin loleaflet/debug loleaflet/html loleaflet/js loleaflet/l10n loleaflet/src loolwsd.xml.in wsd/FileServer.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 7 22:16:19 UTC 2018
loleaflet/admin/admin.html | 8
loleaflet/admin/adminAnalytics.html | 8
loleaflet/admin/adminHistory.html | 8
loleaflet/admin/adminSettings.html | 8
loleaflet/debug/document/admin.html | 2
loleaflet/debug/document/adminAnalytics.html | 2
loleaflet/debug/document/adminSettings.html | 2
loleaflet/html/loleaflet.html.m4 | 18 +
loleaflet/js/main.js | 3
loleaflet/l10n/admin-localizations.json | 236 +++++++++++++-------------
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
loolwsd.xml.in | 1
wsd/FileServer.cpp | 21 +-
wsd/LOOLWSD.cpp | 17 +
wsd/LOOLWSD.hpp | 1
18 files changed, 184 insertions(+), 159 deletions(-)
New commits:
commit 5ae112d563a89a94b852edc03a21efdb19fc0cbd
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Sat Sep 8 00:10:50 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Sat Sep 8 00:12:20 2018 +0200
ServiceRoot: Fix the admin console (the jwt token generation).
Change-Id: Ic1772692471d29c99d7d68834cddb6b304e721d2
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 517477b2e..e0b475595 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -252,7 +252,7 @@ bool FileServerRequestHandler::isAdminLoggedIn(const HTTPRequest& request,
Poco::Net::HTTPCookie cookie("jwt", jwtToken);
// bundlify appears to add an extra /dist -> dist/dist/admin
- cookie.setPath("/loleaflet/dist/");
+ cookie.setPath(LOOLWSD::ServiceRoot + "/loleaflet/dist/");
cookie.setSecure(LOOLWSD::isSSLEnabled() ||
LOOLWSD::isSSLTermination());
response.addCookie(cookie);
commit 7152a8a55c365c94a9756b1fa504ab2836b142d2
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Sep 7 23:34:09 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Sat Sep 8 00:12:20 2018 +0200
ServiceRoot: Fix the branding and update the admin console debug URL.
Change-Id: Id10d7a4d99ea993a398467e528e2018cc12d503b
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index a508c4f15..517477b2e 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -619,11 +619,11 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
Poco::replaceInPlace(preprocess, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH));
Poco::replaceInPlace(preprocess, std::string("%SERVICE_ROOT%"), LOOLWSD::ServiceRoot);
- static const std::string linkCSS("<link rel=\"stylesheet\" href=\"/loleaflet/" LOOLWSD_VERSION_HASH "/%s.css\">");
- static const std::string scriptJS("<script src=\"/loleaflet/" LOOLWSD_VERSION_HASH "/%s.js\"></script>");
+ static const std::string linkCSS("<link rel=\"stylesheet\" href=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.css\">");
+ static const std::string scriptJS("<script src=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.js\"></script>");
- std::string brandCSS(Poco::format(linkCSS, std::string(BRANDING)));
- std::string brandJS(Poco::format(scriptJS, std::string(BRANDING)));
+ std::string brandCSS(Poco::format(linkCSS, LOOLWSD::ServiceRoot, std::string(BRANDING)));
+ std::string brandJS(Poco::format(scriptJS, LOOLWSD::ServiceRoot, std::string(BRANDING)));
const auto& config = Application::instance().config();
#if ENABLE_SUPPORT_KEY
@@ -631,8 +631,8 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
SupportKey key(keyString);
if (!key.verify() || key.validDaysRemaining() <= 0)
{
- brandCSS = Poco::format(linkCSS, std::string(BRANDING_UNSUPPORTED));
- brandJS = Poco::format(scriptJS, std::string(BRANDING_UNSUPPORTED));
+ brandCSS = Poco::format(linkCSS, LOOLWSD::ServiceRoot, std::string(BRANDING_UNSUPPORTED));
+ brandJS = Poco::format(scriptJS, LOOLWSD::ServiceRoot, std::string(BRANDING_UNSUPPORTED));
}
#endif
@@ -792,13 +792,13 @@ void FileServerRequestHandler::preprocessAdminFile(const HTTPRequest& request,co
if (!FileServerRequestHandler::isAdminLoggedIn(request, response))
throw Poco::Net::NotAuthenticatedException("Invalid admin login");
- static const std::string scriptJS("<script src=\"/loleaflet/dist/%s.js\"></script>");
+ static const std::string scriptJS("<script src=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.js\"></script>");
static const std::string footerPage("<div class=\"footer navbar-fixed-bottom text-info text-center\"><strong>Key:</strong> %s <strong>Expiry Date:</strong> %s</div>");
const std::string relPath = getRequestPathname(request);
LOG_DBG("Preprocessing file: " << relPath);
std::string adminFile = *getUncompressedFile(relPath);
- std::string brandJS(Poco::format(scriptJS, std::string(BRANDING)));
+ std::string brandJS(Poco::format(scriptJS, LOOLWSD::ServiceRoot, std::string(BRANDING)));
std::string brandFooter;
#if ENABLE_SUPPORT_KEY
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 7723adb5a..8248d28d8 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -568,6 +568,7 @@ inline std::string getAdminURI(const Poco::Util::LayeredConfiguration &config)
std::ostringstream oss;
oss << getLaunchBase(user + ":" + passwd + "@");
+ oss << LOOLWSD::ServiceRoot;
oss << LOOLWSD_TEST_ADMIN_CONSOLE;
return oss.str();
commit 8928cb0d89408d9fe3995eb188e2adef443e2b90
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Sep 7 23:03:01 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Sat Sep 8 00:12:20 2018 +0200
ServiceRoot: Admin console localization.
Change-Id: I6f9a19df8f15a00a816fbb904f23d3911d03b3ed
diff --git a/loleaflet/l10n/admin-localizations.json b/loleaflet/l10n/admin-localizations.json
index bbd78611f..0ad504c88 100644
--- a/loleaflet/l10n/admin-localizations.json
+++ b/loleaflet/l10n/admin-localizations.json
@@ -1,121 +1,121 @@
{
"en": false,
- "ab": "/loleaflet/dist/l10n/ui-ab.json",
- "af": "/loleaflet/dist/l10n/ui-af.json",
- "am": "/loleaflet/dist/l10n/ui-am.json",
- "an": "/loleaflet/dist/l10n/ui-an.json",
- "ar": "/loleaflet/dist/l10n/ui-ar.json",
- "as": "/loleaflet/dist/l10n/ui-as.json",
- "ast": "/loleaflet/dist/l10n/ui-ast.json",
- "az": "/loleaflet/dist/l10n/ui-az.json",
- "be": "/loleaflet/dist/l10n/ui-be.json",
- "bg": "/loleaflet/dist/l10n/ui-bg.json",
- "bn-in": "/loleaflet/dist/l10n/ui-bn_IN.json",
- "bn": "/loleaflet/dist/l10n/ui-bn.json",
- "bo": "/loleaflet/dist/l10n/ui-bo.json",
- "br": "/loleaflet/dist/l10n/ui-br.json",
- "brx": "/loleaflet/dist/l10n/ui-brx.json",
- "bs": "/loleaflet/dist/l10n/ui-bs.json",
- "ca": "/loleaflet/dist/l10n/ui-ca.json",
- "cs": "/loleaflet/dist/l10n/ui-cs.json",
- "cy": "/loleaflet/dist/l10n/ui-cy.json",
- "da": "/loleaflet/dist/l10n/ui-da.json",
- "de": "/loleaflet/dist/l10n/ui-de.json",
- "dgo": "/loleaflet/dist/l10n/ui-dgo.json",
- "dsb": "/loleaflet/dist/l10n/ui-dsb.json",
- "dz": "/loleaflet/dist/l10n/ui-dz.json",
- "el": "/loleaflet/dist/l10n/ui-el.json",
- "en-gb": "/loleaflet/dist/l10n/ui-en_GB.json",
- "en-za": "/loleaflet/dist/l10n/ui-en_ZA.json",
- "eo": "/loleaflet/dist/l10n/ui-eo.json",
- "es": "/loleaflet/dist/l10n/ui-es.json",
- "et": "/loleaflet/dist/l10n/ui-et.json",
- "eu": "/loleaflet/dist/l10n/ui-eu.json",
- "fa": "/loleaflet/dist/l10n/ui-fa.json",
- "fi": "/loleaflet/dist/l10n/ui-fi.json",
- "fr": "/loleaflet/dist/l10n/ui-fr.json",
- "ga": "/loleaflet/dist/l10n/ui-ga.json",
- "gd": "/loleaflet/dist/l10n/ui-gd.json",
- "gl": "/loleaflet/dist/l10n/ui-gl.json",
- "gn": "/loleaflet/dist/l10n/ui-gug.json",
- "gu": "/loleaflet/dist/l10n/ui-gu.json",
- "he": "/loleaflet/dist/l10n/ui-he.json",
- "hi": "/loleaflet/dist/l10n/ui-hi.json",
- "hr": "/loleaflet/dist/l10n/ui-hr.json",
- "hsb": "/loleaflet/dist/l10n/ui-hsb.json",
- "hu": "/loleaflet/dist/l10n/ui-hu.json",
- "id": "/loleaflet/dist/l10n/ui-id.json",
- "is": "/loleaflet/dist/l10n/ui-is.json",
- "it": "/loleaflet/dist/l10n/ui-it.json",
- "ja": "/loleaflet/dist/l10n/ui-ja.json",
- "jv": "/loleaflet/dist/l10n/ui-jv.json",
- "ka": "/loleaflet/dist/l10n/ui-ka.json",
- "kk": "/loleaflet/dist/l10n/ui-kk.json",
- "kl": "/loleaflet/dist/l10n/ui-kl.json",
- "km": "/loleaflet/dist/l10n/ui-km.json",
- "kn": "/loleaflet/dist/l10n/ui-kn.json",
- "kok": "/loleaflet/dist/l10n/ui-kok.json",
- "ko": "/loleaflet/dist/l10n/ui-ko.json",
- "ks": "/loleaflet/dist/l10n/ui-ks.json",
- "ky": "/loleaflet/dist/l10n/ui-ky.json",
- "lb": "/loleaflet/dist/l10n/ui-lb.json",
- "lo": "/loleaflet/dist/l10n/ui-lo.json",
- "lt": "/loleaflet/dist/l10n/ui-lt.json",
- "lv": "/loleaflet/dist/l10n/ui-lv.json",
- "mai": "/loleaflet/dist/l10n/ui-mai.json",
- "mk": "/loleaflet/dist/l10n/ui-mk.json",
- "ml": "/loleaflet/dist/l10n/ui-ml.json",
- "mni": "/loleaflet/dist/l10n/ui-mni.json",
- "mn": "/loleaflet/dist/l10n/ui-mn.json",
- "mr": "/loleaflet/dist/l10n/ui-mr.json",
- "my": "/loleaflet/dist/l10n/ui-my.json",
- "nb": "/loleaflet/dist/l10n/ui-nb.json",
- "ne": "/loleaflet/dist/l10n/ui-ne.json",
- "nl": "/loleaflet/dist/l10n/ui-nl.json",
- "nn": "/loleaflet/dist/l10n/ui-nn.json",
- "nr": "/loleaflet/dist/l10n/ui-nr.json",
- "nso": "/loleaflet/dist/l10n/ui-nso.json",
- "oc": "/loleaflet/dist/l10n/ui-oc.json",
- "om": "/loleaflet/dist/l10n/ui-om.json",
- "or": "/loleaflet/dist/l10n/ui-or.json",
- "pa-in": "/loleaflet/dist/l10n/ui-pa_IN.json",
- "pl": "/loleaflet/dist/l10n/ui-pl.json",
- "pt-br": "/loleaflet/dist/l10n/ui-pt_BR.json",
- "pt": "/loleaflet/dist/l10n/ui-pt.json",
- "ro": "/loleaflet/dist/l10n/ui-ro.json",
- "ru": "/loleaflet/dist/l10n/ui-ru.json",
- "rw": "/loleaflet/dist/l10n/ui-rw.json",
- "sah": "/loleaflet/dist/l10n/ui-sah.json",
- "sa": "/loleaflet/dist/l10n/ui-sa_IN.json",
- "sat": "/loleaflet/dist/l10n/ui-sat.json",
- "sd": "/loleaflet/dist/l10n/ui-sd.json",
- "sid": "/loleaflet/dist/l10n/ui-sid.json",
- "si": "/loleaflet/dist/l10n/ui-si.json",
- "sk": "/loleaflet/dist/l10n/ui-sk.json",
- "sl": "/loleaflet/dist/l10n/ui-sl.json",
- "sq": "/loleaflet/dist/l10n/ui-sq.json",
- "sr": "/loleaflet/dist/l10n/ui-sr.json",
- "ss": "/loleaflet/dist/l10n/ui-ss.json",
- "st": "/loleaflet/dist/l10n/ui-st.json",
- "sv": "/loleaflet/dist/l10n/ui-sv.json",
- "sw": "/loleaflet/dist/l10n/ui-sw_TZ.json",
- "ta": "/loleaflet/dist/l10n/ui-ta.json",
- "te": "/loleaflet/dist/l10n/ui-te.json",
- "tg": "/loleaflet/dist/l10n/ui-tg.json",
- "th": "/loleaflet/dist/l10n/ui-th.json",
- "ti": "/loleaflet/dist/l10n/ui-ti.json",
- "tn": "/loleaflet/dist/l10n/ui-tn.json",
- "tr": "/loleaflet/dist/l10n/ui-tr.json",
- "ts": "/loleaflet/dist/l10n/ui-ts.json",
- "tt": "/loleaflet/dist/l10n/ui-tt.json",
- "ug": "/loleaflet/dist/l10n/ui-ug.json",
- "uk": "/loleaflet/dist/l10n/ui-uk.json",
- "ur": "/loleaflet/dist/l10n/ui-ur.json",
- "uz": "/loleaflet/dist/l10n/ui-uz.json",
- "ve": "/loleaflet/dist/l10n/ui-ve.json",
- "vi": "/loleaflet/dist/l10n/ui-vi.json",
- "xh": "/loleaflet/dist/l10n/ui-xh.json",
- "zh-cn": "/loleaflet/dist/l10n/ui-zh_CN.json",
- "zh-tw": "/loleaflet/dist/l10n/ui-zh_TW.json",
- "zu": "/loleaflet/dist/l10n/ui-zu.json"
+ "ab": "../l10n/ui-ab.json",
+ "af": "../l10n/ui-af.json",
+ "am": "../l10n/ui-am.json",
+ "an": "../l10n/ui-an.json",
+ "ar": "../l10n/ui-ar.json",
+ "as": "../l10n/ui-as.json",
+ "ast": "../l10n/ui-ast.json",
+ "az": "../l10n/ui-az.json",
+ "be": "../l10n/ui-be.json",
+ "bg": "../l10n/ui-bg.json",
+ "bn-in": "../l10n/ui-bn_IN.json",
+ "bn": "../l10n/ui-bn.json",
+ "bo": "../l10n/ui-bo.json",
+ "br": "../l10n/ui-br.json",
+ "brx": "../l10n/ui-brx.json",
+ "bs": "../l10n/ui-bs.json",
+ "ca": "../l10n/ui-ca.json",
+ "cs": "../l10n/ui-cs.json",
+ "cy": "../l10n/ui-cy.json",
+ "da": "../l10n/ui-da.json",
+ "de": "../l10n/ui-de.json",
+ "dgo": "../l10n/ui-dgo.json",
+ "dsb": "../l10n/ui-dsb.json",
+ "dz": "../l10n/ui-dz.json",
+ "el": "../l10n/ui-el.json",
+ "en-gb": "../l10n/ui-en_GB.json",
+ "en-za": "../l10n/ui-en_ZA.json",
+ "eo": "../l10n/ui-eo.json",
+ "es": "../l10n/ui-es.json",
+ "et": "../l10n/ui-et.json",
+ "eu": "../l10n/ui-eu.json",
+ "fa": "../l10n/ui-fa.json",
+ "fi": "../l10n/ui-fi.json",
+ "fr": "../l10n/ui-fr.json",
+ "ga": "../l10n/ui-ga.json",
+ "gd": "../l10n/ui-gd.json",
+ "gl": "../l10n/ui-gl.json",
+ "gn": "../l10n/ui-gug.json",
+ "gu": "../l10n/ui-gu.json",
+ "he": "../l10n/ui-he.json",
+ "hi": "../l10n/ui-hi.json",
+ "hr": "../l10n/ui-hr.json",
+ "hsb": "../l10n/ui-hsb.json",
+ "hu": "../l10n/ui-hu.json",
+ "id": "../l10n/ui-id.json",
+ "is": "../l10n/ui-is.json",
+ "it": "../l10n/ui-it.json",
+ "ja": "../l10n/ui-ja.json",
+ "jv": "../l10n/ui-jv.json",
+ "ka": "../l10n/ui-ka.json",
+ "kk": "../l10n/ui-kk.json",
+ "kl": "../l10n/ui-kl.json",
+ "km": "../l10n/ui-km.json",
+ "kn": "../l10n/ui-kn.json",
+ "kok": "../l10n/ui-kok.json",
+ "ko": "../l10n/ui-ko.json",
+ "ks": "../l10n/ui-ks.json",
+ "ky": "../l10n/ui-ky.json",
+ "lb": "../l10n/ui-lb.json",
+ "lo": "../l10n/ui-lo.json",
+ "lt": "../l10n/ui-lt.json",
+ "lv": "../l10n/ui-lv.json",
+ "mai": "../l10n/ui-mai.json",
+ "mk": "../l10n/ui-mk.json",
+ "ml": "../l10n/ui-ml.json",
+ "mni": "../l10n/ui-mni.json",
+ "mn": "../l10n/ui-mn.json",
+ "mr": "../l10n/ui-mr.json",
+ "my": "../l10n/ui-my.json",
+ "nb": "../l10n/ui-nb.json",
+ "ne": "../l10n/ui-ne.json",
+ "nl": "../l10n/ui-nl.json",
+ "nn": "../l10n/ui-nn.json",
+ "nr": "../l10n/ui-nr.json",
+ "nso": "../l10n/ui-nso.json",
+ "oc": "../l10n/ui-oc.json",
+ "om": "../l10n/ui-om.json",
+ "or": "../l10n/ui-or.json",
+ "pa-in": "../l10n/ui-pa_IN.json",
+ "pl": "../l10n/ui-pl.json",
+ "pt-br": "../l10n/ui-pt_BR.json",
+ "pt": "../l10n/ui-pt.json",
+ "ro": "../l10n/ui-ro.json",
+ "ru": "../l10n/ui-ru.json",
+ "rw": "../l10n/ui-rw.json",
+ "sah": "../l10n/ui-sah.json",
+ "sa": "../l10n/ui-sa_IN.json",
+ "sat": "../l10n/ui-sat.json",
+ "sd": "../l10n/ui-sd.json",
+ "sid": "../l10n/ui-sid.json",
+ "si": "../l10n/ui-si.json",
+ "sk": "../l10n/ui-sk.json",
+ "sl": "../l10n/ui-sl.json",
+ "sq": "../l10n/ui-sq.json",
+ "sr": "../l10n/ui-sr.json",
+ "ss": "../l10n/ui-ss.json",
+ "st": "../l10n/ui-st.json",
+ "sv": "../l10n/ui-sv.json",
+ "sw": "../l10n/ui-sw_TZ.json",
+ "ta": "../l10n/ui-ta.json",
+ "te": "../l10n/ui-te.json",
+ "tg": "../l10n/ui-tg.json",
+ "th": "../l10n/ui-th.json",
+ "ti": "../l10n/ui-ti.json",
+ "tn": "../l10n/ui-tn.json",
+ "tr": "../l10n/ui-tr.json",
+ "ts": "../l10n/ui-ts.json",
+ "tt": "../l10n/ui-tt.json",
+ "ug": "../l10n/ui-ug.json",
+ "uk": "../l10n/ui-uk.json",
+ "ur": "../l10n/ui-ur.json",
+ "uz": "../l10n/ui-uz.json",
+ "ve": "../l10n/ui-ve.json",
+ "vi": "../l10n/ui-vi.json",
+ "xh": "../l10n/ui-xh.json",
+ "zh-cn": "../l10n/ui-zh_CN.json",
+ "zh-tw": "../l10n/ui-zh_TW.json",
+ "zu": "../l10n/ui-zu.json"
}
commit c5259eb7b642a945d61266d61c0e9420d0f71748
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Sep 7 22:56:09 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Sat Sep 8 00:12:20 2018 +0200
ServiceRoot: Add the serviceRoot to various html and js files.
Change-Id: Ibd9093afa3d1f014c70328446ee42189dd0c2117
diff --git a/loleaflet/admin/admin.html b/loleaflet/admin/admin.html
index f23d510ca..a076a1749 100644
--- a/loleaflet/admin/admin.html
+++ b/loleaflet/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/admin/adminAnalytics.html b/loleaflet/admin/adminAnalytics.html
index 1e801fcb1..7f52c080f 100644
--- a/loleaflet/admin/adminAnalytics.html
+++ b/loleaflet/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/admin/adminHistory.html b/loleaflet/admin/adminHistory.html
index 4752f8a07..60ad593d3 100644
--- a/loleaflet/admin/adminHistory.html
+++ b/loleaflet/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/admin/adminSettings.html b/loleaflet/admin/adminSettings.html
index c7b21879d..8cf1e33c5 100644
--- a/loleaflet/admin/adminSettings.html
+++ b/loleaflet/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/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/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index fc5424f74..dc1ec0c1a 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -123,6 +123,7 @@ ifelse(IOSAPP,[true],
<script>
ifelse(IOSAPP,[true],
[window.host = '';
+ window.serviceRoot = '';
window.accessToken = '';
window.accessTokenTTL = '';
window.accessHeader = '';
@@ -130,6 +131,7 @@ ifelse(IOSAPP,[true],
window.outOfFocusTimeoutSecs = 1000000;
window.idleTimeoutSecs = 1000000;],
[window.host = '%HOST%';
+ window.serviceRoot = '%SERVICE_ROOT%';
window.accessToken = '%ACCESS_TOKEN%';
window.accessTokenTTL = '%ACCESS_TOKEN_TTL%';
window.accessHeader = '%ACCESS_HEADER%';
diff --git a/loleaflet/js/main.js b/loleaflet/js/main.js
index 4f14a26bd..3ff8edf5d 100644
--- a/loleaflet/js/main.js
+++ b/loleaflet/js/main.js
@@ -1,6 +1,6 @@
/* -*- js-indent-level: 8 -*- */
/* global errorMessages getParameterByName accessToken accessTokenTTL accessHeader vex host */
-/* global idleTimeoutSecs outOfFocusTimeoutSecs setupToolbar*/
+/* global serviceRoot idleTimeoutSecs outOfFocusTimeoutSecs setupToolbar*/
/*eslint indent: [error, "tab", { "outerIIFEBody": 0 }]*/
(function (global) {
@@ -52,6 +52,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 cd6744f08..23be707b2 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -68,7 +68,7 @@ L.Socket = L.Class.extend({
}
try {
- 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;
this.socket = new WebSocket(websocketURI);
} catch (e) {
// On IE 11 there is a limitation on the number of WebSockets open to a single domain (6 by default and can go to 128).
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 37e2467bf..116a316c4 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -557,7 +557,7 @@ L.TileLayer = L.GridLayer.extend({
if (this._map.options.wopiSrc != '') {
wopiSrc = '?WOPISrc=' + this._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 9ffd81aca..028ea4649 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -21,7 +21,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 adfed287e..9390299ec 100644
--- a/loleaflet/src/map/handler/Map.SlideShow.js
+++ b/loleaflet/src/map/handler/Map.SlideShow.js
@@ -25,7 +25,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 131ed8f46..a508c4f15 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -815,6 +815,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");
commit 9d07230f8af61712dc5bb7ff11ea2d4877556767
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Sep 7 00:25:50 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Sat Sep 8 00:12:15 2018 +0200
ServiceRoot: Allow prefixing all the URI paths with a given prefix.
For instances that has to run in a deeper path like
https://server/something/blah/loleaflet/HASH/loleaflet.html.
Change-Id: Idacdaf9087d682fd527c3af2ea45d6b51a33908e
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index 2ae7c4a49..fc5424f74 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -35,9 +35,9 @@ ifelse(IOSAPP,[true],
[<link rel="stylesheet" href="bundle.css" />
]),
ifelse(DEBUG,[true],
- foreachq([fileCSS],[LOLEAFLET_CSS],[<link rel="stylesheet" href="/loleaflet/%VERSION%/fileCSS" />
+ foreachq([fileCSS],[LOLEAFLET_CSS],[<link rel="stylesheet" href="%SERVICE_ROOT%/loleaflet/%VERSION%/fileCSS" />
]),
- [<link rel="stylesheet" href="/loleaflet/%VERSION%/bundle.css" />
+ [<link rel="stylesheet" href="%SERVICE_ROOT%/loleaflet/%VERSION%/bundle.css" />
])dnl
)dnl
<!--%BRANDING_CSS%--> <!-- add your logo here -->
@@ -46,10 +46,10 @@ ifelse(IOSAPP,[true],
<link rel="localizations" href="l10n/locore-localizations.json" type="application/vnd.oftn.l10n+json"/>
<link rel="localizations" href="l10n/help-localizations.json" type="application/vnd.oftn.l10n+json"/>
<link rel="localizations" href="l10n/uno-localizations.json" type="application/vnd.oftn.l10n+json"/>],
- [<link rel="localizations" href="/loleaflet/%VERSION%/l10n/localizations.json" type="application/vnd.oftn.l10n+json"/>
- <link rel="localizations" href="/loleaflet/%VERSION%/l10n/locore-localizations.json" type="application/vnd.oftn.l10n+json"/>
- <link rel="localizations" href="/loleaflet/%VERSION%/l10n/help-localizations.json" type="application/vnd.oftn.l10n+json"/>
- <link rel="localizations" href="/loleaflet/%VERSION%/l10n/uno-localizations.json" type="application/vnd.oftn.l10n+json"/>]
+ [<link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/localizations.json" type="application/vnd.oftn.l10n+json"/>
+ <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/locore-localizations.json" type="application/vnd.oftn.l10n+json"/>
+ <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/help-localizations.json" type="application/vnd.oftn.l10n+json"/>
+ <link rel="localizations" href="%SERVICE_ROOT%/loleaflet/%VERSION%/l10n/uno-localizations.json" type="application/vnd.oftn.l10n+json"/>]
)dnl
</head>
@@ -151,9 +151,9 @@ ifelse(IOSAPP,[true],
[ <script src="bundle.js"></script>
]),
ifelse(DEBUG,[true],foreachq([fileJS],[LOLEAFLET_JS],
- [ <script src="/loleaflet/%VERSION%/fileJS"></script>
+ [ <script src="%SERVICE_ROOT%/loleaflet/%VERSION%/fileJS"></script>
]),
- [ <script src="/loleaflet/%VERSION%/bundle.js"></script>
+ [ <script src="%SERVICE_ROOT%/loleaflet/%VERSION%/bundle.js"></script>
])
)dnl
<!--%BRANDING_JS%--> <!-- logo onclick handler -->
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 1c0268999..e626b98f1 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -64,6 +64,7 @@
<net desc="Network settings">
<proto type="string" default="all" desc="Protocol to use IPv4, IPv6 or all for both">all</proto>
+ <service_root type="path" default="" desc="Prefix all the pages, websockets, etc. with this path."></service_root>
<post_allow desc="Allow/deny client IP address for POST(REST)." allow="true">
<host desc="The IPv4 private 192.168 block as plain IPv4 dotted decimal addresses.">192\.168\.[0-9]{1,3}\.[0-9]{1,3}</host>
<host desc="Ditto, but as IPv4-mapped IPv6 addresses">::ffff:192\.168\.[0-9]{1,3}\.[0-9]{1,3}</host>
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 2abc2c0f8..131ed8f46 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -617,6 +617,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
Poco::replaceInPlace(preprocess, std::string("%ACCESS_HEADER%"), escapedAccessHeader);
Poco::replaceInPlace(preprocess, std::string("%HOST%"), host);
Poco::replaceInPlace(preprocess, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH));
+ Poco::replaceInPlace(preprocess, std::string("%SERVICE_ROOT%"), LOOLWSD::ServiceRoot);
static const std::string linkCSS("<link rel=\"stylesheet\" href=\"/loleaflet/" LOOLWSD_VERSION_HASH "/%s.css\">");
static const std::string scriptJS("<script src=\"/loleaflet/" LOOLWSD_VERSION_HASH "/%s.js\"></script>");
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 7d1436897..7723adb5a 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -548,6 +548,7 @@ inline std::string getLaunchURI(const std::string &document)
std::ostringstream oss;
oss << getLaunchBase("");
+ oss << LOOLWSD::ServiceRoot;
oss << LOOLWSD_TEST_LOLEAFLET_UI;
oss << "?file_path=file://";
oss << DEBUG_ABSSRCDIR "/";
@@ -592,6 +593,7 @@ std::string LOOLWSD::LoTemplate;
std::string LOOLWSD::ChildRoot;
std::string LOOLWSD::ServerName;
std::string LOOLWSD::FileServerRoot;
+std::string LOOLWSD::ServiceRoot;
std::string LOOLWSD::LOKitVersion;
std::string LOOLWSD::ConfigFile = LOOLWSD_CONFIGDIR "/loolwsd.xml";
std::string LOOLWSD::ConfigDir = LOOLWSD_CONFIGDIR "/conf.d";
@@ -690,6 +692,7 @@ void LOOLWSD::initialize(Application& self)
{ "logging.level", "trace" },
{ "loleaflet_logging", "false" },
{ "net.proto", "all" },
+ { "net.service_root", "" },
{ "ssl.enable", "true" },
{ "ssl.termination", "true" },
{ "ssl.cert_file_path", LOOLWSD_CONFIGDIR "/cert.pem" },
@@ -822,6 +825,11 @@ void LOOLWSD::initialize(Application& self)
LOG_WRN("Invalid protocol: " << proto);
}
+ // Prefix for the loolwsd pages; should not end with a '/'
+ ServiceRoot = getPathFromConfig("net.service_root");
+ while (ServiceRoot.length() > 0 && ServiceRoot[ServiceRoot.length() - 1] == '/')
+ ServiceRoot.pop_back();
+
#if ENABLE_SSL
LOOLWSD::SSLEnabled.set(getConfigValue<bool>(conf, "ssl.enable", true));
#else
@@ -1791,6 +1799,13 @@ private:
try
{
+ // Check and remove the ServiceRoot from the request.getURI()
+ if (!Util::startsWith(request.getURI(), LOOLWSD::ServiceRoot))
+ throw BadRequestException("The request does not start with prefix: " + LOOLWSD::ServiceRoot);
+
+ std::string requestURIString(request.getURI().substr(LOOLWSD::ServiceRoot.length()));
+ request.setURI(requestURIString);
+
// Routing
Poco::URI requestUri(request.getURI());
std::vector<std::string> reqPathSegs;
@@ -2424,6 +2439,7 @@ private:
const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html");
const std::string uriValue = ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://")
+ std::string("%SERVER_HOST%")
+ + LOOLWSD::ServiceRoot
+ "/loleaflet/" LOOLWSD_VERSION_HASH "/" + loleafletHtml + '?';
InputSource inputSrc(discoveryPath);
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 3ec79c867..90cc932e5 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -57,6 +57,7 @@ public:
static std::string ChildRoot;
static std::string ServerName;
static std::string FileServerRoot;
+ static std::string ServiceRoot; ///< There are installations that need prefixing every page with some path.
static std::string LOKitVersion;
static std::string LogLevel;
static std::atomic<unsigned> NumConnections;
More information about the Libreoffice-commits
mailing list