Skip to content

Commit b752a47

Browse files
committed
make theme specifying possible through richdocuments
Signed-off-by: Pranam Lashkari <[email protected]> Change-Id: I3e6e837464069330975cb377ec0126c5d61477ef
1 parent a3f378e commit b752a47

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

wsd/FileServer.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,9 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
674674
LOG_TRC("css_variables=" << cssVars);
675675
const std::string postMessageOrigin = form.get("postmessage_origin", "");
676676
LOG_TRC("postmessage_origin" << postMessageOrigin);
677+
const std::string theme = form.get("theme", "");
678+
LOG_TRC("theme=" << theme);
679+
677680
// Escape bad characters in access token.
678681
// This is placed directly in javascript in loleaflet.html, we need to make sure
679682
// that no one can do anything nasty with their clever inputs.
@@ -729,8 +732,9 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
729732
LOOLWSD::getConfigValue<bool>("hexify_embedded_urls", false) ? "true" : "false";
730733
Poco::replaceInPlace(preprocess, std::string("%HEXIFY_URL%"), hexifyEmbeddedUrls);
731734

732-
static const std::string linkCSS("<link rel=\"stylesheet\" href=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.css\">");
733-
static const std::string scriptJS("<script src=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/%s.js\"></script>");
735+
std::string themePreFix = (theme == "nextcloud") ? theme + "/" : "";
736+
static const std::string linkCSS("<link rel=\"stylesheet\" href=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/" + themePreFix + "%s.css\">");
737+
static const std::string scriptJS("<script src=\"%s/loleaflet/" LOOLWSD_VERSION_HASH "/" + themePreFix+ "%s.js\"></script>");
734738

735739
std::string brandCSS(Poco::format(linkCSS, responseRoot, std::string(BRANDING)));
736740
std::string brandJS(Poco::format(scriptJS, responseRoot, std::string(BRANDING)));

0 commit comments

Comments
 (0)