summaryrefslogtreecommitdiffstats
path: root/wsd/FileServer.cpp
diff options
context:
space:
mode:
authorgokaysatir <gokaysatir@collabora.com>2020-06-04 01:36:46 +0300
committerAndras Timar <andras.timar@collabora.com>2020-06-04 12:56:16 +0200
commit5f07429b6b8a61e97b9056027a1ab95be2c5eb7d (patch)
treef2a090193e8ada6731227830eb834ce976453b7f /wsd/FileServer.cpp
parentleaflet: update jquery-ui package with lightness them. (diff)
downloadonline-5f07429b6b8a61e97b9056027a1ab95be2c5eb7d.tar.gz
online-5f07429b6b8a61e97b9056027a1ab95be2c5eb7d.zip
leaflet: Update admin console & drop bootstrap package.
Change-Id: I9243393693c2464f2e9a4d24cccf9c5f3415e2ef Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95468 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'wsd/FileServer.cpp')
-rw-r--r--wsd/FileServer.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index a298adb6c4..61280901fc 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -933,11 +933,21 @@ void FileServerRequestHandler::preprocessAdminFile(const HTTPRequest& request,
std::string responseRoot = cnxDetails.getResponseRoot();
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 &nbsp;&nbsp;<strong>Expiry Date:</strong> %s</div>");
+ static const std::string footerPage("<footer class=\"footer has-text-centered\"><strong>Key:</strong> %s &nbsp;&nbsp;<strong>Expiry Date:</strong> %s</footer>");
const std::string relPath = getRequestPathname(request);
LOG_DBG("Preprocessing file: " << relPath);
std::string adminFile = *getUncompressedFile(relPath);
+ std::vector<std::string> templatePath_vec = Util::splitStringToVector(relPath, '/');
+ std::string templatePath = "";
+ for (unsigned int i = 0; i < templatePath_vec.size() - 1; i++)
+ {
+ templatePath += templatePath_vec[i] + "/";
+ }
+ templatePath = "/" + templatePath + "admintemplate.html";
+ std::string templateFile = *getUncompressedFile(templatePath);
+ Poco::replaceInPlace(templateFile, std::string("<!--%MAIN_CONTENT%-->"), adminFile); // Now template has the main content..
+
std::string brandJS(Poco::format(scriptJS, responseRoot, std::string(BRANDING)));
std::string brandFooter;
@@ -953,10 +963,10 @@ void FileServerRequestHandler::preprocessAdminFile(const HTTPRequest& request,
}
#endif
- 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%"), responseRoot);
+ Poco::replaceInPlace(templateFile, std::string("<!--%BRANDING_JS%-->"), brandJS);
+ Poco::replaceInPlace(templateFile, std::string("<!--%FOOTER%-->"), brandFooter);
+ Poco::replaceInPlace(templateFile, std::string("%VERSION%"), std::string(LOOLWSD_VERSION_HASH));
+ Poco::replaceInPlace(templateFile, std::string("%SERVICE_ROOT%"), responseRoot);
// Ask UAs to block if they detect any XSS attempt
response.add("X-XSS-Protection", "1; mode=block");
@@ -971,7 +981,7 @@ void FileServerRequestHandler::preprocessAdminFile(const HTTPRequest& request,
std::ostringstream oss;
response.write(oss);
- oss << adminFile;
+ oss << templateFile;
socket->send(oss.str());
}