diff --git a/common/Common.hpp b/common/Common.hpp index 4eb5cf75cfb1..ee7d3751a990 100644 --- a/common/Common.hpp +++ b/common/Common.hpp @@ -77,8 +77,11 @@ constexpr const char UPLOADING_SUFFIX[] = "ing"; /// The HTTP response Server. Used only in Responses. #define HTTP_SERVER_STRING "COOLWSD HTTP Server " COOLWSD_VERSION -// The client port number, both coolwsd and the kits have this. +/// The client port number, both coolwsd and the kits have this. extern int ClientPortNumber; extern std::string MasterLocation; +/// Controls whether experimental features/behavior is enabled or not. +extern bool EnableExperimental; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/common/Unit.cpp b/common/Unit.cpp index cd1a697f6e15..d2736fa3c807 100644 --- a/common/Unit.cpp +++ b/common/Unit.cpp @@ -33,6 +33,9 @@ static std::thread TimeoutThread; static std::atomic TimeoutThreadRunning(false); std::timed_mutex TimeoutThreadMutex; +/// Controls whether experimental features/behavior is enabled or not. +bool EnableExperimental = false; + UnitBase *UnitBase::linkAndCreateUnit(UnitType type, const std::string &unitLibPath) { #if !MOBILEAPP diff --git a/configure.ac b/configure.ac index e7572f3d8222..42da39077d49 100644 --- a/configure.ac +++ b/configure.ac @@ -352,6 +352,10 @@ AC_ARG_ENABLE([feature-restriction], AS_HELP_STRING([--enable-feature-restriction], [Enable control over which uno-commands/feature to disable completely.])) +AC_ARG_ENABLE([experimental], + AS_HELP_STRING([--enable-experimental], + [Enable experimental features and behavior])) + # Handle options AS_IF([test "$enable_debug" = yes -a -n "$with_poco_libs"], @@ -369,6 +373,8 @@ COOLWSD_ANONYMIZE_USER_DATA=false BROWSER_LOGGING="false" debug_msg="secure mode: product build" anonym_msg="" +ENABLE_EXPERIMENTAL=false +experimental_msg="disabled by default" bundle_msg="using uglified bundled JS and CSS" LOK_LOG_ASSERTIONS=0 log_asserts_msg="disabled" @@ -443,6 +449,12 @@ if test -z "$anonym_msg"; then anonym_msg="anonymization of user-data is disabled" fi +if test "$enable_experimental" = "yes" ; then + ENABLE_EXPERIMENTAL=true + experimental_msg="enabled by default" +fi +AC_SUBST(ENABLE_EXPERIMENTAL) + # macOS: When configuring for building the app itself, on macOS, we need these. # But not when just configuring for building the JS on Linux, for copying over # to the Mac. @@ -1531,6 +1543,7 @@ Configuration: LO integration tests ${lo_msg} SSL support $ssl_msg Debug & low security $debug_msg + Experimental features $experimental_msg Test assertion logging $log_asserts_msg Uglification and bundling $bundle_msg Anonymization $anonym_msg diff --git a/coolwsd.xml.in b/coolwsd.xml.in index e198f5ece8a9..a2056d68eb2f 100644 --- a/coolwsd.xml.in +++ b/coolwsd.xml.in @@ -16,6 +16,7 @@ + @ENABLE_EXPERIMENTAL@ 1 diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp index c8edb7abfbf7..ccafb7b6f671 100644 --- a/kit/ForKit.cpp +++ b/kit/ForKit.cpp @@ -712,6 +712,7 @@ int main(int argc, char** argv) // Parse the configuration. const auto conf = std::getenv("COOL_CONFIG"); config::initialize(std::string(conf ? conf : std::string())); + EnableExperimental = config::getBool("experimental_features", false); #endif Util::setThreadName("forkit"); diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index c0e494125d05..1795b3e4b3c4 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -1387,6 +1387,7 @@ void COOLWSD::innerInitialize(Application& self) { "child_root_path", "jails" }, { "file_server_root_path", "browser/.." }, { "hexify_embedded_urls", "false" }, + { "experimental_features", "false" }, { "lo_jail_subpath", "lo" }, { "logging.protocol", "false" }, { "logging.anonymize.filenames", "false" }, // Deprecated. @@ -1544,6 +1545,9 @@ void COOLWSD::innerInitialize(Application& self) // Allow UT to manipulate before using configuration values. UnitWSD::get().configure(config()); + // Experimental features. + EnableExperimental = getConfigValue(conf, "experimental_features", false); + // Setup user interface mode UserInterface = getConfigValue(conf, "user_interface.mode", "default");