mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -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
|
@ -66,6 +66,11 @@ namespace PlexRequests.Services.Jobs
|
|||
{
|
||||
var results = new PlexSearch();
|
||||
var settings = Plex.GetSettings();
|
||||
if (string.IsNullOrEmpty(settings.PlexAuthToken))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sections = PlexApi.GetLibrarySections(settings.PlexAuthToken, settings.FullUri);
|
||||
var tvSection = sections.Directories.FirstOrDefault(x => x.type.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase));
|
||||
var tvSectionId = tvSection?.Key;
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
<assemblyIdentity name="Ninject.Extensions.ChildKernel" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.10.0" newVersion="3.0.10.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,6 +44,8 @@ using PlexRequests.Helpers;
|
|||
using PlexRequests.Helpers.Analytics;
|
||||
using PlexRequests.UI.Models;
|
||||
|
||||
using StackExchange.Profiling;
|
||||
|
||||
using Action = PlexRequests.Helpers.Analytics.Action;
|
||||
|
||||
namespace PlexRequests.UI.Modules
|
||||
|
@ -75,11 +77,20 @@ namespace PlexRequests.UI.Modules
|
|||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public async Task<Negotiator> Index()
|
||||
{
|
||||
var profiler = MiniProfiler.Current;
|
||||
using (profiler.Step("Loading Index"))
|
||||
{
|
||||
using (profiler.Step("Loading AuthSettingsAsync and returning View"))
|
||||
{
|
||||
var settings = await AuthService.GetSettingsAsync();
|
||||
return View["Index", settings];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async Task<Response> LoginUser()
|
||||
{
|
||||
var dateTimeOffset = Request.Form.DateTimeOffset;
|
||||
|
|
|
@ -61,6 +61,18 @@
|
|||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MiniProfiler, Version=3.0.10.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MiniProfiler.3.0.10\lib\net40\MiniProfiler.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MiniProfiler.Mvc, Version=3.0.11.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MiniProfiler.MVC4.3.0.11\lib\net40\MiniProfiler.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@ -116,6 +128,26 @@
|
|||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="CommandLine, Version=2.0.275.0, Culture=neutral, PublicKeyToken=de6f01bd326f8c32">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@using PlexRequests.UI.Helpers
|
||||
@*@using StackExchange.Profiling*@
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase
|
||||
<html>
|
||||
@Html.Partial("Shared/Partial/_Head")
|
||||
|
@ -10,11 +11,13 @@
|
|||
<div class="container" style="padding-top: 5%">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<div class="scroll-top-wrapper ">
|
||||
<div class="scroll-top-wrapper ">
|
||||
<span class="scroll-top-inner">
|
||||
<i class="fa fa-2x fa-arrow-circle-up"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@*@MiniProfiler.RenderIncludes()*@
|
||||
</body>
|
||||
|
||||
@Html.GetInformationalVersion()
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
<assemblyIdentity name="Ninject.Extensions.ChildKernel" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.10.0" newVersion="3.0.10.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup><system.web.webPages.razor>
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
<package id="FluentValidation" version="6.2.1.0" targetFramework="net45" />
|
||||
<package id="jQuery" version="1.9.1" targetFramework="net45" />
|
||||
<package id="MarkdownSharp" version="1.13.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="MiniProfiler" version="3.0.10" targetFramework="net45" />
|
||||
<package id="MiniProfiler.MVC4" version="3.0.11" targetFramework="net45" />
|
||||
<package id="Moment.js" version="2.9.0" targetFramework="net45" />
|
||||
<package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" />
|
||||
<package id="Nancy" version="1.4.3" targetFramework="net45" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue