summaryrefslogtreecommitdiff
path: root/internal/typeutils
diff options
context:
space:
mode:
Diffstat (limited to 'internal/typeutils')
-rw-r--r--internal/typeutils/internaltofrontend.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index eb4bcf70d..068ba700c 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -576,6 +576,16 @@ func (c *converter) InstanceToAPIInstance(ctx context.Context, i *gtsmodel.Insta
// if the requested instance is *this* instance, we can add some extra information
if host := config.GetHost(); i.Domain == host {
+ if ia, err := c.db.GetInstanceAccount(ctx, ""); err == nil {
+ if ia.HeaderMediaAttachment != nil {
+ // take instance account header as instance thumbnail
+ mi.Thumbnail = ia.HeaderMediaAttachment.URL
+ } else {
+ // or just use a default
+ mi.Thumbnail = config.GetProtocol() + "://" + host + "/assets/logo.png"
+ }
+ }
+
userCount, err := c.db.CountInstanceUsers(ctx, host)
if err == nil {
mi.Stats["user_count"] = userCount
@@ -624,14 +634,6 @@ func (c *converter) InstanceToAPIInstance(ctx context.Context, i *gtsmodel.Insta
}
}
- // get the instance account if it exists and just skip if it doesn't
- ia, err := c.db.GetInstanceAccount(ctx, "")
- if err == nil {
- if ia.HeaderMediaAttachment != nil {
- mi.Thumbnail = ia.HeaderMediaAttachment.URL
- }
- }
-
// contact account is optional but let's try to get it
if i.ContactAccountID != "" {
if i.ContactAccount == nil {