From 720d253fbba41f0f41c45a2f5361e9e1409c72e3 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Tue, 19 Oct 2021 20:17:10 -0500 Subject: [PATCH] add script injection to the config to import custom webfront scripts (ie google tracking) --- SharedLibraryCore/BaseController.cs | 1 + .../Configuration/ApplicationConfiguration.cs | 3 +++ SharedLibraryCore/Configuration/WebfrontConfiguration.cs | 7 +++++++ WebfrontCore/Views/Shared/_Layout.cshtml | 1 + 4 files changed, 12 insertions(+) create mode 100644 SharedLibraryCore/Configuration/WebfrontConfiguration.cs diff --git a/SharedLibraryCore/BaseController.cs b/SharedLibraryCore/BaseController.cs index 8a87e856..88f05156 100644 --- a/SharedLibraryCore/BaseController.cs +++ b/SharedLibraryCore/BaseController.cs @@ -145,6 +145,7 @@ namespace SharedLibraryCore ViewBag.EnableColorCodes = AppConfig.EnableColorCodes; ViewBag.EnablePrivilegedUserPrivacy = AppConfig.EnablePrivilegedUserPrivacy; ViewBag.Configuration = AppConfig; + ViewBag.ScriptInjection = AppConfig.Webfront?.ScriptInjection; base.OnActionExecuting(context); } diff --git a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs index cf9ebdc6..b5cad9c0 100644 --- a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs +++ b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs @@ -38,6 +38,9 @@ namespace SharedLibraryCore.Configuration [LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_BRANDING")] public string WebfrontCustomBranding { get; set; } + [ConfigurationIgnore] + public WebfrontConfiguration Webfront { get; set; } = new WebfrontConfiguration(); + [LocalizedDisplayName("SETUP_ENABLE_MULTIOWN")] public bool EnableMultipleOwners { get; set; } diff --git a/SharedLibraryCore/Configuration/WebfrontConfiguration.cs b/SharedLibraryCore/Configuration/WebfrontConfiguration.cs new file mode 100644 index 00000000..18a9f4f1 --- /dev/null +++ b/SharedLibraryCore/Configuration/WebfrontConfiguration.cs @@ -0,0 +1,7 @@ +namespace SharedLibraryCore.Configuration +{ + public class WebfrontConfiguration + { + public string ScriptInjection { get; set; } + } +} \ No newline at end of file diff --git a/WebfrontCore/Views/Shared/_Layout.cshtml b/WebfrontCore/Views/Shared/_Layout.cshtml index b249b59e..1a073ff0 100644 --- a/WebfrontCore/Views/Shared/_Layout.cshtml +++ b/WebfrontCore/Views/Shared/_Layout.cshtml @@ -202,5 +202,6 @@ }); @await RenderSectionAsync("scripts", required: false) + @Html.Raw(ViewBag.ScriptInjection); \ No newline at end of file