Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@
using System.Diagnostics;
using WebRateLimitAuth.Models;

namespace WebRateLimitAuth.Controllers
namespace WebRateLimitAuth.Controllers;

public class Home2Controller : Controller
{
public class Home2Controller : Controller
{
private readonly ILogger<Home2Controller> _logger;
private readonly ILogger<Home2Controller> _logger;

public Home2Controller(ILogger<Home2Controller> logger)
{
_logger = logger;
}
public Home2Controller(ILogger<Home2Controller> logger)
{
_logger = logger;
}

public IActionResult Index()
{
return View();
}
public IActionResult Index()
{
return View();
}

public async Task<IActionResult> Privacy()
{
await Task.Delay(100);
return View();
}
public async Task<IActionResult> Privacy()
{
await Task.Delay(100);
return View();
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace WebRateLimitAuth.Data
namespace WebRateLimitAuth.Data;

public class ApplicationDbContext : IdentityDbContext
{
public class ApplicationDbContext : IdentityDbContext
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace WebRateLimitAuth.Models
namespace WebRateLimitAuth.Models;

public class ErrorViewModel
{
public class ErrorViewModel
{
public string? RequestId { get; set; }
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ namespace WebRateLimitAuth.Models;
public class MyRateLimitOptions
{
public const string MyRateLimit = "MyRateLimit";

public int permitLimit { get; set; } = 100;
public int window { get; set; } = 10;
public int replenishmentPeriod { get; set; } = 2;
public int queueLimit { get; set; } = 100;
public int segmentsPerWindow { get; set; } = 8;
public int tokenLimit { get; set; } = 10;
public int tokenLimit2 { get; set; } = 20;
public int tokensPerPeriod { get; set; } = 4;
public bool autoReplenishment { get; set; } = false;
public int PermitLimit { get; set; } = 100;
public int Window { get; set; } = 10;
public int ReplenishmentPeriod { get; set; } = 2;
public int QueueLimit { get; set; } = 100;
public int SegmentsPerWindow { get; set; } = 8;
public int TokenLimit { get; set; } = 10;
public int TokenLimit2 { get; set; } = 20;
public int TokensPerPeriod { get; set; } = 4;
public bool AutoReplenishment { get; set; } = false;
}
Loading