# HG changeset patch # User Sebastien Jodogne # Date 1687157144 -7200 # Node ID 6115cfbece79c2f4a9a891b5c080098229327fbd # Parent 16b9f1ff491da99e0b605ddfff642cbb5d86889a added option "Configuration" diff -r 16b9f1ff491d -r 6115cfbece79 Sources/Plugin.cpp --- a/Sources/Plugin.cpp Sun Jun 18 15:27:50 2023 +0200 +++ b/Sources/Plugin.cpp Mon Jun 19 08:45:44 2023 +0200 @@ -493,6 +493,7 @@ static ResourcesCache cache_; +static std::string userConfiguration_; static std::string routerBasename_; static DataSource dataSource_; static bool preload_; @@ -520,17 +521,16 @@ if (uri == "app-config.js") { - std::string system, user; + std::string system; Orthanc::EmbeddedResources::GetFileResource(system, Orthanc::EmbeddedResources::APP_CONFIG_SYSTEM); - Orthanc::EmbeddedResources::GetFileResource(user, Orthanc::EmbeddedResources::APP_CONFIG_USER); - + std::map dictionary; dictionary["ROUTER_BASENAME"] = routerBasename_; dictionary["USE_DICOM_WEB"] = (dataSource_ == DataSource_DicomWeb ? "true" : "false"); system = Orthanc::Toolbox::SubstituteVariables(system, dictionary); - std::string s = (user + "\n" + system); + std::string s = (userConfiguration_ + "\n" + system); OrthancPluginAnswerBuffer(context, output, s.c_str(), s.size(), "application/json"); } else if (uri == "" || // Study list @@ -874,8 +874,9 @@ globalConfiguration.GetSection(configuration, "OHIF"); } - routerBasename_ = configuration.GetStringValue("RouterBasename", "/ohif"); + routerBasename_ = configuration.GetStringValue("RouterBasename", "/ohif/"); std::string s = configuration.GetStringValue("DataSource", "dicom-json"); + std::string userConfigurationPath = configuration.GetStringValue("Configuration", ""); preload_ = configuration.GetBooleanValue("Preload", true); if (s == "dicom-web") @@ -893,6 +894,15 @@ "\"dicomweb\" or \"dicom-json\", but found: " + s); } + if (userConfigurationPath.empty()) + { + Orthanc::EmbeddedResources::GetFileResource(userConfiguration_, Orthanc::EmbeddedResources::APP_CONFIG_USER); + } + else + { + Orthanc::SystemToolbox::ReadFile(userConfiguration_, userConfigurationPath); + } + // Make sure that the router basename ends with a trailing slash if (routerBasename_.empty() || routerBasename_[routerBasename_.size() - 1] != '/')