mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
Tidy conversion to aspnetcore
(cherry picked from commit 490f6e2e6aa3f220cc98f257a3ca3b2bea48fb80) (cherry picked from commit 8f3f90d4078d9d072d8ad4ccc3be35963b7435d6)
This commit is contained in:
parent
876376cb77
commit
2b0da546c9
4 changed files with 7 additions and 23 deletions
|
@ -14,12 +14,10 @@ namespace Lidarr.Http.Authentication
|
||||||
public class AuthenticationController : Controller
|
public class AuthenticationController : Controller
|
||||||
{
|
{
|
||||||
private readonly IAuthenticationService _authService;
|
private readonly IAuthenticationService _authService;
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
|
||||||
|
|
||||||
public AuthenticationController(IAuthenticationService authService, IConfigFileProvider configFileProvider)
|
public AuthenticationController(IAuthenticationService authService)
|
||||||
{
|
{
|
||||||
_authService = authService;
|
_authService = authService;
|
||||||
_configFileProvider = configFileProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("login")]
|
[HttpPost("login")]
|
||||||
|
@ -43,6 +41,7 @@ namespace Lidarr.Http.Authentication
|
||||||
{
|
{
|
||||||
IsPersistent = resource.RememberMe == "on"
|
IsPersistent = resource.RememberMe == "on"
|
||||||
};
|
};
|
||||||
|
|
||||||
await HttpContext.SignInAsync(AuthenticationType.Forms.ToString(), new ClaimsPrincipal(new ClaimsIdentity(claims, "Cookies", "user", "identifier")), authProperties);
|
await HttpContext.SignInAsync(AuthenticationType.Forms.ToString(), new ClaimsPrincipal(new ClaimsIdentity(claims, "Cookies", "user", "identifier")), authProperties);
|
||||||
|
|
||||||
return Redirect("/");
|
return Redirect("/");
|
||||||
|
|
|
@ -39,15 +39,6 @@ namespace Lidarr.Http.Frontend.Mappers
|
||||||
return stream;
|
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()
|
protected string GetHtmlText()
|
||||||
{
|
{
|
||||||
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
if (RuntimeInfo.IsProduction && _generatedContent != null)
|
||||||
|
|
|
@ -39,12 +39,12 @@ namespace Lidarr.Http.Middleware
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.Request.Path.Equals("/index.js"))
|
if (context.Request.Path.Value?.EndsWith("/index.js") ?? false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.Request.Path.Equals("/initialize.js"))
|
if (context.Request.Path.Value?.EndsWith("/initialize.js") ?? false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ namespace Lidarr.Http.Middleware
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.Request.Path.StartsWithSegments("/log", StringComparison.CurrentCultureIgnoreCase) &&
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Routing;
|
using Microsoft.AspNetCore.Mvc.Routing;
|
||||||
|
|
||||||
namespace Lidarr.Http.REST.Attributes
|
namespace Lidarr.Http.REST.Attributes
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[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<string> HttpMethods => new[] { "GET" };
|
public IEnumerable<string> HttpMethods => new[] { "GET" };
|
||||||
public string Template => "{id:int}";
|
public string Template => "{id:int}";
|
||||||
public new int? Order => 0;
|
public int? Order => 0;
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue