Every route is a constant in ApiPaths
Build / Build (push) Successful in 35s

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:
thepraandClaude Opus 5.5 committed 2026-11-10 01:59:20 +01:00
1 parent 0f73f69239
commit 739a1603ca
47 files changed
+952 -373

No files matched your search

@@ -11,21 +11,21 @@ using PrivaPub.ClientModels.User.Avatar;
namespace PrivaPub.Controllers.ClientToServer
{
[ApiController,
Route("clientapi/avatar/private"),
Route(ApiPaths.PrivateAvatar.Prefix),
Authorize(Policy = Policies.IsUser)]
public class PrivateAvatarController(
IPrivateAvatarUsersService privateAvatarUsersService,
IStringLocalizer<GenericRes> localizer,
ILogger<PrivateAvatarController> logger) : ControllerBase
{
[HttpGet, Route("/clientapi/avatar/private/list")]
[HttpGet, Route(ApiPaths.PrivateAvatar.GET_GetAvatars)]
public async Task<IActionResult> GetAvatars(CancellationToken token)
{
var result = await privateAvatarUsersService.GetRootAvatars(User.GetUserId(), token);
return result.IsValid ? Ok(result.Data) : StatusCode(result.StatusCode, result);
}
[HttpPost, Route("/clientapi/avatar/private/insert")]
[HttpPost, Route(ApiPaths.PrivateAvatar.POST_InsertAvatar)]
public async Task<IActionResult> InsertAvatar(InsertAvatarForm model, CancellationToken token = default)
{
var result = new WebResult();
@@ -49,7 +49,7 @@ namespace PrivaPub.Controllers.ClientToServer
// A login deletes one of its personas, with its password again (R6): everything public it had goes, the groups it owns
// with it, as when the whole login is deleted (PersonaRemoval). A suspended persona may be deleted too.
[HttpPost, Route("/clientapi/avatar/private/delete"), Microsoft.AspNetCore.RateLimiting.EnableRateLimiting(Infrastructure.RateLimiting.Accounts)]
[HttpPost, Route(ApiPaths.PrivateAvatar.POST_DeleteAvatar), Microsoft.AspNetCore.RateLimiting.EnableRateLimiting(Infrastructure.RateLimiting.Accounts)]
public async Task<IActionResult> DeleteAvatar(DeletePersonaForm form, [FromServices] Services.IRootUsersService users,
[FromServices] Services.IPersonaRemoval personas, [FromServices] StaticServices.DbEntities dbEntities, CancellationToken token)
{
@@ -65,7 +65,7 @@ namespace PrivaPub.Controllers.ClientToServer
}
// how the persona's clients show what others post (R8): Mastodon's reading preferences, which its API only reads
[HttpGet, Route("/clientapi/avatar/private/preferences")]
[HttpGet, Route(ApiPaths.PrivateAvatar.GET_Preferences)]
public async Task<IActionResult> Preferences([FromQuery] string avatarId, [FromServices] StaticServices.DbEntities dbEntities, CancellationToken token)
{
var avatar = await OwnPersona(avatarId, dbEntities, token);
@@ -74,7 +74,7 @@ namespace PrivaPub.Controllers.ClientToServer
: Ok(PreferencesOf(avatar));
}
[HttpPost, Route("/clientapi/avatar/private/preferences")]
[HttpPost, Route(ApiPaths.PrivateAvatar.POST_SavePreferences)]
public async Task<IActionResult> SavePreferences(PersonaPreferencesForm form, [FromServices] StaticServices.DbEntities dbEntities, CancellationToken token)
{
if (!ModelState.IsValid)
@@ -109,7 +109,7 @@ namespace PrivaPub.Controllers.ClientToServer
ExpandSpoilers = avatar.Settings.ExpandSpoilers
};
[HttpPost, Route("/clientapi/avatar/private/update")]
[HttpPost, Route(ApiPaths.PrivateAvatar.POST_UpdateAvatar)]
public async Task<IActionResult> UpdateAvatar(UpdateAvatarForm model, CancellationToken token = default)
{
var result = new WebResult();