diff --git a/internal/api/client/instance/instance.go b/internal/api/client/instance/instance.go index 7fb08f2..a5becf9 100644 --- a/internal/api/client/instance/instance.go +++ b/internal/api/client/instance/instance.go @@ -34,5 +34,6 @@ func New(config *config.Config, processor processing.Processor, log *logrus.Logg // Route satisfies the ClientModule interface func (m *Module) Route(s router.Router) error { s.AttachHandler(http.MethodGet, InstanceInformationPath, m.InstanceInformationGETHandler) + s.AttachHandler(http.MethodPatch, InstanceInformationPath, m.InstanceUpdatePATCHHandler) return nil } diff --git a/internal/db/pg/instancestats.go b/internal/db/pg/instancestats.go index 7bb9630..b57591d 100644 --- a/internal/db/pg/instancestats.go +++ b/internal/db/pg/instancestats.go @@ -30,7 +30,7 @@ func (ps *postgresService) GetStatusCountForInstance(domain string) (int, error) } else { // join on the domain of the account q = q.Join("JOIN accounts AS account ON account.id = status.account_id"). - Where("account.domain = ?", domain) + Where("account.domain = ?", domain) } return q.Count() diff --git a/internal/processing/instance.go b/internal/processing/instance.go index d0e70f0..a9b2fbd 100644 --- a/internal/processing/instance.go +++ b/internal/processing/instance.go @@ -90,7 +90,7 @@ func (p *processor) InstancePatch(form *apimodel.InstanceSettingsUpdateRequest) return nil, gtserror.NewErrorBadRequest(err, err.Error()) } // contact account user must be admin or moderator otherwise what's the point of contacting them - if !contactUser.Admin || !contactUser.Moderator { + if !contactUser.Admin && !contactUser.Moderator { err := fmt.Errorf("user of selected contact account %s is neither admin nor moderator", contactAccount.Username) return nil, gtserror.NewErrorBadRequest(err, err.Error()) } diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index ab4355c..a5984e0 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -512,6 +512,7 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro Email: i.ContactEmail, Version: i.Version, Stats: make(map[string]int), + ContactAccount: &model.Account{}, } // if the requested instance is *this* instance, we can add some extra information @@ -542,7 +543,18 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro mi.URLS = &model.InstanceURLs{ StreamingAPI: fmt.Sprintf("wss://%s", c.config.Host), } - }aaaaaaaaaaaaaaaaaaaaaaaaaaaa + } + + // get the instance account if it exists and just skip if it doesn't + ia := >smodel.Account{} + if err := c.db.GetWhere([]db.Where{{Key: "username", Value: i.Domain}}, ia); err == nil { + // instance account exists, get the header for the account if it exists + attachment := >smodel.MediaAttachment{} + if err := c.db.GetHeaderForAccountID(attachment, ia.ID); err == nil { + // header exists, set it on the api model + mi.Thumbnail = attachment.URL + } + } // contact account is optional but let's try to get it if i.ContactAccountID != "" { diff --git a/internal/util/regexes.go b/internal/util/regexes.go index 416d66e..6ad7b74 100644 --- a/internal/util/regexes.go +++ b/internal/util/regexes.go @@ -24,7 +24,6 @@ import ( ) const ( - maximumEmailLength = 256 maximumUsernameLength = 64 maximumEmojiShortcodeLength = 30 maximumHashtagLength = 30 diff --git a/web/template/footer.tmpl b/web/template/footer.tmpl index 19e9cdb..88f4cd8 100644 --- a/web/template/footer.tmpl +++ b/web/template/footer.tmpl @@ -5,8 +5,10 @@ Source Code
- Contact: {{.instance.ContactAccount}}
- + Contact: {{.instance.ContactAccount.Username}}
+
+
+ Email: {{.instance.Email}}
diff --git a/web/template/index.tmpl b/web/template/index.tmpl index e898332..ba48e92 100644 --- a/web/template/index.tmpl +++ b/web/template/index.tmpl @@ -8,16 +8,14 @@ federating with {{.instance.Stats.domain_count}} other instances.

This is the default landing page, you can edit it from ./web/template/index.tmpl

- +

+ {{.instance.ShortDescription}} +

- GoToSocial does not provide it's own frontend, but implements the Mastodon client API. + GoToSocial does not provide its own frontend, but implements the Mastodon client API. You can use this server through a variety of clients: