diff --git a/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs b/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs index 19d1b3a5..e11c4b92 100644 --- a/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs +++ b/Iceshrimp.Backend/Controllers/Federation/NodeInfoController.cs @@ -16,7 +16,7 @@ namespace Iceshrimp.Backend.Controllers.Federation; [Route("/nodeinfo")] [EnableCors("well-known")] [Produces(MediaTypeNames.Application.Json)] -public class NodeInfoController(IOptions config, DatabaseContext db) : ControllerBase +public class NodeInfoController(IOptions instanceConfig, IOptions storageConfig, DatabaseContext db) : ControllerBase { [HttpGet("2.1")] [HttpGet("2.0")] @@ -25,7 +25,7 @@ public class NodeInfoController(IOptions config, Databas { var cutoffMonth = DateTime.UtcNow - TimeSpan.FromDays(30); var cutoffHalfYear = DateTime.UtcNow - TimeSpan.FromDays(180); - var instance = config.Value; + var instance = instanceConfig.Value; var totalUsers = await db.Users.LongCountAsync(p => p.IsLocalUser && !Constants.SystemUsers.Contains(p.UsernameLower)); var activeMonth = @@ -37,6 +37,7 @@ public class NodeInfoController(IOptions config, Databas !Constants.SystemUsers.Contains(p.UsernameLower) && p.LastActiveDate > cutoffHalfYear); var localPosts = await db.Notes.LongCountAsync(p => p.UserHost == null); + var maxUploadSize = storageConfig.Value.MaxUploadSizeBytes; return new NodeInfoResponse { @@ -91,23 +92,21 @@ public class NodeInfoController(IOptions config, Databas EnableGithubIntegration = false, EnableDiscordIntegration = false, EnableEmail = false, - - // TODO: STUB PublicTimelineVisibility = new() { Bubble = false, Federated = false, Local = false, }, - UploadLimits = new() { - General = 50_000_000, - Avatar = 50_000_000, - Background = 50_000_000, - Banner = 50_000_000, + UploadLimits = new() { + General = maxUploadSize, + Avatar = maxUploadSize, + Background = maxUploadSize, + Banner = maxUploadSize, }, - Suggestions = new() { + Suggestions = new() { Enabled = false }, - Federation = new() { + Federation = new() { Enabled = true } }, diff --git a/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs b/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs index 053f1f4b..15320005 100644 --- a/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs +++ b/Iceshrimp.Backend/Core/Federation/WebFinger/Types.cs @@ -133,10 +133,10 @@ public class NodeInfoResponse 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; } + [J("general")] public long? General { get; set; } + [J("avatar")] public long? Avatar { get; set; } + [J("background")] public long? Background { get; set; } + [J("banner")] public long? Banner { get; set; } } public class PleromaSuggestions