From 6190eceb609886a91ad387ebcfafeff4e2e22675 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 14 Apr 2016 14:50:40 +0100 Subject: [PATCH] Finally fixed #72 --- .../SettingModels/PlexRequestSettings.cs | 2 +- PlexRequests.Core/Setup.cs | 8 +- PlexRequests.UI/Bootstrapper.cs | 16 ++- PlexRequests.UI/Content/bootstrap.css | 4 +- PlexRequests.UI/Content/font-awesome.css | 4 +- PlexRequests.UI/Helpers/AssetHelper.cs | 109 ++++++++++++++++++ PlexRequests.UI/Helpers/ServiceLocator.cs | 55 +++++++++ .../Modules/ApplicationTesterModule.cs | 2 +- PlexRequests.UI/Modules/ApprovalModule.cs | 2 +- PlexRequests.UI/Modules/BaseAuthModule.cs | 85 ++++++++++++++ PlexRequests.UI/Modules/BaseModule.cs | 58 +++------- PlexRequests.UI/Modules/IndexModule.cs | 2 +- PlexRequests.UI/Modules/RequestsModule.cs | 2 +- PlexRequests.UI/Modules/SearchModule.cs | 2 +- PlexRequests.UI/Modules/UserLoginModule.cs | 2 +- PlexRequests.UI/PlexRequests.UI.csproj | 5 +- PlexRequests.UI/Program.cs | 8 +- PlexRequests.UI/Views/Admin/Logs.cshtml | 7 +- PlexRequests.UI/Views/Admin/Settings.cshtml | 10 ++ PlexRequests.UI/Views/Requests/Index.cshtml | 3 +- PlexRequests.UI/Views/Search/Index.cshtml | 5 +- PlexRequests.UI/Views/Shared/_Layout.cshtml | 17 +-- 22 files changed, 317 insertions(+), 91 deletions(-) create mode 100644 PlexRequests.UI/Helpers/AssetHelper.cs create mode 100644 PlexRequests.UI/Helpers/ServiceLocator.cs create mode 100644 PlexRequests.UI/Modules/BaseAuthModule.cs diff --git a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs index 90596ba39..acf817bbc 100644 --- a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs +++ b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs @@ -33,7 +33,7 @@ namespace PlexRequests.Core.SettingModels public class PlexRequestSettings : Settings { public int Port { get; set; } - public string AssetLocation { get; set; } + public string BaseUrl { get; set; } public bool SearchForMovies { get; set; } public bool SearchForTvShows { get; set; } public bool SearchForMusic { get; set; } diff --git a/PlexRequests.Core/Setup.cs b/PlexRequests.Core/Setup.cs index c59b3556e..73c4b0554 100644 --- a/PlexRequests.Core/Setup.cs +++ b/PlexRequests.Core/Setup.cs @@ -44,7 +44,7 @@ namespace PlexRequests.Core { private static Logger Log = LogManager.GetCurrentClassLogger(); private static DbConfiguration Db { get; set; } - public string SetupDb(string assetLocation) + public string SetupDb(string urlBase) { Db = new DbConfiguration(new SqliteFactory()); var created = Db.CheckDb(); @@ -52,7 +52,7 @@ namespace PlexRequests.Core if (created) { - CreateDefaultSettingsPage(assetLocation); + CreateDefaultSettingsPage(urlBase); } var version = CheckSchema(); @@ -89,7 +89,7 @@ namespace PlexRequests.Core return version; } - private void CreateDefaultSettingsPage(string assetLocation) + private void CreateDefaultSettingsPage(string baseUrl) { var defaultSettings = new PlexRequestSettings { @@ -98,7 +98,7 @@ namespace PlexRequests.Core SearchForMovies = true, SearchForTvShows = true, WeeklyRequestLimit = 0, - AssetLocation = assetLocation ?? "assets" + BaseUrl = baseUrl ?? string.Empty }; var s = new SettingsServiceV2(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider())); s.SaveSettings(defaultSettings); diff --git a/PlexRequests.UI/Bootstrapper.cs b/PlexRequests.UI/Bootstrapper.cs index 86185e79a..6facd7692 100644 --- a/PlexRequests.UI/Bootstrapper.cs +++ b/PlexRequests.UI/Bootstrapper.cs @@ -50,6 +50,7 @@ using PlexRequests.Services.Notification; using PlexRequests.Store; using PlexRequests.Store.Models; using PlexRequests.Store.Repository; +using PlexRequests.UI.Helpers; using PlexRequests.UI.Jobs; using TaskFactory = FluentScheduler.TaskFactory; @@ -61,7 +62,6 @@ namespace PlexRequests.UI // by overriding the various methods and properties. // For more information https://github.com/NancyFx/Nancy/wiki/Bootstrapper - private TinyIoCContainer _container; protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context) { @@ -109,8 +109,8 @@ namespace PlexRequests.UI SubscribeAllObservers(container); base.ConfigureRequestContainer(container, context); - - + var loc = ServiceLocator.Instance; + loc.SetContainer(container); } protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) @@ -121,10 +121,14 @@ namespace PlexRequests.UI base.ApplicationStartup(container, pipelines); + var settings = new SettingsServiceV2(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider())); + var baseUrl = settings.GetSettings().BaseUrl; + var redirect = string.IsNullOrEmpty(baseUrl) ? "~/login" : $"~/{baseUrl}/login"; + // Enable forms auth var formsAuthConfiguration = new FormsAuthenticationConfiguration { - RedirectUrl = "~/login", + RedirectUrl = redirect, UserMapper = container.Resolve() }; @@ -141,9 +145,9 @@ namespace PlexRequests.UI base.ConfigureConventions(nancyConventions); var settings = new SettingsServiceV2(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()),new MemoryCacheProvider())); - var assetLocation = settings.GetSettings().AssetLocation; + var assetLocation = settings.GetSettings().BaseUrl; nancyConventions.StaticContentsConventions.Add( - StaticContentConventionBuilder.AddDirectory("assets", $"{assetLocation}/Content") + StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content", "Content") ); } diff --git a/PlexRequests.UI/Content/bootstrap.css b/PlexRequests.UI/Content/bootstrap.css index 0638c1fb9..83e3b6fa3 100644 --- a/PlexRequests.UI/Content/bootstrap.css +++ b/PlexRequests.UI/Content/bootstrap.css @@ -269,8 +269,8 @@ th { } @font-face { font-family: 'Glyphicons Halflings'; - src: url('../assets/fonts/glyphicons-halflings-regular.eot'); - src: url('../assets/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../assets/fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../assets/fonts/glyphicons-halflings-regular.woff') format('woff'), url('../assets/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../assets/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); + src: url('../Content/fonts/glyphicons-halflings-regular.eot'); + src: url('../Content/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../Content/fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../Content/fonts/glyphicons-halflings-regular.woff') format('woff'), url('../Content/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../Content/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } .glyphicon { position: relative; diff --git a/PlexRequests.UI/Content/font-awesome.css b/PlexRequests.UI/Content/font-awesome.css index b190f2c94..7f747bf2c 100644 --- a/PlexRequests.UI/Content/font-awesome.css +++ b/PlexRequests.UI/Content/font-awesome.css @@ -6,8 +6,8 @@ * -------------------------- */ @font-face { font-family: 'FontAwesome'; - src: url('../assets/fonts/fontawesome-webfont.eot?v=4.5.0'); - src: url('../assets/fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../assets/fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../assets/fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../assets/fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../assets/fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); + src: url('../Content/fonts/fontawesome-webfont.eot?v=4.5.0'); + src: url('../Content/fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../Content/fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../Content/fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../Content/fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../Content/fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); font-weight: normal; font-style: normal; } diff --git a/PlexRequests.UI/Helpers/AssetHelper.cs b/PlexRequests.UI/Helpers/AssetHelper.cs new file mode 100644 index 000000000..20cd8a8d6 --- /dev/null +++ b/PlexRequests.UI/Helpers/AssetHelper.cs @@ -0,0 +1,109 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: AssetHelper.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using System.Text; + +using Nancy.ViewEngines.Razor; + +using PlexRequests.Core; +using PlexRequests.Core.SettingModels; + +namespace PlexRequests.UI.Helpers +{ + public static class AssetHelper + { + private static ServiceLocator Locator => ServiceLocator.Instance; + public static IHtmlString LoadAssets(this HtmlHelpers helper) + { + var settings = Locator.Resolve>().GetSettings(); + var sb = new StringBuilder(); + var assetLocation = settings.BaseUrl; + + var content = GetContentUrl(assetLocation); + + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + sb.AppendLine($""); + + + return helper.Raw(sb.ToString()); + } + + public static IHtmlString LoadSearchAssets(this HtmlHelpers helper) + { + var settings = Locator.Resolve>().GetSettings(); + var sb = new StringBuilder(); + var assetLocation = settings.BaseUrl; + + var content = GetContentUrl(assetLocation); + + sb.AppendLine($""); + + return helper.Raw(sb.ToString()); + } + + public static IHtmlString LoadRequestAssets(this HtmlHelpers helper) + { + var settings = Locator.Resolve>().GetSettings(); + var sb = new StringBuilder(); + var assetLocation = settings.BaseUrl; + + var content = GetContentUrl(assetLocation); + + sb.AppendLine($""); + + return helper.Raw(sb.ToString()); + } + + public static IHtmlString LoadLogsAssets(this HtmlHelpers helper) + { + var settings = Locator.Resolve>().GetSettings(); + var sb = new StringBuilder(); + var assetLocation = settings.BaseUrl; + + var content = GetContentUrl(assetLocation); + + sb.AppendLine($""); + sb.AppendLine($""); + + return helper.Raw(sb.ToString()); + } + + private static string GetContentUrl(string assetLocation) + { + return string.IsNullOrEmpty(assetLocation) ? "~" : $"/{assetLocation}"; + } + } +} \ No newline at end of file diff --git a/PlexRequests.UI/Helpers/ServiceLocator.cs b/PlexRequests.UI/Helpers/ServiceLocator.cs new file mode 100644 index 000000000..c26b0c02e --- /dev/null +++ b/PlexRequests.UI/Helpers/ServiceLocator.cs @@ -0,0 +1,55 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: ServiceLocator.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using Nancy.TinyIoc; + +namespace PlexRequests.UI.Helpers +{ + public class ServiceLocator + { + static ServiceLocator() + { + Singleton = new ServiceLocator(); + } + private static ServiceLocator Singleton { get; set; } + private TinyIoCContainer Container { get; set; } + public static ServiceLocator Instance => Singleton; + + public void SetContainer(TinyIoCContainer container) + { + Container = container; + } + + public T Resolve() where T : class + { + if (Container != null) + { + return Container.Resolve(); + } + return null; + } + } +} \ No newline at end of file diff --git a/PlexRequests.UI/Modules/ApplicationTesterModule.cs b/PlexRequests.UI/Modules/ApplicationTesterModule.cs index 000a54d80..1a59fab2b 100644 --- a/PlexRequests.UI/Modules/ApplicationTesterModule.cs +++ b/PlexRequests.UI/Modules/ApplicationTesterModule.cs @@ -39,7 +39,7 @@ using PlexRequests.UI.Models; namespace PlexRequests.UI.Modules { - public class ApplicationTesterModule : BaseModule + public class ApplicationTesterModule : BaseAuthModule { public ApplicationTesterModule(ICouchPotatoApi cpApi, ISonarrApi sonarrApi, IPlexApi plexApi, diff --git a/PlexRequests.UI/Modules/ApprovalModule.cs b/PlexRequests.UI/Modules/ApprovalModule.cs index 352c479dd..e6cb97c06 100644 --- a/PlexRequests.UI/Modules/ApprovalModule.cs +++ b/PlexRequests.UI/Modules/ApprovalModule.cs @@ -43,7 +43,7 @@ using PlexRequests.UI.Models; namespace PlexRequests.UI.Modules { - public class ApprovalModule : BaseModule + public class ApprovalModule : BaseAuthModule { public ApprovalModule(IRequestService service, ISettingsService cpService, ICouchPotatoApi cpApi, ISonarrApi sonarrApi, diff --git a/PlexRequests.UI/Modules/BaseAuthModule.cs b/PlexRequests.UI/Modules/BaseAuthModule.cs new file mode 100644 index 000000000..fbedffd32 --- /dev/null +++ b/PlexRequests.UI/Modules/BaseAuthModule.cs @@ -0,0 +1,85 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: BaseAuthModule.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion + +using Nancy; +using Nancy.Extensions; +using PlexRequests.UI.Models; +using System; + +namespace PlexRequests.UI.Modules +{ + public class BaseAuthModule : BaseModule + { + private string _username; + private int _dateTimeOffset = -1; + + protected string Username + { + get + { + if (string.IsNullOrEmpty(_username)) + { + _username = Session[SessionKeys.UsernameKey].ToString(); + } + return _username; + } + } + + protected int DateTimeOffset + { + get + { + if (_dateTimeOffset == -1) + { + _dateTimeOffset = (int?)Session[SessionKeys.ClientDateTimeOffsetKey] ?? new DateTimeOffset().Offset.Minutes; + } + return _dateTimeOffset; + } + } + + public BaseAuthModule() + { + Before += (ctx) => CheckAuth(); + } + + public BaseAuthModule(string modulePath) : base(modulePath) + { + Before += (ctx) => CheckAuth(); + } + + + private Response CheckAuth() + { + if (Session[SessionKeys.UsernameKey] == null) + { + return Context.GetRedirect("~/test/userlogin"); + } + return null; + } + + } +} \ No newline at end of file diff --git a/PlexRequests.UI/Modules/BaseModule.cs b/PlexRequests.UI/Modules/BaseModule.cs index a75766775..e3f4a47ca 100644 --- a/PlexRequests.UI/Modules/BaseModule.cs +++ b/PlexRequests.UI/Modules/BaseModule.cs @@ -24,63 +24,35 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ************************************************************************/ #endregion - using Nancy; -using Nancy.Extensions; -using PlexRequests.UI.Models; -using System; + +using PlexRequests.Core; +using PlexRequests.Core.SettingModels; +using PlexRequests.UI.Helpers; namespace PlexRequests.UI.Modules { public class BaseModule : NancyModule { - private string _username; - private int _dateTimeOffset = -1; - - protected string Username + private ServiceLocator Locator => ServiceLocator.Instance; + public BaseModule() { - get - { - if (string.IsNullOrEmpty(_username)) - { - _username = Session[SessionKeys.UsernameKey].ToString(); - } - return _username; - } - } + var settings = Locator.Resolve>().GetSettings(); + var baseUrl = settings.BaseUrl; - protected int DateTimeOffset - { - get - { - if (_dateTimeOffset == -1) - { - _dateTimeOffset = Session[SessionKeys.ClientDateTimeOffsetKey] != null ? - (int)Session[SessionKeys.ClientDateTimeOffsetKey] : (new DateTimeOffset().Offset).Minutes; - } - return _dateTimeOffset; - } - } + var modulePath = string.IsNullOrEmpty(baseUrl) ? string.Empty : baseUrl; - public BaseModule() - { - Before += (ctx) => CheckAuth(); + ModulePath = modulePath; } - public BaseModule(string modulePath) : base(modulePath) + public BaseModule(string modulePath) { - Before += (ctx) => CheckAuth(); - } + var settings = Locator.Resolve>().GetSettings(); + var baseUrl = settings.BaseUrl; + var settingModulePath = string.IsNullOrEmpty(baseUrl) ? modulePath : $"{baseUrl}/{modulePath}"; - private Response CheckAuth() - { - if (Session[SessionKeys.UsernameKey] == null) - { - return Context.GetRedirect("~/userlogin"); - } - return null; + ModulePath = settingModulePath; } - } } \ No newline at end of file diff --git a/PlexRequests.UI/Modules/IndexModule.cs b/PlexRequests.UI/Modules/IndexModule.cs index 3a3539b83..bb099889c 100644 --- a/PlexRequests.UI/Modules/IndexModule.cs +++ b/PlexRequests.UI/Modules/IndexModule.cs @@ -29,7 +29,7 @@ using Nancy.Extensions; namespace PlexRequests.UI.Modules { - public class IndexModule : BaseModule + public class IndexModule : BaseAuthModule { public IndexModule() { diff --git a/PlexRequests.UI/Modules/RequestsModule.cs b/PlexRequests.UI/Modules/RequestsModule.cs index 92a326a56..afb98b454 100644 --- a/PlexRequests.UI/Modules/RequestsModule.cs +++ b/PlexRequests.UI/Modules/RequestsModule.cs @@ -46,7 +46,7 @@ using System.Threading.Tasks; namespace PlexRequests.UI.Modules { - public class RequestsModule : BaseModule + public class RequestsModule : BaseAuthModule { public RequestsModule( IRequestService service, diff --git a/PlexRequests.UI/Modules/SearchModule.cs b/PlexRequests.UI/Modules/SearchModule.cs index a278952a7..b7faaa9bc 100644 --- a/PlexRequests.UI/Modules/SearchModule.cs +++ b/PlexRequests.UI/Modules/SearchModule.cs @@ -55,7 +55,7 @@ using TMDbLib.Objects.General; namespace PlexRequests.UI.Modules { - public class SearchModule : BaseModule + public class SearchModule : BaseAuthModule { public SearchModule(ICacheProvider cache, ISettingsService cpSettings, ISettingsService prSettings, IAvailabilityChecker checker, diff --git a/PlexRequests.UI/Modules/UserLoginModule.cs b/PlexRequests.UI/Modules/UserLoginModule.cs index c1528bdd7..c0f629f01 100644 --- a/PlexRequests.UI/Modules/UserLoginModule.cs +++ b/PlexRequests.UI/Modules/UserLoginModule.cs @@ -44,7 +44,7 @@ using PlexRequests.UI.Models; namespace PlexRequests.UI.Modules { - public class UserLoginModule : NancyModule + public class UserLoginModule : BaseModule { public UserLoginModule(ISettingsService auth, IPlexApi api) : base("userlogin") { diff --git a/PlexRequests.UI/PlexRequests.UI.csproj b/PlexRequests.UI/PlexRequests.UI.csproj index f9e5207d6..ec156d653 100644 --- a/PlexRequests.UI/PlexRequests.UI.csproj +++ b/PlexRequests.UI/PlexRequests.UI.csproj @@ -164,7 +164,9 @@ + + @@ -175,6 +177,7 @@ + @@ -197,7 +200,7 @@ - + diff --git a/PlexRequests.UI/Program.cs b/PlexRequests.UI/Program.cs index 51b1b900b..6b1fde866 100644 --- a/PlexRequests.UI/Program.cs +++ b/PlexRequests.UI/Program.cs @@ -53,7 +53,7 @@ namespace PlexRequests.UI private static Logger Log = LogManager.GetCurrentClassLogger(); static void Main(string[] args) { - var assetLocation = "assets"; + var baseUrl = "assets"; var port = -1; if (args.Length > 0) { @@ -65,8 +65,8 @@ namespace PlexRequests.UI case "base": i++; var value = args[i]; - Console.WriteLine("Settings URL Base"); - assetLocation = value; + Console.WriteLine($"Using a Base URL {args[i]}"); + baseUrl = value; break; default: int portResult; @@ -88,7 +88,7 @@ namespace PlexRequests.UI WriteOutVersion(); var s = new Setup(); - var cn = s.SetupDb(assetLocation); + var cn = s.SetupDb(baseUrl); s.CacheQualityProfiles(); ConfigureTargets(cn); diff --git a/PlexRequests.UI/Views/Admin/Logs.cshtml b/PlexRequests.UI/Views/Admin/Logs.cshtml index d7d37655f..7281ad000 100644 --- a/PlexRequests.UI/Views/Admin/Logs.cshtml +++ b/PlexRequests.UI/Views/Admin/Logs.cshtml @@ -1,7 +1,6 @@ -@Html.Partial("_Sidebar") - - - +@using PlexRequests.UI.Helpers +@Html.Partial("_Sidebar") +@Html.LoadLogsAssets()
diff --git a/PlexRequests.UI/Views/Admin/Settings.cshtml b/PlexRequests.UI/Views/Admin/Settings.cshtml index d8e08431e..1bb82cb7a 100644 --- a/PlexRequests.UI/Views/Admin/Settings.cshtml +++ b/PlexRequests.UI/Views/Admin/Settings.cshtml @@ -23,6 +23,16 @@
You will have to restart after changing the port. + +
+ + +
+ +
+
+ You will have to restart after changing the url base. +
- +@Html.LoadRequestAssets() diff --git a/PlexRequests.UI/Views/Search/Index.cshtml b/PlexRequests.UI/Views/Search/Index.cshtml index 9fdbb3e06..ea9d2ba8b 100644 --- a/PlexRequests.UI/Views/Search/Index.cshtml +++ b/PlexRequests.UI/Views/Search/Index.cshtml @@ -1,4 +1,5 @@ -
+@using PlexRequests.UI.Helpers +

Search

Want to watch something that is not currently on Plex?! No problem! Just search for it below and request it!


@@ -209,4 +210,4 @@ - +@Html.LoadSearchAssets() diff --git a/PlexRequests.UI/Views/Shared/_Layout.cshtml b/PlexRequests.UI/Views/Shared/_Layout.cshtml index 48e312759..50126d584 100644 --- a/PlexRequests.UI/Views/Shared/_Layout.cshtml +++ b/PlexRequests.UI/Views/Shared/_Layout.cshtml @@ -1,5 +1,6 @@ @using Nancy.Security @using Nancy.Session +@using PlexRequests.UI.Helpers @using PlexRequests.UI.Models @inherits Nancy.ViewEngines.Razor.NancyRazorViewBase @@ -7,21 +8,7 @@ Plex Requests - - - - - - - - - - - - - - - + @Html.LoadAssets()