From 91e0f09bc51bd0d134b63bc07d4c446a7ff98fbb Mon Sep 17 00:00:00 2001 From: pancakes Date: Mon, 27 Jan 2025 23:48:59 +1000 Subject: [PATCH] [backend/api] Add remote emoji list endpoint for moderators --- .../Controllers/Web/EmojiController.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Iceshrimp.Backend/Controllers/Web/EmojiController.cs b/Iceshrimp.Backend/Controllers/Web/EmojiController.cs index fe24dcc9..4231df57 100644 --- a/Iceshrimp.Backend/Controllers/Web/EmojiController.cs +++ b/Iceshrimp.Backend/Controllers/Web/EmojiController.cs @@ -46,6 +46,27 @@ public class EmojiController( .ToListAsync(); } + [HttpGet("remote")] + [Authorize("role:moderator")] + [ProducesResults(HttpStatusCode.OK)] + public async Task> GetRemoteEmoji() + { + return await db.Emojis + .Where(p => p.Host != null) + .Select(p => new EmojiResponse + { + Id = p.Id, + Name = p.Name, + Uri = p.Uri, + Aliases = p.Aliases, + Category = p.Host, + PublicUrl = p.GetAccessUrl(instance.Value), + License = p.License, + Sensitive = p.Sensitive + }) + .ToListAsync(); + } + [HttpGet("{id}")] [ProducesResults(HttpStatusCode.OK)] [ProducesErrors(HttpStatusCode.NotFound)]