From 01e376526863a17d1f5bae72fd7693afa215291a Mon Sep 17 00:00:00 2001 From: nicole mikołajczyk Date: Mon, 9 Jun 2025 12:32:14 +0200 Subject: [feature] Add fields introduced in Mastodon 4.4.0 to `/api/v2/instance` response (#4240) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description ## Checklist - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have not leveraged AI to create the proposed changes. - [x] I/we have performed a self-review of added code. - [x] I/we have written code that is legible and maintainable by others. - [ ] I/we have commented the added code, particularly in hard-to-understand areas. - [x] I/we have made any necessary changes to documentation. - [ ] I/we have added tests that cover new code. - [ ] I/we have run tests and they pass locally with the changes. - [x] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4240 Co-authored-by: nicole mikołajczyk Co-committed-by: nicole mikołajczyk --- internal/typeutils/internaltofrontend.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/typeutils/internaltofrontend.go') diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index ecf817c66..b6cb2bb37 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -1889,8 +1889,12 @@ func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins instance.Thumbnail = thumbnail + termsOfService := config.GetProtocol() + "://" + i.Domain + "/about#rules" + // configuration instance.Configuration.URLs.Streaming = "wss://" + i.Domain + instance.Configuration.URLs.About = config.GetProtocol() + "://" + i.Domain + "/about" + instance.Configuration.URLs.TermsOfService = &termsOfService instance.Configuration.Statuses.MaxCharacters = config.GetStatusesMaxChars() instance.Configuration.Statuses.MaxMediaAttachments = config.GetStatusesMediaMaxFiles() instance.Configuration.Statuses.CharactersReservedPerURL = instanceStatusesCharactersReservedPerURL @@ -1936,6 +1940,8 @@ func (c *Converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins instance.Registrations.Enabled = config.GetAccountsRegistrationOpen() instance.Registrations.ApprovalRequired = true // always required instance.Registrations.Message = nil // todo: not implemented + instance.Registrations.MinAge = nil // not implemented + instance.Registrations.ReasonRequired = config.GetAccountsReasonRequired() // contact instance.Contact.Email = i.ContactEmail -- cgit v1.2.3