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
This commit is contained in:
1 parent
0f73f69239
commit
739a1603ca
47 files changed
+952
-373
No files matched your search
@@ -24,7 +24,7 @@ namespace PrivaPub.Controllers.ClientToServer
|
||||
// by an administrator, checked again against the database. Every act is kept in the staff's log (emoji.insert,
|
||||
// emoji.update, emoji.delete). An emoji is never renamed: its shortcode is its id on other servers (/grimaces/{shortcode}).
|
||||
[ApiController,
|
||||
Route("clientapi/admin/emoji"),
|
||||
Route(ApiPaths.EmojiAdmin.Prefix),
|
||||
Authorize(Policy = Policies.IsAdmin)]
|
||||
public class EmojiAdminController(
|
||||
IModerationLog log,
|
||||
@@ -45,7 +45,7 @@ namespace PrivaPub.Controllers.ClientToServer
|
||||
|
||||
IActionResult Refused(int status, string message) => StatusCode(status, new WebResult().Invalidate(localizer[message], status));
|
||||
|
||||
[HttpGet, Route("list")]
|
||||
[HttpGet, Route(ApiPaths.EmojiAdmin.GET_List)]
|
||||
public async Task<IActionResult> List(CancellationToken token)
|
||||
{
|
||||
if (await Administrator(token) == default)
|
||||
@@ -55,7 +55,7 @@ namespace PrivaPub.Controllers.ClientToServer
|
||||
}
|
||||
|
||||
// a new emoji; a shortcode deleted before comes back as it was written, with its new picture (the same id elsewhere)
|
||||
[HttpPost, Route("insert"), RequestSizeLimit(MaxRequestBytes), RequestFormLimits(MultipartBodyLengthLimit = MaxRequestBytes)]
|
||||
[HttpPost, Route(ApiPaths.EmojiAdmin.POST_Insert), RequestSizeLimit(MaxRequestBytes), RequestFormLimits(MultipartBodyLengthLimit = MaxRequestBytes)]
|
||||
public async Task<IActionResult> Insert([FromForm] LocalEmojiForm form, CancellationToken token)
|
||||
{
|
||||
var admin = await Administrator(token);
|
||||
@@ -104,7 +104,7 @@ namespace PrivaPub.Controllers.ClientToServer
|
||||
|
||||
// the emoji with that shortcode as it should be now: its category, the picker, disabled or not, and a new picture if
|
||||
// one is sent
|
||||
[HttpPost, Route("update"), RequestSizeLimit(MaxRequestBytes), RequestFormLimits(MultipartBodyLengthLimit = MaxRequestBytes)]
|
||||
[HttpPost, Route(ApiPaths.EmojiAdmin.POST_Update), RequestSizeLimit(MaxRequestBytes), RequestFormLimits(MultipartBodyLengthLimit = MaxRequestBytes)]
|
||||
public async Task<IActionResult> Update([FromForm] LocalEmojiForm form, CancellationToken token)
|
||||
{
|
||||
var admin = await Administrator(token);
|
||||
@@ -167,7 +167,7 @@ namespace PrivaPub.Controllers.ClientToServer
|
||||
|
||||
// deleted: offered nowhere, left out of what posts and profiles render, its picture trashed, and its id answers 410.
|
||||
// No other server is told (Mastodon tells none either); they keep their copy until they read a post again.
|
||||
[HttpPost, Route("delete")]
|
||||
[HttpPost, Route(ApiPaths.EmojiAdmin.POST_Delete)]
|
||||
public async Task<IActionResult> Delete([FromQuery] string shortcode, CancellationToken token)
|
||||
{
|
||||
var admin = await Administrator(token);
|
||||
|
||||
Reference in new issue
Block a user