mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 01:56:55 -07:00
Merge branch 'develop' of https://github.com/tidusjar/Ombi into develop
This commit is contained in:
commit
41d5ef5f41
5 changed files with 43 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
||||||
{
|
{
|
||||||
public static class OmbiRoles
|
public static class OmbiRoles
|
||||||
{
|
{
|
||||||
|
// DONT FORGET TO ADD TO IDENTITYCONTROLLER.CREATEROLES AND THE UI!
|
||||||
|
|
||||||
public const string Admin = nameof(Admin);
|
public const string Admin = nameof(Admin);
|
||||||
public const string AutoApproveMovie = nameof(AutoApproveMovie);
|
public const string AutoApproveMovie = nameof(AutoApproveMovie);
|
||||||
public const string AutoApproveTv = nameof(AutoApproveTv);
|
public const string AutoApproveTv = nameof(AutoApproveTv);
|
||||||
|
|
|
@ -17,5 +17,6 @@ namespace Ombi.Store.Entities
|
||||||
TheMovieDb = 4,
|
TheMovieDb = 4,
|
||||||
StoragePath = 5,
|
StoragePath = 5,
|
||||||
Notification = 6,
|
Notification = 6,
|
||||||
|
BaseUrl=7,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -194,6 +194,7 @@ namespace Ombi.Controllers
|
||||||
await CreateRole(OmbiRoles.RequestMovie);
|
await CreateRole(OmbiRoles.RequestMovie);
|
||||||
await CreateRole(OmbiRoles.RequestTv);
|
await CreateRole(OmbiRoles.RequestTv);
|
||||||
await CreateRole(OmbiRoles.Disabled);
|
await CreateRole(OmbiRoles.Disabled);
|
||||||
|
await CreateRole(OmbiRoles.RecievesNewsletter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CreateRole(string role)
|
private async Task CreateRole(string role)
|
||||||
|
|
|
@ -23,11 +23,13 @@ namespace Ombi
|
||||||
|
|
||||||
var host = string.Empty;
|
var host = string.Empty;
|
||||||
var storagePath = string.Empty;
|
var storagePath = string.Empty;
|
||||||
|
var baseUrl = string.Empty;
|
||||||
var result = Parser.Default.ParseArguments<Options>(args)
|
var result = Parser.Default.ParseArguments<Options>(args)
|
||||||
.WithParsed(o =>
|
.WithParsed(o =>
|
||||||
{
|
{
|
||||||
host = o.Host;
|
host = o.Host;
|
||||||
storagePath = o.StoragePath;
|
storagePath = o.StoragePath;
|
||||||
|
baseUrl = o.BaseUrl;
|
||||||
}).WithNotParsed(err =>
|
}).WithNotParsed(err =>
|
||||||
{
|
{
|
||||||
foreach (var e in err)
|
foreach (var e in err)
|
||||||
|
@ -47,6 +49,7 @@ namespace Ombi
|
||||||
{
|
{
|
||||||
var config = ctx.ApplicationConfigurations.ToList();
|
var config = ctx.ApplicationConfigurations.ToList();
|
||||||
var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url);
|
var url = config.FirstOrDefault(x => x.Type == ConfigurationTypes.Url);
|
||||||
|
var dbBaseUrl = config.FirstOrDefault(x => x.Type == ConfigurationTypes.BaseUrl);
|
||||||
if (url == null)
|
if (url == null)
|
||||||
{
|
{
|
||||||
url = new ApplicationConfiguration
|
url = new ApplicationConfiguration
|
||||||
|
@ -65,6 +68,25 @@ namespace Ombi
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
urlValue = url.Value;
|
urlValue = url.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dbBaseUrl == null)
|
||||||
|
{
|
||||||
|
if (baseUrl.HasValue() && baseUrl.StartsWith("/"))
|
||||||
|
{
|
||||||
|
dbBaseUrl = new ApplicationConfiguration
|
||||||
|
{
|
||||||
|
Type = ConfigurationTypes.BaseUrl,
|
||||||
|
Value = baseUrl
|
||||||
|
};
|
||||||
|
ctx.ApplicationConfigurations.Add(dbBaseUrl);
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!baseUrl.Equals(dbBaseUrl.Value))
|
||||||
|
{
|
||||||
|
dbBaseUrl.Value = baseUrl;
|
||||||
|
ctx.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteSchedulesDb();
|
DeleteSchedulesDb();
|
||||||
|
@ -118,5 +140,8 @@ namespace Ombi
|
||||||
[Option("storage", Required = false, HelpText = "Storage path, where we save the logs and database")]
|
[Option("storage", Required = false, HelpText = "Storage path, where we save the logs and database")]
|
||||||
public string StoragePath { get; set; }
|
public string StoragePath { get; set; }
|
||||||
|
|
||||||
|
[Option("baseurl", Required = false, HelpText = "The base URL for reverse proxy scenarios")]
|
||||||
|
public string BaseUrl { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ using Ombi.Schedule;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Store.Context;
|
using Ombi.Store.Context;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
|
using Ombi.Store.Repository;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
@ -176,6 +177,19 @@ namespace Ombi
|
||||||
{
|
{
|
||||||
app.UsePathBase(settings.BaseUrl);
|
app.UsePathBase(settings.BaseUrl);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if it's in the startup args
|
||||||
|
var appConfig = serviceProvider.GetService<IApplicationConfigRepository>();
|
||||||
|
var baseUrl = appConfig.Get(ConfigurationTypes.BaseUrl).Result;
|
||||||
|
if (baseUrl.Value.HasValue())
|
||||||
|
{
|
||||||
|
settings.BaseUrl = baseUrl.Value;
|
||||||
|
ombiService.SaveSettings(settings);
|
||||||
|
|
||||||
|
app.UsePathBase(settings.BaseUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.UseHangfireServer(new BackgroundJobServerOptions { WorkerCount = 1, ServerTimeout = TimeSpan.FromDays(1), ShutdownTimeout = TimeSpan.FromDays(1)});
|
app.UseHangfireServer(new BackgroundJobServerOptions { WorkerCount = 1, ServerTimeout = TimeSpan.FromDays(1), ShutdownTimeout = TimeSpan.FromDays(1)});
|
||||||
app.UseHangfireDashboard(settings.BaseUrl.HasValue() ? $"{settings.BaseUrl}/hangfire" : "/hangfire",
|
app.UseHangfireDashboard(settings.BaseUrl.HasValue() ? $"{settings.BaseUrl}/hangfire" : "/hangfire",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue