diff --git a/PlexRequests.Core/PlexRequests.Core.csproj b/PlexRequests.Core/PlexRequests.Core.csproj index ad631e57c..0f4d11b1d 100644 --- a/PlexRequests.Core/PlexRequests.Core.csproj +++ b/PlexRequests.Core/PlexRequests.Core.csproj @@ -67,6 +67,7 @@ + diff --git a/PlexRequests.Core/SettingModels/PlexSettings.cs b/PlexRequests.Core/SettingModels/PlexSettings.cs new file mode 100644 index 000000000..166dd581b --- /dev/null +++ b/PlexRequests.Core/SettingModels/PlexSettings.cs @@ -0,0 +1,49 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: CouchPotatoSettings.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; +using Newtonsoft.Json; +using PlexRequests.Helpers; + +namespace PlexRequests.Core.SettingModels +{ + public class PlexSettings : Settings + { + public string Ip { get; set; } + public int Port { get; set; } + + [JsonIgnore] + public Uri FullUri + { + get + { + var formatted = Ip.ReturnUri(Port); + return formatted; + } + } + } +} \ No newline at end of file diff --git a/PlexRequests.UI/Bootstrapper.cs b/PlexRequests.UI/Bootstrapper.cs index 03bb685b1..b1b1971ec 100644 --- a/PlexRequests.UI/Bootstrapper.cs +++ b/PlexRequests.UI/Bootstrapper.cs @@ -60,6 +60,7 @@ namespace PlexRequests.UI container.Register, SettingsServiceV2>(); container.Register, SettingsServiceV2>(); container.Register, SettingsServiceV2>(); + container.Register, SettingsServiceV2>(); container.Register, GenericRepository>(); base.ConfigureRequestContainer(container, context); diff --git a/PlexRequests.UI/Modules/AdminModule.cs b/PlexRequests.UI/Modules/AdminModule.cs index a22169096..3758d6f22 100644 --- a/PlexRequests.UI/Modules/AdminModule.cs +++ b/PlexRequests.UI/Modules/AdminModule.cs @@ -48,13 +48,16 @@ namespace PlexRequests.UI.Modules private ISettingsService RpService { get; set; } private ISettingsService CpService { get; set; } private ISettingsService AuthService { get; set; } + private ISettingsService PlexService { get; set; } private static Logger Log = LogManager.GetCurrentClassLogger(); - public AdminModule(ISettingsService rpService, ISettingsService cpService, ISettingsService auth) : base("admin") + public AdminModule(ISettingsService rpService, ISettingsService cpService, ISettingsService auth, ISettingsService plex) : base("admin") { RpService = rpService; CpService = cpService; AuthService = auth; + PlexService = plex; + #if !DEBUG this.RequiresAuthentication(); #endif @@ -71,6 +74,9 @@ namespace PlexRequests.UI.Modules Get["/couchpotato"] = _ => CouchPotato(); Post["/couchpotato"] = _ => SaveCouchPotato(); + + Get["/plex"] = _ => Plex(); + Post["/plex"] = _ => SavePlex(); } private Negotiator Authentication() @@ -180,5 +186,20 @@ namespace PlexRequests.UI.Modules return Context.GetRedirect("~/admin/couchpotato"); } + private Negotiator Plex() + { + var settings = PlexService.GetSettings(); + + return View["Plex", settings]; + } + + private Response SavePlex() + { + var plexSettings = this.Bind(); + PlexService.SaveSettings(plexSettings); + + return Context.GetRedirect("~/admin/plex"); + } + } } \ No newline at end of file diff --git a/PlexRequests.UI/PlexRequests.UI.csproj b/PlexRequests.UI/PlexRequests.UI.csproj index 3775b7d24..a06449bdd 100644 --- a/PlexRequests.UI/PlexRequests.UI.csproj +++ b/PlexRequests.UI/PlexRequests.UI.csproj @@ -249,6 +249,9 @@ Always + + Always + web.config diff --git a/PlexRequests.UI/Views/Admin/Plex.cshtml b/PlexRequests.UI/Views/Admin/Plex.cshtml new file mode 100644 index 000000000..ef380bdf6 --- /dev/null +++ b/PlexRequests.UI/Views/Admin/Plex.cshtml @@ -0,0 +1,42 @@ +@Html.Partial("/Admin/_Sidebar") +@{ + int port; + if (Model.Port == 0) + { + port = 32400; + } + else + { + port = Model.Port; + } +} +
+
+
+ Plex Settings + +
+ +
+ +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+
+
+ + diff --git a/PlexRequests.UI/Views/Admin/_Sidebar.cshtml b/PlexRequests.UI/Views/Admin/_Sidebar.cshtml index 140166eb3..b19c1f580 100644 --- a/PlexRequests.UI/Views/Admin/_Sidebar.cshtml +++ b/PlexRequests.UI/Views/Admin/_Sidebar.cshtml @@ -2,6 +2,7 @@
Plex Request Settings Authentication + Plex Settings CouchPotato Settings Sonarr Settings Sickbeard Settings diff --git a/PlexRequests.UI/Views/UserLogin/Index.cshtml b/PlexRequests.UI/Views/UserLogin/Index.cshtml index a9aa8707d..91ea25ac1 100644 --- a/PlexRequests.UI/Views/UserLogin/Index.cshtml +++ b/PlexRequests.UI/Views/UserLogin/Index.cshtml @@ -1,19 +1,34 @@ -
- -
- @if (Model.UsePassword) - { - - - } -
- +

Login

+
+ +
+ +
+ +
+
+ +
+
+ @if (Model.UsePassword) + { +
+ +
+
+ +
+ } +
+