mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-28 02:43:31 -06:00
[feature] Report Masto version in /api/v1/instance (#1977)
This commit is contained in:
parent
43a2753ef0
commit
f8f0312042
5 changed files with 50 additions and 0 deletions
|
|
@ -45,6 +45,7 @@ const (
|
|||
instanceAccountsMaxFeaturedTags = 10
|
||||
instanceAccountsMaxProfileFields = 6 // FIXME: https://github.com/superseriousbusiness/gotosocial/issues/1876
|
||||
instanceSourceURL = "https://github.com/superseriousbusiness/gotosocial"
|
||||
instanceMastodonVersion = "3.5.3"
|
||||
)
|
||||
|
||||
var instanceStatusesSupportedMimeTypes = []string{
|
||||
|
|
@ -52,6 +53,10 @@ var instanceStatusesSupportedMimeTypes = []string{
|
|||
string(apimodel.StatusContentTypeMarkdown),
|
||||
}
|
||||
|
||||
func toMastodonVersion(in string) string {
|
||||
return instanceMastodonVersion + "+" + strings.ReplaceAll(in, " ", "-")
|
||||
}
|
||||
|
||||
func (c *converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error) {
|
||||
// we can build this sensitive account easily by first getting the public account....
|
||||
apiAccount, err := c.AccountToAPIAccountPublic(ctx, a)
|
||||
|
|
@ -740,6 +745,10 @@ func (c *converter) InstanceToAPIV1Instance(ctx context.Context, i *gtsmodel.Ins
|
|||
MaxTootChars: uint(config.GetStatusesMaxChars()),
|
||||
}
|
||||
|
||||
if config.GetInstanceInjectMastodonVersion() {
|
||||
instance.Version = toMastodonVersion(instance.Version)
|
||||
}
|
||||
|
||||
// configuration
|
||||
instance.Configuration.Statuses.MaxCharacters = config.GetStatusesMaxChars()
|
||||
instance.Configuration.Statuses.MaxMediaAttachments = config.GetStatusesMediaMaxFiles()
|
||||
|
|
@ -839,6 +848,10 @@ func (c *converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins
|
|||
Rules: []interface{}{}, // todo: not implemented
|
||||
}
|
||||
|
||||
if config.GetInstanceInjectMastodonVersion() {
|
||||
instance.Version = toMastodonVersion(instance.Version)
|
||||
}
|
||||
|
||||
// thumbnail
|
||||
thumbnail := apimodel.InstanceV2Thumbnail{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue