2021-03-13 19:07:05 +03:00
|
|
|
/*
|
|
|
|
GoToSocial
|
2021-12-20 20:42:19 +03:00
|
|
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
2021-03-13 19:07:05 +03:00
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-05-08 15:25:55 +03:00
|
|
|
package model
|
2021-03-13 19:07:05 +03:00
|
|
|
|
2021-06-23 17:35:57 +03:00
|
|
|
import "mime/multipart"
|
|
|
|
|
2021-08-02 20:06:44 +03:00
|
|
|
// Instance models information about this or another instance.
|
|
|
|
//
|
|
|
|
// swagger:model instance
|
2021-03-13 19:07:05 +03:00
|
|
|
type Instance struct {
|
2021-08-02 20:06:44 +03:00
|
|
|
// The URI of the instance.
|
2022-07-05 15:03:44 +03:00
|
|
|
// example: https://gts.example.org
|
2021-05-09 15:06:06 +03:00
|
|
|
URI string `json:"uri,omitempty"`
|
2022-07-05 15:03:44 +03:00
|
|
|
// The domain of accounts on this instance.
|
|
|
|
// This will not necessarily be the same as
|
|
|
|
// simply the Host part of the URI.
|
|
|
|
// example: example.org
|
|
|
|
AccountDomain string `json:"account_domain,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// The title of the instance.
|
|
|
|
// example: GoToSocial Example Instance
|
2021-05-09 15:06:06 +03:00
|
|
|
Title string `json:"title,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// Description of the instance.
|
|
|
|
//
|
|
|
|
// Should be HTML formatted, but might be plaintext.
|
|
|
|
//
|
|
|
|
// This should be displayed on the 'about' page for an instance.
|
2021-03-13 19:07:05 +03:00
|
|
|
Description string `json:"description"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// A shorter description of the instance.
|
|
|
|
//
|
|
|
|
// Should be HTML formatted, but might be plaintext.
|
|
|
|
//
|
|
|
|
// This should be displayed on the instance splash/landing page.
|
2021-03-13 19:07:05 +03:00
|
|
|
ShortDescription string `json:"short_description"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// An email address that may be used for inquiries.
|
|
|
|
// example: admin@example.org
|
2021-03-13 19:07:05 +03:00
|
|
|
Email string `json:"email"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// The version of GoToSocial installed on the instance.
|
|
|
|
//
|
|
|
|
// This will contain at least a semantic version number.
|
|
|
|
//
|
|
|
|
// It may also contain, after a space, the short git commit ID of the running software.
|
|
|
|
//
|
|
|
|
// example: 0.1.1 cb85f65
|
2021-05-22 16:51:20 +03:00
|
|
|
Version string `json:"version"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// Primary language of the instance.
|
|
|
|
// example: en
|
2021-05-09 15:06:06 +03:00
|
|
|
Languages []string `json:"languages,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// New account registrations are enabled on this instance.
|
2021-03-13 19:07:05 +03:00
|
|
|
Registrations bool `json:"registrations"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// New account registrations require admin approval.
|
2021-03-13 19:07:05 +03:00
|
|
|
ApprovalRequired bool `json:"approval_required"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// Invites are enabled on this instance.
|
2021-03-13 19:07:05 +03:00
|
|
|
InvitesEnabled bool `json:"invites_enabled"`
|
2022-06-26 11:58:45 +03:00
|
|
|
// Configuration object containing values about status limits etc.
|
|
|
|
// This key/value will be omitted for remote instances.
|
|
|
|
Configuration *InstanceConfiguration `json:"configuration,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// URLs of interest for client applications.
|
2021-05-09 15:06:06 +03:00
|
|
|
URLS *InstanceURLs `json:"urls,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// Statistics about the instance: number of posts, accounts, etc.
|
2021-06-23 17:35:57 +03:00
|
|
|
Stats map[string]int `json:"stats,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// URL of the instance avatar/banner image.
|
|
|
|
// example: https://example.org/files/instance/thumbnail.jpeg
|
2021-05-09 15:06:06 +03:00
|
|
|
Thumbnail string `json:"thumbnail"`
|
2022-11-08 20:11:06 +03:00
|
|
|
// MIME type of the instance thumbnail.
|
|
|
|
// example: image/png
|
|
|
|
ThumbnailType string `json:"thumbnail_type,omitempty"`
|
|
|
|
// Description of the instance thumbnail.
|
|
|
|
// example: picture of a cute lil' friendly sloth
|
|
|
|
ThumbnailDescription string `json:"thumbnail_description,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// Contact account for the instance.
|
2021-03-13 19:07:05 +03:00
|
|
|
ContactAccount *Account `json:"contact_account,omitempty"`
|
2021-08-02 20:06:44 +03:00
|
|
|
// Maximum allowed length of a post on this instance, in characters.
|
|
|
|
//
|
|
|
|
// This is provided for compatibility with Tusky and other apps.
|
|
|
|
//
|
|
|
|
// example: 5000
|
2021-05-09 15:06:06 +03:00
|
|
|
MaxTootChars uint `json:"max_toot_chars"`
|
2021-03-13 19:07:05 +03:00
|
|
|
}
|
|
|
|
|
2022-06-26 11:58:45 +03:00
|
|
|
// InstanceConfiguration models instance configuration parameters.
|
|
|
|
//
|
|
|
|
// swagger:model instanceConfiguration
|
|
|
|
type InstanceConfiguration struct {
|
|
|
|
// Instance configuration pertaining to status limits.
|
|
|
|
Statuses *InstanceConfigurationStatuses `json:"statuses"`
|
|
|
|
// Instance configuration pertaining to media attachment types + size limits.
|
|
|
|
MediaAttachments *InstanceConfigurationMediaAttachments `json:"media_attachments"`
|
|
|
|
// Instance configuration pertaining to poll limits.
|
|
|
|
Polls *InstanceConfigurationPolls `json:"polls"`
|
2022-09-12 14:14:29 +03:00
|
|
|
// Instance configuration pertaining to accounts.
|
|
|
|
Accounts *InstanceConfigurationAccounts `json:"accounts"`
|
2022-10-06 13:00:53 +03:00
|
|
|
// Instance configuration pertaining to emojis.
|
|
|
|
Emojis *InstanceConfigurationEmojis `json:"emojis"`
|
2022-06-26 11:58:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// InstanceConfigurationStatuses models instance status config parameters.
|
|
|
|
//
|
|
|
|
// swagger:model instanceConfigurationStatuses
|
|
|
|
type InstanceConfigurationStatuses struct {
|
|
|
|
// Maximum allowed length of a post on this instance, in characters.
|
|
|
|
//
|
|
|
|
// example: 5000
|
|
|
|
MaxCharacters int `json:"max_characters"`
|
|
|
|
// Max number of attachments allowed on a status.
|
|
|
|
//
|
|
|
|
// example: 4
|
|
|
|
MaxMediaAttachments int `json:"max_media_attachments"`
|
2022-09-08 13:36:42 +03:00
|
|
|
// Amount of characters clients should assume a url takes up.
|
2022-06-26 11:58:45 +03:00
|
|
|
//
|
2022-09-08 13:36:42 +03:00
|
|
|
// example: 25
|
2022-06-26 11:58:45 +03:00
|
|
|
CharactersReservedPerURL int `json:"characters_reserved_per_url"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// InstanceConfigurationMediaAttachments models instance media attachment config parameters.
|
|
|
|
//
|
|
|
|
// swagger:model instanceConfigurationMediaAttachments
|
|
|
|
type InstanceConfigurationMediaAttachments struct {
|
|
|
|
// List of mime types that it's possible to upload to this instance.
|
|
|
|
//
|
|
|
|
// example: ["image/jpeg","image/gif"]
|
|
|
|
SupportedMimeTypes []string `json:"supported_mime_types"`
|
|
|
|
// Max allowed image size in bytes
|
|
|
|
//
|
|
|
|
// example: 2097152
|
|
|
|
ImageSizeLimit int `json:"image_size_limit"`
|
|
|
|
// Max allowed image size in pixels as height*width.
|
|
|
|
//
|
|
|
|
// GtS doesn't set a limit on this, but for compatibility
|
|
|
|
// we give Mastodon's 4096x4096px value here.
|
|
|
|
//
|
|
|
|
// example: 16777216
|
|
|
|
ImageMatrixLimit int `json:"image_matrix_limit"`
|
|
|
|
// Max allowed video size in bytes
|
|
|
|
//
|
|
|
|
// example: 10485760
|
|
|
|
VideoSizeLimit int `json:"video_size_limit"`
|
|
|
|
// Max allowed video frame rate.
|
|
|
|
//
|
|
|
|
// example: 60
|
|
|
|
VideoFrameRateLimit int `json:"video_frame_rate_limit"`
|
|
|
|
// Max allowed video size in pixels as height*width.
|
|
|
|
//
|
|
|
|
// GtS doesn't set a limit on this, but for compatibility
|
|
|
|
// we give Mastodon's 4096x4096px value here.
|
|
|
|
//
|
|
|
|
// example: 16777216
|
|
|
|
VideoMatrixLimit int `json:"video_matrix_limit"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// InstanceConfigurationPolls models instance poll config parameters.
|
|
|
|
//
|
|
|
|
// swagger:model instanceConfigurationPolls
|
|
|
|
type InstanceConfigurationPolls struct {
|
|
|
|
// Number of options permitted in a poll on this instance.
|
|
|
|
//
|
|
|
|
// example: 4
|
|
|
|
MaxOptions int `json:"max_options"`
|
|
|
|
// Number of characters allowed per option in the poll.
|
|
|
|
//
|
|
|
|
// example: 50
|
|
|
|
MaxCharactersPerOption int `json:"max_characters_per_option"`
|
|
|
|
// Minimum expiration time of the poll in seconds.
|
|
|
|
//
|
|
|
|
// example: 300
|
|
|
|
MinExpiration int `json:"min_expiration"`
|
|
|
|
// Maximum expiration time of the poll in seconds.
|
|
|
|
//
|
|
|
|
// example: 2629746
|
|
|
|
MaxExpiration int `json:"max_expiration"`
|
|
|
|
}
|
|
|
|
|
2022-09-12 14:14:29 +03:00
|
|
|
// InstanceConfigurationAccounts models instance account config parameters.
|
|
|
|
type InstanceConfigurationAccounts struct {
|
|
|
|
// Whether or not accounts on this instance are allowed to upload custom CSS for profiles and statuses.
|
|
|
|
//
|
|
|
|
// example: false
|
|
|
|
AllowCustomCSS bool `json:"allow_custom_css"`
|
|
|
|
}
|
|
|
|
|
2022-10-06 13:00:53 +03:00
|
|
|
// InstanceConfigurationEmojis models instance emoji config parameters.
|
|
|
|
type InstanceConfigurationEmojis struct {
|
|
|
|
// Max allowed emoji image size in bytes.
|
|
|
|
//
|
|
|
|
// example: 51200
|
|
|
|
EmojiSizeLimit int `json:"emoji_size_limit"`
|
|
|
|
}
|
|
|
|
|
2021-08-02 20:06:44 +03:00
|
|
|
// InstanceURLs models instance-relevant URLs for client application consumption.
|
|
|
|
//
|
|
|
|
// swagger:model instanceURLs
|
2021-03-13 19:07:05 +03:00
|
|
|
type InstanceURLs struct {
|
2021-08-02 20:06:44 +03:00
|
|
|
// Websockets address for status and notification streaming.
|
|
|
|
// example: wss://example.org
|
2021-03-13 19:07:05 +03:00
|
|
|
StreamingAPI string `json:"streaming_api"`
|
|
|
|
}
|
|
|
|
|
2021-08-02 20:06:44 +03:00
|
|
|
// InstanceSettingsUpdateRequest models an instance update request.
|
|
|
|
//
|
|
|
|
// swagger:ignore
|
2021-06-23 17:35:57 +03:00
|
|
|
type InstanceSettingsUpdateRequest struct {
|
2021-07-08 16:05:19 +03:00
|
|
|
// Title to use for the instance. Max 40 characters.
|
|
|
|
Title *string `form:"title" json:"title" xml:"title"`
|
|
|
|
// Username for the instance contact account. Must be the username of an existing admin.
|
|
|
|
ContactUsername *string `form:"contact_username" json:"contact_username" xml:"contact_username"`
|
|
|
|
// Email for reaching the instance administrator(s).
|
|
|
|
ContactEmail *string `form:"contact_email" json:"contact_email" xml:"contact_email"`
|
|
|
|
// Short description of the instance, max 500 chars. HTML formatting accepted.
|
|
|
|
ShortDescription *string `form:"short_description" json:"short_description" xml:"short_description"`
|
|
|
|
// Longer description of the instance, max 5,000 chars. HTML formatting accepted.
|
|
|
|
Description *string `form:"description" json:"description" xml:"description"`
|
|
|
|
// Terms and conditions of the instance, max 5,000 chars. HTML formatting accepted.
|
|
|
|
Terms *string `form:"terms" json:"terms" xml:"terms"`
|
|
|
|
// Image to use as the instance thumbnail.
|
2022-11-08 20:11:06 +03:00
|
|
|
Avatar *multipart.FileHeader `form:"thumbnail" json:"thumbnail" xml:"thumbnail"`
|
|
|
|
// Image description for the instance avatar.
|
|
|
|
AvatarDescription *string `form:"thumbnail_description" json:"thumbnail_description" xml:"thumbnail_description"`
|
2021-07-08 16:05:19 +03:00
|
|
|
// Image to use as the instance header.
|
|
|
|
Header *multipart.FileHeader `form:"header" json:"header" xml:"header"`
|
2021-06-23 17:35:57 +03:00
|
|
|
}
|