theme: use integration theme value from the interation message

problem:
till now we used values from DOM elements which were unreliable,
sometimes they are not discoverable due to nested iframs.
That threw some 404 due to incorrect theming path.

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ibc291ce9f64db799095e1edcb14c598bdd085de7
This commit is contained in:
Pranam Lashkari 2023-07-21 22:49:17 +07:00 committed by pedropintosilva
parent f84835b0c6
commit fb5909bc40
2 changed files with 3 additions and 2 deletions

View file

@ -407,7 +407,7 @@ var brandingLink = document.createElement('link');
brandingLink.setAttribute("rel", "stylesheet");
brandingLink.setAttribute("type", "text/css");
var theme_name = document.getElementsByName("theme")[[0]] ? document.getElementsByName("theme")[[0]].value : '';
var theme_name = '%BRANDING_THEME%';
var theme_prefix = '';
if(window.useIntegrationTheme === 'true' && theme_name !== '') {
theme_prefix = theme_name + '/';

View file

@ -920,7 +920,8 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
Poco::replaceInPlace(preprocess, std::string("%COOLWSD_VERSION%"), std::string(COOLWSD_VERSION));
Poco::replaceInPlace(preprocess, std::string("%SERVICE_ROOT%"), responseRoot);
Poco::replaceInPlace(preprocess, std::string("%UI_DEFAULTS%"), uiDefaultsToJSON(uiDefaults, userInterfaceMode, userInterfaceTheme));
Poco::replaceInPlace(preprocess, std::string("%UI_THEME%"), userInterfaceTheme);
Poco::replaceInPlace(preprocess, std::string("%UI_THEME%"), userInterfaceTheme); // UI_THEME refers to light or dark theme
Poco::replaceInPlace(preprocess, std::string("%BRANDING_THEME%"), theme);
Poco::replaceInPlace(preprocess, std::string("%POSTMESSAGE_ORIGIN%"), escapedPostmessageOrigin);
Poco::replaceInPlace(preprocess, std::string("%CHECK_FILE_INFO_OVERRIDE%"),
checkFileInfoToJSON(checkfileinfo_override));