From 6937a90342ea03de5451ed8a1ed9699fdaff889e Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 1 Jan 2021 23:45:51 +0000 Subject: [PATCH 1/7] Try the new way of setting up the reverse proxy --- src/Ombi/ClientApp/src/index.html | 35 +-------- src/Ombi/ClientApp/src/main.ts | 4 +- src/Ombi/Ombi.csproj | 2 +- src/Ombi/Program.cs | 118 ++++++++++++++++++++++-------- src/Ombi/Startup.cs | 21 +----- 5 files changed, 90 insertions(+), 90 deletions(-) diff --git a/src/Ombi/ClientApp/src/index.html b/src/Ombi/ClientApp/src/index.html index f7804c77f..b71541a3e 100644 --- a/src/Ombi/ClientApp/src/index.html +++ b/src/Ombi/ClientApp/src/index.html @@ -2,39 +2,7 @@ - + @@ -64,7 +32,6 @@ var colors = ["#f44336", "#f44336", "#9c27b0", "#673ab7", "#3f51b5", "#2196f3", "#03a9f4", "#00bcd4", "#009688", "#4caf50", "#cddc39", "#ffeb3b", "#ffc107", "#ff9800", "#ff5722", "#9e9e9e", "#607d8b"]; var bgColor = colors[Math.floor(Math.random() * colors.length)]; window.loading_screen = window.pleaseWait({ - // logo: "assets/images/logo.png", template: `
diff --git a/src/Ombi/ClientApp/src/main.ts b/src/Ombi/ClientApp/src/main.ts index 85668688d..14d0d41bf 100644 --- a/src/Ombi/ClientApp/src/main.ts +++ b/src/Ombi/ClientApp/src/main.ts @@ -15,9 +15,7 @@ import { AppModule } from "./app/app.module"; import { hmrBootstrap } from "./hmr"; declare var module: any; -// declare var __webpack_require__: any; -// __webpack_require__.p = '/ombi'; -// __webpack_require__ = '/ombi'; + if (environment.production) { enableProdMode(); } diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index 9ac73264c..00bdc9f4c 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -64,7 +64,7 @@ - + diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index 46b5c8559..8f77657dc 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -13,6 +13,10 @@ using Ombi.Extensions; using Ombi.Helpers; using System.Threading.Tasks; using System.Collections.Generic; +using Newtonsoft.Json; +using Ombi.Settings.Settings.Models; +using System.Diagnostics; +using System.IO; namespace Ombi { @@ -46,7 +50,10 @@ namespace Ombi }); Console.WriteLine(HelpOutput(result)); - + if (baseUrl.HasValue()) + { + Console.WriteLine($"Base Url: {baseUrl}"); + } UrlArgs = host; var urlValue = string.Empty; @@ -61,14 +68,14 @@ namespace Ombi using (var provider = services.BuildServiceProvider()) { var settingsDb = provider.GetRequiredService(); + var ombiDb = provider.GetRequiredService(); if (migrate) { Console.WriteLine("Migrate in progress..."); - + var migrationTasks = new List(); var externalDb = provider.GetRequiredService(); - var ombiDb = provider.GetRequiredService(); migrationTasks.Add(settingsDb.Database.MigrateAsync()); migrationTasks.Add(ombiDb.Database.MigrateAsync()); migrationTasks.Add(externalDb.Database.MigrateAsync()); @@ -81,7 +88,7 @@ namespace Ombi var config = await settingsDb.ApplicationConfigurations.ToListAsync(); var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url); - var dbBaseUrl = config.FirstOrDefault(x => x.Type == ConfigurationTypes.BaseUrl); + var ombiSettingsContent = await settingsDb.Settings.FirstOrDefaultAsync(x => x.SettingsName == "OmbiSettings"); var securityToken = config.FirstOrDefault(x => x.Type == ConfigurationTypes.SecurityToken); await CheckSecurityToken(securityToken, settingsDb, instance); if (url == null) @@ -118,34 +125,7 @@ namespace Ombi urlValue = host; } - if (dbBaseUrl == null) - { - if (baseUrl.HasValue() && baseUrl.StartsWith("/")) - { - dbBaseUrl = new ApplicationConfiguration - { - Type = ConfigurationTypes.BaseUrl, - Value = baseUrl - }; - - using (var tran = await settingsDb.Database.BeginTransactionAsync()) - { - settingsDb.ApplicationConfigurations.Add(dbBaseUrl); - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } - } - } - else if (baseUrl.HasValue() && !baseUrl.Equals(dbBaseUrl.Value)) - { - dbBaseUrl.Value = baseUrl; - - using (var tran = await settingsDb.Database.BeginTransactionAsync()) - { - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } - } + await SortOutBaseUrl(baseUrl, settingsDb, ombiSettingsContent); Console.WriteLine($"We are running on {urlValue}"); @@ -197,6 +177,80 @@ namespace Ombi return result.ToString(); } + + private static async Task SortOutBaseUrl(string baseUrl, SettingsContext settingsDb, GlobalSettings ombiSettingsContent) + { + var setBaseUrl = false; + if (ombiSettingsContent == null) + { + Console.WriteLine("Creating new Settings entity"); + ombiSettingsContent = new GlobalSettings + { + SettingsName = "OmbiSettings", + Content = JsonConvert.SerializeObject(new OmbiSettings()) + }; + using (var tran = await settingsDb.Database.BeginTransactionAsync()) + { + settingsDb.Add(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + } + } + var ombiSettings = JsonConvert.DeserializeObject(ombiSettingsContent.Content); + if (ombiSettings == null) + { + if (baseUrl.HasValue() && baseUrl.StartsWith("/")) + { + setBaseUrl = true; + ombiSettings = new OmbiSettings + { + BaseUrl = baseUrl + }; + + ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings); + using (var tran = await settingsDb.Database.BeginTransactionAsync()) + { + settingsDb.Update(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + } + } + } + else if (baseUrl.HasValue() && !baseUrl.Equals(ombiSettings.BaseUrl)) + { + setBaseUrl = true; + ombiSettings.BaseUrl = baseUrl; + + ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings); + using (var tran = await settingsDb.Database.BeginTransactionAsync()) + { + settingsDb.Update(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + } + } + + + if (setBaseUrl) + { + var process = Process.GetCurrentProcess().MainModule.FileName; + var ombiInstalledDir = Path.GetDirectoryName(process); + var indexPath = Path.Combine(ombiInstalledDir, "ClientApp", "dist", "index.html"); + if (!File.Exists(indexPath)) + { + var error = $"Can't set the base URL because we cannot find the file at {indexPath}, if you are trying to set a base url please report this on Github!"; + Console.WriteLine(error); + throw new Exception(error); + } + var indexHtml = await File.ReadAllTextAsync(indexPath); + indexHtml = indexHtml.Replace("" + , $"", StringComparison.InvariantCultureIgnoreCase); + + await File.WriteAllTextAsync(indexPath, indexHtml); + + Console.WriteLine($"Wrote new baseurl at {indexPath}"); + } + } } public class Options diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index 49227a344..804abb840 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -153,25 +153,6 @@ namespace Ombi ombiService.SaveSettings(settings); } - if (!settings.Set) - { - settings.Set = true; - settings.CollectAnalyticData = true; - ombiService.SaveSettings(settings); - } - - // Check if it's in the startup args - var appConfig = serviceProvider.GetService(); - var baseUrl = appConfig.Get(ConfigurationTypes.BaseUrl); - if (baseUrl != null) - { - if (baseUrl.Value.HasValue()) - { - settings.BaseUrl = baseUrl.Value; - ombiService.SaveSettings(settings); - } - } - if (settings.BaseUrl.HasValue()) { app.UsePathBase(settings.BaseUrl); @@ -233,8 +214,8 @@ namespace Ombi app.UseSpa(spa => { -#if DEBUG spa.Options.SourcePath = "ClientApp"; +#if DEBUG spa.UseProxyToSpaDevelopmentServer("http://localhost:3578"); #endif }); From b90ef2148bcf29baed40420ea90ed96f44b72084 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 10 Feb 2021 20:32:32 +0000 Subject: [PATCH 2/7] Fixed the extra slash --- src/Ombi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index 74425eeaa..18a54ddb1 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -256,7 +256,7 @@ namespace Ombi } var indexHtml = await File.ReadAllTextAsync(indexPath); indexHtml = indexHtml.Replace("" - , $"", StringComparison.InvariantCultureIgnoreCase); + , $"", StringComparison.InvariantCultureIgnoreCase); await File.WriteAllTextAsync(indexPath, indexHtml); From 80a3dedf878bfe7ab77976fded958293be15004c Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 11 Feb 2021 08:53:19 +0000 Subject: [PATCH 3/7] Trimed the frontend baseUrl if there is an extra forwardslash the end --- src/Ombi/Program.cs | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index 18a54ddb1..f639acf33 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -201,12 +201,16 @@ namespace Ombi SettingsName = "OmbiSettings", Content = JsonConvert.SerializeObject(new OmbiSettings()) }; - using (var tran = await settingsDb.Database.BeginTransactionAsync()) + var strat = settingsDb.Database.CreateExecutionStrategy(); + await strat.ExecuteAsync(async () => { - settingsDb.Add(ombiSettingsContent); - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } + using (var tran = await settingsDb.Database.BeginTransactionAsync()) + { + settingsDb.Add(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + } + }); } var ombiSettings = JsonConvert.DeserializeObject(ombiSettingsContent.Content); if (ombiSettings == null) @@ -220,12 +224,16 @@ namespace Ombi }; ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings); - using (var tran = await settingsDb.Database.BeginTransactionAsync()) + var strat = settingsDb.Database.CreateExecutionStrategy(); + await strat.ExecuteAsync(async () => { - settingsDb.Update(ombiSettingsContent); - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } + using (var tran = await settingsDb.Database.BeginTransactionAsync()) + { + settingsDb.Update(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + } + }); } } else if (baseUrl.HasValue() && !baseUrl.Equals(ombiSettings.BaseUrl)) @@ -234,17 +242,22 @@ namespace Ombi ombiSettings.BaseUrl = baseUrl; ombiSettingsContent.Content = JsonConvert.SerializeObject(ombiSettings); - using (var tran = await settingsDb.Database.BeginTransactionAsync()) + var strat = settingsDb.Database.CreateExecutionStrategy(); + await strat.ExecuteAsync(async () => { - settingsDb.Update(ombiSettingsContent); - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } + using (var tran = await settingsDb.Database.BeginTransactionAsync()) + { + settingsDb.Update(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + } + }); } if (setBaseUrl) { + var trimmedBaseUrl = baseUrl.EndsWith('/') ? baseUrl.TrimEnd('/') : baseUrl; var process = Process.GetCurrentProcess().MainModule.FileName; var ombiInstalledDir = Path.GetDirectoryName(process); var indexPath = Path.Combine(ombiInstalledDir, "ClientApp", "dist", "index.html"); @@ -256,7 +269,7 @@ namespace Ombi } var indexHtml = await File.ReadAllTextAsync(indexPath); indexHtml = indexHtml.Replace("" - , $"", StringComparison.InvariantCultureIgnoreCase); + , $"", StringComparison.InvariantCultureIgnoreCase); await File.WriteAllTextAsync(indexPath, indexHtml); From 472803ec316afd2f0a49d3f01abacecd0c143e38 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 11 Feb 2021 21:50:59 +0000 Subject: [PATCH 4/7] Ensure we always update the index page with the new base url --- src/Ombi/Program.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index f639acf33..fe45ae376 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -268,10 +268,17 @@ namespace Ombi throw new Exception(error); } var indexHtml = await File.ReadAllTextAsync(indexPath); - indexHtml = indexHtml.Replace("" - , $"", StringComparison.InvariantCultureIgnoreCase); + var sb = new StringBuilder(indexHtml); - await File.WriteAllTextAsync(indexPath, indexHtml); + var headPosition = indexHtml.IndexOf(""); + var firstLinkPosition = indexHtml.IndexOf("window[\"baseHref\"] = '{trimmedBaseUrl}';"); + + await File.WriteAllTextAsync(indexPath, sb.ToString()); Console.WriteLine($"Wrote new baseurl at {indexPath}"); } From bb4d8924f43976c56c8b1b49a8931f1a14f9ea5e Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 12 Feb 2021 12:15:37 +0000 Subject: [PATCH 5/7] Fixed some warnings --- src/.editorconfig | 10 ++ src/Ombi/Attributes/AdminAttribute.cs | 1 - src/Ombi/Ombi.csproj | 4 + src/Ombi/Program.cs | 139 +++++++++++------------- src/Ombi/Properties/launchSettings.json | 4 +- src/Ombi/Startup.cs | 7 +- 6 files changed, 81 insertions(+), 84 deletions(-) create mode 100644 src/.editorconfig diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 000000000..d5aa43a0a --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,10 @@ +[*.cs] + +# CS1591: Missing XML comment for publicly visible type or member +dotnet_diagnostic.CS1591.severity = none + +# RCS1090: Add call to 'ConfigureAwait' (or vice versa). +dotnet_diagnostic.RCS1090.severity = none + +# RCS1036: Remove redundant empty line. +dotnet_diagnostic.RCS1036.severity = none diff --git a/src/Ombi/Attributes/AdminAttribute.cs b/src/Ombi/Attributes/AdminAttribute.cs index d92d5d52c..fc2e9332d 100644 --- a/src/Ombi/Attributes/AdminAttribute.cs +++ b/src/Ombi/Attributes/AdminAttribute.cs @@ -8,6 +8,5 @@ namespace Ombi.Attributes { Roles = "Admin"; } - } } \ No newline at end of file diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index 6ea4049d1..4ae2c07ee 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -45,6 +45,10 @@ + + + + diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index f639acf33..1b358ea4b 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -49,8 +49,6 @@ namespace Ombi } }); - - Console.WriteLine(HelpOutput(result)); if (baseUrl.HasValue()) { @@ -64,82 +62,75 @@ namespace Ombi demoInstance.Demo = demo; instance.StoragePath = storagePath ?? string.Empty; - var services = new ServiceCollection(); services.ConfigureDatabases(null); - using (var provider = services.BuildServiceProvider()) - { - var settingsDb = provider.GetRequiredService(); - var ombiDb = provider.GetRequiredService(); + using var provider = services.BuildServiceProvider(); + var settingsDb = provider.GetRequiredService(); + var ombiDb = provider.GetRequiredService(); - if (migrate) - { - Console.WriteLine("Migrate in progress..."); + if (migrate) + { + Console.WriteLine("Migrate in progress..."); - var migrationTasks = new List(); - var externalDb = provider.GetRequiredService(); - migrationTasks.Add(settingsDb.Database.MigrateAsync()); - migrationTasks.Add(ombiDb.Database.MigrateAsync()); - migrationTasks.Add(externalDb.Database.MigrateAsync()); + var migrationTasks = new List(); + var externalDb = provider.GetRequiredService(); + migrationTasks.Add(settingsDb.Database.MigrateAsync()); + migrationTasks.Add(ombiDb.Database.MigrateAsync()); + migrationTasks.Add(externalDb.Database.MigrateAsync()); - Task.WaitAll(migrationTasks.ToArray()); + Task.WaitAll(migrationTasks.ToArray()); - Console.WriteLine("Migrate complete."); - Environment.Exit(0); - } + Console.WriteLine("Migrate complete."); + Environment.Exit(0); + } - var config = await settingsDb.ApplicationConfigurations.ToListAsync(); - var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url); - var ombiSettingsContent = await settingsDb.Settings.FirstOrDefaultAsync(x => x.SettingsName == "OmbiSettings"); - var securityToken = config.FirstOrDefault(x => x.Type == ConfigurationTypes.SecurityToken); - await CheckSecurityToken(securityToken, settingsDb, instance); - if (url == null) + var config = await settingsDb.ApplicationConfigurations.ToListAsync(); + var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url); + var ombiSettingsContent = await settingsDb.Settings.FirstOrDefaultAsync(x => x.SettingsName == "OmbiSettings"); + var securityToken = config.FirstOrDefault(x => x.Type == ConfigurationTypes.SecurityToken); + await CheckSecurityToken(securityToken, settingsDb, instance); + if (url == null) + { + url = new ApplicationConfiguration { - url = new ApplicationConfiguration - { - Type = ConfigurationTypes.Url, - Value = "http://*:5000" - }; - var strat = settingsDb.Database.CreateExecutionStrategy(); - await strat.ExecuteAsync(async () => - { - using (var tran = await settingsDb.Database.BeginTransactionAsync()) - { - settingsDb.ApplicationConfigurations.Add(url); - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } - }); + Type = ConfigurationTypes.Url, + Value = "http://*:5000" + }; + var strat = settingsDb.Database.CreateExecutionStrategy(); + await strat.ExecuteAsync(async () => + { + using var tran = await settingsDb.Database.BeginTransactionAsync(); + settingsDb.ApplicationConfigurations.Add(url); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + }); - urlValue = url.Value; - } + urlValue = url.Value; + } - if (!url.Value.Equals(host)) + if (!url.Value.Equals(host)) + { + url.Value = UrlArgs; + var strat = settingsDb.Database.CreateExecutionStrategy(); + await strat.ExecuteAsync(async () => { - url.Value = UrlArgs; - var strat = settingsDb.Database.CreateExecutionStrategy(); - await strat.ExecuteAsync(async () => - { - using (var tran = await settingsDb.Database.BeginTransactionAsync()) - { - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } - }); + using var tran = await settingsDb.Database.BeginTransactionAsync(); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); + }); - urlValue = url.Value; - } - else if (string.IsNullOrEmpty(urlValue)) - { - urlValue = host; - } + urlValue = url.Value; + } + else if (string.IsNullOrEmpty(urlValue)) + { + urlValue = host; + } - await SortOutBaseUrl(baseUrl, settingsDb, ombiSettingsContent); + await SortOutBaseUrl(baseUrl, settingsDb, ombiSettingsContent); - Console.WriteLine($"We are running on {urlValue}"); + Console.WriteLine($"We are running on {urlValue}"); - CreateHostBuilder(args).Build().Run(); - } + CreateHostBuilder(args).Build().Run(); } private static async Task CheckSecurityToken(ApplicationConfiguration securityToken, SettingsContext ctx, StartupSingleton instance) @@ -154,12 +145,10 @@ namespace Ombi var strat = ctx.Database.CreateExecutionStrategy(); await strat.ExecuteAsync(async () => { - using (var tran = await ctx.Database.BeginTransactionAsync()) - { - ctx.ApplicationConfigurations.Add(securityToken); - await ctx.SaveChangesAsync(); - await tran.CommitAsync(); - } + using var tran = await ctx.Database.BeginTransactionAsync(); + ctx.ApplicationConfigurations.Add(securityToken); + await ctx.SaveChangesAsync(); + await tran.CommitAsync(); }); } @@ -170,7 +159,7 @@ namespace Ombi Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.ConfigureKestrel(serverOptions => + webBuilder.ConfigureKestrel(_ => { // Set properties and call methods on options }); @@ -204,12 +193,10 @@ namespace Ombi var strat = settingsDb.Database.CreateExecutionStrategy(); await strat.ExecuteAsync(async () => { - using (var tran = await settingsDb.Database.BeginTransactionAsync()) - { - settingsDb.Add(ombiSettingsContent); - await settingsDb.SaveChangesAsync(); - await tran.CommitAsync(); - } + using var tran = await settingsDb.Database.BeginTransactionAsync(); + settingsDb.Add(ombiSettingsContent); + await settingsDb.SaveChangesAsync(); + await tran.CommitAsync(); }); } var ombiSettings = JsonConvert.DeserializeObject(ombiSettingsContent.Content); diff --git a/src/Ombi/Properties/launchSettings.json b/src/Ombi/Properties/launchSettings.json index ab355f92a..0116bc6e8 100644 --- a/src/Ombi/Properties/launchSettings.json +++ b/src/Ombi/Properties/launchSettings.json @@ -14,7 +14,7 @@ "profiles": { "IIS Express": { "commandName": "IISExpress", - "commandLineArgs": "--host http://*:3577", + "commandLineArgs": "--host http://*:3577" , "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -22,7 +22,7 @@ }, "Ombi": { "commandName": "Project", - "commandLineArgs": "--host http://localhost:3577 ", + "commandLineArgs": "--host http://localhost:3577 --baseUrl /ombi/", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index 959eec8e0..b52be0528 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -93,7 +93,7 @@ namespace Ombi .AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore); services.AddOmbiMappingProfile(); - services.AddAutoMapper(expression => { expression.AddCollectionMappers(); }); + services.AddAutoMapper(expression => expression.AddCollectionMappers()); services.RegisterApplicationDependencies(); // Ioc and EF services.AddSwagger(); @@ -110,10 +110,7 @@ namespace Ombi services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest); services.AddSignalR(); - services.AddSpaStaticFiles(configuration => - { - configuration.RootPath = "ClientApp/dist"; - }); + services.AddSpaStaticFiles(configuration => configuration.RootPath = "ClientApp/dist"); } From 3d7a0486549af8c3dfafeb845506cf357487a6e7 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 12 Feb 2021 12:21:38 +0000 Subject: [PATCH 6/7] Set the base url correctly when it's stored in the settings --- src/Ombi/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index e46757c5a..60f287a16 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -240,6 +240,12 @@ namespace Ombi } }); } + else + { + // The base url might have changed in the settings, so just rewrite + setBaseUrl = true; + baseUrl = ombiSettings.BaseUrl.HasValue() ? ombiSettings.BaseUrl : string.Empty; + } if (setBaseUrl) From 795fbac1ad70e2c0e6e7285dae967143f4708bb9 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sun, 28 Feb 2021 18:18:07 +0000 Subject: [PATCH 7/7] Fixed #4073 --- src/Ombi/wwwroot/translations/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json index 0efb3fe88..9dbac0924 100644 --- a/src/Ombi/wwwroot/translations/en.json +++ b/src/Ombi/wwwroot/translations/en.json @@ -273,7 +273,7 @@ "AllSeasonsTooltip": "This will request every season for this show", "FirstSeasonTooltip": "This will only request the First Season for this show", "LatestSeasonTooltip": "This will only request the Latest Season for this show", - "NoEpisodes": "There unfortunatly is no episode data for this show yet!" + "NoEpisodes": "There Unfortunately is no episode data for this show yet!" }, "SonarrConfiguration": "Sonarr Configuration", "RadarrConfiguration": "Radarr Configuration", @@ -313,4 +313,4 @@ "MobileQRCode":"Mobile QR Code", "LegacyApp":"Launch Legacy App" } -} \ No newline at end of file +}