Files
SocialPub/PrivaPub/Api/Mastodon/Controllers/CustomEmojisController.cs
T
thepraandClaude Opus 5.5 739a1603ca
Build / Build (push) Successful in 35s
Every route is a constant in ApiPaths
All 384 routes, the Mastodon API, the client API and the frozen federation
paths, are read from one class with one nested class per controller. Their
values are unchanged, checked one by one against the old literals; decePubClient
keeps its own APIs class.

Checked against GoToSocial in the pasture: 64 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
2026-11-10 01:59:20 +01:00

23 lines
1.0 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PrivaPub.Api.Mastodon.Entities;
using PrivaPub.Api.Mastodon.Infrastructure;
using PrivaPub.Domain.Content;
namespace PrivaPub.Api.Mastodon.Controllers
{
// Mastodon's list of the server's custom emoji (completion program R7), for clients' pickers: as Mastodon lists them,
// those offered (not disabled) and shown in the picker, by shortcode. Read from LocalEmojis, the copy in memory that every
// change reloads at once (and that is read again when five minutes old), so no request reads the database.
public class CustomEmojisController : MastodonController
{
[HttpGet(ApiPaths.CustomEmojis.GET_List), AllowAnonymous]
public IActionResult List() => Json(LocalEmojis.Current.Values
.Where(e => e.VisibleInPicker)
.OrderBy(e => e.Shortcode, StringComparer.Ordinal)
.Select(e => new CustomEmojiEntity { Shortcode = e.Shortcode, Url = e.Url, StaticUrl = e.StaticUrl, VisibleInPicker = true, Category = e.Category })
.ToList());
}
}