diff --git a/src/GZCTF/Controllers/GameController.cs b/src/GZCTF/Controllers/GameController.cs index 5b88d3e6b..d581f1123 100644 --- a/src/GZCTF/Controllers/GameController.cs +++ b/src/GZCTF/Controllers/GameController.cs @@ -533,10 +533,7 @@ public async Task ChallengesWithTeamInfo([FromRoute] int id, Canc ScoreboardModel scoreboard = await gameRepository.GetScoreboard(context.Game!, token); - ScoreboardItem? boardItem = scoreboard.Items[context.Participation!.TeamId]; - - // make sure team info is not null - boardItem ??= new ScoreboardItem + ScoreboardItem boardItem = scoreboard.Items.TryGetValue(context.Participation!.TeamId, out var item) ? item : new() { Avatar = context.Participation!.Team.AvatarUrl, SolvedCount = 0, diff --git a/src/GZCTF/Middlewares/RateLimiter.cs b/src/GZCTF/Middlewares/RateLimiter.cs index 886a185a8..8cc72d255 100644 --- a/src/GZCTF/Middlewares/RateLimiter.cs +++ b/src/GZCTF/Middlewares/RateLimiter.cs @@ -82,7 +82,7 @@ public static void ConfigureRateLimiter(RateLimiterOptions options) context.HttpContext.Response.Headers.RetryAfter = afterSec.ToString(NumberFormatInfo.InvariantInfo); await context.HttpContext.Response.WriteAsJsonAsync( - new RequestResponse(localizer[nameof(Resources.Program.RateLimit_TooManyRequests)], + new RequestResponse(localizer[nameof(Resources.Program.RateLimit_TooManyRequests), afterSec], StatusCodes.Status429TooManyRequests ), cancellationToken); }; @@ -109,4 +109,4 @@ await context.HttpContext.Response.WriteAsJsonAsync( o.ReplenishmentPeriod = TimeSpan.FromSeconds(5); }); } -} \ No newline at end of file +}