[backend/akko-client] Stub out just enough to allow Akkoma-FE to start

This commit is contained in:
Kopper 2024-08-31 23:57:33 +03:00 committed by Iceshrimp development
parent 7e1bccadaf
commit 1bac67cd06
4 changed files with 106 additions and 1 deletions

View file

@ -90,9 +90,34 @@ public class NodeInfoController(IOptions<Config.InstanceSection> config, Databas
MaxCaptionTextLength = 0,
EnableGithubIntegration = false,
EnableDiscordIntegration = false,
EnableEmail = false
EnableEmail = false,
// TODO: STUB
PublicTimelineVisibility = new() {
Bubble = true,
Federated = true,
Local = true,
},
UploadLimits = new() {
General = 50_000_000,
Avatar = 50_000_000,
Background = 50_000_000,
Banner = 50_000_000,
},
Suggestions = new() {
Enabled = false
},
Federation = new() {
Enabled = true
}
},
OpenRegistrations = false
};
}
[HttpGet("2.0.json")]
public IActionResult GetNodeInfoAkkoFE()
{
return Redirect("/nodeinfo/2.0");
}
}

View file

@ -0,0 +1,26 @@
using System.Net;
using System.Net.Mime;
using Iceshrimp.Backend.Controllers.Mastodon.Attributes;
using Iceshrimp.Backend.Controllers.Pleroma.Schemas;
using Iceshrimp.Backend.Controllers.Shared.Attributes;
using Iceshrimp.Backend.Core.Configuration;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
using Microsoft.Extensions.Options;
namespace Iceshrimp.Backend.Controllers.Pleroma;
[MastodonApiController]
[EnableCors("mastodon")]
[EnableRateLimiting("sliding")]
[Produces(MediaTypeNames.Application.Json)]
public class FrontendController : ControllerBase
{
[HttpGet("/api/v1/pleroma/frontend_configurations")]
[ProducesResults(HttpStatusCode.OK)]
public FrontendConfigurationsResponse GetFrontendConfigurations([FromServices] IOptionsSnapshot<Config> config)
{
return new FrontendConfigurationsResponse();
}
}

View file

@ -0,0 +1,14 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas;
public class FrontendConfigurationsResponse()
{
[J("pleroma_fe")] public PleromaFeConfiguration PleromaFe => new();
}
// TODO: STUB
public class PleromaFeConfiguration()
{
}

View file

@ -110,6 +110,46 @@ public class NodeInfoResponse
[J("enableGithubIntegration")] public bool? EnableGithubIntegration { get; set; }
[J("enableDiscordIntegration")] public bool? EnableDiscordIntegration { get; set; }
[J("enableEmail")] public bool? EnableEmail { get; set; }
[J("publicTimelineVisibility")] public PleromaPublicTimelineVisibility? PublicTimelineVisibility { get; set; }
[J("features")] public PleromaFeature[] Features { get; set; } = [];
[J("uploadLimits")] public PleromaUploadLimits? UploadLimits { get; set; }
[J("suggestions")] public PleromaSuggestions? Suggestions { get; set; }
[J("federation")] public PleromaFederation? Federation { get; set; }
[J("localBubbleInstances")] public string[] LocalBubbleInstances { get; set; } = [];
// TODO: list of ap object ids i believe?
[J("staffAccounts")] public string[] StaffAccounts { get; set; } = [];
}
public enum PleromaFeature
{
}
public class PleromaPublicTimelineVisibility
{
[J("bubble")] public bool? Bubble { get; set; }
[J("federated")] public bool? Federated { get; set; }
[J("local")] public bool? Local { get; set; }
}
public class PleromaUploadLimits
{
[J("general")] public int? General { get; set; }
[J("avatar")] public int? Avatar { get; set; }
[J("background")] public int? Background { get; set; }
[J("banner")] public int? Banner { get; set; }
}
public class PleromaSuggestions
{
[J("enabled")] public bool? Enabled { get; set; }
}
public class PleromaFederation
{
[J("enabled")] public bool? Enabled { get; set; }
}
public class Maintainer