mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Short circuit when Plex hasn't been setup. Added Miniprofiler
This commit is contained in:
parent
0f34885444
commit
5d18877b49
8 changed files with 86 additions and 5 deletions
|
@ -53,6 +53,8 @@ using Nancy.Json;
|
|||
|
||||
using Ninject;
|
||||
|
||||
using StackExchange.Profiling;
|
||||
|
||||
namespace PlexRequests.UI
|
||||
{
|
||||
public class Bootstrapper : NinjectNancyBootstrapper
|
||||
|
@ -86,6 +88,10 @@ namespace PlexRequests.UI
|
|||
|
||||
base.ApplicationStartup(container, pipelines);
|
||||
|
||||
#if DEBUG
|
||||
pipelines.BeforeRequest += StartProfiler;
|
||||
pipelines.AfterRequest += EndProfiler;
|
||||
#endif
|
||||
var settings = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
|
||||
var baseUrl = settings.GetSettings().BaseUrl;
|
||||
var redirect = string.IsNullOrEmpty(baseUrl) ? "~/login" : $"~/{baseUrl}/login";
|
||||
|
@ -191,5 +197,16 @@ namespace PlexRequests.UI
|
|||
var loc = ServiceLocator.Instance;
|
||||
loc.SetContainer(container);
|
||||
}
|
||||
|
||||
private static Response StartProfiler(NancyContext ctx)
|
||||
{
|
||||
MiniProfiler.Start();
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void EndProfiler(NancyContext ctx)
|
||||
{
|
||||
MiniProfiler.Stop();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue