mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 21:17:23 +01:00
make speedtest rate limit to remote config and default to 0.5h
This commit is contained in:
parent
0d72e3b40e
commit
532c123927
2 changed files with 3 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ public class SpeedTestController : ControllerBase
|
|||
public async Task<IActionResult> DownloadTest(CancellationToken cancellationToken)
|
||||
{
|
||||
var user = HttpContext.User.Claims.First(f => string.Equals(f.Type, MareClaimTypes.Uid, StringComparison.Ordinal)).Value;
|
||||
var speedtestLimit = _configurationService.GetValueOrDefault(nameof(StaticFilesServerConfiguration.SpeedTestHoursRateLimit), 6);
|
||||
var speedtestLimit = _configurationService.GetValueOrDefault(nameof(StaticFilesServerConfiguration.SpeedTestHoursRateLimit), 0.5);
|
||||
if (_memoryCache.TryGetValue<DateTime>(user, out var value))
|
||||
{
|
||||
var hoursRemaining = value.Subtract(DateTime.UtcNow).TotalHours;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue