Add home mode option - enabling more configurability for CODE.

Requested by several users and partners - defaults to off/un-changed.
When set it allows optional disabling of welcome/feedback when used
in a homely environment.

Also bump default max doc/conneciton limits in configure to 10k.

Change-Id: I3c917901e02445d45f6f86b554d47a60aa4e575d
Signed-off-by: Henry Castro <hcastro@collabora.com>
pull/5104/head
Henry Castro 2022-06-29 09:46:01 -04:00
parent e1c951982a
commit ed096f2df3
7 changed files with 53 additions and 15 deletions

View File

@ -303,6 +303,8 @@ m4_ifelse(MOBILEAPP,[true],
window.postMessageOriginExt = '';
window.coolLogging = 'true';
window.enableWelcomeMessage = false;
window.autoShowWelcome = false;
window.autoShowFeedback = true;
window.outOfFocusTimeoutSecs = 1000000;
window.idleTimeoutSecs = 1000000;
window.protocolDebug = false;
@ -322,6 +324,8 @@ m4_ifelse(MOBILEAPP,[true],
window.coolLogging = '%BROWSER_LOGGING%';
window.coolwsdVersion = '%COOLWSD_VERSION%';
window.enableWelcomeMessage = %ENABLE_WELCOME_MSG%;
window.autoShowWelcome = %AUTO_SHOW_WELCOME%;
window.autoShowFeedback = %AUTO_SHOW_FEEDBACK%;
window.userInterfaceMode = '%USER_INTERFACE_MODE%';
window.useIntegrationTheme = '%USE_INTEGRATION_THEME%';
window.enableMacrosExecution = '%ENABLE_MACROS_EXECUTION%';

View File

@ -59,7 +59,7 @@ L.Map.Feedback = L.Handler.extend({
laterDate.setTime(timeValue + 432000000);
}
if (docCount > 15 && currentDate > laterDate)
if (docCount > 15 && currentDate > laterDate && window.autoShowFeedback)
setTimeout(L.bind(this.onFeedback, this), this._map.options.feedbackTimeout);
}
},

View File

@ -38,7 +38,7 @@ L.Map.Welcome = L.Handler.extend({
var isGuest = viewInfo && viewInfo.userextrainfo &&
viewInfo.userextrainfo.is_guest;
if (!isGuest && this.shouldWelcome()) {
if (!isGuest && window.autoShowWelcome && this.shouldWelcome()) {
this.showWelcomeDialog();
}
},

View File

@ -776,7 +776,7 @@ fi
AC_SUBST(ENABLE_GTKAPP)
AM_CONDITIONAL([ENABLE_GTKAPP], [test "$ENABLE_GTKAPP" = "true"])
MAX_CONNECTIONS=20
MAX_CONNECTIONS=9999
AS_IF([test -n "$with_max_connections" && test "$with_max_connections" -gt "0"],
[MAX_CONNECTIONS="$with_max_connections"])
AS_IF([test "$MAX_CONNECTIONS" -lt "3"],
@ -784,7 +784,7 @@ AS_IF([test "$MAX_CONNECTIONS" -lt "3"],
AC_DEFINE_UNQUOTED([MAX_CONNECTIONS],[$MAX_CONNECTIONS],[Limit the maximum number of open connections])
AC_SUBST(MAX_CONNECTIONS)
MAX_DOCUMENTS=10
MAX_DOCUMENTS=9999
AS_IF([test -n "$with_max_documents" && test "$with_max_documents" -gt "0"],
[MAX_DOCUMENTS="$with_max_documents"])
AS_IF([test "$MAX_DOCUMENTS" -gt "$MAX_CONNECTIONS"],

View File

@ -248,6 +248,10 @@
<url desc="URL of optional JSON file that lists fonts to be included in Online" type="string" default=""></url>
</remote_font_config>
<home_mode>
<enable desc="Enable more configuration options for home users" type="bool" default="false">false</enable>
</home_mode>
@LOCK_CONFIGURATION@
@FEATURE_RESTRICTION_CONFIGURATION@

View File

@ -1937,6 +1937,8 @@ void COOLWSD::innerInitialize(Application& self)
{ "trace.path[@snapshot]", "false" },
{ "trace[@enable]", "false" },
{ "welcome.enable", "false" },
{ "home_mode.enable", "false" },
{ "feedback.show", "true" },
#ifdef ENABLE_FEATURE_LOCK
{ "feature_lock.locked_hosts[@allow]", "false"},
{ "feature_lock.locked_hosts.fallback[@read_only]", "false"},
@ -2317,10 +2319,6 @@ void COOLWSD::innerInitialize(Application& self)
Quarantine::createQuarantineMap();
}
#if ENABLE_WELCOME_MESSAGE
conf.setString("welcome.enable", "true");
#endif
NumPreSpawnedChildren = getConfigValue<int>(conf, "num_prespawn_children", 1);
if (NumPreSpawnedChildren < 1)
{
@ -2350,8 +2348,25 @@ void COOLWSD::innerInitialize(Application& self)
setenv("SAL_DISABLE_OPENCL", "true", 1);
// Log the connection and document limits.
COOLWSD::MaxConnections = MAX_CONNECTIONS;
COOLWSD::MaxDocuments = MAX_DOCUMENTS;
#if ENABLE_WELCOME_MESSAGE
if (getConfigValue<bool>(conf, "home_mode.enable", false))
{
COOLWSD::MaxConnections = 20;
COOLWSD::MaxDocuments = 10;
}
else
{
conf.setString("feedback.show", "true");
conf.setString("welcome.enable", "true");
COOLWSD::MaxConnections = MAX_CONNECTIONS;
COOLWSD::MaxDocuments = MAX_DOCUMENTS;
}
#else
{
COOLWSD::MaxConnections = MAX_CONNECTIONS;
COOLWSD::MaxDocuments = MAX_DOCUMENTS;
}
#endif
#if !MOBILEAPP
NoSeccomp = !getConfigValue<bool>(conf, "security.seccomp", true);

View File

@ -997,13 +997,20 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
const unsigned int idleTimeoutSecs = config.getUInt("per_view.idle_timeout_secs", 900);
Poco::replaceInPlace(preprocess, std::string("%IDLE_TIMEOUT_SECS%"), std::to_string(idleTimeoutSecs));
#if ENABLE_WELCOME_MESSAGE
std::string enableWelcomeMessage = "true";
#else // configurable
std::string enableWelcomeMessage = stringifyBoolFromConfig(config, "welcome.enable", false);
#endif
#if ENABLE_WELCOME_MESSAGE
std::string enableWelcomeMessage = "true";
std::string autoShowWelcome = "true";
if (config.getBool("home_mode.enable", false))
{
autoShowWelcome = stringifyBoolFromConfig(config, "welcome.enable", false);
}
#else // configurable
std::string enableWelcomeMessage = stringifyBoolFromConfig(config, "welcome.enable", false);
std::string autoShowWelcome = stringifyBoolFromConfig(config, "welcome.enable", false);
#endif
Poco::replaceInPlace(preprocess, std::string("%ENABLE_WELCOME_MSG%"), enableWelcomeMessage);
Poco::replaceInPlace(preprocess, std::string("%AUTO_SHOW_WELCOME%"), autoShowWelcome);
// the config value of 'notebookbar/tabbed' or 'classic/compact' overrides the UIMode
// from the WOPI
@ -1035,6 +1042,14 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request,
std::string enableMacrosExecution = stringifyBoolFromConfig(config, "security.enable_macros_execution", false);
Poco::replaceInPlace(preprocess, std::string("%ENABLE_MACROS_EXECUTION%"), enableMacrosExecution);
if (!config.getBool("feedback.show", true) && config.getBool("home_mode.enable", false))
{
Poco::replaceInPlace(preprocess, std::string("%AUTO_SHOW_FEEDBACK%"), (std::string)"false");
}
else
{
Poco::replaceInPlace(preprocess, std::string("%AUTO_SHOW_FEEDBACK%"), (std::string)"true");
}
Poco::replaceInPlace(preprocess, std::string("%FEEDBACK_URL%"), std::string(FEEDBACK_URL));
Poco::replaceInPlace(preprocess, std::string("%WELCOME_URL%"), std::string(WELCOME_URL));