domain.go (3480B)
1 // GoToSocial 2 // Copyright (C) GoToSocial Authors admin@gotosocial.org 3 // SPDX-License-Identifier: AGPL-3.0-or-later 4 // 5 // This program is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Affero General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Affero General Public License for more details. 14 // 15 // You should have received a copy of the GNU Affero General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 package model 19 20 import "mime/multipart" 21 22 // Domain represents a remote domain 23 // 24 // swagger:model domain 25 type Domain struct { 26 // The hostname of the domain. 27 // example: example.org 28 Domain string `form:"domain" json:"domain" validate:"required"` 29 // Time at which this domain was suspended. Key will not be present on open domains. 30 // example: 2021-07-30T09:20:25+00:00 31 SuspendedAt string `json:"suspended_at,omitempty"` 32 // Time at which this domain was silenced. Key will not be present on open domains. 33 // example: 2021-07-30T09:20:25+00:00 34 SilencedAt string `json:"silenced_at,omitempty"` 35 // If the domain is blocked, what's the publicly-stated reason for the block. 36 // example: they smell 37 PublicComment string `form:"public_comment" json:"public_comment,omitempty"` 38 } 39 40 // DomainBlock represents a block on one domain 41 // 42 // swagger:model domainBlock 43 type DomainBlock struct { 44 Domain 45 // The ID of the domain block. 46 // example: 01FBW21XJA09XYX51KV5JVBW0F 47 // readonly: true 48 ID string `json:"id,omitempty"` 49 // Obfuscate the domain name when serving this domain block publicly. 50 // A useful anti-harassment tool. 51 // example: false 52 Obfuscate bool `json:"obfuscate,omitempty"` 53 // Private comment for this block, visible to our instance admins only. 54 // example: they are poopoo 55 PrivateComment string `json:"private_comment,omitempty"` 56 // The ID of the subscription that created/caused this domain block. 57 // example: 01FBW25TF5J67JW3HFHZCSD23K 58 SubscriptionID string `json:"subscription_id,omitempty"` 59 // ID of the account that created this domain block. 60 // example: 01FBW2758ZB6PBR200YPDDJK4C 61 CreatedBy string `json:"created_by,omitempty"` 62 // Time at which this block was created (ISO 8601 Datetime). 63 // example: 2021-07-30T09:20:25+00:00 64 CreatedAt string `json:"created_at,omitempty"` 65 } 66 67 // DomainBlockCreateRequest is the form submitted as a POST to /api/v1/admin/domain_blocks to create a new block. 68 // 69 // swagger:model domainBlockCreateRequest 70 type DomainBlockCreateRequest struct { 71 // A list of domains to block. Only used if import=true is specified. 72 Domains *multipart.FileHeader `form:"domains" json:"domains" xml:"domains"` 73 // hostname/domain to block 74 Domain string `form:"domain" json:"domain" xml:"domain"` 75 // whether the domain should be obfuscated when being displayed publicly 76 Obfuscate bool `form:"obfuscate" json:"obfuscate" xml:"obfuscate"` 77 // private comment for other admins on why the domain was blocked 78 PrivateComment string `form:"private_comment" json:"private_comment" xml:"private_comment"` 79 // public comment on the reason for the domain block 80 PublicComment string `form:"public_comment" json:"public_comment" xml:"public_comment"` 81 }