diff --git a/src/Readarr.Http/Authentication/AuthenticationController.cs b/src/Readarr.Http/Authentication/AuthenticationController.cs index d5bd9002f..fe632efd2 100644 --- a/src/Readarr.Http/Authentication/AuthenticationController.cs +++ b/src/Readarr.Http/Authentication/AuthenticationController.cs @@ -14,12 +14,10 @@ namespace Readarr.Http.Authentication public class AuthenticationController : Controller { private readonly IAuthenticationService _authService; - private readonly IConfigFileProvider _configFileProvider; - public AuthenticationController(IAuthenticationService authService, IConfigFileProvider configFileProvider) + public AuthenticationController(IAuthenticationService authService) { _authService = authService; - _configFileProvider = configFileProvider; } [HttpPost("login")] @@ -43,6 +41,7 @@ namespace Readarr.Http.Authentication { IsPersistent = resource.RememberMe == "on" }; + await HttpContext.SignInAsync(AuthenticationType.Forms.ToString(), new ClaimsPrincipal(new ClaimsIdentity(claims, "Cookies", "user", "identifier")), authProperties); return Redirect("/"); diff --git a/src/Readarr.Http/Frontend/Mappers/HtmlMapperBase.cs b/src/Readarr.Http/Frontend/Mappers/HtmlMapperBase.cs index 93826cffc..2a97ce243 100644 --- a/src/Readarr.Http/Frontend/Mappers/HtmlMapperBase.cs +++ b/src/Readarr.Http/Frontend/Mappers/HtmlMapperBase.cs @@ -39,15 +39,6 @@ namespace Readarr.Http.Frontend.Mappers return stream; } - /* - public override IActionResult GetResponse(string resourceUrl) - { - var response = base.GetResponse(resourceUrl); - response.Headers["X-UA-Compatible"] = "IE=edge"; - - return response; - }*/ - protected string GetHtmlText() { if (RuntimeInfo.IsProduction && _generatedContent != null) diff --git a/src/Readarr.Http/Middleware/CacheableSpecification.cs b/src/Readarr.Http/Middleware/CacheableSpecification.cs index a8e7749af..9a656b86a 100644 --- a/src/Readarr.Http/Middleware/CacheableSpecification.cs +++ b/src/Readarr.Http/Middleware/CacheableSpecification.cs @@ -39,12 +39,12 @@ namespace Readarr.Http.Middleware return false; } - if (context.Request.Path.Equals("/index.js")) + if (context.Request.Path.Value?.EndsWith("/index.js") ?? false) { return false; } - if (context.Request.Path.Equals("/initialize.js")) + if (context.Request.Path.Value?.EndsWith("/initialize.js") ?? false) { return false; } @@ -55,7 +55,7 @@ namespace Readarr.Http.Middleware } if (context.Request.Path.StartsWithSegments("/log", StringComparison.CurrentCultureIgnoreCase) && - context.Request.Path.ToString().EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase)) + (context.Request.Path.Value?.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase) ?? false)) { return false; } diff --git a/src/Readarr.Http/REST/Attributes/RestGetByIdAttribute.cs b/src/Readarr.Http/REST/Attributes/RestGetByIdAttribute.cs index 870b91e10..a198ee55a 100644 --- a/src/Readarr.Http/REST/Attributes/RestGetByIdAttribute.cs +++ b/src/Readarr.Http/REST/Attributes/RestGetByIdAttribute.cs @@ -1,21 +1,15 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Routing; namespace NzbDrone.Http.REST.Attributes { [AttributeUsage(AttributeTargets.Method)] - public class RestGetByIdAttribute : ActionFilterAttribute, IActionHttpMethodProvider, IRouteTemplateProvider + public class RestGetByIdAttribute : Attribute, IActionHttpMethodProvider, IRouteTemplateProvider { - public override void OnActionExecuting(ActionExecutingContext context) - { - Console.WriteLine($"OnExecuting {context.Controller.GetType()} {context.ActionDescriptor.DisplayName}"); - } - public IEnumerable HttpMethods => new[] { "GET" }; public string Template => "{id:int}"; - public new int? Order => 0; + public int? Order => 0; public string Name { get; } } }