From 827ea857e0c818af3a952b43add2278f3349fbe0 Mon Sep 17 00:00:00 2001 From: Anojh Date: Wed, 11 Apr 2018 13:55:36 -0700 Subject: [PATCH 1/2] Inject base url if set before theme file url, see issue #1795 --- src/Ombi/Controllers/SettingsController.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index 9ffa9d81f..44702a073 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -274,6 +274,12 @@ namespace Ombi.Controllers public async Task GetThemeContent([FromQuery]string url) { var css = await _githubApi.GetThemesRawContent(url); + var ombiSettings = await OmbiSettings(); + if (ombiSettings.BaseUrl != null) + { + int index = css.IndexOf("/api/"); + css = css.Insert(index, ombiSettings.BaseUrl); + } return Content(css, "text/css"); } From 738bdb46d72f3c1cd13c521548ec2fad89f03042 Mon Sep 17 00:00:00 2001 From: Anojh Date: Fri, 20 Apr 2018 14:02:19 -0700 Subject: [PATCH 2/2] Fix baseurl breaking themes --- src/Ombi/Controllers/SettingsController.cs | 6 ------ src/Ombi/Views/Shared/_Layout.cshtml | 10 ++++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index 44702a073..9ffa9d81f 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -274,12 +274,6 @@ namespace Ombi.Controllers public async Task GetThemeContent([FromQuery]string url) { var css = await _githubApi.GetThemesRawContent(url); - var ombiSettings = await OmbiSettings(); - if (ombiSettings.BaseUrl != null) - { - int index = css.IndexOf("/api/"); - css = css.Insert(index, ombiSettings.BaseUrl); - } return Content(css, "text/css"); } diff --git a/src/Ombi/Views/Shared/_Layout.cshtml b/src/Ombi/Views/Shared/_Layout.cshtml index cafd75357..1f2610e1c 100644 --- a/src/Ombi/Views/Shared/_Layout.cshtml +++ b/src/Ombi/Views/Shared/_Layout.cshtml @@ -85,8 +85,14 @@ O:::::::OOO:::::::Om::::m m::::m m::::mb:::::bbbbbb::::::bi::::::i @{ - if (customization.HasPresetTheme) - { + if (customization.HasPresetTheme) + { + if (!string.IsNullOrEmpty(baseUrl)) + { + var index = customization.PresetThemeContent.IndexOf("/api/"); + customization.PresetThemeContent = customization.PresetThemeContent.Insert(index, "/" + baseUrl); + } +