feat: Implement spam protection with configurable limits and auto-mute escalation

This commit is contained in:
HueByte
2026-07-17 19:47:57 +02:00
parent 3281064720
commit 53d0d326cb
9 changed files with 556 additions and 0 deletions
+5
View File
@@ -106,6 +106,11 @@ while (true)
// ── Upload limits (admin-configurable via the "Uploads" section) ─────
var uploadLimits = builder.Configuration.GetSection("Uploads").Get<UploadLimits>() ?? new UploadLimits();
builder.Services.AddSingleton(uploadLimits);
// ── Spam protection (admin-configurable via the "Spam" section) ──────
var spamOptions = builder.Configuration.GetSection("Spam").Get<SpamOptions>() ?? new SpamOptions();
builder.Services.AddSingleton(spamOptions);
builder.Services.AddSingleton<SpamGuard>();
// Raise the multipart form ceiling to match the configured limits; per-endpoint
// request-body limits are applied at the action from the same values.
builder.Services.Configure<Microsoft.AspNetCore.Http.Features.FormOptions>(o =>