Refactor controller OpenAPI tags
This commit is contained in:
parent
6de8ea12e6
commit
3c72d50459
7 changed files with 27 additions and 0 deletions
|
@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
|
|||
namespace Iceshrimp.Backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Tags("ActivityPub")]
|
||||
[UseNewtonsoftJson]
|
||||
public class ActivityPubController : Controller {
|
||||
[HttpGet("/notes/{id}")]
|
||||
|
|
|
@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
namespace Iceshrimp.Backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Tags("Authentication")]
|
||||
[EnableRateLimiting("sliding")]
|
||||
[Produces("application/json")]
|
||||
[Route("/api/iceshrimp/v1/auth")]
|
||||
|
|
21
Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs
Normal file
21
Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Iceshrimp.Backend.Controllers.Schemas;
|
||||
using Iceshrimp.Backend.Core.Database;
|
||||
using Iceshrimp.Backend.Core.Database.Tables;
|
||||
using Iceshrimp.Backend.Core.Helpers;
|
||||
using Iceshrimp.Backend.Core.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Iceshrimp.Backend.Controllers.Mastodon;
|
||||
|
||||
[ApiController]
|
||||
[Tags("Mastodon")]
|
||||
[EnableRateLimiting("sliding")]
|
||||
[Produces("application/json")]
|
||||
[Route("/api/v1")]
|
||||
public class MastodonAuthController() : Controller {
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ using Microsoft.Extensions.Options;
|
|||
namespace Iceshrimp.Backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Tags("Federation")]
|
||||
[Route("/nodeinfo")]
|
||||
public class NodeInfoController(IOptions<Config.InstanceSection> config) : Controller {
|
||||
[HttpGet("2.1")]
|
||||
|
|
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
namespace Iceshrimp.Backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Tags("User")]
|
||||
[Produces("application/json")]
|
||||
[EnableRateLimiting("sliding")]
|
||||
[Route("/api/iceshrimp/v1/user/{id}")]
|
||||
|
|
|
@ -10,6 +10,7 @@ using Microsoft.Extensions.Options;
|
|||
namespace Iceshrimp.Backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Tags("Federation")]
|
||||
[Route("/.well-known")]
|
||||
public class WellKnownController(IOptions<Config.InstanceSection> config, DatabaseContext db) : Controller {
|
||||
[HttpGet("webfinger")]
|
||||
|
|
|
@ -83,6 +83,7 @@ public static class ServiceExtensions {
|
|||
//TODO: separate limiter for authenticated users, partitioned by user id
|
||||
//TODO: ipv6 /64 subnet buckets
|
||||
//TODO: rate limit status headers - maybe switch to https://github.com/stefanprodan/AspNetCoreRateLimit?
|
||||
//TODO: alternatively just write our own
|
||||
services.AddRateLimiter(options => {
|
||||
options.AddSlidingWindowLimiter("sliding", limiterOptions => {
|
||||
limiterOptions.PermitLimit = 500;
|
||||
|
|
Loading…
Add table
Reference in a new issue