[backend/akko-client] Expose VAPID public key

This commit is contained in:
Kopper 2024-09-01 01:32:25 +03:00 committed by Iceshrimp development
parent 3fb8fea316
commit 0e7e2698e0
4 changed files with 15 additions and 1 deletions

View file

@ -33,10 +33,14 @@ public class InstanceController(DatabaseContext db, MetaService meta) : Controll
var (instanceName, instanceDescription, adminContact) =
await meta.GetMany(MetaEntity.InstanceName, MetaEntity.InstanceDescription, MetaEntity.AdminContactEmail);
var vapidKey = await meta.Get(MetaEntity.VapidPublicKey); // can't merge with above call since they're all nullable and this is not.
return new InstanceInfoV1Response(config.Value, instanceName, instanceDescription, adminContact)
{
Stats = new InstanceStats(userCount, noteCount, instanceCount)
Stats = new InstanceStats(userCount, noteCount, instanceCount),
Pleroma = new() {
VapidPublicKey = vapidKey
}
};
}

View file

@ -1,3 +1,4 @@
using Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
using Iceshrimp.Backend.Core.Configuration;
using Iceshrimp.Backend.Core.Extensions;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
@ -33,6 +34,7 @@ public class InstanceInfoV1Response(
[J("urls")] public InstanceUrls Urls => new(config.Instance);
[J("configuration")] public InstanceConfigurationV1 Configuration => new(config.Instance);
[J("pleroma")] public required PleromaInstanceExtensions Pleroma { get; set; }
//TODO: add the rest
}

View file

@ -0,0 +1,8 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Pleroma.Schemas.Entities;
public class PleromaInstanceExtensions
{
[J("vapid_public_key")] public required string VapidPublicKey { get; set; }
}