From c6a2a99c1b50fd1f8e62322b61668f5f94ebed90 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 21 Feb 2024 02:35:52 +0100 Subject: [PATCH] [backend/controllers] Inherit from ControllerBase instead of Controller as we do not need MVC View support --- Iceshrimp.Backend/Controllers/ActivityPubController.cs | 2 +- Iceshrimp.Backend/Controllers/AdminController.cs | 2 +- Iceshrimp.Backend/Controllers/AuthController.cs | 2 +- Iceshrimp.Backend/Controllers/DriveController.cs | 2 +- Iceshrimp.Backend/Controllers/FallbackController.cs | 2 +- Iceshrimp.Backend/Controllers/IdenticonController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/AccountController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/MediaController.cs | 2 +- .../Controllers/Mastodon/NotificationController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/SearchController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/StatusController.cs | 2 +- Iceshrimp.Backend/Controllers/Mastodon/TimelineController.cs | 2 +- Iceshrimp.Backend/Controllers/NodeInfoController.cs | 2 +- Iceshrimp.Backend/Controllers/NoteController.cs | 2 +- Iceshrimp.Backend/Controllers/TimelineController.cs | 2 +- Iceshrimp.Backend/Controllers/UserController.cs | 2 +- Iceshrimp.Backend/Controllers/WellKnownController.cs | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Iceshrimp.Backend/Controllers/ActivityPubController.cs b/Iceshrimp.Backend/Controllers/ActivityPubController.cs index 9f3879ba..936eb19e 100644 --- a/Iceshrimp.Backend/Controllers/ActivityPubController.cs +++ b/Iceshrimp.Backend/Controllers/ActivityPubController.cs @@ -17,7 +17,7 @@ namespace Iceshrimp.Backend.Controllers; [Tags("ActivityPub")] [UseNewtonsoftJson] [Produces("application/activity+json", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")] -public class ActivityPubController : Controller +public class ActivityPubController : ControllerBase { [HttpGet("/notes/{id}")] [AuthorizedFetch] diff --git a/Iceshrimp.Backend/Controllers/AdminController.cs b/Iceshrimp.Backend/Controllers/AdminController.cs index 8cb33254..8bcf911c 100644 --- a/Iceshrimp.Backend/Controllers/AdminController.cs +++ b/Iceshrimp.Backend/Controllers/AdminController.cs @@ -18,7 +18,7 @@ namespace Iceshrimp.Backend.Controllers; [SuppressMessage("ReSharper", "SuggestBaseTypeForParameterInConstructor", Justification = "We only have a DatabaseContext in our DI pool, not the base type")] [Produces(MediaTypeNames.Application.Json)] -public class AdminController(DatabaseContext db) : Controller +public class AdminController(DatabaseContext db) : ControllerBase { [HttpPost("invites/generate")] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(InviteResponse))] diff --git a/Iceshrimp.Backend/Controllers/AuthController.cs b/Iceshrimp.Backend/Controllers/AuthController.cs index f282956d..e73cd317 100644 --- a/Iceshrimp.Backend/Controllers/AuthController.cs +++ b/Iceshrimp.Backend/Controllers/AuthController.cs @@ -17,7 +17,7 @@ namespace Iceshrimp.Backend.Controllers; [EnableRateLimiting("sliding")] [Produces(MediaTypeNames.Application.Json)] [Route("/api/iceshrimp/v1/auth")] -public class AuthController(DatabaseContext db, UserService userSvc) : Controller +public class AuthController(DatabaseContext db, UserService userSvc) : ControllerBase { [HttpGet] [Authenticate] diff --git a/Iceshrimp.Backend/Controllers/DriveController.cs b/Iceshrimp.Backend/Controllers/DriveController.cs index 52dfc435..92216c76 100644 --- a/Iceshrimp.Backend/Controllers/DriveController.cs +++ b/Iceshrimp.Backend/Controllers/DriveController.cs @@ -16,7 +16,7 @@ public class DriveController( [SuppressMessage("ReSharper", "SuggestBaseTypeForParameterInConstructor")] IOptionsSnapshot options, ILogger logger -) : Controller +) : ControllerBase { [EnableCors("drive")] [HttpGet("/files/{accessKey}")] diff --git a/Iceshrimp.Backend/Controllers/FallbackController.cs b/Iceshrimp.Backend/Controllers/FallbackController.cs index 8e44bae9..ec3d1140 100644 --- a/Iceshrimp.Backend/Controllers/FallbackController.cs +++ b/Iceshrimp.Backend/Controllers/FallbackController.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc; namespace Iceshrimp.Backend.Controllers; [Produces(MediaTypeNames.Application.Json)] -public class FallbackController : Controller +public class FallbackController : ControllerBase { [ProducesResponseType(StatusCodes.Status501NotImplemented, Type = typeof(ErrorResponse))] public IActionResult FallbackAction() diff --git a/Iceshrimp.Backend/Controllers/IdenticonController.cs b/Iceshrimp.Backend/Controllers/IdenticonController.cs index d4bb1c75..08f2ea5c 100644 --- a/Iceshrimp.Backend/Controllers/IdenticonController.cs +++ b/Iceshrimp.Backend/Controllers/IdenticonController.cs @@ -15,7 +15,7 @@ namespace Iceshrimp.Backend.Controllers; [Route("/identicon/{id}")] [Produces(MediaTypeNames.Image.Png)] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(object))] -public class IdenticonController : Controller +public class IdenticonController : ControllerBase { [HttpGet] public async Task GetIdenticon(string id) diff --git a/Iceshrimp.Backend/Controllers/Mastodon/AccountController.cs b/Iceshrimp.Backend/Controllers/Mastodon/AccountController.cs index e5d59b51..7f99194e 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/AccountController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/AccountController.cs @@ -30,7 +30,7 @@ public class AccountController( NotificationService notificationSvc, ActivityPub.ActivityRenderer activityRenderer, ActivityPub.ActivityDeliverService deliverSvc -) : Controller +) : ControllerBase { [HttpGet("verify_credentials")] [Authorize("read:accounts")] diff --git a/Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs b/Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs index 5ffced68..f8d83c1a 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/AuthController.cs @@ -17,7 +17,7 @@ namespace Iceshrimp.Backend.Controllers.Mastodon; [EnableRateLimiting("sliding")] [EnableCors("mastodon")] [Produces(MediaTypeNames.Application.Json)] -public class AuthController(DatabaseContext db) : Controller +public class AuthController(DatabaseContext db) : ControllerBase { [HttpGet("/api/v1/apps/verify_credentials")] [Authenticate] diff --git a/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs b/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs index 640c20bd..ee7d719e 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/InstanceController.cs @@ -15,7 +15,7 @@ namespace Iceshrimp.Backend.Controllers.Mastodon; [EnableCors("mastodon")] [EnableRateLimiting("sliding")] [Produces(MediaTypeNames.Application.Json)] -public class InstanceController(DatabaseContext db) : Controller +public class InstanceController(DatabaseContext db) : ControllerBase { [HttpGet("/api/v1/instance")] public async Task GetInstanceInfoV1([FromServices] IOptionsSnapshot config) diff --git a/Iceshrimp.Backend/Controllers/Mastodon/MediaController.cs b/Iceshrimp.Backend/Controllers/Mastodon/MediaController.cs index 45b16757..952ac28e 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/MediaController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/MediaController.cs @@ -19,7 +19,7 @@ namespace Iceshrimp.Backend.Controllers.Mastodon; [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AttachmentEntity))] [ProducesResponseType(StatusCodes.Status401Unauthorized, Type = typeof(MastodonErrorResponse))] [ProducesResponseType(StatusCodes.Status403Forbidden, Type = typeof(MastodonErrorResponse))] -public class MediaController(DriveService driveSvc) : Controller +public class MediaController(DriveService driveSvc) : ControllerBase { [HttpPost("/api/v1/media")] [HttpPost("/api/v2/media")] diff --git a/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs b/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs index 388687d0..71bca5ca 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/NotificationController.cs @@ -21,7 +21,7 @@ namespace Iceshrimp.Backend.Controllers.Mastodon; [EnableCors("mastodon")] [EnableRateLimiting("sliding")] [Produces(MediaTypeNames.Application.Json)] -public class NotificationController(DatabaseContext db, NotificationRenderer notificationRenderer) : Controller +public class NotificationController(DatabaseContext db, NotificationRenderer notificationRenderer) : ControllerBase { [HttpGet] [Authorize("read:notifications")] diff --git a/Iceshrimp.Backend/Controllers/Mastodon/SearchController.cs b/Iceshrimp.Backend/Controllers/Mastodon/SearchController.cs index 05e21e18..9c2fddbe 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/SearchController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/SearchController.cs @@ -28,7 +28,7 @@ public class SearchController( UserRenderer userRenderer, NoteService noteSvc, ActivityPub.UserResolver userResolver -) : Controller +) : ControllerBase { [HttpGet("/api/v2/search")] [Authorize("read:search")] diff --git a/Iceshrimp.Backend/Controllers/Mastodon/StatusController.cs b/Iceshrimp.Backend/Controllers/Mastodon/StatusController.cs index 3da8e61a..3ea9b9c3 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/StatusController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/StatusController.cs @@ -26,7 +26,7 @@ public class StatusController( NoteRenderer noteRenderer, NoteService noteSvc, IDistributedCache cache -) : Controller +) : ControllerBase { [HttpGet("{id}")] [Authenticate("read:statuses")] diff --git a/Iceshrimp.Backend/Controllers/Mastodon/TimelineController.cs b/Iceshrimp.Backend/Controllers/Mastodon/TimelineController.cs index 7977d327..4bb4dd37 100644 --- a/Iceshrimp.Backend/Controllers/Mastodon/TimelineController.cs +++ b/Iceshrimp.Backend/Controllers/Mastodon/TimelineController.cs @@ -24,7 +24,7 @@ namespace Iceshrimp.Backend.Controllers.Mastodon; [Produces(MediaTypeNames.Application.Json)] [ProducesResponseType(StatusCodes.Status401Unauthorized, Type = typeof(MastodonErrorResponse))] [ProducesResponseType(StatusCodes.Status403Forbidden, Type = typeof(MastodonErrorResponse))] -public class TimelineController(DatabaseContext db, NoteRenderer noteRenderer, IDistributedCache cache) : Controller +public class TimelineController(DatabaseContext db, NoteRenderer noteRenderer, IDistributedCache cache) : ControllerBase { [Authorize("read:statuses")] [HttpGet("home")] diff --git a/Iceshrimp.Backend/Controllers/NodeInfoController.cs b/Iceshrimp.Backend/Controllers/NodeInfoController.cs index 25f87526..87a8cd14 100644 --- a/Iceshrimp.Backend/Controllers/NodeInfoController.cs +++ b/Iceshrimp.Backend/Controllers/NodeInfoController.cs @@ -14,7 +14,7 @@ namespace Iceshrimp.Backend.Controllers; [Route("/nodeinfo")] [EnableCors("well-known")] [Produces(MediaTypeNames.Application.Json)] -public class NodeInfoController(IOptions config, DatabaseContext db) : Controller +public class NodeInfoController(IOptions config, DatabaseContext db) : ControllerBase { [HttpGet("2.1")] [HttpGet("2.0")] diff --git a/Iceshrimp.Backend/Controllers/NoteController.cs b/Iceshrimp.Backend/Controllers/NoteController.cs index c5e1d5e8..050eab55 100644 --- a/Iceshrimp.Backend/Controllers/NoteController.cs +++ b/Iceshrimp.Backend/Controllers/NoteController.cs @@ -16,7 +16,7 @@ namespace Iceshrimp.Backend.Controllers; [EnableRateLimiting("sliding")] [Route("/api/iceshrimp/v1/note")] [Produces(MediaTypeNames.Application.Json)] -public class NoteController(DatabaseContext db, NoteService noteSvc) : Controller +public class NoteController(DatabaseContext db, NoteService noteSvc) : ControllerBase { [HttpGet("{id}")] [Authenticate] diff --git a/Iceshrimp.Backend/Controllers/TimelineController.cs b/Iceshrimp.Backend/Controllers/TimelineController.cs index 5751d7fb..1cd9b8b1 100644 --- a/Iceshrimp.Backend/Controllers/TimelineController.cs +++ b/Iceshrimp.Backend/Controllers/TimelineController.cs @@ -15,7 +15,7 @@ namespace Iceshrimp.Backend.Controllers; [EnableRateLimiting("sliding")] [Route("/api/iceshrimp/v1/timeline")] [Produces(MediaTypeNames.Application.Json)] -public class TimelineController(DatabaseContext db, IDistributedCache cache) : Controller +public class TimelineController(DatabaseContext db, IDistributedCache cache) : ControllerBase { [HttpGet("home")] [Authenticate] diff --git a/Iceshrimp.Backend/Controllers/UserController.cs b/Iceshrimp.Backend/Controllers/UserController.cs index 8317711f..4d6995ab 100644 --- a/Iceshrimp.Backend/Controllers/UserController.cs +++ b/Iceshrimp.Backend/Controllers/UserController.cs @@ -15,7 +15,7 @@ namespace Iceshrimp.Backend.Controllers; [EnableRateLimiting("sliding")] [Route("/api/iceshrimp/v1/user/{id}")] [Produces(MediaTypeNames.Application.Json)] -public class UserController(DatabaseContext db) : Controller +public class UserController(DatabaseContext db) : ControllerBase { [HttpGet] [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(UserResponse))] diff --git a/Iceshrimp.Backend/Controllers/WellKnownController.cs b/Iceshrimp.Backend/Controllers/WellKnownController.cs index 5fa6a1ef..bffc31ab 100644 --- a/Iceshrimp.Backend/Controllers/WellKnownController.cs +++ b/Iceshrimp.Backend/Controllers/WellKnownController.cs @@ -15,7 +15,7 @@ namespace Iceshrimp.Backend.Controllers; [Tags("Federation")] [Route("/.well-known")] [EnableCors("well-known")] -public class WellKnownController(IOptions config, DatabaseContext db) : Controller +public class WellKnownController(IOptions config, DatabaseContext db) : ControllerBase { [HttpGet("webfinger")] [Produces(MediaTypeNames.Application.Json)]