From 03c7585ebe0bdf2d28f6ded928c065fbdd1c085f Mon Sep 17 00:00:00 2001 From: TidusJar Date: Thu, 12 May 2016 16:01:05 -0400 Subject: [PATCH] Finished #209 --- .../PlexRequests.Api.Interfaces.csproj | 11 +- PlexRequests.Api.Interfaces/packages.config | 6 +- .../PlexRequests.Api.Models.csproj | 11 +- PlexRequests.Api/PlexRequests.Api.csproj | 38 +++---- PlexRequests.Api/packages.config | 16 +-- PlexRequests.Core/PlexRequests.Core.csproj | 46 ++++---- .../PlexRequests.Helpers.csproj | 18 ++- .../PlexRequests.Services.csproj | 72 +++++------- PlexRequests.Services/packages.config | 26 ++--- PlexRequests.Store/PlexRequests.Store.csproj | 32 +++--- PlexRequests.UI/Models/JsonResponseModel.cs | 2 - PlexRequests.UI/Modules/AdminModule.cs | 21 +++- PlexRequests.UI/Modules/UserLoginModule.cs | 2 +- PlexRequests.UI/PlexRequests.UI.csproj | 106 +++++++----------- PlexRequests.UI/Views/Admin/Settings.cshtml | 34 +++++- PlexRequests.UI/packages.config | 80 ++++++------- 16 files changed, 250 insertions(+), 271 deletions(-) diff --git a/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj b/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj index 52b7980a0..033b18133 100644 --- a/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj +++ b/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Api.Interfaces PlexRequests.Api.Interfaces - v4.5.2 + v4.5 512 @@ -31,10 +31,6 @@ 4 - - ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll - True - @@ -43,6 +39,9 @@ + + ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll + diff --git a/PlexRequests.Api.Interfaces/packages.config b/PlexRequests.Api.Interfaces/packages.config index 43a581e30..d14ce056f 100644 --- a/PlexRequests.Api.Interfaces/packages.config +++ b/PlexRequests.Api.Interfaces/packages.config @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj b/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj index 08d39300b..efd7d834d 100644 --- a/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj +++ b/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Api.Models PlexRequests.Api.Models - v4.5.2 + v4.5 512 @@ -31,10 +31,6 @@ 4 - - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - True - @@ -43,6 +39,9 @@ + + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + diff --git a/PlexRequests.Api/PlexRequests.Api.csproj b/PlexRequests.Api/PlexRequests.Api.csproj index 31e8af32a..aa7db4a5b 100644 --- a/PlexRequests.Api/PlexRequests.Api.csproj +++ b/PlexRequests.Api/PlexRequests.Api.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Api PlexRequests.Api - v4.5.2 + v4.5 512 @@ -31,37 +31,31 @@ 4 - + + + + + + + + + ..\packages\Dapper.1.42\lib\net45\Dapper.dll - True - + ..\packages\Nancy.1.4.3\lib\net40\Nancy.dll - True - + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - True - + ..\packages\NLog.4.2.3\lib\net45\NLog.dll - True - + ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll - True - - - - - - - - - + ..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll - True diff --git a/PlexRequests.Api/packages.config b/PlexRequests.Api/packages.config index 82a3f269f..23ed979dc 100644 --- a/PlexRequests.Api/packages.config +++ b/PlexRequests.Api/packages.config @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/PlexRequests.Core/PlexRequests.Core.csproj b/PlexRequests.Core/PlexRequests.Core.csproj index 453ea859e..8a66e8d43 100644 --- a/PlexRequests.Core/PlexRequests.Core.csproj +++ b/PlexRequests.Core/PlexRequests.Core.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Core PlexRequests.Core - v4.5.2 + v4.5 512 @@ -34,40 +34,34 @@ ..\Assemblies\Mono.Data.Sqlite.dll - + + + + + + + + + + ..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll + + ..\packages\Nancy.1.4.3\lib\net40\Nancy.dll - True - + ..\packages\Nancy.Authentication.Forms.1.4.1\lib\net40\Nancy.Authentication.Forms.dll - True - + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - True - + ..\packages\NLog.4.2.3\lib\net45\NLog.dll - True - + ..\packages\Octokit.0.19.0\lib\net45\Octokit.dll - True - + ..\packages\valueinjecter.3.1.1.2\lib\net40\Omu.ValueInjecter.dll - True - - - - - - - - - - - ..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll @@ -102,7 +96,7 @@ - {95834072-a675-415d-aa8f-877c91623810} + {95834072-A675-415D-AA8F-877C91623810} PlexRequests.Api.Interfaces diff --git a/PlexRequests.Helpers/PlexRequests.Helpers.csproj b/PlexRequests.Helpers/PlexRequests.Helpers.csproj index c8c08a6ec..2ae841459 100644 --- a/PlexRequests.Helpers/PlexRequests.Helpers.csproj +++ b/PlexRequests.Helpers/PlexRequests.Helpers.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Helpers PlexRequests.Helpers - v4.5.2 + v4.5 512 @@ -31,14 +31,6 @@ 4 - - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\NLog.4.2.3\lib\net45\NLog.dll - True - @@ -48,6 +40,12 @@ + + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NLog.4.2.3\lib\net45\NLog.dll + diff --git a/PlexRequests.Services/PlexRequests.Services.csproj b/PlexRequests.Services/PlexRequests.Services.csproj index 72b0e9372..d69e3d162 100644 --- a/PlexRequests.Services/PlexRequests.Services.csproj +++ b/PlexRequests.Services/PlexRequests.Services.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Services PlexRequests.Services - v4.5.2 + v4.5 512 @@ -31,66 +31,54 @@ 4 - + + + + + + + + + + + + + ..\packages\MimeKit.1.2.22\lib\net45\BouncyCastle.dll - True - + ..\packages\Common.Logging.3.0.0\lib\net40\Common.Logging.dll - True - + ..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll - True - + ..\packages\MailKit.1.2.21\lib\net451\MailKit.dll - True - - + ..\packages\MimeKit.1.2.22\lib\net45\MimeKit.dll - True - - False + ..\Assemblies\Mono.Data.Sqlite.dll - + ..\packages\NLog.4.2.3\lib\net45\NLog.dll - True - + ..\packages\Quartz.2.3.3\lib\net40\Quartz.dll - True - - - + ..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll - True - + ..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll - True - + ..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll - True - + ..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll - True - - - - - - - - - @@ -125,7 +113,7 @@ - {95834072-a675-415d-aa8f-877c91623810} + {95834072-A675-415D-AA8F-877C91623810} PlexRequests.Api.Interfaces @@ -133,11 +121,11 @@ PlexRequests.Api.Models - {8cb8d235-2674-442d-9c6a-35fcaeeb160d} + {8CB8D235-2674-442D-9C6A-35FCAEEB160D} PlexRequests.Api - {dd7dc444-d3bf-4027-8ab9-efc71f5ec581} + {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581} PlexRequests.Core @@ -145,7 +133,7 @@ PlexRequests.Helpers - {92433867-2b7b-477b-a566-96c382427525} + {92433867-2B7B-477B-A566-96C382427525} PlexRequests.Store diff --git a/PlexRequests.Services/packages.config b/PlexRequests.Services/packages.config index 41673ca47..4560acea8 100644 --- a/PlexRequests.Services/packages.config +++ b/PlexRequests.Services/packages.config @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/PlexRequests.Store/PlexRequests.Store.csproj b/PlexRequests.Store/PlexRequests.Store.csproj index 927969b86..ad8dd61b7 100644 --- a/PlexRequests.Store/PlexRequests.Store.csproj +++ b/PlexRequests.Store/PlexRequests.Store.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties PlexRequests.Store PlexRequests.Store - v4.5.2 + v4.5 512 @@ -31,25 +31,9 @@ 4 - - ..\packages\Dapper.1.42\lib\net45\Dapper.dll - True - - - ..\packages\Dapper.Contrib.1.43\lib\net45\Dapper.Contrib.dll - True - ..\Assemblies\Mono.Data.Sqlite.dll - - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\NLog.4.2.3\lib\net45\NLog.dll - True - @@ -59,6 +43,18 @@ + + ..\packages\Dapper.1.42\lib\net45\Dapper.dll + + + ..\packages\Dapper.Contrib.1.43\lib\net45\Dapper.Contrib.dll + + + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + + + ..\packages\NLog.4.2.3\lib\net45\NLog.dll + diff --git a/PlexRequests.UI/Models/JsonResponseModel.cs b/PlexRequests.UI/Models/JsonResponseModel.cs index f272b023b..affaa3bde 100644 --- a/PlexRequests.UI/Models/JsonResponseModel.cs +++ b/PlexRequests.UI/Models/JsonResponseModel.cs @@ -30,7 +30,5 @@ namespace PlexRequests.UI.Models { public bool Result { get; set; } public string Message { get; set; } - public string BaseUrl { get; set; } - public bool HasBase => !string.IsNullOrEmpty(BaseUrl); } } \ No newline at end of file diff --git a/PlexRequests.UI/Modules/AdminModule.cs b/PlexRequests.UI/Modules/AdminModule.cs index 6c93b00d1..a738e9951 100644 --- a/PlexRequests.UI/Modules/AdminModule.cs +++ b/PlexRequests.UI/Modules/AdminModule.cs @@ -209,10 +209,23 @@ namespace PlexRequests.UI.Modules private Response SaveAdmin() { var model = this.Bind(); - - PrService.SaveSettings(model); - - return Context.GetRedirect(!string.IsNullOrEmpty(BaseUrl) ? $"~/{BaseUrl}/admin" : "~/admin"); + var valid = this.Validate (model); + if (!valid.IsValid) { + return Response.AsJson(valid.SendJsonError()); + } + + if (!string.IsNullOrWhiteSpace (model.BaseUrl)) { + if (model.BaseUrl.StartsWith ("/") || model.BaseUrl.StartsWith ("\\")); + { + model.BaseUrl = model.BaseUrl.Remove (0, 1); + } + } + var result = PrService.SaveSettings(model); + if (result) { + return Response.AsJson (new JsonResponseModel{ Result = true }); + } + + return Response.AsJson (new JsonResponseModel{ Result = false, Message = "We could not save to the database, please try again" }); } private Response RequestAuthToken() diff --git a/PlexRequests.UI/Modules/UserLoginModule.cs b/PlexRequests.UI/Modules/UserLoginModule.cs index 1bf57150f..a543287c1 100644 --- a/PlexRequests.UI/Modules/UserLoginModule.cs +++ b/PlexRequests.UI/Modules/UserLoginModule.cs @@ -142,7 +142,7 @@ namespace PlexRequests.UI.Modules Session[SessionKeys.ClientDateTimeOffsetKey] = (int)dateTimeOffset; return Response.AsJson(authenticated - ? new JsonResponseModel { Result = true, BaseUrl = BaseUrl} + ? new JsonResponseModel { Result = true } : new JsonResponseModel { Result = false, Message = "Incorrect User or Password"}); } diff --git a/PlexRequests.UI/PlexRequests.UI.csproj b/PlexRequests.UI/PlexRequests.UI.csproj index f836325ac..4c50eb4f8 100644 --- a/PlexRequests.UI/PlexRequests.UI.csproj +++ b/PlexRequests.UI/PlexRequests.UI.csproj @@ -9,7 +9,7 @@ Properties PlexRequests.UI PlexRequests - v4.5.2 + v4.5 512 ..\..\ true @@ -52,126 +52,95 @@ prompt 4 - - - - - + + + + + + + + + ..\packages\CommandLineParser.2.0.275-beta\lib\net45\CommandLine.dll - True - + ..\packages\Common.Logging.3.0.0\lib\net40\Common.Logging.dll - True - + ..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll - True - + ..\packages\Dapper.1.42\lib\net45\Dapper.dll - True - + ..\packages\FluentValidation.6.2.1.0\lib\Net45\FluentValidation.dll - True - + ..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll - True - + ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - True - + ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll - True - + ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - True - + ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll - True - - False + ..\Assemblies\Mono.Data.Sqlite.dll - + ..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll - True - + ..\packages\Nancy.1.4.3\lib\net40\Nancy.dll - True - + ..\packages\Nancy.Authentication.Basic.1.4.1\lib\net40\Nancy.Authentication.Basic.dll - True - + ..\packages\Nancy.Authentication.Forms.1.4.1\lib\net40\Nancy.Authentication.Forms.dll - True - + ..\packages\Nancy.Hosting.Self.1.4.1\lib\net40\Nancy.Hosting.Self.dll - True - + ..\packages\Nancy.Owin.1.4.1\lib\net40\Nancy.Owin.dll - True - + ..\packages\Nancy.Validation.FluentValidation.1.4.1\lib\net40\Nancy.Validation.FluentValidation.dll - True - + ..\packages\Nancy.Viewengines.Razor.1.4.1\lib\net40\Nancy.ViewEngines.Razor.dll - True - + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - True - + ..\packages\NLog.4.2.3\lib\net45\NLog.dll - True - + ..\packages\Owin.1.0\lib\net40\Owin.dll - True - + ..\packages\Quartz.2.3.3\lib\net40\Quartz.dll - True - + ..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll - True - - - - - + ..\packages\System.Data.SQLite.Core.1.0.99.0\lib\net46\System.Data.SQLite.dll - True - - - - + ..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll - True - - + ..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll - True @@ -225,6 +194,7 @@ + @@ -426,7 +396,7 @@ PlexRequests.Api.Models - {8cb8d235-2674-442d-9c6a-35fcaeeb160d} + {8CB8D235-2674-442D-9C6A-35FCAEEB160D} PlexRequests.Api diff --git a/PlexRequests.UI/Views/Admin/Settings.cshtml b/PlexRequests.UI/Views/Admin/Settings.cshtml index 956ed5dbc..b6d119855 100644 --- a/PlexRequests.UI/Views/Admin/Settings.cshtml +++ b/PlexRequests.UI/Views/Admin/Settings.cshtml @@ -21,7 +21,7 @@ }
-
+
Request Plex Settings
@@ -168,9 +168,39 @@
- +
+ + \ No newline at end of file diff --git a/PlexRequests.UI/packages.config b/PlexRequests.UI/packages.config index 196008837..304f7dab8 100644 --- a/PlexRequests.UI/packages.config +++ b/PlexRequests.UI/packages.config @@ -1,41 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file