Release v1.0.0 #16

Merged
Wesser merged 492 commits from release/v1.0.0 into master 2025-02-12 09:19:32 +03:00
240 changed files with 10647 additions and 99 deletions
Showing only changes of commit b1250616a7 - Show all commits

View File

@ -6,7 +6,7 @@ namespace Mirea.Api.Endpoint.Common.Services;
public static class UrlHelper public static class UrlHelper
{ {
public static string CurrentDomain(HttpContext context) => public static string GetCurrentDomain(this HttpContext context) =>
context.Request.Headers["X-Forwarded-Host"].FirstOrDefault() ?? context.Request.Host.Host; context.Request.Headers["X-Forwarded-Host"].FirstOrDefault() ?? context.Request.Host.Host;
private static string CreateSubPath(string? path) private static string CreateSubPath(string? path)

View File

@ -74,9 +74,11 @@ public partial class SetupController(
Response.Cookies.Append("AuthToken", token, new CookieOptions Response.Cookies.Append("AuthToken", token, new CookieOptions
{ {
Path = UrlHelper.GetSubPathWithoutFirstApiName + "api", Path = UrlHelper.GetSubPathWithoutFirstApiName + "api",
Domain = UrlHelper.CurrentDomain(ControllerContext.HttpContext), Domain = HttpContext.GetCurrentDomain(),
#if !DEBUG
Secure = true, Secure = true,
HttpOnly = true HttpOnly = true
#endif
}); });
return Ok(true); return Ok(true);
} }

View File

@ -30,9 +30,11 @@ public class AuthController(IOptionsSnapshot<Admin> user, AuthService auth, Pass
{ {
Expires = expires, Expires = expires,
Path = UrlHelper.GetSubPathWithoutFirstApiName + "api", Path = UrlHelper.GetSubPathWithoutFirstApiName + "api",
Domain = UrlHelper.CurrentDomain(ControllerContext.HttpContext), Domain = HttpContext.GetCurrentDomain(),
#if !DEBUG
Secure = true, Secure = true,
HttpOnly = true HttpOnly = true
#endif
}; };
Response.Cookies.Append(name, value, cookieOptions); Response.Cookies.Append(name, value, cookieOptions);