commit aeb665df554059103b9fb94c608e78a85631301a
parent 43c3a47773a71db9fb49589a72273fe823947dcf
Author: tsmethurst <tobi.smethurst@klarrio.com>
Date: Sat, 22 May 2021 15:51:20 +0200
small fiddling to allow whalebird to work (a bit)
Diffstat:
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/internal/api/client/account/accountupdate.go b/internal/api/client/account/accountupdate.go
@@ -44,9 +44,9 @@ func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
}
l.Tracef("retrieved account %+v", authed.Account.ID)
- l.Trace("parsing request form")
+ l.Debugf("parsing request form %s", c.Request.Form)
form := &model.UpdateCredentialsRequest{}
- if err := c.ShouldBind(form); err != nil || form == nil {
+ if err := c.ShouldBind(&form); err != nil || form == nil {
l.Debugf("could not parse form from request: %s", err)
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
diff --git a/internal/api/model/instance.go b/internal/api/model/instance.go
@@ -33,7 +33,7 @@ type Instance struct {
// An email that may be contacted for any inquiries.
Email string `json:"email"`
// The version of Mastodon installed on the instance.
- Version string `json:"version,omitempty"`
+ Version string `json:"version"`
// Primary langauges of the website and its staff.
Languages []string `json:"languages,omitempty"`
// Whether registrations are enabled.
diff --git a/internal/gtsmodel/instance.go b/internal/gtsmodel/instance.go
@@ -30,4 +30,6 @@ type Instance struct {
ContactAccountID string
// Reputation score of this instance
Reputation int64 `pg:",notnull,default:0"`
+ // Version of the software used on this instance
+ Version string
}
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
@@ -550,6 +550,7 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro
Description: i.Description,
ShortDescription: i.ShortDescription,
Email: i.ContactEmail,
+ Version: i.Version,
}
if i.Domain == c.config.Host {
@@ -557,13 +558,16 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro
mi.ApprovalRequired = c.config.AccountsConfig.RequireApproval
mi.InvitesEnabled = false // TODO
mi.MaxTootChars = uint(c.config.StatusesConfig.MaxChars)
+ mi.URLS = &model.InstanceURLs{
+ StreamingAPI: fmt.Sprintf("wss://%s", c.config.Host),
+ }
}
// contact account is optional but let's try to get it
if i.ContactAccountID != "" {
ia := >smodel.Account{}
if err := c.db.GetByID(i.ContactAccountID, ia); err == nil {
- ma, err := c.AccountToMastoPublic(ia)
+ ma, err := c.AccountToMastoPublic(ia)
if err == nil {
mi.ContactAccount = ma
}