# HG changeset patch # User Sebastien Jodogne # Date 1608205735 -3600 # Node ID 91e5cbacb94dd292203a53748ffcc7ce5eb81f5d # Parent 4770ac7287ecc7c54d8f55b2a9a0f4d0ff7c0cb4# Parent 85b5b0e1bac9945b9bf9d08ac41681a275f57ffd integration varian->mainline diff -r 4770ac7287ec -r 91e5cbacb94d NEWS --- a/NEWS Thu Dec 17 11:42:48 2020 +0100 +++ b/NEWS Thu Dec 17 12:48:55 2020 +0100 @@ -11,6 +11,7 @@ * New configuration options (contributions by Varian): - "DeidentifyLogs" to remove patient identification from the logs (C-GET, C-MOVE, C-FIND) - "DeidentifyLogsDicomVersion" to specify the deidentification rules for the logs + - "OrthancExplorerEnabled" to enable/disable the Orthanc Explorer Web user interface REST API -------- diff -r 4770ac7287ec -r 91e5cbacb94d OrthancServer/Resources/Configuration.json --- a/OrthancServer/Resources/Configuration.json Thu Dec 17 11:42:48 2020 +0100 +++ b/OrthancServer/Resources/Configuration.json Thu Dec 17 12:48:55 2020 +0100 @@ -71,6 +71,11 @@ // Explorer will not be available. "HttpServerEnabled" : true, + // Enable/disable the Orthanc Explorer Web user interface. This + // option is only meaningful if the "HttpServerEnabled" option is + // set to "true" (new in Orthanc 1.8.2). + "OrthancExplorerEnabled" : true, + // HTTP port for the REST services and for the GUI "HttpPort" : 8042, diff -r 4770ac7287ec -r 91e5cbacb94d OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Thu Dec 17 11:42:48 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Thu Dec 17 12:48:55 2020 +0100 @@ -205,7 +205,8 @@ // Registration of the various REST handlers -------------------------------- - OrthancRestApi::OrthancRestApi(ServerContext& context) : + OrthancRestApi::OrthancRestApi(ServerContext& context, + bool orthancExplorerEnabled) : context_(context), leaveBarrier_(false), resetRequestReceived_(false), @@ -213,7 +214,7 @@ "orthanc_rest_api_active_requests", MetricsType_MaxOver10Seconds) { - RegisterSystem(); + RegisterSystem(orthancExplorerEnabled); RegisterChanges(); RegisterResources(); diff -r 4770ac7287ec -r 91e5cbacb94d OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h Thu Dec 17 11:42:48 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h Thu Dec 17 12:48:55 2020 +0100 @@ -58,7 +58,7 @@ bool resetRequestReceived_; MetricsRegistry::SharedMetrics activeRequests_; - void RegisterSystem(); + void RegisterSystem(bool orthancExplorerEnabled); void RegisterChanges(); @@ -75,7 +75,8 @@ static void ShutdownOrthanc(RestApiPostCall& call); public: - explicit OrthancRestApi(ServerContext& context); + explicit OrthancRestApi(ServerContext& context, + bool orthancExplorerEnabled); virtual bool Handle(HttpOutput& output, RequestOrigin origin, diff -r 4770ac7287ec -r 91e5cbacb94d OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Thu Dec 17 11:42:48 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Thu Dec 17 12:48:55 2020 +0100 @@ -556,9 +556,13 @@ } - void OrthancRestApi::RegisterSystem() + void OrthancRestApi::RegisterSystem(bool orthancExplorerEnabled) { - Register("/", ServeRoot); + if (orthancExplorerEnabled) + { + Register("/", ServeRoot); + } + Register("/system", GetSystemInformation); Register("/statistics", GetStatistics); Register("/tools/generate-uid", GenerateUid); diff -r 4770ac7287ec -r 91e5cbacb94d OrthancServer/Sources/main.cpp --- a/OrthancServer/Sources/main.cpp Thu Dec 17 11:42:48 2020 +0100 +++ b/OrthancServer/Sources/main.cpp Thu Dec 17 12:48:55 2020 +0100 @@ -1229,10 +1229,25 @@ FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer"); #endif - context.GetHttpHandler().Register(staticResources, false); + // Do not register static resources if orthanc explorer is disabled + bool orthancExplorerEnabled = false; + { + OrthancConfiguration::ReaderLock lock; + orthancExplorerEnabled = lock.GetConfiguration().GetBooleanParameter( + "OrthancExplorerEnabled", true); + } + + if (orthancExplorerEnabled) + { + context.GetHttpHandler().Register(staticResources, false); + } + else + { + LOG(WARNING) << "Orthanc Explorer UI is disabled"; + } // Thirdly, consider the built-in REST API of Orthanc - OrthancRestApi restApi(context); + OrthancRestApi restApi(context, orthancExplorerEnabled); context.GetHttpHandler().Register(restApi, true); context.SetupJobsEngine(false /* not running unit tests */, loadJobsFromDatabase);