// GoToSocial
// Copyright (C) GoToSocial Authors admin@gotosocial.org
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see
Here's a fuller description of the GoToSocial testrig instance.
This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing
Users on this instance:
If you need to edit the models for the testrig, you can do so at internal/testmodels.go
.
This is the GoToSocial testrig. It doesn't federate or anything.
When the testrig is shut down, all data on it will be deleted.
Don't use this in production!
", "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "someone@example.org", "version": "0.0.0-testrig", "languages": [ "nl", "en-gb" ], "registrations": true, "approval_required": true, "invites_enabled": false, "configuration": { "statuses": { "max_characters": 5000, "max_media_attachments": 6, "characters_reserved_per_url": 25, "supported_mime_types": [ "text/plain", "text/markdown" ] }, "media_attachments": { "supported_mime_types": [ "image/jpeg", "image/gif", "image/webp", "audio/mp2", "audio/mp3", "video/x-msvideo", "audio/flac", "audio/x-flac", "image/png", "image/apng", "audio/ogg", "video/ogg", "audio/x-m4a", "video/mp4", "video/quicktime", "audio/x-ms-wma", "video/x-ms-wmv", "video/webm", "audio/x-matroska", "video/x-matroska" ], "image_size_limit": 41943040, "image_matrix_limit": 16777216, "video_size_limit": 41943040, "video_frame_rate_limit": 60, "video_matrix_limit": 16777216 }, "polls": { "max_options": 6, "max_characters_per_option": 50, "min_expiration": 300, "max_expiration": 2629746 }, "accounts": { "allow_custom_css": true, "max_featured_tags": 10, "max_profile_fields": 6 }, "emojis": { "emoji_size_limit": 51200 } }, "urls": { "streaming_api": "wss://localhost:8080" }, "stats": { "domain_count": 2, "status_count": 20, "user_count": 4 }, "thumbnail": "http://localhost:8080/assets/logo.webp", "contact_account": { "id": "01F8MH17FWEB39HZJ76B6VXSKF", "username": "admin", "acct": "admin", "display_name": "", "locked": false, "discoverable": true, "bot": false, "created_at": "2022-05-17T13:10:59.000Z", "note": "", "url": "http://localhost:8080/@admin", "avatar": "", "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", "followers_count": 1, "following_count": 1, "statuses_count": 4, "last_status_at": "2021-10-20T10:41:37.000Z", "emojis": [], "fields": [], "enable_rss": true, "role": { "name": "admin" } }, "max_toot_chars": 5000, "rules": [ { "id": "01GP3AWY4CRDVRNZKW0TEAMB51", "text": "Be gay" }, { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } ], "terms": "This is where a list of terms and conditions might go.
For example:
If you want to sign up on this instance, you oughta know that we:
password
wherever possible.Geoff's Instance
"}, }) if expectedCode := http.StatusOK; code != expectedCode { suite.FailNowf("wrong status code", "expected %d but got %d", expectedCode, code) } dst := new(bytes.Buffer) if err := json.Indent(dst, b, "", " "); err != nil { suite.FailNow(err.Error()) } suite.Equal(`{ "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "Geoff's Instance", "description": "Here's a fuller description of the GoToSocial testrig instance.
This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing
Users on this instance:
If you need to edit the models for the testrig, you can do so at internal/testmodels.go
.
This is the GoToSocial testrig. It doesn't federate or anything.
When the testrig is shut down, all data on it will be deleted.
Don't use this in production!
", "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ "nl", "en-gb" ], "registrations": true, "approval_required": true, "invites_enabled": false, "configuration": { "statuses": { "max_characters": 5000, "max_media_attachments": 6, "characters_reserved_per_url": 25, "supported_mime_types": [ "text/plain", "text/markdown" ] }, "media_attachments": { "supported_mime_types": [ "image/jpeg", "image/gif", "image/webp", "audio/mp2", "audio/mp3", "video/x-msvideo", "audio/flac", "audio/x-flac", "image/png", "image/apng", "audio/ogg", "video/ogg", "audio/x-m4a", "video/mp4", "video/quicktime", "audio/x-ms-wma", "video/x-ms-wmv", "video/webm", "audio/x-matroska", "video/x-matroska" ], "image_size_limit": 41943040, "image_matrix_limit": 16777216, "video_size_limit": 41943040, "video_frame_rate_limit": 60, "video_matrix_limit": 16777216 }, "polls": { "max_options": 6, "max_characters_per_option": 50, "min_expiration": 300, "max_expiration": 2629746 }, "accounts": { "allow_custom_css": true, "max_featured_tags": 10, "max_profile_fields": 6 }, "emojis": { "emoji_size_limit": 51200 } }, "urls": { "streaming_api": "wss://localhost:8080" }, "stats": { "domain_count": 2, "status_count": 20, "user_count": 4 }, "thumbnail": "http://localhost:8080/assets/logo.webp", "contact_account": { "id": "01F8MH17FWEB39HZJ76B6VXSKF", "username": "admin", "acct": "admin", "display_name": "", "locked": false, "discoverable": true, "bot": false, "created_at": "2022-05-17T13:10:59.000Z", "note": "", "url": "http://localhost:8080/@admin", "avatar": "", "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", "followers_count": 1, "following_count": 1, "statuses_count": 4, "last_status_at": "2021-10-20T10:41:37.000Z", "emojis": [], "fields": [], "enable_rss": true, "role": { "name": "admin" } }, "max_toot_chars": 5000, "rules": [ { "id": "01GP3AWY4CRDVRNZKW0TEAMB51", "text": "Be gay" }, { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } ], "terms": "This is where a list of terms and conditions might go.
For example:
If you want to sign up on this instance, you oughta know that we:
password
wherever possible.Here's a fuller description of the GoToSocial testrig instance.
This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing
Users on this instance:
If you need to edit the models for the testrig, you can do so at internal/testmodels.go
.
This is some html, which is allowed in short descriptions.
", "short_description_text": "This is some html, which is allowed in short descriptions.", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ "nl", "en-gb" ], "registrations": true, "approval_required": true, "invites_enabled": false, "configuration": { "statuses": { "max_characters": 5000, "max_media_attachments": 6, "characters_reserved_per_url": 25, "supported_mime_types": [ "text/plain", "text/markdown" ] }, "media_attachments": { "supported_mime_types": [ "image/jpeg", "image/gif", "image/webp", "audio/mp2", "audio/mp3", "video/x-msvideo", "audio/flac", "audio/x-flac", "image/png", "image/apng", "audio/ogg", "video/ogg", "audio/x-m4a", "video/mp4", "video/quicktime", "audio/x-ms-wma", "video/x-ms-wmv", "video/webm", "audio/x-matroska", "video/x-matroska" ], "image_size_limit": 41943040, "image_matrix_limit": 16777216, "video_size_limit": 41943040, "video_frame_rate_limit": 60, "video_matrix_limit": 16777216 }, "polls": { "max_options": 6, "max_characters_per_option": 50, "min_expiration": 300, "max_expiration": 2629746 }, "accounts": { "allow_custom_css": true, "max_featured_tags": 10, "max_profile_fields": 6 }, "emojis": { "emoji_size_limit": 51200 } }, "urls": { "streaming_api": "wss://localhost:8080" }, "stats": { "domain_count": 2, "status_count": 20, "user_count": 4 }, "thumbnail": "http://localhost:8080/assets/logo.webp", "contact_account": { "id": "01F8MH17FWEB39HZJ76B6VXSKF", "username": "admin", "acct": "admin", "display_name": "", "locked": false, "discoverable": true, "bot": false, "created_at": "2022-05-17T13:10:59.000Z", "note": "", "url": "http://localhost:8080/@admin", "avatar": "", "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", "followers_count": 1, "following_count": 1, "statuses_count": 4, "last_status_at": "2021-10-20T10:41:37.000Z", "emojis": [], "fields": [], "enable_rss": true, "role": { "name": "admin" } }, "max_toot_chars": 5000, "rules": [ { "id": "01GP3AWY4CRDVRNZKW0TEAMB51", "text": "Be gay" }, { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } ], "terms": "This is where a list of terms and conditions might go.
For example:
If you want to sign up on this instance, you oughta know that we:
password
wherever possible.This is some html, which is allowed in short descriptions.
"}, }) if err != nil { panic(err) } bodyBytes := requestBody.Bytes() // set up the request recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPatch, instance.InstanceInformationPathV1, bodyBytes, w.FormDataContentType(), true) ctx.Set(oauth.SessionAuthorizedAccount, suite.testAccounts["local_account_1"]) ctx.Set(oauth.SessionAuthorizedToken, oauth.DBTokenToToken(suite.testTokens["local_account_1"])) ctx.Set(oauth.SessionAuthorizedApplication, suite.testApplications["application_1"]) ctx.Set(oauth.SessionAuthorizedUser, suite.testUsers["local_account_1"]) // call the handler suite.instanceModule.InstanceUpdatePATCHHandler(ctx) suite.Equal(http.StatusForbidden, recorder.Code) result := recorder.Result() defer result.Body.Close() b, err := io.ReadAll(result.Body) suite.NoError(err) suite.Equal(`{"error":"Forbidden: user is not an admin so cannot update instance settings"}`, string(b)) } func (suite *InstancePatchTestSuite) TestInstancePatch6() { code, b := suite.instancePatch("", "", map[string][]string{ "contact_email": {""}, }) if expectedCode := http.StatusOK; code != expectedCode { suite.FailNowf("wrong status code", "expected %d but got %d", expectedCode, code) } dst := new(bytes.Buffer) if err := json.Indent(dst, b, "", " "); err != nil { suite.FailNow(err.Error()) } suite.Equal(`{ "uri": "http://localhost:8080", "account_domain": "localhost:8080", "title": "GoToSocial Testrig Instance", "description": "Here's a fuller description of the GoToSocial testrig instance.
This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing
Users on this instance:
If you need to edit the models for the testrig, you can do so at internal/testmodels.go
.
This is the GoToSocial testrig. It doesn't federate or anything.
When the testrig is shut down, all data on it will be deleted.
Don't use this in production!
", "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "", "version": "0.0.0-testrig", "languages": [ "nl", "en-gb" ], "registrations": true, "approval_required": true, "invites_enabled": false, "configuration": { "statuses": { "max_characters": 5000, "max_media_attachments": 6, "characters_reserved_per_url": 25, "supported_mime_types": [ "text/plain", "text/markdown" ] }, "media_attachments": { "supported_mime_types": [ "image/jpeg", "image/gif", "image/webp", "audio/mp2", "audio/mp3", "video/x-msvideo", "audio/flac", "audio/x-flac", "image/png", "image/apng", "audio/ogg", "video/ogg", "audio/x-m4a", "video/mp4", "video/quicktime", "audio/x-ms-wma", "video/x-ms-wmv", "video/webm", "audio/x-matroska", "video/x-matroska" ], "image_size_limit": 41943040, "image_matrix_limit": 16777216, "video_size_limit": 41943040, "video_frame_rate_limit": 60, "video_matrix_limit": 16777216 }, "polls": { "max_options": 6, "max_characters_per_option": 50, "min_expiration": 300, "max_expiration": 2629746 }, "accounts": { "allow_custom_css": true, "max_featured_tags": 10, "max_profile_fields": 6 }, "emojis": { "emoji_size_limit": 51200 } }, "urls": { "streaming_api": "wss://localhost:8080" }, "stats": { "domain_count": 2, "status_count": 20, "user_count": 4 }, "thumbnail": "http://localhost:8080/assets/logo.webp", "contact_account": { "id": "01F8MH17FWEB39HZJ76B6VXSKF", "username": "admin", "acct": "admin", "display_name": "", "locked": false, "discoverable": true, "bot": false, "created_at": "2022-05-17T13:10:59.000Z", "note": "", "url": "http://localhost:8080/@admin", "avatar": "", "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", "followers_count": 1, "following_count": 1, "statuses_count": 4, "last_status_at": "2021-10-20T10:41:37.000Z", "emojis": [], "fields": [], "enable_rss": true, "role": { "name": "admin" } }, "max_toot_chars": 5000, "rules": [ { "id": "01GP3AWY4CRDVRNZKW0TEAMB51", "text": "Be gay" }, { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } ], "terms": "This is where a list of terms and conditions might go.
For example:
If you want to sign up on this instance, you oughta know that we:
password
wherever possible.Here's a fuller description of the GoToSocial testrig instance.
This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing
Users on this instance:
If you need to edit the models for the testrig, you can do so at internal/testmodels.go
.
This is the GoToSocial testrig. It doesn't federate or anything.
When the testrig is shut down, all data on it will be deleted.
Don't use this in production!
", "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ "nl", "en-gb" ], "registrations": true, "approval_required": true, "invites_enabled": false, "configuration": { "statuses": { "max_characters": 5000, "max_media_attachments": 6, "characters_reserved_per_url": 25, "supported_mime_types": [ "text/plain", "text/markdown" ] }, "media_attachments": { "supported_mime_types": [ "image/jpeg", "image/gif", "image/webp", "audio/mp2", "audio/mp3", "video/x-msvideo", "audio/flac", "audio/x-flac", "image/png", "image/apng", "audio/ogg", "video/ogg", "audio/x-m4a", "video/mp4", "video/quicktime", "audio/x-ms-wma", "video/x-ms-wmv", "video/webm", "audio/x-matroska", "video/x-matroska" ], "image_size_limit": 41943040, "image_matrix_limit": 16777216, "video_size_limit": 41943040, "video_frame_rate_limit": 60, "video_matrix_limit": 16777216 }, "polls": { "max_options": 6, "max_characters_per_option": 50, "min_expiration": 300, "max_expiration": 2629746 }, "accounts": { "allow_custom_css": true, "max_featured_tags": 10, "max_profile_fields": 6 }, "emojis": { "emoji_size_limit": 51200 } }, "urls": { "streaming_api": "wss://localhost:8080" }, "stats": { "domain_count": 2, "status_count": 20, "user_count": 4 }, "thumbnail": "http://localhost:8080/fileserver/01AY6P665V14JJR0AFVRT7311Y/attachment/original/`+instanceAccount.AvatarMediaAttachment.ID+`.gif",`+` "thumbnail_type": "image/gif", "thumbnail_static": "http://localhost:8080/fileserver/01AY6P665V14JJR0AFVRT7311Y/attachment/small/`+instanceAccount.AvatarMediaAttachment.ID+`.webp",`+` "thumbnail_static_type": "image/webp", "thumbnail_description": "A bouncing little green peglin.", "contact_account": { "id": "01F8MH17FWEB39HZJ76B6VXSKF", "username": "admin", "acct": "admin", "display_name": "", "locked": false, "discoverable": true, "bot": false, "created_at": "2022-05-17T13:10:59.000Z", "note": "", "url": "http://localhost:8080/@admin", "avatar": "", "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", "followers_count": 1, "following_count": 1, "statuses_count": 4, "last_status_at": "2021-10-20T10:41:37.000Z", "emojis": [], "fields": [], "enable_rss": true, "role": { "name": "admin" } }, "max_toot_chars": 5000, "rules": [ { "id": "01GP3AWY4CRDVRNZKW0TEAMB51", "text": "Be gay" }, { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } ], "terms": "This is where a list of terms and conditions might go.
For example:
If you want to sign up on this instance, you oughta know that we:
password
wherever possible.Here's a fuller description of the GoToSocial testrig instance.
This instance is for testing purposes only. It doesn't federate at all. Go check out https://github.com/superseriousbusiness/gotosocial/tree/main/testrig and https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#testing
Users on this instance:
If you need to edit the models for the testrig, you can do so at internal/testmodels.go
.
This is the GoToSocial testrig. It doesn't federate or anything.
When the testrig is shut down, all data on it will be deleted.
Don't use this in production!
", "short_description_text": "This is the GoToSocial testrig. It doesn't federate or anything.\n\nWhen the testrig is shut down, all data on it will be deleted.\n\nDon't use this in production!", "email": "admin@example.org", "version": "0.0.0-testrig", "languages": [ "nl", "en-gb" ], "registrations": true, "approval_required": true, "invites_enabled": false, "configuration": { "statuses": { "max_characters": 5000, "max_media_attachments": 6, "characters_reserved_per_url": 25, "supported_mime_types": [ "text/plain", "text/markdown" ] }, "media_attachments": { "supported_mime_types": [ "image/jpeg", "image/gif", "image/webp", "audio/mp2", "audio/mp3", "video/x-msvideo", "audio/flac", "audio/x-flac", "image/png", "image/apng", "audio/ogg", "video/ogg", "audio/x-m4a", "video/mp4", "video/quicktime", "audio/x-ms-wma", "video/x-ms-wmv", "video/webm", "audio/x-matroska", "video/x-matroska" ], "image_size_limit": 41943040, "image_matrix_limit": 16777216, "video_size_limit": 41943040, "video_frame_rate_limit": 60, "video_matrix_limit": 16777216 }, "polls": { "max_options": 6, "max_characters_per_option": 50, "min_expiration": 300, "max_expiration": 2629746 }, "accounts": { "allow_custom_css": true, "max_featured_tags": 10, "max_profile_fields": 6 }, "emojis": { "emoji_size_limit": 51200 } }, "urls": { "streaming_api": "wss://localhost:8080" }, "stats": { "domain_count": 2, "status_count": 20, "user_count": 4 }, "thumbnail": "http://localhost:8080/assets/logo.webp", "contact_account": { "id": "01F8MH17FWEB39HZJ76B6VXSKF", "username": "admin", "acct": "admin", "display_name": "", "locked": false, "discoverable": true, "bot": false, "created_at": "2022-05-17T13:10:59.000Z", "note": "", "url": "http://localhost:8080/@admin", "avatar": "", "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", "followers_count": 1, "following_count": 1, "statuses_count": 4, "last_status_at": "2021-10-20T10:41:37.000Z", "emojis": [], "fields": [], "enable_rss": true, "role": { "name": "admin" } }, "max_toot_chars": 5000, "rules": [ { "id": "01GP3AWY4CRDVRNZKW0TEAMB51", "text": "Be gay" }, { "id": "01GP3DFY9XQ1TJMZT5BGAZPXX3", "text": "Do crime" } ], "terms": "This is where a list of terms and conditions might go.
For example:
If you want to sign up on this instance, you oughta know that we:
password
wherever possible.