Kill switch

This commit is contained in:
Zeeshaun
2026-04-01 20:22:05 +00:00
parent bed8e91bc0
commit c718fb343d
14 changed files with 413 additions and 15 deletions
@@ -68,11 +68,28 @@ public class CharactersController : ControllerBase
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
if (string.IsNullOrWhiteSpace(userId))
return Unauthorized();
var characters = await _characters.GetForOwnerAsync(userId);
return Ok(characters);
}
[HttpPost("internal/reset-coords")]
public async Task<IActionResult> ResetCoordsInternal([FromBody] InternalResetCharactersToCoordRequest req)
{
var configuredKey = (_configuration["InternalApi:Key"] ?? _configuration["Jwt:Key"] ?? string.Empty).Trim();
var requestKey = (Request.Headers["X-Internal-Api-Key"].FirstOrDefault() ?? string.Empty).Trim();
if (string.IsNullOrWhiteSpace(configuredKey) || !string.Equals(configuredKey, requestKey, StringComparison.Ordinal))
return Unauthorized();
if (req.Coord is null)
return BadRequest("coord required");
var updatedCharacterCount = await _characters.ResetAllCoordsAsync(req.Coord);
return Ok(new InternalResetCharactersToCoordResponse
{
UpdatedCharacterCount = updatedCharacterCount
});
}
[HttpGet("{id}/visible-locations")]
[Authorize(Roles = "USER,SUPER")]
public async Task<IActionResult> VisibleLocations(string id)