[backend/federation] Populate themeColor in nodeinfo from meta store

This commit is contained in:
pancakes 2025-03-27 16:02:43 +10:00
parent adcd41a81f
commit 740e622d5d
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View file

@ -46,9 +46,9 @@ public class NodeInfoController(
var localPosts = await db.Notes.LongCountAsync(p => p.UserHost == null); var localPosts = await db.Notes.LongCountAsync(p => p.UserHost == null);
var maxUploadSize = storageConfig.Value.MaxUploadSizeBytes; var maxUploadSize = storageConfig.Value.MaxUploadSizeBytes;
var (instanceName, instanceDescription, adminContact) = var (instanceName, instanceDescription, adminContact, themeColor) =
await meta.GetManyAsync(MetaEntity.InstanceName, MetaEntity.InstanceDescription, await meta.GetManyAsync(MetaEntity.InstanceName, MetaEntity.InstanceDescription,
MetaEntity.AdminContactEmail); MetaEntity.AdminContactEmail, MetaEntity.ThemeColor);
return new NodeInfoResponse return new NodeInfoResponse
{ {
@ -88,7 +88,7 @@ public class NodeInfoController(
TosUrl = "todo", TosUrl = "todo",
RepositoryUrl = new Uri(Constants.RepositoryUrl), RepositoryUrl = new Uri(Constants.RepositoryUrl),
FeedbackUrl = new Uri(Constants.IssueTrackerUrl), FeedbackUrl = new Uri(Constants.IssueTrackerUrl),
ThemeColor = "#000000", ThemeColor = themeColor,
DisableRegistration = true, DisableRegistration = true,
DisableLocalTimeline = false, DisableLocalTimeline = false,
DisableRecommendedTimeline = false, DisableRecommendedTimeline = false,

View file

@ -79,6 +79,7 @@ public static class MetaEntity
public static readonly NullableStringMeta InstanceName = new("instance_name"); public static readonly NullableStringMeta InstanceName = new("instance_name");
public static readonly NullableStringMeta InstanceDescription = new("instance_description"); public static readonly NullableStringMeta InstanceDescription = new("instance_description");
public static readonly NullableStringMeta AdminContactEmail = new("admin_contact_email"); public static readonly NullableStringMeta AdminContactEmail = new("admin_contact_email");
public static readonly NullableStringMeta ThemeColor = new("theme_color");
} }
public class Meta<T>( public class Meta<T>(