# HG changeset patch # User Sebastien Jodogne # Date 1686839825 -7200 # Node ID cbc4be362700367487f0c7dac167d11ae8d15742 # Parent cc0e9401b02758ef75c12f3ca7f2416a00791fc6 added configuration option "RouterBasename" diff -r cc0e9401b027 -r cbc4be362700 Sources/Plugin.cpp --- a/Sources/Plugin.cpp Thu Jun 15 10:03:54 2023 +0200 +++ b/Sources/Plugin.cpp Thu Jun 15 16:37:05 2023 +0200 @@ -26,6 +26,7 @@ #include #include +#include #include @@ -99,6 +100,7 @@ static ResourcesCache cache_; +static std::string routerBasename_; void ServeFile(OrthancPluginRestOutput* output, const char* url, @@ -120,6 +122,11 @@ 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_; + + system = Orthanc::Toolbox::SubstituteVariables(system, dictionary); + std::string s = (user + "\n" + system); OrthancPluginAnswerBuffer(context, output, s.c_str(), s.size(), "application/json"); } @@ -197,12 +204,21 @@ Orthanc::Logging::Initialize(context); #endif + OrthancPlugins::OrthancConfiguration configuration; + + { + OrthancPlugins::OrthancConfiguration globalConfiguration; + globalConfiguration.GetSection(configuration, "OHIF"); + } + + routerBasename_ = configuration.GetStringValue("RouterBasename", "/ohif"); + OrthancPluginSetDescription(context, "OHIF plugin for Orthanc."); OrthancPlugins::RegisterRestCallback("/ohif/(.*)", true); OrthancPluginRegisterOnChangeCallback(context, OnChangeCallback); - + // Extend the default Orthanc Explorer with custom JavaScript for OHIF std::string explorer; Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); diff -r cc0e9401b027 -r cbc4be362700 Sources/app-config-system.js --- a/Sources/app-config-system.js Thu Jun 15 10:03:54 2023 +0200 +++ b/Sources/app-config-system.js Thu Jun 15 16:37:05 2023 +0200 @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -window.config.routerBasename = '/ohif'; +window.config.routerBasename = '${ROUTER_BASENAME}'; window.config.dataSources = [ {