mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-15 04:57:30 -06:00
fix up stats, allow more instance settings
This commit is contained in:
parent
fd57cca437
commit
c08dc0937b
6 changed files with 108 additions and 7 deletions
|
|
@ -511,9 +511,30 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro
|
|||
ShortDescription: i.ShortDescription,
|
||||
Email: i.ContactEmail,
|
||||
Version: i.Version,
|
||||
Stats: make(map[string]int),
|
||||
}
|
||||
|
||||
// if the requested instance is *this* instance, we can add some extra information
|
||||
if i.Domain == c.config.Host {
|
||||
userCountKey := "user_count"
|
||||
statusCountKey := "status_count"
|
||||
domainCountKey := "domain_count"
|
||||
|
||||
userCount, err := c.db.GetUserCountForInstance(c.config.Host)
|
||||
if err == nil {
|
||||
mi.Stats[userCountKey] = userCount
|
||||
}
|
||||
|
||||
statusCount, err := c.db.GetStatusCountForInstance(c.config.Host)
|
||||
if err == nil {
|
||||
mi.Stats[statusCountKey] = statusCount
|
||||
}
|
||||
|
||||
domainCount, err := c.db.GetDomainCountForInstance(c.config.Host)
|
||||
if err == nil {
|
||||
mi.Stats[domainCountKey] = domainCount
|
||||
}
|
||||
|
||||
mi.Registrations = c.config.AccountsConfig.OpenRegistration
|
||||
mi.ApprovalRequired = c.config.AccountsConfig.RequireApproval
|
||||
mi.InvitesEnabled = false // TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue