BTCPay-infrastructure-recovery

This commit is contained in:
sysadmin
2025-09-04 21:28:47 +01:00
parent b4cee007c4
commit be4d797c6c
22 changed files with 1552 additions and 101 deletions

View File

@@ -44,9 +44,15 @@ public class PushNotificationController : ControllerBase
try
{
var userIdClaim = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
var username = User.FindFirst(ClaimTypes.Name)?.Value ?? User.Identity?.Name;
// Debug logging
var logger = HttpContext.RequestServices.GetRequiredService<ILogger<PushNotificationController>>();
logger.LogInformation("Push subscription attempt - UserIdClaim: {UserIdClaim}, Username: {Username}", userIdClaim, username);
if (string.IsNullOrEmpty(userIdClaim) || !Guid.TryParse(userIdClaim, out Guid userId))
{
return Unauthorized("Invalid user ID");
return Unauthorized(new { error = "Invalid user ID", userIdClaim, username });
}
var userAgent = Request.Headers.UserAgent.ToString();
@@ -65,6 +71,8 @@ public class PushNotificationController : ControllerBase
}
catch (Exception ex)
{
var logger = HttpContext.RequestServices.GetRequiredService<ILogger<PushNotificationController>>();
logger.LogError(ex, "Push subscription error");
return StatusCode(500, new { error = ex.Message });
}
}