From d38313ab24ef75de45b7647c5ebc54cfbd79409d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Mon, 27 Jan 2025 16:46:09 +0100 Subject: [PATCH] Add xml parameters brandProductName and brandproductURL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In user_interface section. Signed-off-by: Méven Car Change-Id: If5033a3221de985cf82eace8dc7c28fec220c419 --- browser/html/cool.html.m4 | 3 +++ browser/js/global.js | 3 +++ browser/src/control/Control.AboutDialog.ts | 4 ++-- configure.ac | 5 +++++ coolwsd.xml.in | 3 +++ wsd/FileServer.cpp | 5 +++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/browser/html/cool.html.m4 b/browser/html/cool.html.m4 index 4ab070585d2f2..824b3a2171a4b 100644 --- a/browser/html/cool.html.m4 +++ b/browser/html/cool.html.m4 @@ -47,6 +47,9 @@ m4_ifelse(MOBILEAPP, [true], ] ) + + + diff --git a/browser/js/global.js b/browser/js/global.js index e759eb86f67f7..5e3c85a6d2e25 100644 --- a/browser/js/global.js +++ b/browser/js/global.js @@ -281,6 +281,9 @@ class InitializerBase { document.getElementById('content-keeper').remove(); }, false); + window.brandProductName = document.getElementById("init-product-branding-name").value; + window.brandProductURL = document.getElementById("init-product-branding-url").value; + this.initiateCoolParams(); } diff --git a/browser/src/control/Control.AboutDialog.ts b/browser/src/control/Control.AboutDialog.ts index 3e5d35cfe1cf6..b92477b971181 100644 --- a/browser/src/control/Control.AboutDialog.ts +++ b/browser/src/control/Control.AboutDialog.ts @@ -87,12 +87,12 @@ class AboutDialog { productName = windowAny.MobileAppName; } else { productName = - typeof brandProductName !== 'undefined' + typeof brandProductName === 'string' && brandProductName.length > 0 ? brandProductName : 'Collabora Online Development Edition (unbranded)'; } var productURL = - typeof brandProductURL !== 'undefined' + typeof brandProductURL === 'string' && brandProductURL.length > 0 ? brandProductURL : 'https://collaboraonline.github.io/'; diff --git a/configure.ac b/configure.ac index 0b0d267727a74..33e9485c27b65 100644 --- a/configure.ac +++ b/configure.ac @@ -989,6 +989,7 @@ WELCOME_CONFIG_FRAGMENT= HOME_MODE_CONFIGURATION= ENABLE_WELCOME_MESSAGE=0 WELCOME_URL= +CONFIG_INTERFACE_FRAGMENT= if test -n "$with_welcome_url"; then WELCOME_URL=$with_welcome_url ENABLE_WELCOME_MESSAGE=1 @@ -999,12 +1000,16 @@ else WELCOME_CONFIG_FRAGMENT=" false " + CONFIG_INTERFACE_FRAGMENT=" + https://www.collaboraonline.com" fi AC_SUBST([WELCOME_CONFIG_FRAGMENT]) AM_SUBST_NOTMAKE(WELCOME_CONFIG_FRAGMENT) AC_SUBST([HOME_MODE_CONFIGURATION]) AM_SUBST_NOTMAKE(HOME_MODE_CONFIGURATION) +AC_SUBST([CONFIG_INTERFACE_FRAGMENT]) +AM_SUBST_NOTMAKE(CONFIG_INTERFACE_FRAGMENT) AC_DEFINE_UNQUOTED([ENABLE_WELCOME_MESSAGE],$ENABLE_WELCOME_MESSAGE,[Should the Release notes message be shown on upgrade]) AM_CONDITIONAL([ENABLE_WELCOME_MESSAGE], [test "$ENABLE_WELCOME_MESSAGE" = "1"]) AC_DEFINE_UNQUOTED([WELCOME_URL],["$WELCOME_URL"],[The welcome url of the build.]) diff --git a/coolwsd.xml.in b/coolwsd.xml.in index 238500e622fc8..95842fbbf5475 100644 --- a/coolwsd.xml.in +++ b/coolwsd.xml.in @@ -259,6 +259,9 @@ default true true + + @CONFIG_INTERFACE_FRAGMENT@ + diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp index c75c35cff1f6b..c7043504caf77 100644 --- a/wsd/FileServer.cpp +++ b/wsd/FileServer.cpp @@ -1718,6 +1718,11 @@ FileServerRequestHandler::ResourceAccessDetails FileServerRequestHandler::prepro #else // configurable std::string enableWelcomeMessage = stringifyBoolFromConfig(config, "welcome.enable", false); std::string autoShowWelcome = stringifyBoolFromConfig(config, "welcome.enable", false); + + std::string brandProductURL = ConfigUtil::getConfigValue(config, "user_interface.brandProductURL", ""); + std::string brandProductName = ConfigUtil::getConfigValue(config, "user_interface.brandProductName", ""); + Poco::replaceInPlace(preprocess, std::string("%PRODUCT_BRANDING_NAME%"), brandProductName); + Poco::replaceInPlace(preprocess, std::string("%PRODUCT_BRANDING_URL%"), brandProductURL); #endif Poco::replaceInPlace(preprocess, std::string("%ENABLE_WELCOME_MSG%"), enableWelcomeMessage);