| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | /* | 
					
						
							|  |  |  |    GoToSocial | 
					
						
							|  |  |  |    Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    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 14:25:55 +02:00
										 |  |  | package model | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-23 16:35:57 +02:00
										 |  |  | import "mime/multipart" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | // Instance represents the software instance of Mastodon running on this domain. See https://docs.joinmastodon.org/entities/instance/ | 
					
						
							|  |  |  | type Instance struct { | 
					
						
							|  |  |  | 	// REQUIRED | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// The domain name of the instance. | 
					
						
							| 
									
										
										
										
											2021-05-09 14:06:06 +02:00
										 |  |  | 	URI string `json:"uri,omitempty"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// The title of the website. | 
					
						
							| 
									
										
										
										
											2021-05-09 14:06:06 +02:00
										 |  |  | 	Title string `json:"title,omitempty"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// Admin-defined description of the Mastodon site. | 
					
						
							|  |  |  | 	Description string `json:"description"` | 
					
						
							|  |  |  | 	// A shorter description defined by the admin. | 
					
						
							|  |  |  | 	ShortDescription string `json:"short_description"` | 
					
						
							|  |  |  | 	// An email that may be contacted for any inquiries. | 
					
						
							|  |  |  | 	Email string `json:"email"` | 
					
						
							|  |  |  | 	// The version of Mastodon installed on the instance. | 
					
						
							| 
									
										
										
										
											2021-05-22 15:51:20 +02:00
										 |  |  | 	Version string `json:"version"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// Primary langauges of the website and its staff. | 
					
						
							| 
									
										
										
										
											2021-05-09 14:06:06 +02:00
										 |  |  | 	Languages []string `json:"languages,omitempty"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// Whether registrations are enabled. | 
					
						
							|  |  |  | 	Registrations bool `json:"registrations"` | 
					
						
							|  |  |  | 	// Whether registrations require moderator approval. | 
					
						
							|  |  |  | 	ApprovalRequired bool `json:"approval_required"` | 
					
						
							|  |  |  | 	// Whether invites are enabled. | 
					
						
							|  |  |  | 	InvitesEnabled bool `json:"invites_enabled"` | 
					
						
							|  |  |  | 	// URLs of interest for clients apps. | 
					
						
							| 
									
										
										
										
											2021-05-09 14:06:06 +02:00
										 |  |  | 	URLS *InstanceURLs `json:"urls,omitempty"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// Statistics about how much information the instance contains. | 
					
						
							| 
									
										
										
										
											2021-06-23 16:35:57 +02:00
										 |  |  | 	Stats map[string]int `json:"stats,omitempty"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// Banner image for the website. | 
					
						
							| 
									
										
										
										
											2021-05-09 14:06:06 +02:00
										 |  |  | 	Thumbnail string `json:"thumbnail"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | 	// A user that can be contacted, as an alternative to email. | 
					
						
							|  |  |  | 	ContactAccount *Account `json:"contact_account,omitempty"` | 
					
						
							| 
									
										
										
										
											2021-05-09 14:06:06 +02:00
										 |  |  | 	// What's the maximum allowed length of a post on this instance? | 
					
						
							|  |  |  | 	// This is provided for compatibility with Tusky. | 
					
						
							|  |  |  | 	MaxTootChars uint `json:"max_toot_chars"` | 
					
						
							| 
									
										
										
										
											2021-03-13 17:07:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // InstanceURLs represents URLs necessary for successfully connecting to the instance as a user. See https://docs.joinmastodon.org/entities/instance/ | 
					
						
							|  |  |  | type InstanceURLs struct { | 
					
						
							|  |  |  | 	// Websockets address for push streaming. | 
					
						
							|  |  |  | 	StreamingAPI string `json:"streaming_api"` | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // InstanceStats represents some public-facing stats about the instance. See https://docs.joinmastodon.org/entities/instance/ | 
					
						
							|  |  |  | type InstanceStats struct { | 
					
						
							|  |  |  | 	// Users registered on this instance. | 
					
						
							|  |  |  | 	UserCount int `json:"user_count"` | 
					
						
							|  |  |  | 	// Statuses authored by users on instance. | 
					
						
							|  |  |  | 	StatusCount int `json:"status_count"` | 
					
						
							|  |  |  | 	// Domains federated with this instance. | 
					
						
							|  |  |  | 	DomainCount int `json:"domain_count"` | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-06-23 16:35:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // InstanceSettingsUpdateRequest is the form to be parsed on a PATCH to /api/v1/instance | 
					
						
							|  |  |  | type InstanceSettingsUpdateRequest struct { | 
					
						
							|  |  |  | 	SiteTitle            *string               `form:"site_title" json:"site_title" xml:"site_title"` | 
					
						
							|  |  |  | 	SiteContactUsername  *string               `form:"site_contact_username" json:"site_contact_username" xml:"site_contact_username"` | 
					
						
							|  |  |  | 	SiteContactEmail     *string               `form:"site_contact_email" json:"site_contact_email" xml:"site_contact_email"` | 
					
						
							|  |  |  | 	SiteShortDescription *string               `form:"site_short_description" json:"site_short_description" xml:"site_short_description"` | 
					
						
							|  |  |  | 	SiteDescription      *string               `form:"site_description" json:"site_description" xml:"site_description"` | 
					
						
							|  |  |  | 	SiteTerms            *string               `form:"site_terms" json:"site_terms" xml:"site_terms"` | 
					
						
							|  |  |  | 	Avatar               *multipart.FileHeader `form:"avatar" json:"avatar" xml:"avatar"` | 
					
						
							|  |  |  | 	Header               *multipart.FileHeader `form:"header" json:"header" xml:"header"` | 
					
						
							|  |  |  | } |