Documentation
¶
Overview ¶
Package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database. These types should never be serialized and/or sent out via public APIs, as they contain sensitive information. The annotation used on these structs is for handling them via the bun-db ORM. See here for more info on bun model annotations: https://bun.uptrace.dev/guide/models.html
Package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database. These types should never be serialized and/or sent out via public APIs, as they contain sensitive information. The annotation used on these structs is for handling them via the bun-db ORM. See here for more info on bun model annotations: https://bun.uptrace.dev/guide/models.html
Index ¶
- Constants
- func ConversationOtherAccountsKey(otherAccountIDs []string) string
- func ForwardCompatibleInteractionRequestURI(interactionURI string, suffix string) string
- type Account
- func (a *Account) AlsoKnownAsPopulated() bool
- func (a *Account) DeletedSelf() bool
- func (a *Account) EmojisPopulated() bool
- func (a *Account) IsAliasedTo(uri string) bool
- func (a *Account) IsInstance() bool
- func (a *Account) IsLocal() bool
- func (a *Account) IsMoving() bool
- func (a *Account) IsNew() bool
- func (a *Account) IsRemote() bool
- func (a *Account) IsSuspended() bool
- func (a *Account) PubKeyExpired() bool
- func (a *Account) UsernameDomain() string
- type AccountActorType
- type AccountNote
- type AccountSettings
- type AccountStats
- type AccountToEmoji
- type AdminAction
- type AdminActionCategory
- type AdminActionType
- type AdvancedMigration
- type Application
- type BackfillStatus
- type Block
- type Content
- type Conversation
- type ConversationToStatus
- type DeniedUser
- type DomainAllow
- func (d *DomainAllow) GetCreatedAt() time.Time
- func (d *DomainAllow) GetCreatedByAccount() *Account
- func (d *DomainAllow) GetCreatedByAccountID() string
- func (d *DomainAllow) GetDomain() string
- func (d *DomainAllow) GetID() string
- func (d *DomainAllow) GetObfuscate() *bool
- func (d *DomainAllow) GetPrivateComment() string
- func (d *DomainAllow) GetPublicComment() string
- func (d *DomainAllow) GetSubscriptionID() string
- func (d *DomainAllow) GetType() DomainPermissionType
- func (d *DomainAllow) GetUpdatedAt() time.Time
- func (d *DomainAllow) IsOrphan() bool
- func (d *DomainAllow) SetCreatedByAccount(i *Account)
- func (d *DomainAllow) SetCreatedByAccountID(i string)
- func (d *DomainAllow) SetObfuscate(i *bool)
- func (d *DomainAllow) SetPrivateComment(i string)
- func (d *DomainAllow) SetPublicComment(i string)
- func (d *DomainAllow) SetSubscriptionID(i string)
- func (d *DomainAllow) SetUpdatedAt(i time.Time)
- type DomainBlock
- func (d *DomainBlock) GetCreatedAt() time.Time
- func (d *DomainBlock) GetCreatedByAccount() *Account
- func (d *DomainBlock) GetCreatedByAccountID() string
- func (d *DomainBlock) GetDomain() string
- func (d *DomainBlock) GetID() string
- func (d *DomainBlock) GetObfuscate() *bool
- func (d *DomainBlock) GetPrivateComment() string
- func (d *DomainBlock) GetPublicComment() string
- func (d *DomainBlock) GetSubscriptionID() string
- func (d *DomainBlock) GetType() DomainPermissionType
- func (d *DomainBlock) GetUpdatedAt() time.Time
- func (d *DomainBlock) IsOrphan() bool
- func (d *DomainBlock) SetCreatedByAccount(i *Account)
- func (d *DomainBlock) SetCreatedByAccountID(i string)
- func (d *DomainBlock) SetObfuscate(i *bool)
- func (d *DomainBlock) SetPrivateComment(i string)
- func (d *DomainBlock) SetPublicComment(i string)
- func (d *DomainBlock) SetSubscriptionID(i string)
- func (d *DomainBlock) SetUpdatedAt(i time.Time)
- type DomainPermSubContentType
- type DomainPermission
- type DomainPermissionDraft
- func (d *DomainPermissionDraft) GetCreatedAt() time.Time
- func (d *DomainPermissionDraft) GetCreatedByAccount() *Account
- func (d *DomainPermissionDraft) GetCreatedByAccountID() string
- func (d *DomainPermissionDraft) GetDomain() string
- func (d *DomainPermissionDraft) GetID() string
- func (d *DomainPermissionDraft) GetObfuscate() *bool
- func (d *DomainPermissionDraft) GetPrivateComment() string
- func (d *DomainPermissionDraft) GetPublicComment() string
- func (d *DomainPermissionDraft) GetSubscriptionID() string
- func (d *DomainPermissionDraft) GetType() DomainPermissionType
- func (d *DomainPermissionDraft) GetUpdatedAt() time.Time
- func (d *DomainPermissionDraft) IsOrphan() bool
- func (d *DomainPermissionDraft) SetCreatedByAccount(i *Account)
- func (d *DomainPermissionDraft) SetCreatedByAccountID(i string)
- func (d *DomainPermissionDraft) SetObfuscate(i *bool)
- func (d *DomainPermissionDraft) SetPrivateComment(i string)
- func (d *DomainPermissionDraft) SetPublicComment(i string)
- func (d *DomainPermissionDraft) SetSubscriptionID(i string)
- func (d *DomainPermissionDraft) SetUpdatedAt(i time.Time)
- type DomainPermissionExclude
- func (d *DomainPermissionExclude) GetCreatedAt() time.Time
- func (d *DomainPermissionExclude) GetCreatedByAccount() *Account
- func (d *DomainPermissionExclude) GetCreatedByAccountID() string
- func (d *DomainPermissionExclude) GetDomain() string
- func (d *DomainPermissionExclude) GetID() string
- func (d *DomainPermissionExclude) GetObfuscate() *bool
- func (d *DomainPermissionExclude) GetPrivateComment() string
- func (d *DomainPermissionExclude) GetPublicComment() string
- func (d *DomainPermissionExclude) GetSubscriptionID() string
- func (d *DomainPermissionExclude) GetType() DomainPermissionType
- func (d *DomainPermissionExclude) GetUpdatedAt() time.Time
- func (d *DomainPermissionExclude) IsOrphan() bool
- func (d *DomainPermissionExclude) SetCreatedByAccount(i *Account)
- func (d *DomainPermissionExclude) SetCreatedByAccountID(i string)
- func (d *DomainPermissionExclude) SetObfuscate(_ *bool)
- func (d *DomainPermissionExclude) SetPrivateComment(i string)
- func (d *DomainPermissionExclude) SetPublicComment(_ string)
- func (d *DomainPermissionExclude) SetSubscriptionID(_ string)
- func (d *DomainPermissionExclude) SetUpdatedAt(i time.Time)
- type DomainPermissionSubscription
- type DomainPermissionType
- type EmailDomainBlock
- type Emoji
- type EmojiCategory
- type Field
- type File
- type FileMeta
- type FileType
- type Filter
- type FilterAction
- type FilterContext
- type FilterContexts
- func (ctxs FilterContexts) Account() bool
- func (ctxs FilterContexts) Applies(ctx FilterContext) bool
- func (ctxs FilterContexts) Home() bool
- func (ctxs FilterContexts) Notifications() bool
- func (ctxs FilterContexts) Public() bool
- func (ctxs *FilterContexts) SetAccount()
- func (ctxs *FilterContexts) SetHome()
- func (ctxs *FilterContexts) SetNotifications()
- func (ctxs *FilterContexts) SetPublic()
- func (ctxs *FilterContexts) SetThread()
- func (ctxs FilterContexts) String() string
- func (ctxs FilterContexts) Thread() bool
- func (ctxs *FilterContexts) UnsetAccount()
- func (ctxs *FilterContexts) UnsetHome()
- func (ctxs *FilterContexts) UnsetNotifications()
- func (ctxs *FilterContexts) UnsetPublic()
- func (ctxs *FilterContexts) UnsetThread()
- type FilterKeyword
- type FilterStatus
- type Focus
- type Follow
- type FollowRequest
- type FollowedTag
- type HeaderFilter
- type HeaderFilterAllow
- type HeaderFilterBlock
- type Instance
- type Interaction
- type InteractionPolicy
- func DefaultInteractionPolicyDirect() *InteractionPolicy
- func DefaultInteractionPolicyFollowersOnly() *InteractionPolicy
- func DefaultInteractionPolicyFor(v Visibility) *InteractionPolicy
- func DefaultInteractionPolicyPublic() *InteractionPolicy
- func DefaultInteractionPolicyUnlocked() *InteractionPolicy
- type InteractionRequest
- type InteractionType
- type List
- type ListEntry
- type Marker
- type MarkerName
- type MediaAttachment
- type Mention
- type Move
- type NewSignup
- type Notification
- type NotificationType
- type Original
- type ParseMentionFunc
- type PolicyCheckResult
- type PolicyPermission
- type PolicyRules
- type PolicyValue
- type PolicyValues
- type Poll
- type PollVote
- type ProcessingStatus
- type Relationship
- type RepliesPolicy
- type Report
- type RouterSession
- type Rule
- type ScheduledStatus
- type ScheduledStatusPoll
- type SinBinStatus
- type Small
- type Status
- func (s *Status) AllAttachmentIDs() []string
- func (s *Status) AttachmentsPopulated() bool
- func (s *Status) BelongsToAccount(accountID string) bool
- func (s *Status) EditsPopulated() bool
- func (s *Status) EmojisPopulated() bool
- func (s *Status) EmojisUpToDate(other *Status) bool
- func (s *Status) GetAccount() *Account
- func (s *Status) GetAccountID() string
- func (s *Status) GetAttachmentByRemoteURL(url string) (*MediaAttachment, bool)
- func (s *Status) GetBoostOfAccountID() string
- func (s *Status) GetBoostOfID() string
- func (s *Status) GetID() string
- func (s *Status) GetMentionByTargetID(id string) (*Mention, bool)
- func (s *Status) GetMentionByTargetURI(uri string) (*Mention, bool)
- func (s *Status) GetMentionByUsernameDomain(username, domain string) (*Mention, bool)
- func (s *Status) GetTagByName(name string) (*Tag, bool)
- func (s *Status) IsLocal() bool
- func (s *Status) IsLocalOnly() bool
- func (s *Status) MentionsAccount(accountID string) bool
- func (s *Status) MentionsPopulated() bool
- func (s *Status) TagsPopulated() bool
- func (s *Status) UpdatedAt() time.Time
- type StatusBookmark
- type StatusContentType
- type StatusEdit
- type StatusFave
- type StatusMute
- type StatusToEmoji
- type StatusToTag
- type Tag
- type Theme
- type Thread
- type ThreadMute
- type Thumbnail
- type Token
- type Tombstone
- type User
- type UserMute
- type VAPIDKeyPair
- type Visibility
- type WebLayout
- type WebPushNotificationPolicy
- type WebPushSubscription
- type WebPushSubscriptionNotificationFlags
- type WorkerTask
- type WorkerType
Constants ¶
const ( // Suffix to append to the URI of // impolite Likes to mock a LikeRequest. LikeRequestSuffix = "#LikeRequest" // Suffix to append to the URI of // impolite replies to mock a ReplyRequest. ReplyRequestSuffix = "#ReplyRequest" // Suffix to append to the URI of impolite // Announces to mock an AnnounceRequest. AnnounceRequestSuffix = "#AnnounceRequest" )
Variables ¶
This section is empty.
Functions ¶
func ConversationOtherAccountsKey ¶
ConversationOtherAccountsKey creates an OtherAccountsKey from a list of OtherAccountIDs.
func ForwardCompatibleInteractionRequestURI ¶ added in v0.20.0
A useless function that appends two strings, this exists largely to indicate where a request URI is being generated as forward compatible with our planned polite request flow fully introduced in v0.21.0.
TODO: remove this in v0.21.0. everything the linter complains about after removing this, needs updating.
Types ¶
type Account ¶
type Account struct {
// Database ID of the account.
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
// Datetime when the account was created.
// Corresponds to ActivityStreams `published` prop.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Datetime when was the account was last updated,
// ie., when the actor last sent out an Update
// activity, or if never, when it was `published`.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Datetime when the account was last fetched /
// dereferenced by this GoToSocial instance.
FetchedAt time.Time `bun:"type:timestamptz,nullzero"`
// Username of the account.
//
// Corresponds to AS `preferredUsername` prop, which gives
// no uniqueness guarantee. However, we do enforce uniqueness
// for it as, in practice, it always is and we rely on this.
Username string `bun:",nullzero,notnull,unique:accounts_username_domain_uniq"`
// Domain of the account, discovered via webfinger.
//
// Null if this is a local account, otherwise
// something like `example.org`.
Domain string `bun:",nullzero,unique:accounts_username_domain_uniq"`
// Database ID of the account's avatar MediaAttachment, if set.
AvatarMediaAttachmentID string `bun:"type:CHAR(26),nullzero"`
// MediaAttachment corresponding to AvatarMediaAttachmentID.
AvatarMediaAttachment *MediaAttachment `bun:"-"`
// URL of the avatar media.
//
// Null for local accounts.
AvatarRemoteURL string `bun:",nullzero"`
// Database ID of the account's header MediaAttachment, if set.
HeaderMediaAttachmentID string `bun:"type:CHAR(26),nullzero"`
// MediaAttachment corresponding to HeaderMediaAttachmentID.
HeaderMediaAttachment *MediaAttachment `bun:"-"`
// URL of the header media.
//
// Null for local accounts.
HeaderRemoteURL string `bun:",nullzero"`
// Display name for this account, if set.
//
// Corresponds to the ActivityStreams `name` property.
//
// If null, fall back to username for display purposes.
DisplayName string `bun:",nullzero"`
// Database IDs of any emojis used in
// this account's bio, display name, etc
EmojiIDs []string `bun:"emojis,array"`
// Emojis corresponding to EmojiIDs.
Emojis []*Emoji `bun:"-"`
// A slice of of key/value fields that
// this account has added to their profile.
//
// Corresponds to schema.org PropertyValue types in `attachments`.
Fields []*Field `bun:",nullzero"`
// The raw (unparsed) content of fields that this
// account has added to their profile, before
// conversion to HTML.
//
// Only set for local accounts.
FieldsRaw []*Field `bun:",nullzero"`
// A note that this account has on their profile
// (ie., the account's bio/description of themselves).
//
// Corresponds to the ActivityStreams `summary` property.
Note string `bun:",nullzero"`
// The raw (unparsed) version of Note, before conversion to HTML.
//
// Only set for local accounts.
NoteRaw string `bun:",nullzero"`
// ActivityPub URI/IDs by which this account is also known.
//
// Corresponds to the ActivityStreams `alsoKnownAs` property.
AlsoKnownAsURIs []string `bun:"also_known_as_uris,array"`
// Accounts matching AlsoKnownAsURIs.
AlsoKnownAs []*Account `bun:"-"`
// URI/ID to which the account has (or claims to have) moved.
//
// Corresponds to the ActivityStreams `movedTo` property.
//
// Even if this field is set the move may not yet have been
// processed. Check `move` for this.
MovedToURI string `bun:",nullzero"`
// Account matching MovedToURI.
MovedTo *Account `bun:"-"`
// ID of a Move in the database for this account.
// Only set if we received or created a Move activity
// for which this account URI was the origin.
MoveID string `bun:"type:CHAR(26),nullzero"`
// Move corresponding to MoveID, if set.
Move *Move `bun:"-"`
// True if account requires manual approval of Follows.
//
// Corresponds to AS `manuallyApprovesFollowers` prop.
Locked *bool `bun:",nullzero,notnull,default:true"`
// True if account has opted in to being shown in
// directories and exposed to search engines.
//
// Corresponds to the toot `discoverable` property.
Discoverable *bool `bun:",nullzero,notnull,default:false"`
// ActivityPub URI/ID for this account.
//
// Must be set, must be unique.
URI string `bun:",nullzero,notnull,unique"`
// URL at which a web representation of this
// account should be available, if set.
//
// Corresponds to ActivityStreams `url` prop.
URL string `bun:",nullzero"`
// URI of the actor's inbox.
//
// Corresponds to ActivityPub `inbox` property.
//
// According to AP this MUST be set, but some
// implementations don't set it for service actors.
InboxURI string `bun:",nullzero"`
//
// Corresponds to ActivityPub `endpoints.sharedInbox`.
//
// Gotcha warning: this is a string pointer because
// it has three possible states:
//
// 1. null: We don't know (yet) if actor has a shared inbox.
// 2. empty: We know it doesn't have a shared inbox.
// 3. not empty: We know it does have a shared inbox.
SharedInboxURI *string `bun:""`
// URI/ID of the actor's outbox.
//
// Corresponds to ActivityPub `outbox` property.
//
// According to AP this MUST be set, but some
// implementations don't set it for service actors.
OutboxURI string `bun:",nullzero"`
// URI/ID of the actor's following collection.
//
// Corresponds to ActivityPub `following` property.
//
// According to AP this SHOULD be set.
FollowingURI string `bun:",nullzero"`
// URI/ID of the actor's followers collection.
//
// Corresponds to ActivityPub `followers` property.
//
// According to AP this SHOULD be set.
FollowersURI string `bun:",nullzero"`
// URI/ID of the actor's featured collection.
//
// Corresponds to the Toot `featured` property.
FeaturedCollectionURI string `bun:",nullzero"`
// ActivityStreams type of the actor.
//
// Application, Group, Organization, Person, or Service.
ActorType AccountActorType `bun:",nullzero,notnull"`
// Private key for signing http requests.
//
// Only defined for local accounts
PrivateKey *rsa.PrivateKey `bun:""`
// Public key for authorizing signed http requests.
//
// Defined for both local and remote accounts
PublicKey *rsa.PublicKey `bun:",notnull"`
// Dereferenceable location of this actor's public key.
//
// Corresponds to https://w3id.org/security/v1 `publicKey.id`.
PublicKeyURI string `bun:",nullzero,notnull,unique"`
// Datetime at which public key will expire/has expired,
// and should be fetched again as appropriate.
//
// Only ever set for remote accounts.
PublicKeyExpiresAt time.Time `bun:"type:timestamptz,nullzero"`
// Datetime at which account was marked as a "memorial",
// ie., user owning the account has passed away.
MemorializedAt time.Time `bun:"type:timestamptz,nullzero"`
// Datetime at which account was set to
// have all its media shown as sensitive.
SensitizedAt time.Time `bun:"type:timestamptz,nullzero"`
// Datetime at which account was silenced.
SilencedAt time.Time `bun:"type:timestamptz,nullzero"`
// Datetime at which account was suspended.
SuspendedAt time.Time `bun:"type:timestamptz,nullzero"`
// ID of the database entry that caused this account to
// be suspended. Can be an account ID or a domain block ID.
SuspensionOrigin string `bun:"type:CHAR(26),nullzero"`
// gtsmodel.AccountSettings for this account.
//
// Local, non-instance-actor accounts only.
Settings *AccountSettings `bun:"-"`
// gtsmodel.AccountStats for this account.
//
// Local accounts only.
Stats *AccountStats `bun:"-"`
// True if the actor hides to-public statusables
// from unauthenticated public access via the web.
// Default "false" if not set on the actor model.
HidesToPublicFromUnauthedWeb *bool `bun:",nullzero,notnull,default:false"`
// True if the actor hides cc-public statusables
// from unauthenticated public access via the web.
// Default "true" if not set on the actor model.
HidesCcPublicFromUnauthedWeb *bool `bun:",nullzero,notnull,default:true"`
}
Account represents either a local or a remote ActivityPub actor. https://www.w3.org/TR/activitypub/#actor-objects
func (*Account) AlsoKnownAsPopulated ¶
AlsoKnownAsPopulated returns whether alsoKnownAs accounts are populated according to current AlsoKnownAsURIs.
func (*Account) DeletedSelf ¶ added in v0.20.1
DeletedSelf returns true if account deleted itself.
func (*Account) EmojisPopulated ¶
EmojisPopulated returns whether emojis are populated according to current EmojiIDs.
func (*Account) IsAliasedTo ¶
IsAliasedTo returns true if account is aliased to the given account URI.
func (*Account) IsInstance ¶
IsInstance returns whether account is an instance internal actor account.
func (*Account) IsNew ¶
IsNew returns whether an account is "new" in the sense that it has not been previously stored in the database.
func (*Account) IsSuspended ¶
IsSuspended returns true if account has been suspended from this instance.
func (*Account) PubKeyExpired ¶
PubKeyExpired returns true if the account's public key has been marked as expired, and the expiry time has passed.
func (*Account) UsernameDomain ¶
UsernameDomain returns account @username@domain (missing domain if local).
type AccountActorType ¶
type AccountActorType enumType
AccountActorType is the ActivityStreams type of an actor.
const ( AccountActorTypeUnknown AccountActorType = 0 AccountActorTypeApplication AccountActorType = 1 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application AccountActorTypeGroup AccountActorType = 2 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group AccountActorTypeOrganization AccountActorType = 3 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-organization AccountActorTypePerson AccountActorType = 4 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person AccountActorTypeService AccountActorType = 5 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service )
func ParseAccountActorType ¶
func ParseAccountActorType(in string) AccountActorType
ParseAccountActorType returns an actor type from the given value.
func (AccountActorType) IsBot ¶
func (t AccountActorType) IsBot() bool
func (AccountActorType) String ¶
func (t AccountActorType) String() string
String returns a stringified form of AccountActorType.
type AccountNote ¶
type AccountNote struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
AccountID string `bun:"type:CHAR(26),unique:account_notes_account_id_target_account_id_uniq,notnull,nullzero"` // ID of the local account that created the note
Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID
TargetAccountID string `bun:"type:CHAR(26),unique:account_notes_account_id_target_account_id_uniq,notnull,nullzero"` // Who is the target of this note?
TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID
Comment string `bun:""` // The text of the note.
}
AccountNote stores a private note from a local account related to any account.
type AccountSettings ¶
type AccountSettings struct {
AccountID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // AccountID that owns this settings.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item was last updated.
Privacy Visibility `bun:",nullzero,default:3"` // Default post privacy for this account
Sensitive *bool `bun:",nullzero,notnull,default:false"` // Set posts from this account to sensitive by default?
Language string `bun:",nullzero,notnull,default:'en'"` // What language does this account post in?
StatusContentType string `bun:",nullzero"` // What is the default format for statuses posted by this account (only for local accounts).
Theme string `bun:",nullzero"` // Preset CSS theme filename selected by this Account (empty string if nothing set).
CustomCSS string `bun:",nullzero"` // Custom CSS that should be displayed for this Account's profile and statuses.
EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed
HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections.
WebLayout WebLayout `bun:",nullzero,notnull,default:1"` // Layout to use when showing this profile via the web.
InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy.
InteractionPolicyMutualsOnly *InteractionPolicy `bun:""` // Interaction policy to use for new mutuals only visibility statuses. If null, assume default policy.
InteractionPolicyFollowersOnly *InteractionPolicy `bun:""` // Interaction policy to use for new followers only visibility statuses. If null, assume default policy.
InteractionPolicyUnlocked *InteractionPolicy `bun:""` // Interaction policy to use for new unlocked visibility statuses. If null, assume default policy.
InteractionPolicyPublic *InteractionPolicy `bun:""` // Interaction policy to use for new public visibility statuses. If null, assume default policy.
}
AccountSettings models settings / preferences for a local, non-instance account.
type AccountStats ¶
type AccountStats struct {
AccountID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // AccountID of this AccountStats.
RegeneratedAt time.Time `bun:"type:timestamptz,nullzero"` // Time this stats model was last regenerated (ie., created from scratch using COUNTs).
FollowersCount *int `bun:",nullzero,notnull"` // Number of accounts following AccountID.
FollowingCount *int `bun:",nullzero,notnull"` // Number of accounts followed by AccountID.
FollowRequestsCount *int `bun:",nullzero,notnull"` // Number of pending follow requests aimed at AccountID.
StatusesCount *int `bun:",nullzero,notnull"` // Number of statuses created by AccountID.
StatusesPinnedCount *int `bun:",nullzero,notnull"` // Number of statuses pinned by AccountID.
LastStatusAt time.Time `bun:"type:timestamptz,nullzero"` // Time of most recent status created by AccountID.
}
AccountStats models statistics for a remote or local account.
type AccountToEmoji ¶
type AccountToEmoji struct {
AccountID string `bun:"type:CHAR(26),unique:accountemoji,nullzero,notnull"`
Account *Account `bun:"rel:belongs-to"`
EmojiID string `bun:"type:CHAR(26),unique:accountemoji,nullzero,notnull"`
Emoji *Emoji `bun:"rel:belongs-to"`
}
AccountToEmoji is an intermediate struct to facilitate the many2many relationship between an account and one or more emojis.
type AdminAction ¶
type AdminAction struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Creation time of this item.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Last updated time of this item.
CompletedAt time.Time `bun:"type:timestamptz,nullzero"` // Completion time of this item.
TargetCategory AdminActionCategory `bun:",nullzero,notnull"` // Category of the entity targeted by this action.
TargetID string `bun:",nullzero,notnull"` // Identifier of the target. May be a ULID (in case of accounts), or a domain name (in case of domains).
Target interface{} `bun:"-"` // Target of the action. Might be a domain string, might be an account.
Type AdminActionType `bun:",nullzero,notnull"` // Type of action that was taken.
AccountID string `bun:"type:CHAR(26),notnull,nullzero"` // Who performed this admin action.
Account *Account `bun:"rel:has-one"` // Account corresponding to accountID
Text string `bun:",nullzero"` // Free text field for explaining why this action was taken, or adding a note about this action.
SendEmail *bool `bun:",nullzero,notnull,default:false"` // Send an email to the target account's user to explain what happened (local accounts only).
ReportIDs []string `bun:"reports,array"` // IDs of any reports cited when creating this action.
Reports []*Report `bun:"-"` // Reports corresponding to ReportIDs.
Errors []string `bun:",array"` // String value of any error(s) encountered while processing. May be helpful for admins to debug.
}
AdminAction models an action taken by an instance administrator towards an account, domain, etc.
func (*AdminAction) Key ¶
func (a *AdminAction) Key() string
Key returns a key for the AdminAction which is unique only on its TargetCategory and TargetID fields. This key can be used to check if this AdminAction overlaps with another action performed on the same target, regardless of the Type of either this or the other action.
type AdminActionCategory ¶
type AdminActionCategory uint8
AdminActionCategory describes the category of entity that this admin action targets.
const ( AdminActionCategoryUnknown AdminActionCategory = iota AdminActionCategoryAccount AdminActionCategoryDomain )
func ParseAdminActionCategory ¶
func ParseAdminActionCategory(in string) AdminActionCategory
func (AdminActionCategory) String ¶
func (c AdminActionCategory) String() string
type AdminActionType ¶
type AdminActionType uint8
AdminActionType describes a type of action taken on an entity by an admin.
const ( AdminActionUnknown AdminActionType = iota AdminActionDisable AdminActionReenable AdminActionSilence AdminActionUnsilence AdminActionSuspend AdminActionUnsuspend AdminActionExpireKeys AdminActionUnallow )
func ParseAdminActionType ¶
func ParseAdminActionType(in string) AdminActionType
func (AdminActionType) String ¶
func (t AdminActionType) String() string
type AdvancedMigration ¶
type AdvancedMigration struct {
ID string `bun:",pk,nullzero,notnull,unique"` // id of this migration (preassigned, not a ULID)
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
StateJSON []byte `bun:",nullzero"` // JSON dump of the migration state
Finished *bool `bun:",nullzero,notnull,default:false"` // has this migration finished?
}
AdvancedMigration stores state for an "advanced migration", which is a migration that doesn't fit into the Bun migration framework.
type Application ¶
type Application struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
Name string `bun:",notnull"` // name of the application given when it was created (eg., 'tusky')
Website string `bun:",nullzero"` // website for the application given when it was created (eg., 'https://tusky.app')
RedirectURIs []string `bun:"redirect_uris,array"` // redirect uris requested by the application for oauth2 flow
ClientID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the associated oauth client entity in the db
ClientSecret string `bun:",nullzero,notnull"` // secret of the associated oauth client entity in the db
Scopes string `bun:",notnull"` // scopes requested when this app was created
ManagedByUserID string `bun:"type:CHAR(26),nullzero"` // id of the user that manages this application, if it was created through the settings panel
}
Application represents an application that can perform actions on behalf of a user.
It is equivalent to an OAuth client.
func (*Application) GetDomain ¶
func (a *Application) GetDomain() string
Implements oauth2.ClientInfo.
func (*Application) GetSecret ¶
func (a *Application) GetSecret() string
Implements oauth2.ClientInfo.
func (*Application) GetUserID ¶
func (a *Application) GetUserID() string
Implements oauth2.ClientInfo.
func (*Application) IsPublic ¶ added in v0.20.0
func (a *Application) IsPublic() bool
Implements oauth2.IsPublic.
type BackfillStatus ¶
type BackfillStatus struct {
*Status
}
BackfillStatus is a wrapper for creating a status without pushing notifications to followers.
type Block ¶
type Block struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
URI string `bun:",notnull,nullzero,unique"` // ActivityPub uri of this block.
AccountID string `bun:"type:CHAR(26),unique:blocksrctarget,notnull,nullzero"` // Who does this block originate from?
Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID
TargetAccountID string `bun:"type:CHAR(26),unique:blocksrctarget,notnull,nullzero"` // Who is the target of this block ?
TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID
}
Block refers to the blocking of one account by another.
type Content ¶
Content models the simple string content of a status along with its ContentMap, which contains content entries keyed by BCP47 language tag.
Content and/or ContentMap may be zero/nil.
type Conversation ¶
type Conversation struct {
// ID of this item in the database.
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
// When was this item created?
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// When was this item last updated?
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Account that owns the conversation.
AccountID string `` /* 154-byte string literal not displayed */
Account *Account `bun:"-"`
// Other accounts participating in the conversation.
// Doesn't include the owner. May be empty in the case of a DM to yourself.
OtherAccountIDs []string `bun:"other_account_ids,array"`
OtherAccounts []*Account `bun:"-"`
// Denormalized lookup key derived from unique OtherAccountIDs, sorted and concatenated with commas.
// May be empty in the case of a DM to yourself.
OtherAccountsKey string `bun:",notnull,unique:conversations_thread_id_account_id_other_accounts_key_uniq"`
// Thread that the conversation is part of.
ThreadID string `bun:"type:CHAR(26),nullzero,notnull,unique:conversations_thread_id_account_id_other_accounts_key_uniq"`
// ID of the last status in this conversation.
LastStatusID string `bun:"type:CHAR(26),nullzero,notnull,unique:conversations_account_id_last_status_id_uniq"`
LastStatus *Status `bun:"-"`
// Has the owner read all statuses in this conversation?
Read *bool `bun:",default:false"`
}
Conversation represents direct messages between the owner account and a set of other accounts.
type ConversationToStatus ¶
type ConversationToStatus struct {
ConversationID string `bun:"type:CHAR(26),unique:conversation_to_statuses_conversation_id_status_id_uniq,nullzero,notnull"`
Conversation *Conversation `bun:"rel:belongs-to"`
StatusID string `bun:"type:CHAR(26),unique:conversation_to_statuses_conversation_id_status_id_uniq,nullzero,notnull"`
Status *Status `bun:"rel:belongs-to"`
}
ConversationToStatus is an intermediate struct to facilitate the many2many relationship between a conversation and its statuses, including but not limited to the last status. These are used only when deleting a status from a conversation.
type DeniedUser ¶
type DeniedUser struct {
// Database ID of the user.
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
// Datetime when the user was denied.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Datetime when the denied user was last updated.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Email address provided on the sign-up form.
Email string `bun:",nullzero,notnull"`
// Username provided on the sign-up form.
Username string `bun:",nullzero,notnull"`
// IP address the sign-up originated from.
SignUpIP net.IP `bun:",nullzero"`
// Invite ID provided on the sign-up form (if applicable).
InviteID string `bun:"type:CHAR(26),nullzero"`
// Locale provided on the sign-up form.
Locale string `bun:",nullzero"`
// ID of application used to create this sign-up.
CreatedByApplicationID string `bun:"type:CHAR(26),nullzero"`
// Reason provided by user on the sign-up form.
SignUpReason string `bun:",nullzero"`
// Comment from instance admin about why this sign-up was denied.
PrivateComment string `bun:",nullzero"`
// Send an email informing user that their sign-up has been denied.
SendEmail *bool `bun:",nullzero,notnull,default:false"`
// Message to include when sending an email to the
// denied user's email address, if SendEmail is true.
Message string `bun:",nullzero"`
}
DeniedUser represents one user sign-up that was submitted to the instance and denied.
type DomainAllow ¶
type DomainAllow struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Domain string `bun:",nullzero,notnull"` // domain to allow. Eg. 'whatever.com'
CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this allow
CreatedByAccount *Account `bun:"-"` // Account corresponding to createdByAccountID
PrivateComment string `bun:""` // Private comment on this allow, viewable to admins
PublicComment string `bun:""` // Public comment on this allow, viewable (optionally) by everyone
Obfuscate *bool `bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly
SubscriptionID string `bun:"type:CHAR(26),nullzero"` // if this allow was created through a subscription, what's the subscription ID?
}
DomainAllow represents a federation allow towards a particular domain.
func (*DomainAllow) GetCreatedAt ¶
func (d *DomainAllow) GetCreatedAt() time.Time
func (*DomainAllow) GetCreatedByAccount ¶
func (d *DomainAllow) GetCreatedByAccount() *Account
func (*DomainAllow) GetCreatedByAccountID ¶
func (d *DomainAllow) GetCreatedByAccountID() string
func (*DomainAllow) GetDomain ¶
func (d *DomainAllow) GetDomain() string
func (*DomainAllow) GetID ¶
func (d *DomainAllow) GetID() string
func (*DomainAllow) GetObfuscate ¶
func (d *DomainAllow) GetObfuscate() *bool
func (*DomainAllow) GetPrivateComment ¶
func (d *DomainAllow) GetPrivateComment() string
func (*DomainAllow) GetPublicComment ¶
func (d *DomainAllow) GetPublicComment() string
func (*DomainAllow) GetSubscriptionID ¶
func (d *DomainAllow) GetSubscriptionID() string
func (*DomainAllow) GetType ¶
func (d *DomainAllow) GetType() DomainPermissionType
func (*DomainAllow) GetUpdatedAt ¶
func (d *DomainAllow) GetUpdatedAt() time.Time
func (*DomainAllow) IsOrphan ¶
func (d *DomainAllow) IsOrphan() bool
func (*DomainAllow) SetCreatedByAccount ¶
func (d *DomainAllow) SetCreatedByAccount(i *Account)
func (*DomainAllow) SetCreatedByAccountID ¶
func (d *DomainAllow) SetCreatedByAccountID(i string)
func (*DomainAllow) SetObfuscate ¶
func (d *DomainAllow) SetObfuscate(i *bool)
func (*DomainAllow) SetPrivateComment ¶
func (d *DomainAllow) SetPrivateComment(i string)
func (*DomainAllow) SetPublicComment ¶
func (d *DomainAllow) SetPublicComment(i string)
func (*DomainAllow) SetSubscriptionID ¶
func (d *DomainAllow) SetSubscriptionID(i string)
func (*DomainAllow) SetUpdatedAt ¶
func (d *DomainAllow) SetUpdatedAt(i time.Time)
type DomainBlock ¶
type DomainBlock struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Domain string `bun:",nullzero,notnull"` // domain to block. Eg. 'whatever.com'
CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this block
CreatedByAccount *Account `bun:"-"` // Account corresponding to createdByAccountID
PrivateComment string `bun:""` // Private comment on this block, viewable to admins
PublicComment string `bun:""` // Public comment on this block, viewable (optionally) by everyone
Obfuscate *bool `bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly
SubscriptionID string `bun:"type:CHAR(26),nullzero"` // if this block was created through a subscription, what's the subscription ID?
}
DomainBlock represents a federation block against a particular domain
func (*DomainBlock) GetCreatedAt ¶
func (d *DomainBlock) GetCreatedAt() time.Time
func (*DomainBlock) GetCreatedByAccount ¶
func (d *DomainBlock) GetCreatedByAccount() *Account
func (*DomainBlock) GetCreatedByAccountID ¶
func (d *DomainBlock) GetCreatedByAccountID() string
func (*DomainBlock) GetDomain ¶
func (d *DomainBlock) GetDomain() string
func (*DomainBlock) GetID ¶
func (d *DomainBlock) GetID() string
func (*DomainBlock) GetObfuscate ¶
func (d *DomainBlock) GetObfuscate() *bool
func (*DomainBlock) GetPrivateComment ¶
func (d *DomainBlock) GetPrivateComment() string
func (*DomainBlock) GetPublicComment ¶
func (d *DomainBlock) GetPublicComment() string
func (*DomainBlock) GetSubscriptionID ¶
func (d *DomainBlock) GetSubscriptionID() string
func (*DomainBlock) GetType ¶
func (d *DomainBlock) GetType() DomainPermissionType
func (*DomainBlock) GetUpdatedAt ¶
func (d *DomainBlock) GetUpdatedAt() time.Time
func (*DomainBlock) IsOrphan ¶
func (d *DomainBlock) IsOrphan() bool
func (*DomainBlock) SetCreatedByAccount ¶
func (d *DomainBlock) SetCreatedByAccount(i *Account)
func (*DomainBlock) SetCreatedByAccountID ¶
func (d *DomainBlock) SetCreatedByAccountID(i string)
func (*DomainBlock) SetObfuscate ¶
func (d *DomainBlock) SetObfuscate(i *bool)
func (*DomainBlock) SetPrivateComment ¶
func (d *DomainBlock) SetPrivateComment(i string)
func (*DomainBlock) SetPublicComment ¶
func (d *DomainBlock) SetPublicComment(i string)
func (*DomainBlock) SetSubscriptionID ¶
func (d *DomainBlock) SetSubscriptionID(i string)
func (*DomainBlock) SetUpdatedAt ¶
func (d *DomainBlock) SetUpdatedAt(i time.Time)
type DomainPermSubContentType ¶
type DomainPermSubContentType enumType
const ( DomainPermSubContentTypeUnknown DomainPermSubContentType = 0 // ??? DomainPermSubContentTypeCSV DomainPermSubContentType = 1 // text/csv DomainPermSubContentTypeJSON DomainPermSubContentType = 2 // application/json DomainPermSubContentTypePlain DomainPermSubContentType = 3 // text/plain )
func NewDomainPermSubContentType ¶
func NewDomainPermSubContentType(in string) DomainPermSubContentType
func (DomainPermSubContentType) String ¶
func (p DomainPermSubContentType) String() string
type DomainPermission ¶
type DomainPermission interface {
GetID() string
GetCreatedAt() time.Time
GetUpdatedAt() time.Time
SetUpdatedAt(i time.Time)
GetDomain() string
GetCreatedByAccountID() string
SetCreatedByAccountID(i string)
GetCreatedByAccount() *Account
SetCreatedByAccount(i *Account)
GetPrivateComment() string
SetPrivateComment(i string)
GetPublicComment() string
SetPublicComment(i string)
GetObfuscate() *bool
SetObfuscate(i *bool)
GetSubscriptionID() string
SetSubscriptionID(i string)
GetType() DomainPermissionType
// Return true if this DomainPermission
// does not have a subscription id set.
IsOrphan() bool
}
DomainPermission models a domain permission entry -- block / allow / draft / exclude.
type DomainPermissionDraft ¶
type DomainPermissionDraft struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Time when this item was created.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Time when this item was last updated.
PermissionType DomainPermissionType `bun:",notnull,unique:domain_permission_drafts_permission_type_domain_subscription_id_uniq"` // Permission type of the draft.
Domain string `bun:",nullzero,notnull,unique:domain_permission_drafts_permission_type_domain_subscription_id_uniq"` // Domain to block or allow. Eg. 'whatever.com'.
CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this subscription.
CreatedByAccount *Account `bun:"-"` // Account corresponding to createdByAccountID.
PrivateComment string `bun:",nullzero"` // Private comment on this perm, viewable to admins.
PublicComment string `bun:",nullzero"` // Public comment on this perm, viewable (optionally) by everyone.
Obfuscate *bool `bun:",nullzero,notnull,default:false"` // Obfuscate domain name when displaying it publicly.
SubscriptionID string `bun:"type:CHAR(26),unique:domain_permission_drafts_permission_type_domain_subscription_id_uniq"` // ID of the subscription that created this draft, if any.
}
func (*DomainPermissionDraft) GetCreatedAt ¶
func (d *DomainPermissionDraft) GetCreatedAt() time.Time
func (*DomainPermissionDraft) GetCreatedByAccount ¶
func (d *DomainPermissionDraft) GetCreatedByAccount() *Account
func (*DomainPermissionDraft) GetCreatedByAccountID ¶
func (d *DomainPermissionDraft) GetCreatedByAccountID() string
func (*DomainPermissionDraft) GetDomain ¶
func (d *DomainPermissionDraft) GetDomain() string
func (*DomainPermissionDraft) GetID ¶
func (d *DomainPermissionDraft) GetID() string
func (*DomainPermissionDraft) GetObfuscate ¶
func (d *DomainPermissionDraft) GetObfuscate() *bool
func (*DomainPermissionDraft) GetPrivateComment ¶
func (d *DomainPermissionDraft) GetPrivateComment() string
func (*DomainPermissionDraft) GetPublicComment ¶
func (d *DomainPermissionDraft) GetPublicComment() string
func (*DomainPermissionDraft) GetSubscriptionID ¶
func (d *DomainPermissionDraft) GetSubscriptionID() string
func (*DomainPermissionDraft) GetType ¶
func (d *DomainPermissionDraft) GetType() DomainPermissionType
func (*DomainPermissionDraft) GetUpdatedAt ¶
func (d *DomainPermissionDraft) GetUpdatedAt() time.Time
func (*DomainPermissionDraft) IsOrphan ¶
func (d *DomainPermissionDraft) IsOrphan() bool
func (*DomainPermissionDraft) SetCreatedByAccount ¶
func (d *DomainPermissionDraft) SetCreatedByAccount(i *Account)
func (*DomainPermissionDraft) SetCreatedByAccountID ¶
func (d *DomainPermissionDraft) SetCreatedByAccountID(i string)
func (*DomainPermissionDraft) SetObfuscate ¶
func (d *DomainPermissionDraft) SetObfuscate(i *bool)
func (*DomainPermissionDraft) SetPrivateComment ¶
func (d *DomainPermissionDraft) SetPrivateComment(i string)
func (*DomainPermissionDraft) SetPublicComment ¶
func (d *DomainPermissionDraft) SetPublicComment(i string)
func (*DomainPermissionDraft) SetSubscriptionID ¶
func (d *DomainPermissionDraft) SetSubscriptionID(i string)
func (*DomainPermissionDraft) SetUpdatedAt ¶
func (d *DomainPermissionDraft) SetUpdatedAt(i time.Time)
type DomainPermissionExclude ¶
type DomainPermissionExclude struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Time when this item was created.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Time when this item was last updated.
Domain string `bun:",nullzero,notnull,unique"` // Domain to exclude. Eg. 'whatever.com'.
CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this exclude.
CreatedByAccount *Account `bun:"-"` // Account corresponding to createdByAccountID.
PrivateComment string `bun:",nullzero"` // Private comment on this exclude, viewable to admins.
}
DomainPermissionExclude represents one domain that should be excluded when domain permission (excludes) are created from subscriptions.
func (*DomainPermissionExclude) GetCreatedAt ¶
func (d *DomainPermissionExclude) GetCreatedAt() time.Time
func (*DomainPermissionExclude) GetCreatedByAccount ¶
func (d *DomainPermissionExclude) GetCreatedByAccount() *Account
func (*DomainPermissionExclude) GetCreatedByAccountID ¶
func (d *DomainPermissionExclude) GetCreatedByAccountID() string
func (*DomainPermissionExclude) GetDomain ¶
func (d *DomainPermissionExclude) GetDomain() string
func (*DomainPermissionExclude) GetID ¶
func (d *DomainPermissionExclude) GetID() string
func (*DomainPermissionExclude) GetObfuscate ¶
func (d *DomainPermissionExclude) GetObfuscate() *bool
func (*DomainPermissionExclude) GetPrivateComment ¶
func (d *DomainPermissionExclude) GetPrivateComment() string
func (*DomainPermissionExclude) GetPublicComment ¶
func (d *DomainPermissionExclude) GetPublicComment() string
func (*DomainPermissionExclude) GetSubscriptionID ¶
func (d *DomainPermissionExclude) GetSubscriptionID() string
func (*DomainPermissionExclude) GetType ¶
func (d *DomainPermissionExclude) GetType() DomainPermissionType
func (*DomainPermissionExclude) GetUpdatedAt ¶
func (d *DomainPermissionExclude) GetUpdatedAt() time.Time
func (*DomainPermissionExclude) IsOrphan ¶
func (d *DomainPermissionExclude) IsOrphan() bool
func (*DomainPermissionExclude) SetCreatedByAccount ¶
func (d *DomainPermissionExclude) SetCreatedByAccount(i *Account)
func (*DomainPermissionExclude) SetCreatedByAccountID ¶
func (d *DomainPermissionExclude) SetCreatedByAccountID(i string)
func (*DomainPermissionExclude) SetObfuscate ¶
func (d *DomainPermissionExclude) SetObfuscate(_ *bool)
func (*DomainPermissionExclude) SetPrivateComment ¶
func (d *DomainPermissionExclude) SetPrivateComment(i string)
func (*DomainPermissionExclude) SetPublicComment ¶
func (d *DomainPermissionExclude) SetPublicComment(_ string)
func (*DomainPermissionExclude) SetSubscriptionID ¶
func (d *DomainPermissionExclude) SetSubscriptionID(_ string)
func (*DomainPermissionExclude) SetUpdatedAt ¶
func (d *DomainPermissionExclude) SetUpdatedAt(i time.Time)
type DomainPermissionSubscription ¶
type DomainPermissionSubscription struct {
// ID of this item in the database.
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
// Priority of this subscription compared
// to others of the same permission type.
// 0-255 (higher = higher priority).
Priority uint8 `bun:""`
// Moderator-set title for this list.
Title string `bun:",nullzero,unique"`
// Permission type of the subscription.
PermissionType DomainPermissionType `bun:",nullzero,notnull"`
// Create domain permission entries
// resulting from this subscription as drafts.
AsDraft *bool `bun:",nullzero,notnull,default:true"`
// Adopt orphaned domain permissions
// present in this subscription's entries.
AdoptOrphans *bool `bun:",nullzero,notnull,default:false"`
// Account ID of the creator of this subscription.
CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"`
// Account corresponding to createdByAccountID.
CreatedByAccount *Account `bun:"-"`
// URI of the domain permission list.
URI string `bun:",nullzero,notnull,unique"`
// Content type to expect from the URI.
ContentType DomainPermSubContentType `bun:",nullzero,notnull"`
// Username to send when doing
// a GET of URI using basic auth.
FetchUsername string `bun:",nullzero"`
// Password to send when doing
// a GET of URI using basic auth.
FetchPassword string `bun:",nullzero"`
// Time when fetch of URI was last attempted.
FetchedAt time.Time `bun:"type:timestamptz,nullzero"`
// Time when the domain permission list
// was last *successfuly* fetched, to be
// transmitted as If-Modified-Since header.
SuccessfullyFetchedAt time.Time `bun:"type:timestamptz,nullzero"`
// "Last-Modified" time received from the
// server (if any) on last successful fetch.
// Used for HTTP request caching.
LastModified time.Time `bun:"type:timestamptz,nullzero"`
// "ETag" header last received from the
// server (if any) on last successful fetch.
// Used for HTTP request caching.
ETag string `bun:"etag,nullzero"`
// If latest fetch attempt errored,
// this field stores the error message.
// Cleared on latest successful fetch.
Error string `bun:",nullzero"`
// If true, then when a list is processed, if the
// list does *not* contain entries that it *did*
// contain previously, ie., retracted entries,
// then domain permissions corresponding to those
// entries will be removed.
//
// If false, they will just be orphaned instead.
RemoveRetracted *bool `bun:",nullzero,notnull,default:true"`
}
type DomainPermissionType ¶
type DomainPermissionType uint8
Domain permission type.
const ( DomainPermissionUnknown DomainPermissionType = iota DomainPermissionBlock // Explicitly block a domain. DomainPermissionAllow // Explicitly allow a domain. )
func ParseDomainPermissionType ¶
func ParseDomainPermissionType(in string) DomainPermissionType
func (DomainPermissionType) String ¶
func (p DomainPermissionType) String() string
type EmailDomainBlock ¶
type EmailDomainBlock struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Domain string `bun:",nullzero,notnull"` // Email domain to block. Eg. 'gmail.com' or 'hotmail.com'
CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this block
CreatedByAccount *Account `bun:"rel:belongs-to"` // Account corresponding to createdByAccountID
}
EmailDomainBlock represents a domain that the server should automatically reject sign-up requests from.
type Emoji ¶
type Emoji struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Shortcode string `bun:",nullzero,notnull,unique:domainshortcode"` // String shortcode for this emoji -- the part that's between colons. This should be a-zA-Z_ eg., 'blob_hug' 'purple_heart' 'Gay_Otter' Must be unique with domain.
Domain string `bun:",nullzero,unique:domainshortcode"` // Origin domain of this emoji, eg 'example.org', 'queer.party'. empty string for local emojis.
ImageRemoteURL string `bun:",nullzero"` // Where can this emoji be retrieved remotely? Null for local emojis.
ImageStaticRemoteURL string `bun:",nullzero"` // Where can a static / non-animated version of this emoji be retrieved remotely? Null for local emojis.
ImageURL string `bun:",nullzero"` // Where can this emoji be retrieved from the local server? Null for remote emojis.
ImageStaticURL string `bun:",nullzero"` // Where can a static version of this emoji be retrieved from the local server? Null for remote emojis.
ImagePath string `bun:",notnull"` // Path of the emoji image in the server storage system.
ImageStaticPath string `bun:",notnull"` // Path of a static version of the emoji image in the server storage system
ImageContentType string `bun:",notnull"` // MIME content type of the emoji image
ImageStaticContentType string `bun:",notnull"` // MIME content type of the static version of the emoji image.
ImageFileSize int `bun:",notnull"` // Size of the emoji image file in bytes, for serving purposes.
ImageStaticFileSize int `bun:",notnull"` // Size of the static version of the emoji image file in bytes, for serving purposes.
Disabled *bool `bun:",nullzero,notnull,default:false"` // Has a moderation action disabled this emoji from being shown?
URI string `bun:",nullzero,notnull,unique"` // ActivityPub uri of this emoji. Something like 'https://example.org/emojis/1234'
VisibleInPicker *bool `bun:",nullzero,notnull,default:true"` // Is this emoji visible in the admin emoji picker?
Category *EmojiCategory `bun:"rel:belongs-to"` // In which emoji category is this emoji visible?
CategoryID string `bun:"type:CHAR(26),nullzero"` // ID of the category this emoji belongs to.
Cached *bool `bun:",nullzero,notnull,default:false"` // whether emoji is cached in locally in gotosocial storage.
}
Emoji represents a custom emoji that's been uploaded through the admin UI or downloaded from a remote instance.
func (*Emoji) IsLocal ¶
IsLocal returns true if the emoji is local to this instance., ie., it did not originate from a remote instance.
func (*Emoji) ShortcodeDomain ¶
ShortcodeDomain returns the [shortcode]@[domain] for the given emoji.
type EmojiCategory ¶
type EmojiCategory struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Name string `bun:",nullzero,notnull,unique"` // name of this category
}
EmojiCategory represents a grouping of custom emojis.
type Field ¶
type Field struct {
Name string // Name of this field.
Value string // Value of this field.
VerifiedAt time.Time `bun:",nullzero"` // This field was verified at (optional).
}
Field represents a key value field on an account, for things like pronouns, website, etc. VerifiedAt is optional, to be used only if Value is a URL to a webpage that contains the username of the user.
type File ¶
type File struct {
Path string `bun:",notnull"` // Path of the file in storage.
ContentType string `bun:",notnull"` // MIME content type of the file.
FileSize int `bun:",notnull"` // File size in bytes
}
File refers to the metadata for the whole file
type FileMeta ¶
type FileMeta struct {
Original Original `bun:"embed:original_"`
Small Small `bun:"embed:small_"`
Focus Focus `bun:"embed:focus_"`
}
FileMeta describes metadata about the actual contents of the file.
type FileType ¶
type FileType int
FileType refers to the file type of the media attaachment.
const ( // MediaAttachment file types. FileTypeUnknown FileType = 0 // FileTypeUnknown is for unknown file types (surprise surprise!) FileTypeImage FileType = 1 // FileTypeImage is for jpegs, pngs, and standard gifs FileTypeAudio FileType = 2 // FileTypeAudio is for audio-only files (no video) FileTypeVideo FileType = 3 // FileTypeVideo is for files with audio + visual FileTypeGifv FileType = 4 // FileTypeGifv is for short video-only files (20s or less, mp4, no audio). )
type Filter ¶
type Filter struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
ExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Time filter should expire. If null, should not expire.
AccountID string `bun:"type:CHAR(26),notnull,nullzero,unique:filters_account_id_title_uniq"` // ID of the local account that created the filter.
Title string `bun:",nullzero,notnull,unique:filters_account_id_title_uniq"` // The name of the filter.
Action FilterAction `bun:",nullzero,notnull,default:0"` // The action to take.
Keywords []*FilterKeyword `bun:"-"` // Keywords for this filter.
KeywordIDs []string `bun:"keywords,array"` //
Statuses []*FilterStatus `bun:"-"` // Statuses for this filter.
StatusIDs []string `bun:"statuses,array"` //
Contexts FilterContexts `bun:",nullzero,notnull,default:0"` // Which contexts does this filter apply in?
}
Filter stores a filter created by a local account.
func (*Filter) Expired ¶
Expired returns whether the filter has expired at a given time. Filters without an expiration timestamp never expire.
func (*Filter) KeywordsPopulated ¶ added in v0.20.0
KeywordsPopulated returns whether keywords are populated according to current KeywordIDs.
func (*Filter) StatusesPopulated ¶ added in v0.20.0
StatusesPopulated returns whether statuses are populated according to current StatusIDs.
type FilterAction ¶
type FilterAction enumType
FilterAction represents the action to take on a filtered status.
const ( // FilterActionNone filters should not exist, except // internally, for partially constructed or invalid filters. FilterActionNone FilterAction = 0 // FilterActionWarn means that the // status should be shown behind a warning. FilterActionWarn FilterAction = 1 // FilterActionHide means that the status should // be removed from timeline results entirely. FilterActionHide FilterAction = 2 // FilterActionBlur means that the status should // be shown with its media attachments hidden/blurred. FilterActionBlur FilterAction = 3 )
func (FilterAction) String ¶ added in v0.20.0
func (act FilterAction) String() string
String returns human-readable form of FilterAction.
type FilterContext ¶ added in v0.20.0
type FilterContext bitFieldType
FilterContext represents the context in which a Filter applies.
These are used as bit-field masks to determine which are enabled in a FilterContexts bit field, as well as to signify internally any particular context in which a status should be filtered in.
const ( // FilterContextNone means no filters should // be applied, this is for internal use only. FilterContextNone FilterContext = 0 // FilterContextHome means this status is being // filtered as part of a home or list timeline. FilterContextHome FilterContext = 1 << 1 // FilterContextNotifications means this status is // being filtered as part of the notifications timeline. FilterContextNotifications FilterContext = 1 << 2 // FilterContextPublic means this status is // being filtered as part of a public or tag timeline. FilterContextPublic FilterContext = 1 << 3 // FilterContextThread means this status is // being filtered as part of a thread's context. FilterContextThread FilterContext = 1 << 4 // FilterContextAccount means this status is // being filtered as part of an account's statuses. FilterContextAccount FilterContext = 1 << 5 )
func (FilterContext) String ¶ added in v0.20.0
func (ctx FilterContext) String() string
String returns human-readable form of FilterContext.
type FilterContexts ¶ added in v0.20.0
type FilterContexts bitFieldType
FilterContexts stores multiple contexts in which a Filter applies as bits in an int.
func (FilterContexts) Account ¶ added in v0.20.0
func (ctxs FilterContexts) Account() bool
Account returns whether FilterContextAccount is set.
func (FilterContexts) Applies ¶ added in v0.20.0
func (ctxs FilterContexts) Applies(ctx FilterContext) bool
Applies returns whether receiving FilterContexts applies in FilterContexts.
func (FilterContexts) Home ¶ added in v0.20.0
func (ctxs FilterContexts) Home() bool
Home returns whether FilterContextHome is set.
func (FilterContexts) Notifications ¶ added in v0.20.0
func (ctxs FilterContexts) Notifications() bool
Notifications returns whether FilterContextNotifications is set.
func (FilterContexts) Public ¶ added in v0.20.0
func (ctxs FilterContexts) Public() bool
Public returns whether FilterContextPublic is set.
func (*FilterContexts) SetAccount ¶ added in v0.20.0
func (ctxs *FilterContexts) SetAccount()
SetAccount will set / unset the FilterContextAccount bit.
func (*FilterContexts) SetHome ¶ added in v0.20.0
func (ctxs *FilterContexts) SetHome()
SetHome will set the FilterContextHome bit.
func (*FilterContexts) SetNotifications ¶ added in v0.20.0
func (ctxs *FilterContexts) SetNotifications()
SetNotifications will set the FilterContextNotifications bit.
func (*FilterContexts) SetPublic ¶ added in v0.20.0
func (ctxs *FilterContexts) SetPublic()
SetPublic will set the FilterContextPublic bit.
func (*FilterContexts) SetThread ¶ added in v0.20.0
func (ctxs *FilterContexts) SetThread()
SetThread will set the FilterContextThread bit.
func (FilterContexts) String ¶ added in v0.20.0
func (ctxs FilterContexts) String() string
String returns a single human-readable form of FilterContexts.
func (FilterContexts) Thread ¶ added in v0.20.0
func (ctxs FilterContexts) Thread() bool
Thread returns whether FilterContextThread is set.
func (*FilterContexts) UnsetAccount ¶ added in v0.20.0
func (ctxs *FilterContexts) UnsetAccount()
UnsetAccount will unset the FilterContextAccount bit.
func (*FilterContexts) UnsetHome ¶ added in v0.20.0
func (ctxs *FilterContexts) UnsetHome()
UnsetHome will unset the FilterContextHome bit.
func (*FilterContexts) UnsetNotifications ¶ added in v0.20.0
func (ctxs *FilterContexts) UnsetNotifications()
UnsetNotifications will unset the FilterContextNotifications bit.
func (*FilterContexts) UnsetPublic ¶ added in v0.20.0
func (ctxs *FilterContexts) UnsetPublic()
UnsetPublic will unset the FilterContextPublic bit.
func (*FilterContexts) UnsetThread ¶ added in v0.20.0
func (ctxs *FilterContexts) UnsetThread()
UnsetThread will unset the FilterContextThread bit.
type FilterKeyword ¶
type FilterKeyword struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
FilterID string `bun:"type:CHAR(26),notnull,nullzero,unique:filter_keywords_filter_id_keyword_uniq"` // ID of the filter that this keyword belongs to.
Keyword string `bun:",nullzero,notnull,unique:filter_keywords_filter_id_keyword_uniq"` // The keyword or phrase to filter against.
WholeWord *bool `bun:",nullzero,notnull,default:false"` // Should the filter consider word boundaries?
Regexp *regexp.Regexp `bun:"-"` // pre-prepared regular expression
}
FilterKeyword stores a single keyword to filter statuses against.
func (*FilterKeyword) Compile ¶
func (k *FilterKeyword) Compile() (err error)
Compile will compile this FilterKeyword as a prepared regular expression.
type FilterStatus ¶
type FilterStatus struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
FilterID string `bun:"type:CHAR(26),notnull,nullzero,unique:filter_statuses_filter_id_status_id_uniq"` // ID of the filter that this keyword belongs to.
StatusID string `bun:"type:CHAR(26),notnull,nullzero,unique:filter_statuses_filter_id_status_id_uniq"` // ID of the status to filter.
}
FilterStatus stores a single status to filter.
type Focus ¶
Focus describes the 'center' of the image for display purposes. X and Y should each be between -1 and 1
type Follow ¶
type Follow struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
URI string `bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow.
AccountID string `bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who does this follow originate from?
Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID
TargetAccountID string `bun:"type:CHAR(26),unique:srctarget,notnull,nullzero"` // Who is the target of this follow ?
TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID
ShowReblogs *bool `bun:",nullzero,notnull,default:true"` // Does this follow also want to see reblogs and not just posts?
Notify *bool `bun:",nullzero,notnull,default:false"` // does the following account want to be notified when the followed account posts?
}
Follow represents one account following another, and the metadata around that follow.
type FollowRequest ¶
type FollowRequest struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
URI string `bun:",notnull,nullzero,unique"` // ActivityPub uri of this follow (request).
AccountID string `bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who does this follow request originate from?
Account *Account `bun:"rel:belongs-to"` // Account corresponding to accountID
TargetAccountID string `bun:"type:CHAR(26),unique:frsrctarget,notnull,nullzero"` // Who is the target of this follow request?
TargetAccount *Account `bun:"rel:belongs-to"` // Account corresponding to targetAccountID
ShowReblogs *bool `bun:",nullzero,notnull,default:true"` // Does this follow also want to see reblogs and not just posts?
Notify *bool `bun:",nullzero,notnull,default:false"` // does the following account want to be notified when the followed account posts?
}
FollowRequest represents one account requesting to follow another, and the metadata around that request.
type FollowedTag ¶
type FollowedTag struct {
// ID of the account that follows the tag.
AccountID string `bun:"type:CHAR(26),pk,nullzero"`
// ID of the tag.
TagID string `bun:"type:CHAR(26),pk,nullzero"`
}
FollowedTag represents a user following a tag.
type HeaderFilter ¶
type HeaderFilter struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database
Header string `bun:",nullzero,notnull"` // Canonical request header this filter pertains to.
Regex string `bun:",nullzero,notnull"` // Request header value matching regular expression.
AuthorID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this filter
Author *Account `bun:"-"` // Account corresponding to AuthorID
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
}
HeaderFilter represents an HTTP request filter in the database, with a header to match against, value matching regex, and details about its creation.
type HeaderFilterAllow ¶
type HeaderFilterAllow struct{ HeaderFilter }
HeaderFilterAllow represents an allow HTTP header filter in the database.
type HeaderFilterBlock ¶
type HeaderFilterBlock struct{ HeaderFilter }
HeaderFilterBlock represents a block HTTP header filter in the database.
type Instance ¶
type Instance struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Domain string `bun:",nullzero,notnull,unique"` // Instance domain eg example.org
Title string `bun:""` // Title of this instance as it would like to be displayed.
URI string `bun:",nullzero,notnull,unique"` // base URI of this instance eg https://example.org
SuspendedAt time.Time `bun:"type:timestamptz,nullzero"` // When was this instance suspended, if at all?
DomainBlockID string `bun:"type:CHAR(26),nullzero"` // ID of any existing domain block for this instance in the database
DomainBlock *DomainBlock `bun:"rel:belongs-to"` // Domain block corresponding to domainBlockID
ShortDescription string `bun:""` // Short description of this instance
ShortDescriptionText string `bun:""` // Raw text version of short description (before parsing).
Description string `bun:""` // Longer description of this instance.
DescriptionText string `bun:""` // Raw text version of long description (before parsing).
CustomCSS string `bun:",nullzero"` // Custom CSS for the instance.
Terms string `bun:""` // Terms and conditions of this instance.
TermsText string `bun:""` // Raw text version of terms (before parsing).
ContactEmail string `bun:""` // Contact email address for this instance
ContactAccountUsername string `bun:",nullzero"` // Username of the contact account for this instance
ContactAccountID string `bun:"type:CHAR(26),nullzero"` // Contact account ID in the database for this instance
ContactAccount *Account `bun:"rel:belongs-to"` // account corresponding to contactAccountID
Reputation int64 `bun:",notnull,default:0"` // Reputation score of this instance
Version string `bun:",nullzero"` // Version of the software used on this instance
Rules []Rule `bun:"-"` // List of instance rules
}
Instance represents a federated instance, either local or remote.
type Interaction ¶ added in v0.20.0
type Interaction interface {
GetAccount() *Account
}
Interaction abstractly represents one interaction with a status, via liking, replying to, or boosting it.
type InteractionPolicy ¶
type InteractionPolicy struct {
// Conditions in which a Like
// interaction will be accepted
// for an item with this policy.
CanLike *PolicyRules
// Conditions in which a Reply
// interaction will be accepted
// for an item with this policy.
CanReply *PolicyRules
// Conditions in which an Announce
// interaction will be accepted
// for an item with this policy.
CanAnnounce *PolicyRules
}
An InteractionPolicy determines which interactions will be accepted for an item, and according to what rules.
func DefaultInteractionPolicyDirect ¶
func DefaultInteractionPolicyDirect() *InteractionPolicy
Returns a default interaction policy for a post with visibility of direct.
func DefaultInteractionPolicyFollowersOnly ¶
func DefaultInteractionPolicyFollowersOnly() *InteractionPolicy
Returns a default interaction policy for a post with visibility of followers only.
func DefaultInteractionPolicyFor ¶
func DefaultInteractionPolicyFor(v Visibility) *InteractionPolicy
Returns the default interaction policy for the given visibility level.
func DefaultInteractionPolicyPublic ¶
func DefaultInteractionPolicyPublic() *InteractionPolicy
Returns a default interaction policy for a post with visibility of public.
func DefaultInteractionPolicyUnlocked ¶
func DefaultInteractionPolicyUnlocked() *InteractionPolicy
Returns a default interaction policy for a post with visibility of unlocked.
func (*InteractionPolicy) DifferentFrom ¶ added in v0.20.0
func (ip1 *InteractionPolicy) DifferentFrom(ip2 *InteractionPolicy) bool
DifferentFrom returns true if p1 and p2 are different.
type InteractionRequest ¶
type InteractionRequest struct {
// ID of this item in the database.
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
// ID of the status targeted by the interaction.
TargetStatusID string `bun:"type:CHAR(26),nullzero,notnull"`
// Local status corresponding to TargetStatusID.
// Column not stored in DB.
TargetStatus *Status `bun:"-"`
// ID of the account being interacted with.
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"`
// Account corresponding to TargetAccountID.
// Column not stored in DB.
TargetAccount *Account `bun:"-"`
// ID of the account doing the interaction request.
InteractingAccountID string `bun:"type:CHAR(26),nullzero,notnull"`
// Account corresponding to InteractingAccountID.
// Column not stored in DB.
InteractingAccount *Account `bun:"-"`
// URI of the Request, if this InteractionRequest originated from
// a polite Request type (LikeRequest, ReplyRequest, AnnounceRequest, etc.).
//
// If the interaction request originated from an interaction
// (Like, Create (status), Announce, etc.) transmitted impolitely,
// this will be set to a mocked URI.
InteractionRequestURI string `bun:",nullzero,notnull,unique"`
// URI of the interaction itself.
InteractionURI string `bun:",nullzero,notnull,unique"`
// Type of interaction being requested.
InteractionType InteractionType `bun:",notnull"`
// True if this interaction request
// originated from a polite Request type.
Polite *bool `bun:",nullzero,notnull,default:false"`
// Set if InteractionType = InteractionLike.
// Column not stored in DB.
Like *StatusFave `bun:"-"`
// Set if InteractionType = InteractionReply.
// Column not stored in DB.
Reply *Status `bun:"-"`
// Set if InteractionType = InteractionAnnounce.
// Column not stored in DB.
Announce *Status `bun:"-"`
// If interaction request was accepted, time at which this occurred.
AcceptedAt time.Time `bun:"type:timestamptz,nullzero"`
// If interaction request was rejected, time at which this occurred.
RejectedAt time.Time `bun:"type:timestamptz,nullzero"`
// URI of the Accept (if accepted) or Reject (if rejected).
// Field may be empty if currently neither accepted not rejected, or if
// acceptance/rejection was implicit (ie., not resulting from an Activity).
ResponseURI string `bun:",nullzero,unique"`
// URI of the Authorization object (if accepted).
//
// Field will only be set if the interaction has been accepted.
AuthorizationURI string `bun:",nullzero,unique"`
}
InteractionRequest represents one interaction request that is either accepted, rejected, or awaiting acceptance or rejection by the target account.
func (*InteractionRequest) IsAccepted ¶
func (ir *InteractionRequest) IsAccepted() bool
IsAccepted returns true if this interaction request has been accepted.
func (*InteractionRequest) IsPending ¶
func (ir *InteractionRequest) IsPending() bool
IsHandled returns true if interaction request has been neither accepted or rejected.
func (*InteractionRequest) IsPolite ¶ added in v0.20.0
func (ir *InteractionRequest) IsPolite() bool
IsPolite returns true if this interaction request was done "politely" with a *Request type, or false if it was done "impolitely" with direct send of a like, reply, or announce.
The following information is not strictly needed but provides useful context for why interaction requests are determined to be either "polite" or "impolite".
A "polite" interaction request flow indicates that it was performed with the latest currently accepted manner of doing things. This manner is different to that initially introduced by us (GoToSocial) pre-v0.20.0, as it is the result of our previous design going through many iterations with Mastodon developers as part of designing their similar quote post flow.
An "impolite" interaction request flow is that produced either by an older interaction-policy-AWARE GoToSocial instance, or by any interaction-policy-UNAWARE server instance.
Regarding per-version GoToSocial behaviour (summarized by tobi):
from v0.19.0 and before, we know about and can respond only to impolite interactions, and we send out impolite as well
from v0.20.0 onwards, we know about and can respond to both polite / impolite interaction requests, but we still send out impolite
from v0.21.0 onwards, we know about and can respond to both polite and impolite interaction requests, and we send out polite
func (*InteractionRequest) IsRejected ¶
func (ir *InteractionRequest) IsRejected() bool
IsRejected returns true if this interaction request has been rejected.
type InteractionType ¶
type InteractionType enumType
Like / Reply / Announce
const ( InteractionLike InteractionType = 0 InteractionReply InteractionType = 1 InteractionAnnounce InteractionType = 2 )
func (InteractionType) String ¶
func (i InteractionType) String() string
Stringifies this InteractionType in a manner suitable for serving via the API.
type List ¶
type List struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Title string `bun:",nullzero,notnull,unique:listaccounttitle"` // Title of this list.
AccountID string `bun:"type:CHAR(26),notnull,nullzero,unique:listaccounttitle"` // Account that created/owns the list
Account *Account `bun:"-"` // Account corresponding to accountID
RepliesPolicy RepliesPolicy `bun:",nullzero,notnull,default:'followed'"` // RepliesPolicy for this list.
Exclusive *bool `bun:",nullzero,notnull,default:false"` // Hide posts from members of this list from your home timeline.
}
List refers to a list of follows for which the owning account wants to view a timeline of posts.
type ListEntry ¶
type ListEntry struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
ListID string `bun:"type:CHAR(26),notnull,nullzero,unique:listentrylistfollow"` // ID of the list that this entry belongs to.
FollowID string `bun:"type:CHAR(26),notnull,nullzero,unique:listentrylistfollow"` // Follow that the account owning this entry wants to see posts of in the timeline.
Follow *Follow `bun:"-"` // Follow corresponding to followID.
}
ListEntry refers to a single follow entry in a list.
type Marker ¶
type Marker struct {
AccountID string `bun:"type:CHAR(26),pk,unique:markers_account_id_timeline_uniq,notnull,nullzero"` // ID of the local account that owns the marker
Name MarkerName `bun:",nullzero,notnull,pk,unique:markers_account_id_timeline_uniq"` // Name of the marked timeline
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When marker was last updated
Version int `bun:",nullzero,notnull,default:0"` // For optimistic concurrency control
LastReadID string `bun:"type:CHAR(26),notnull,nullzero"` // Last ID read on this timeline (status ID for home, notification ID for notifications)
}
Marker stores a local account's read position on a given timeline.
type MarkerName ¶
type MarkerName string
MarkerName is the name of one of the timelines we can store markers for.
const ( MarkerNameHome MarkerName = "home" MarkerNameNotifications MarkerName = "notifications" )
type MediaAttachment ¶
type MediaAttachment struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
StatusID string `bun:"type:CHAR(26),nullzero"` // ID of the status to which this is attached
URL string `bun:",nullzero"` // Where can the attachment be retrieved on *this* server
RemoteURL string `bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media)
Type FileType `bun:",notnull,default:0"` // Type of file (image/gifv/audio/video/unknown)
FileMeta FileMeta `bun:",embed:,notnull"` // Metadata about the file
AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong
Description string `bun:""` // Description of the attachment (for screenreaders)
ScheduledStatusID string `bun:"type:CHAR(26),nullzero"` // To which scheduled status does this attachment belong
Blurhash string `bun:",nullzero"` // What is the generated blurhash of this attachment
Processing ProcessingStatus `bun:",notnull,default:2"` // What is the processing status of this attachment
File File `bun:",embed:file_,notnull,nullzero"` // metadata for the whole file
Thumbnail Thumbnail `bun:",embed:thumbnail_,notnull,nullzero"` // small image thumbnail derived from a larger image, video, or audio file.
Avatar *bool `bun:",nullzero,notnull,default:false"` // Is this attachment being used as an avatar?
Header *bool `bun:",nullzero,notnull,default:false"` // Is this attachment being used as a header?
Cached *bool `bun:",nullzero,notnull,default:false"` // Is this attachment currently cached by our instance?
}
MediaAttachment represents a user-uploaded media attachment: an image/video/audio/gif that is somewhere in storage and that can be retrieved and served by the router.
func (*MediaAttachment) IsLocal ¶
func (m *MediaAttachment) IsLocal() bool
IsLocal returns whether media attachment is local.
func (*MediaAttachment) IsRemote ¶
func (m *MediaAttachment) IsRemote() bool
IsRemote returns whether media attachment is remote.
type Mention ¶
type Mention struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the status this mention originates from
Status *Status `bun:"rel:belongs-to"` // status referred to by statusID
OriginAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the mention creator account
OriginAccountURI string `bun:",nullzero,notnull"` // ActivityPub URI of the originator/creator of the mention
OriginAccount *Account `bun:"rel:belongs-to"` // account referred to by originAccountID
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Mention target/receiver account ID
TargetAccount *Account `bun:"rel:belongs-to"` // account referred to by targetAccountID
Silent *bool `bun:",nullzero,notnull,default:false"` // Prevent this mention from generating a notification?
// NameString is for putting in the namestring of the mentioned user
// before the mention is dereferenced. Should be in a form along the lines of:
// @whatever_username@example.org
//
// This will not be put in the database, it's just for convenience.
NameString string `bun:"-"`
// IsNew indicates whether this mention is "new" in the sense
// that it has not previously been inserted into the database.
//
// This will not be put in the database, it's just for convenience.
IsNew bool `bun:"-"`
// TargetAccountURI is the AP ID (uri) of the user mentioned.
//
// This will not be put in the database, it's just for convenience.
TargetAccountURI string `bun:"-"`
// TargetAccountURL is the web url of the user mentioned.
//
// This will not be put in the database, it's just for convenience.
TargetAccountURL string `bun:"-"`
}
Mention refers to the 'tagging' or 'mention' of a user within a status.
type Move ¶
type Move struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was item created.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // When was item last updated.
AttemptedAt time.Time `bun:"type:timestamptz,nullzero"` // When was processing of the Move to TargetURI last attempted by our instance (zero if not yet attempted).
SucceededAt time.Time `bun:"type:timestamptz,nullzero"` // When did the processing of the Move to TargetURI succeed according to our criteria (zero if not yet complete).
OriginURI string `bun:",nullzero,notnull,unique:moveorigintarget"` // OriginURI of the Move. Ie., the Move Object.
Origin *url.URL `bun:"-"` // URL corresponding to OriginURI. Not stored in the database.
TargetURI string `bun:",nullzero,notnull,unique:moveorigintarget"` // TargetURI of the Move. Ie., the Move Target.
Target *url.URL `bun:"-"` // URL corresponding to TargetURI. Not stored in the database.
URI string `bun:",nullzero,notnull,unique"` // ActivityPub ID/URI of the Move Activity itself.
}
Move represents an ActivityPub "Move" activity received (or created) by this instance.
type NewSignup ¶
type NewSignup struct {
Username string // Username of the new account (required).
Email string // Email address of the user (required).
Password string // Plaintext (not yet hashed) password for the user (required).
Reason string // Reason given by the user when submitting a sign up request (optional).
PreApproved bool // Mark the new user/account as preapproved (optional)
SignUpIP net.IP // IP address from which the sign up request occurred (optional).
Locale string // Locale code for the new account/user (optional).
AppID string // ID of the application used to create this account (optional).
EmailVerified bool // Mark submitted email address as already verified (optional).
ExternalID string // ID of this user in external OIDC system (optional).
Admin bool // Mark new user as an admin user (optional).
}
NewSignup models parameters for the creation of a new user + account on this instance.
Aside from username, email, and password, it is fine to use zero values on fields of this struct.
This struct is not stored in the database, it's just for passing around parameters.
type Notification ¶
type Notification struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
NotificationType NotificationType `bun:",nullzero,notnull"` // Type of this notification
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the account targeted by the notification (ie., who will receive the notification?)
TargetAccount *Account `bun:"-"` // Account corresponding to TargetAccountID. Can be nil, always check first + select using ID if necessary.
OriginAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the account that performed the action that created the notification.
OriginAccount *Account `bun:"-"` // Account corresponding to OriginAccountID. Can be nil, always check first + select using ID if necessary.
StatusOrEditID string `bun:"status_id,type:CHAR(26),nullzero"` // If the notification pertains to a status or a status edit event, what is the database ID of the status or status edit?
Status *Status `bun:"-"` // Status corresponding to StatusOrEditID. Can be nil, always check first + select using ID if necessary.
Read *bool `bun:",nullzero,notnull,default:false"` // Notification has been seen/read
}
Notification models an alert/notification sent to an account about something like a reblog, like, new follow request, etc.
type NotificationType ¶
type NotificationType enumType
NotificationType describes the reason/type of this notification.
const ( // Notification Types NotificationUnknown NotificationType = 0 // NotificationUnknown -- unknown notification type, error if this occurs NotificationFollow NotificationType = 1 // NotificationFollow -- someone followed you NotificationFollowRequest NotificationType = 2 // NotificationFollowRequest -- someone requested to follow you NotificationMention NotificationType = 3 // NotificationMention -- someone mentioned you in their status NotificationReblog NotificationType = 4 // NotificationReblog -- someone boosted one of your statuses NotificationFavourite NotificationType = 5 // NotificationFavourite -- someone faved/liked one of your statuses NotificationPoll NotificationType = 6 // NotificationPoll -- a poll you voted in or created has ended NotificationStatus NotificationType = 7 // NotificationStatus -- someone you enabled notifications for has posted a status. NotificationAdminSignup NotificationType = 8 // NotificationAdminSignup -- someone has submitted a new account sign-up to the instance. NotificationPendingFave NotificationType = 9 // NotificationPendingFave -- Someone has faved a status of yours, which requires approval by you. NotificationPendingReply NotificationType = 10 // NotificationPendingReply -- Someone has replied to a status of yours, which requires approval by you. NotificationPendingReblog NotificationType = 11 // NotificationPendingReblog -- Someone has boosted a status of yours, which requires approval by you. NotificationAdminReport NotificationType = 12 // NotificationAdminReport -- someone has submitted a new report to the instance. NotificationUpdate NotificationType = 13 // NotificationUpdate -- someone has edited their status. NotificationTypeNumValues NotificationType = 14 // NotificationTypeNumValues -- 1 + number of max notification type )
func ParseNotificationType ¶
func ParseNotificationType(in string) NotificationType
ParseNotificationType returns a notification type from the given value.
func (NotificationType) String ¶
func (t NotificationType) String() string
String returns a stringified, frontend API compatible form of NotificationType.
type Original ¶
type Original struct {
Width int // width in pixels
Height int // height in pixels
Size int // size in pixels (width * height)
Aspect float32 // aspect ratio (width / height)
Duration *float32 // video-specific: duration of the video in seconds
Framerate *float32 // video-specific: fps
Bitrate *uint64 // video-specific: bitrate
}
Original can be used for original metadata for any media type
type ParseMentionFunc ¶
type ParseMentionFunc func(ctx context.Context, namestring string, originAccountID string, statusID string) (*Mention, error)
ParseMentionFunc describes a function that takes a lowercase account namestring in the form "@test@whatever.example.org" for a remote account, or "@test" for a local account, and returns a fully populated mention for that account, with the given origin status ID and origin account ID.
If the account is remote and not yet found in the database, then ParseMentionFunc will try to webfinger the remote account and put it in the database before returning.
Mentions generated by this function are not put in the database, that's still up to the caller to do.
type PolicyCheckResult ¶
type PolicyCheckResult struct {
// Permission permitted /
// with approval / forbidden.
Permission PolicyPermission
// Value that this check matched on.
// Only set if Permission = automatic.
PermissionMatchedOn *PolicyValue
}
PolicyCheckResult encapsulates the results of checking a certain Actor URI + type of interaction against an interaction policy.
func (*PolicyCheckResult) AutomaticApproval ¶ added in v0.20.0
func (pcr *PolicyCheckResult) AutomaticApproval() bool
AutomaticApproval returns true if this policy check resulted in Permission = automatic approval.
func (*PolicyCheckResult) Forbidden ¶
func (pcr *PolicyCheckResult) Forbidden() bool
Permitted returns true if this policy check resulted in Permission = forbidden.
func (*PolicyCheckResult) ManualApproval ¶ added in v0.20.0
func (pcr *PolicyCheckResult) ManualApproval() bool
Permitted returns true if this policy check resulted in Permission = manual approval.
func (*PolicyCheckResult) MatchedOnCollection ¶
func (pcr *PolicyCheckResult) MatchedOnCollection() bool
MatchedOnCollection returns true if this policy check result turned up AutomaticApproval, and matched based on the requester's presence in a followers or following collection.
type PolicyPermission ¶
type PolicyPermission int
PolicyPermission represents the permission state for a certain Actor URI and interaction type, in relation to a policy.
const ( // Interaction is forbidden for this // PolicyValue + interaction combination. PolicyPermissionForbidden PolicyPermission = iota // Interaction is conditionally permitted // for this PolicyValue + interaction combo, // pending approval by the item owner. PolicyPermissionManualApproval // Interaction is permitted for this // PolicyValue + interaction combination. PolicyPermissionAutomaticApproval )
func (PolicyPermission) String ¶ added in v0.19.2
func (p PolicyPermission) String() string
type PolicyRules ¶
type PolicyRules struct {
// AutomaticApproval is for PolicyValue entries
// that are pre-approved to do an interaction
// and will receive automatic approval.
//
// Note: This is stored in the db as JSON.
// JSON tags set for back compat with previous
// (now deprecated) name for this PolicyValues.
AutomaticApproval PolicyValues `json:"Always,omitempty"`
// ManualApproval is for PolicyValues entries
// that are conditionally permitted to do
// an interaction, pending manual approval.
//
// Note: This is stored in the db as JSON.
// JSON tags set for back compat with previous
// (now deprecated) name for this PolicyValues.
ManualApproval PolicyValues `json:"WithApproval,omitempty"`
}
PolicyRules represents the rules according to which a certain interaction is permitted to various Actor and Actor Collection URIs.
func DefaultCanAnnounceFor ¶ added in v0.19.2
func DefaultCanAnnounceFor(v Visibility) *PolicyRules
DefaultCanAnnounceFor returns the default policy rules for the canAnnounce sub-policy.
func DefaultCanLikeFor ¶ added in v0.19.2
func DefaultCanLikeFor(v Visibility) *PolicyRules
DefaultCanLikeFor returns the default policy rules for the canLike sub-policy.
func DefaultCanReplyFor ¶ added in v0.19.2
func DefaultCanReplyFor(v Visibility) *PolicyRules
DefaultCanReplyFor returns the default policy rules for the canReply sub-policy.
func (*PolicyRules) DifferentFrom ¶ added in v0.20.0
func (pr1 *PolicyRules) DifferentFrom(pr2 *PolicyRules) bool
DifferentFrom returns true if pr1 and pr2 are not equal in terms of nilness or content.
type PolicyValue ¶
type PolicyValue string
A policy URI is GoToSocial's internal representation of one ActivityPub URI for an Actor or a Collection of Actors, specific to the domain of enforcing interaction policies.
A PolicyValue can be stored in the database either as one of the Value constants defined below (to save space), OR as a full-fledged ActivityPub URI.
A PolicyValue should be translated to the canonical string value of the represented URI when federating an item, or from the canonical string value of the URI when receiving or retrieving an item.
For example, if the PolicyValue `followers` was being federated outwards in an interaction policy attached to an item created by the actor `https://example.org/users/someone`, then it should be translated to their followers URI when sent, eg., `https://example.org/users/someone/followers`.
Likewise, if GoToSocial receives an item with an interaction policy containing `https://example.org/users/someone/followers`, and the item was created by `https://example.org/users/someone`, then the followers URI would be converted to `followers` for internal storage.
const ( // Stand-in for ActivityPub magic public URI, // which encompasses every possible Actor URI. PolicyValuePublic PolicyValue = "public" // Stand-in for the Followers Collection of // the item owner's Actor. PolicyValueFollowers PolicyValue = "followers" // Stand-in for the Following Collection of // the item owner's Actor. PolicyValueFollowing PolicyValue = "following" // Stand-in for the Mutuals Collection of // the item owner's Actor. // // (TODO: Reserved, currently unused). PolicyValueMutuals PolicyValue = "mutuals" // Stand-in for Actor URIs tagged in the item. PolicyValueMentioned PolicyValue = "mentioned" // Stand-in for the Actor URI of the item owner. PolicyValueAuthor PolicyValue = "author" )
func (PolicyValue) FeasibleForVisibility ¶
func (p PolicyValue) FeasibleForVisibility(v Visibility) bool
FeasibleForVisibility returns true if the PolicyValue could feasibly be set in a policy for an item with the given visibility, otherwise returns false.
For example, PolicyValuePublic could not be set in a policy for an item with visibility FollowersOnly, but could be set in a policy for an item with visibility Public or Unlocked.
This is not prescriptive, and should be used only to guide policy choices. Eg., if a remote instance wants to do something wacky like set "anyone can interact with this status" for a Direct visibility status, that's their business; our normal visibility filtering will prevent users on our instance from actually being able to interact unless they can see the status anyway.
type PolicyValues ¶
type PolicyValues []PolicyValue
type Poll ¶
type Poll struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // Unique identity string.
Multiple *bool `bun:",nullzero,notnull,default:false"` // Is this a multiple choice poll? i.e. can you vote on multiple options.
HideCounts *bool `bun:",nullzero,notnull,default:false"` // Hides vote counts until poll ends.
Options []string `bun:",nullzero,notnull"` // The available options for this poll.
Votes []int `bun:",nullzero,notnull"` // Vote counts per choice.
Voters *int `bun:",nullzero,notnull"` // Total no. voters count.
StatusID string `bun:"type:CHAR(26),nullzero,notnull,unique"` // Status ID of which this Poll is attached to.
Status *Status `bun:"-"` // The related Status for StatusID (not always set).
ExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // The expiry date of this Poll, will be zerotime until set. (local polls ALWAYS have this set).
ClosedAt time.Time `bun:"type:timestamptz,nullzero"` // The closure date of this poll, anything other than zerotime indicates closed.
Closing bool `bun:"-"` // An ephemeral field only set on Polls in the middle of closing.
}
Poll represents an attached (to) Status poll, i.e. a questionaire. Can be remote / local.
func (*Poll) CheckVotes ¶
func (p *Poll) CheckVotes()
CheckVotes ensures that the Poll.Votes slice is not nil, else initializing an int slice len+cap equal to Poll.Options. Note this should not be needed anywhere other than the database and the processor.
func (*Poll) DecrementVotes ¶
DecrementVotes decrements Poll vote counts for given choices, and voters if 'withVoter' is set.
func (*Poll) IncrementVotes ¶
IncrementVotes increments Poll vote counts for given choices, and voters if 'isNew' is set.
type PollVote ¶
type PollVote struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // Unique identity string.
Choices []int `bun:",nullzero,notnull"` // The Poll's option indices of which these are votes for.
AccountID string `bun:"type:CHAR(26),nullzero,notnull,unique:in_poll_by_account"` // Account ID from which this vote originated.
Account *Account `bun:"-"` // The related Account for AccountID (not always set).
PollID string `bun:"type:CHAR(26),nullzero,notnull,unique:in_poll_by_account"` // Poll ID of which this is a vote in.
Poll *Poll `bun:"-"` // The related Poll for PollID (not always set).
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // The creation date of this PollVote.
}
PollVote represents a single instance of vote(s) in a Poll by an account. If the Poll is single-choice, len(.Choices) = 1, if multiple-choice then len(.Choices) >= 1. Can be remote or local.
type ProcessingStatus ¶
type ProcessingStatus int
ProcessingStatus refers to how far along in the processing stage the attachment is.
const ( ProcessingStatusReceived ProcessingStatus = 0 // ProcessingStatusReceived indicates the attachment has been received and is awaiting processing. No thumbnail available yet. ProcessingStatusProcessing ProcessingStatus = 1 // ProcessingStatusProcessing indicates the attachment is currently being processed. Thumbnail is available but full media is not. ProcessingStatusProcessed ProcessingStatus = 2 // ProcessingStatusProcessed indicates the attachment has been fully processed and is ready to be served. ProcessingStatusError ProcessingStatus = 666 // ProcessingStatusError indicates something went wrong processing the attachment and it won't be tried again--these can be deleted. )
MediaAttachment processing states.
type Relationship ¶
type Relationship struct {
ID string // The account id.
Following bool // Are you following this user?
ShowingReblogs bool // Are you receiving this user's boosts in your home timeline?
Notifying bool // Have you enabled notifications for this user?
FollowedBy bool // Are you followed by this user?
Blocking bool // Are you blocking this user?
BlockedBy bool // Is this user blocking you?
Muting bool // Are you muting this user?
MutingNotifications bool // Are you muting notifications from this user?
Requested bool // Do you have a pending follow request targeting this user?
RequestedBy bool // Does the user have a pending follow request targeting you?
DomainBlocking bool // Are you blocking this user's domain?
Endorsed bool // Are you featuring this user on your profile?
Note string // Your note on this account.
}
Relationship describes a requester's relationship with another account.
type RepliesPolicy ¶
type RepliesPolicy string
RepliesPolicy denotes which replies should be shown in the list.
const ( RepliesPolicyFollowed RepliesPolicy = "followed" // Show replies to any followed user. RepliesPolicyList RepliesPolicy = "list" // Show replies to members of the list only. RepliesPolicyNone RepliesPolicy = "none" // Don't show replies. )
type Report ¶
type Report struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
URI string `bun:",unique,nullzero,notnull"` // activitypub URI of this report
AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account created this report
Account *Account `bun:"-"` // account corresponding to AccountID
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account is targeted by this report
TargetAccount *Account `bun:"-"` // account corresponding to TargetAccountID
Comment string `bun:",nullzero"` // comment / explanation for this report, by the reporter
StatusIDs []string `bun:"statuses,array"` // database IDs of any statuses referenced by this report
Statuses []*Status `bun:"-"` // statuses corresponding to StatusIDs
RuleIDs []string `bun:"rules,array"` // database IDs of any rules referenced by this report
Rules []*Rule `bun:"-"` // rules corresponding to RuleIDs
Forwarded *bool `bun:",nullzero,notnull,default:false"` // flag to indicate report should be forwarded to remote instance
ActionTaken string `bun:",nullzero"` // string description of what action was taken in response to this report
ActionTakenAt time.Time `bun:"type:timestamptz,nullzero"` // time at which action was taken, if any
ActionTakenByAccountID string `bun:"type:CHAR(26),nullzero"` // database ID of account which took action, if any
ActionTakenByAccount *Account `bun:"-"` // account corresponding to ActionTakenByID, if any
}
Report models a user-created reported about an account, which should be reviewed and acted upon by instance admins.
This can be either a report created locally (on this instance) about a user on this or another instance, OR a report that was created remotely (on another instance) about a user on this instance, and received via the federated (s2s) API.
type RouterSession ¶
type RouterSession struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Auth []byte `bun:"type:bytea,notnull,nullzero"`
Crypt []byte `bun:"type:bytea,notnull,nullzero"`
}
RouterSession is used to store and retrieve settings for a router session.
type Rule ¶
type Rule struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Text string `bun:",nullzero"` // text content of the rule
Order *uint `bun:",nullzero,notnull,unique"` // rule ordering, index from 0
Deleted *bool `bun:",nullzero,notnull,default:false"` // has this rule been deleted, still kept in database for reference in historic reports
}
Rule models an instance rule set by the admin
type ScheduledStatus ¶ added in v0.20.0
type ScheduledStatus struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account scheduled this status
Account *Account `bun:"-"` // Account corresponding to AccountID
ScheduledAt time.Time `bun:"type:timestamptz,nullzero,notnull"` // time at which the status is scheduled
Text string `bun:""` // Text content of the status
Poll ScheduledStatusPoll `bun:",embed:poll_,notnull,nullzero"` //
MediaIDs []string `bun:"attachments,array"` // Database IDs of any media attachments associated with this status
MediaAttachments []*MediaAttachment `bun:"-"` // Attachments corresponding to media IDs
Sensitive *bool `bun:",nullzero,notnull,default:false"` // mark the status as sensitive?
SpoilerText string `bun:""` // Original text of the content warning without formatting
Visibility Visibility `bun:",nullzero,notnull"` // visibility entry for this status
InReplyToID string `bun:"type:CHAR(26),nullzero"` // id of the status this status replies to
Language string `bun:",nullzero"` // what language is this status written in?
ApplicationID string `bun:"type:CHAR(26),nullzero"` // Which application was used to create this status?
Application *Application `bun:"-"` //
LocalOnly *bool `bun:",nullzero,notnull,default:false"` // Whether the status is not federated
ContentType string `bun:",nullzero"` // Content type used to process the original text of the status
InteractionPolicy *InteractionPolicy `bun:""` // InteractionPolicy for this status. If null then the default InteractionPolicy should be assumed for this status's Visibility. Always null for boost wrappers.
Idempotency string `bun:",nullzero"` // Currently unused
}
ScheduledStatus represents a status that is scheduled to be published at given time by a local user.
func (*ScheduledStatus) AttachmentsPopulated ¶ added in v0.20.0
func (s *ScheduledStatus) AttachmentsPopulated() bool
AttachmentsPopulated returns whether media attachments are populated according to current AttachmentIDs.
type ScheduledStatusPoll ¶ added in v0.20.0
type ScheduledStatusPoll struct {
Options []string `bun:",nullzero,array"` // The available options for this poll.
ExpiresIn int `bun:",nullzero"` // Duration the poll should be open, in seconds
Multiple *bool `bun:",nullzero,notnull,default:false"` // Is this a multiple choice poll? i.e. can you vote on multiple options.
HideTotals *bool `bun:",nullzero,notnull,default:false"` // Hides vote counts until poll ends.
}
type SinBinStatus ¶
type SinBinStatus struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Creation time of this item.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // Last-updated time of this item.
URI string `bun:",unique,nullzero,notnull"` // ActivityPub URI/ID of this status.
URL string `bun:",nullzero"` // Web url for viewing this status.
Domain string `bun:",nullzero"` // Domain of the status, will be null if this is a local status, otherwise something like `example.org`.
AccountURI string `bun:",nullzero,notnull"` // ActivityPub uri of the author of this status.
InReplyToURI string `bun:",nullzero"` // ActivityPub uri of the status this status is a reply to.
Content string `bun:",nullzero"` // Content of this status.
AttachmentLinks []string `bun:",nullzero,array"` // Links to attachments of this status.
MentionTargetURIs []string `bun:",nullzero,array"` // URIs of mentioned accounts.
EmojiLinks []string `bun:",nullzero,array"` // Links to any emoji images used in this status.
PollOptions []string `bun:",nullzero,array"` // String values of any poll options used in this status.
ContentWarning string `bun:",nullzero"` // CW / subject string for this status.
Visibility Visibility `bun:",nullzero,notnull"` // Visibility level of this status.
Sensitive *bool `bun:",nullzero,notnull,default:false"` // Mark the status as sensitive.
Language string `bun:",nullzero"` // Language code for this status.
ActivityStreamsType string `bun:",nullzero,notnull"` // ActivityStreams type of this status.
}
SinBinStatus represents a status that's been rejected and/or reported + quarantined.
Automatically rejected statuses are not put in the sin bin, only statuses that were stored on the instance and which someone (local or remote) has subsequently rejected.
type Small ¶
type Small struct {
Width int // width in pixels
Height int // height in pixels
Size int // size in pixels (width * height)
Aspect float32 // aspect ratio (width / height)
}
Small can be used for a thumbnail of any media type
type Status ¶
type Status struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
EditedAt time.Time `bun:"type:timestamptz,nullzero"` // when this status was last edited (if set)
FetchedAt time.Time `bun:"type:timestamptz,nullzero"` // when was item (remote) last fetched.
PinnedAt time.Time `bun:"type:timestamptz,nullzero"` // Status was pinned by owning account at this time.
URI string `bun:",unique,nullzero,notnull"` // activitypub URI of this status
URL string `bun:",nullzero"` // web url for viewing this status
Content string `bun:""` // Content HTML for this status.
AttachmentIDs []string `bun:"attachments,array"` // Database IDs of any media attachments associated with this status
Attachments []*MediaAttachment `bun:"attached_media,rel:has-many"` // Attachments corresponding to attachmentIDs
TagIDs []string `bun:"tags,array"` // Database IDs of any tags used in this status
Tags []*Tag `bun:"attached_tags,m2m:status_to_tags"` // Tags corresponding to tagIDs. https://bun.uptrace.dev/guide/relations.html#many-to-many-relation
MentionIDs []string `bun:"mentions,array"` // Database IDs of any mentions in this status
Mentions []*Mention `bun:"attached_mentions,rel:has-many"` // Mentions corresponding to mentionIDs
EmojiIDs []string `bun:"emojis,array"` // Database IDs of any emojis used in this status
Emojis []*Emoji `bun:"attached_emojis,m2m:status_to_emojis"` // Emojis corresponding to emojiIDs. https://bun.uptrace.dev/guide/relations.html#many-to-many-relation
Local *bool `bun:",nullzero,notnull,default:false"` // is this status from a local account?
AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // which account posted this status?
Account *Account `bun:"rel:belongs-to"` // account corresponding to accountID
AccountURI string `bun:",nullzero,notnull"` // activitypub uri of the owner of this status
InReplyToID string `bun:"type:CHAR(26),nullzero"` // id of the status this status replies to
InReplyToURI string `bun:",nullzero"` // activitypub uri of the status this status is a reply to
InReplyToAccountID string `bun:"type:CHAR(26),nullzero"` // id of the account that this status replies to
InReplyTo *Status `bun:"-"` // status corresponding to inReplyToID
InReplyToAccount *Account `bun:"rel:belongs-to"` // account corresponding to inReplyToAccountID
BoostOfID string `bun:"type:CHAR(26),nullzero"` // id of the status this status is a boost of
BoostOfURI string `bun:"-"` // URI of the status this status is a boost of; field not inserted in the db, just for dereferencing purposes.
BoostOfAccountID string `bun:"type:CHAR(26),nullzero"` // id of the account that owns the boosted status
BoostOf *Status `bun:"-"` // status that corresponds to boostOfID
BoostOfAccount *Account `bun:"rel:belongs-to"` // account that corresponds to boostOfAccountID
ThreadID string `bun:"type:CHAR(26),nullzero,notnull,default:'00000000000000000000000000'"` // id of the thread to which this status belongs
EditIDs []string `bun:"edits,array"` // IDs of status edits for this status, ordered from smallest (oldest) -> largest (newest) ID.
Edits []*StatusEdit `bun:"-"` // Edits of this status, ordered from oldest -> newest edit.
PollID string `bun:"type:CHAR(26),nullzero"` //
Poll *Poll `bun:"-"` //
ContentWarning string `bun:",nullzero"` // Content warning HTML for this status.
ContentWarningText string `bun:""` // Original text of the content warning without formatting
Visibility Visibility `bun:",nullzero,notnull"` // visibility entry for this status
Sensitive *bool `bun:",nullzero,notnull,default:false"` // mark the status as sensitive?
Language string `bun:",nullzero"` // what language is this status written in?
CreatedWithApplicationID string `bun:"type:CHAR(26),nullzero"` // Which application was used to create this status?
CreatedWithApplication *Application `bun:"rel:belongs-to"` // application corresponding to createdWithApplicationID
ActivityStreamsType string `bun:",nullzero,notnull"` // What is the activitystreams type of this status? See: https://www.w3.org/TR/activitystreams-vocabulary/#object-types. Will probably almost always be Note but who knows!.
Text string `bun:""` // Original text of the status without formatting
ContentType StatusContentType `bun:",nullzero"` // Content type used to process the original text of the status
Federated *bool `bun:",notnull"` // This status will be federated beyond the local timeline(s)
InteractionPolicy *InteractionPolicy `bun:""` // InteractionPolicy for this status. If null then the default InteractionPolicy should be assumed for this status's Visibility. Always null for boost wrappers.
PendingApproval *bool `bun:",nullzero,notnull,default:false"` // If true then status is a reply or boost wrapper that must be Approved by the reply-ee or boost-ee before being fully distributed.
PreApproved bool `bun:"-"` // If true, then status is a reply to or boost wrapper of a status on our instance, has permission to do the interaction, and an Accept should be sent out for it immediately. Field not stored in the DB.
ApprovedByURI string `bun:",nullzero"` // URI of *either* an Accept Activity, or a ReplyAuthorization or AnnounceAuthorization, which approves the Announce, Create or interaction request Activity that this status was/will be attached to.
}
Status represents a user-created 'post' or 'status' in the database, either remote or local
func (*Status) AllAttachmentIDs ¶
AllAttachmentIDs gathers ALL media attachment IDs from both the receiving Status{}, and any historical Status{}.Edits.
func (*Status) AttachmentsPopulated ¶
AttachmentsPopulated returns whether media attachments are populated according to current AttachmentIDs.
func (*Status) BelongsToAccount ¶
BelongsToAccount returns whether status belongs to the given account ID.
func (*Status) EditsPopulated ¶
EditsPopulated returns whether edits are populated according to current EditIDs.
func (*Status) EmojisPopulated ¶
EmojisPopulated returns whether emojis are populated according to current EmojiIDs.
func (*Status) EmojisUpToDate ¶
EmojisUpToDate returns whether status emoji attachments of receiving status are up-to-date according to emoji attachments of the passed status, by comparing their emoji URIs. We don't use IDs as this is used to determine whether there are new emojis to fetch.
func (*Status) GetAccount ¶ added in v0.20.0
GetAccount returns the account that owns this status. May be nil if status not populated. Fulfils Interaction interface.
func (*Status) GetAccountID ¶
GetAccountID implements timeline.Timelineable{}.
func (*Status) GetAttachmentByRemoteURL ¶
func (s *Status) GetAttachmentByRemoteURL(url string) (*MediaAttachment, bool)
GetAttachmentByRemoteURL searches status for MediaAttachment{} with remote URL.
func (*Status) GetBoostOfAccountID ¶
GetBoostOfAccountID implements timeline.Timelineable{}.
func (*Status) GetBoostOfID ¶
GetBoostOfID implements timeline.Timelineable{}.
func (*Status) GetMentionByTargetID ¶
GetMentionByTargetID searches status for Mention{} with target ID.
func (*Status) GetMentionByTargetURI ¶
GetMentionByTargetURI searches status for Mention{} with target URI.
func (*Status) GetMentionByUsernameDomain ¶
GetMentionByUsernameDomain fetches the Mention associated with given username and domains, typically extracted from a mention Namestring.
func (*Status) GetTagByName ¶
GetTagByName searches status for Tag{} with name.
func (*Status) IsLocal ¶
IsLocal returns true if this is a local status (ie., originating from this instance).
func (*Status) IsLocalOnly ¶
IsLocalOnly returns true if this status is "local-only" ie., unfederated.
func (*Status) MentionsAccount ¶
MentionsAccount returns whether status mentions the given account ID.
func (*Status) MentionsPopulated ¶
MentionsPopulated returns whether mentions are populated according to current MentionIDs.
func (*Status) TagsPopulated ¶
TagsPopulated returns whether tags are populated according to current TagIDs.
type StatusBookmark ¶
type StatusBookmark struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the account that created ('did') the bookmark
Account *Account `bun:"rel:belongs-to"` // account that created the bookmark
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the bookmarked status
TargetAccount *Account `bun:"rel:belongs-to"` // account owning the bookmarked status
StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been bookmarked
Status *Status `bun:"rel:belongs-to"` // the bookmarked status
}
StatusBookmark refers to one account having a 'bookmark' of the status of another account.
type StatusContentType ¶
type StatusContentType enumType
StatusContentType is the content type with which a status's text is parsed. Can be either plain or markdown. Empty will default to plain.
const ( StatusContentTypePlain StatusContentType = 1 StatusContentTypeMarkdown StatusContentType = 2 StatusContentTypeDefault = StatusContentTypePlain )
type StatusEdit ¶
type StatusEdit struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // ID of this item in the database.
Content string `bun:""` // Content of status at time of edit; likely html-formatted but not guaranteed.
ContentWarning string `bun:",nullzero"` // Content warning of status at time of edit.
Text string `bun:""` // Original status text, without formatting, at time of edit.
ContentType StatusContentType `bun:",nullzero"` // Content type used to process the original text of the status.
Language string `bun:",nullzero"` // Status language at time of edit.
Sensitive *bool `bun:",nullzero,notnull,default:false"` // Status sensitive flag at time of edit.
AttachmentIDs []string `bun:"attachments,array"` // Database IDs of media attachments associated with status at time of edit.
AttachmentDescriptions []string `bun:",array"` // Previous media descriptions of media attachments associated with status at time of edit.
Attachments []*MediaAttachment `bun:"-"` // Media attachments relating to .AttachmentIDs field (not always populated).
PollOptions []string `bun:",array"` // Poll options of status at time of edit, only set if status contains a poll.
PollVotes []int `bun:",array"` // Poll vote count at time of status edit, only set if poll votes were reset.
StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // The originating status ID this is a historical edit of.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // The creation time of this version of the status content (according to receiving server).
}
StatusEdit represents a **historical** view of a Status after a received edit. The Status itself will always contain the latest up-to-date information.
Note that stored status edits may not exactly match that of the origin server, they are a best-effort by receiver to store version history. There is no AP history endpoint.
func (*StatusEdit) AttachmentsPopulated ¶
func (e *StatusEdit) AttachmentsPopulated() bool
AttachmentsPopulated returns whether media attachments are populated according to current AttachmentIDs.
type StatusFave ¶
type StatusFave struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
AccountID string `bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // id of the account that created ('did') the fave
Account *Account `bun:"-"` // account that created the fave
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the faved status
TargetAccount *Account `bun:"-"` // account owning the faved status
StatusID string `bun:"type:CHAR(26),unique:statusfaveaccountstatus,nullzero,notnull"` // database id of the status that has been 'faved'
Status *Status `bun:"-"` // the faved status
URI string `bun:",nullzero,notnull,unique"` // ActivityPub URI of this fave
PendingApproval *bool `bun:",nullzero,notnull,default:false"` // If true then Like must be Approved by the like-ee before being fully distributed.
PreApproved bool `bun:"-"` // If true, then fave targets a status on our instance, has permission to do the interaction, and an Accept should be sent out for it immediately. Field not stored in the DB.
ApprovedByURI string `bun:",nullzero"` // URI of an Accept Activity that approves this Like.
}
StatusFave refers to a 'fave' or 'like' in the database, from one account, targeting the status of another account
func (*StatusFave) GetAccount ¶ added in v0.20.0
func (f *StatusFave) GetAccount() *Account
GetAccount returns the account that owns this fave. May be nil if fave not populated. Fulfils Interaction interface.
type StatusMute ¶
type StatusMute struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
AccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id of the account that created ('did') the mute
Account *Account `bun:"rel:belongs-to"` // pointer to the account specified by accountID
TargetAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the muted status (can be the same as accountID)
TargetAccount *Account `bun:"rel:belongs-to"` // pointer to the account specified by targetAccountID
StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been muted
Status *Status `bun:"rel:belongs-to"` // pointer to the muted status specified by statusID
}
StatusMute IS DEPRECATED -- USE THREADMUTE INSTEAD NOW! THIS TABLE DOESN'T EXIST ANYMORE!
type StatusToEmoji ¶
type StatusToEmoji struct {
StatusID string `bun:"type:CHAR(26),unique:statusemoji,nullzero,notnull"`
Status *Status `bun:"rel:belongs-to"`
EmojiID string `bun:"type:CHAR(26),unique:statusemoji,nullzero,notnull"`
Emoji *Emoji `bun:"rel:belongs-to"`
}
StatusToEmoji is an intermediate struct to facilitate the many2many relationship between a status and one or more emojis.
type StatusToTag ¶
type StatusToTag struct {
StatusID string `bun:"type:CHAR(26),unique:statustag,nullzero,notnull"`
Status *Status `bun:"rel:belongs-to"`
TagID string `bun:"type:CHAR(26),unique:statustag,nullzero,notnull"`
Tag *Tag `bun:"rel:belongs-to"`
}
StatusToTag is an intermediate struct to facilitate the many2many relationship between a status and one or more tags.
type Tag ¶
type Tag struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Name string `bun:",unique,nullzero,notnull"` // (lowercase) name of the tag without the hash prefix
Useable *bool `bun:",nullzero,notnull,default:true"` // Tag is useable on this instance.
Listable *bool `bun:",nullzero,notnull,default:true"` // Tagged statuses can be listed on this instance.
Href string `bun:"-"` // Href of the hashtag. Will only be set on freshly-extracted hashtags from remote AP messages. Not stored in the database.
}
Tag represents a hashtag for gathering public statuses together.
type Theme ¶
type Theme struct {
// User-facing title of this theme.
Title string
// User-facing description of this theme.
Description string
// FileName of this theme in the themes
// directory (eg., `light-blurple.css`).
FileName string
}
Theme represents a user-selected CSS theme for an account.
type Thread ¶
type Thread struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
StatusIDs []string `bun:"-"` // ids of statuses belonging to this thread (order not guaranteed)
}
Thread represents one thread of statuses. TODO: add more fields here if necessary.
type ThreadMute ¶
type ThreadMute struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
ThreadID string `bun:"type:CHAR(26),nullzero,notnull,unique:thread_mute_thread_id_account_id"` // ID of the muted thread
AccountID string `bun:"type:CHAR(26),nullzero,notnull,unique:thread_mute_thread_id_account_id"` // Account ID of the creator of this mute
}
ThreadMute represents an account-level mute of a thread of statuses.
type Thumbnail ¶
type Thumbnail struct {
Path string `bun:",notnull"` // Path of the file in storage.
ContentType string `bun:",notnull"` // MIME content type of the file.
FileSize int `bun:",notnull"` // File size in bytes
URL string `bun:",nullzero"` // What is the URL of the thumbnail on the local server
RemoteURL string `bun:",nullzero"` // What is the remote URL of the thumbnail (empty for local media)
}
Thumbnail refers to a small image thumbnail derived from a larger image, video, or audio file.
type Token ¶
type Token struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
LastUsed time.Time `bun:"type:timestamptz,nullzero"` // approximate time when this token was last used
ClientID string `bun:"type:CHAR(26),nullzero,notnull"` // ID of the client who owns this token
UserID string `bun:"type:CHAR(26),nullzero"` // ID of the user who owns this token
RedirectURI string `bun:",nullzero,notnull"` // Oauth redirect URI for this token
Scope string `bun:",nullzero,notnull,default:'read'"` // Oauth scope
Code string `bun:",pk,nullzero,notnull,default:''"` // Code, if present
CodeChallenge string `bun:",nullzero"` // Code challenge, if code present
CodeChallengeMethod string `bun:",nullzero"` // Code challenge method, if code present
CodeCreateAt time.Time `bun:"type:timestamptz,nullzero"` // Code created time, if code present
CodeExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Code expires at -- null means the code never expires
Access string `bun:",pk,nullzero,notnull,default:''"` // User level access token, if present
AccessCreateAt time.Time `bun:"type:timestamptz,nullzero"` // User level access token created time, if access present
AccessExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // User level access token expires at -- null means the token never expires
Refresh string `bun:",pk,nullzero,notnull,default:''"` // Refresh token, if present
RefreshCreateAt time.Time `bun:"type:timestamptz,nullzero"` // Refresh created at, if refresh present
RefreshExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Refresh expires at -- null means the refresh token never expires
}
Token is a translation of the gotosocial token with the ExpiresIn fields replaced with ExpiresAt.
type Tombstone ¶
type Tombstone struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
Domain string `bun:",nullzero,notnull"` // Domain of the Object/Actor.
URI string `bun:",nullzero,notnull,unique"` // ActivityPub URI for this Object/Actor.
}
Tombstone represents either a remote fediverse account, object, activity etc which has been deleted. It's useful in cases where a remote account has been deleted, and we don't want to keep trying to process subsequent activities from that account, or deletes which target it.
type User ¶
type User struct {
// Database ID of the user.
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
// Datetime when the user was created.
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Datetime when was the user was last updated.
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
// Confirmed email address for this user.
//
// This should be unique, ie., only one email
// address registered per instance. Multiple
// users per email are not (yet) supported.
Email string `bun:",nullzero,unique"`
// Database ID of the Account for this user.
AccountID string `bun:"type:CHAR(26),nullzero,notnull,unique"`
// Account corresponding to AccountID.
Account *Account `bun:"-"`
// Bcrypt-encrypted password of this user, generated using
// https://pkg.go.dev/golang.org/x/crypto/bcrypt#GenerateFromPassword.
//
// A salt is included so we're safe against 🌈 tables.
EncryptedPassword string `bun:",nullzero,notnull"`
// 2FA secret for this user.
//
// Null if 2FA is not enabled for this user.
TwoFactorSecret string `bun:",nullzero"`
// Slice of bcrypt-encrypted backup/recovery codes that a
// user can use if they lose their 2FA authenticator app.
//
// Null if 2FA is not enabled for this user.
TwoFactorBackups []string `bun:",nullzero,array"`
// Datetime when 2fa was enabled.
//
// Null if 2fa is not enabled for this user.
TwoFactorEnabledAt time.Time `bun:"type:timestamptz,nullzero"`
// IP this user used to sign up.
//
// Only stored for pending sign-ups.
SignUpIP net.IP `bun:",nullzero"`
// Database ID of the invite that this
// user used to sign up, if applicable.
InviteID string `bun:"type:CHAR(26),nullzero"`
// Reason given for signing up
// when this user was created.
Reason string `bun:",nullzero"`
// Timezone/locale in which
// this user is located.
Locale string `bun:",nullzero"`
// Database ID of the Application used to create this user.
CreatedByApplicationID string `bun:"type:CHAR(26),nullzero"`
// Application corresponding to ApplicationID.
CreatedByApplication *Application `bun:"-"`
// Datetime when this user was last contacted by email.
LastEmailedAt time.Time `bun:"type:timestamptz,nullzero"`
// Confirmation token emailed to this user.
//
// Only set if user's email not yet confirmed.
ConfirmationToken string `bun:",nullzero"`
// Datetime when confirmation token was emailed to user.
ConfirmationSentAt time.Time `bun:"type:timestamptz,nullzero"`
// Datetime when user confirmed
// their email address, if applicable.
ConfirmedAt time.Time `bun:"type:timestamptz,nullzero"`
// Email address that hasn't yet been confirmed.
UnconfirmedEmail string `bun:",nullzero"`
// True if user has moderator role.
Moderator *bool `bun:",nullzero,notnull,default:false"`
// True if user has admin role.
Admin *bool `bun:",nullzero,notnull,default:false"`
// True if user is disabled from posting.
Disabled *bool `bun:",nullzero,notnull,default:false"`
// True if this user's sign up has
// been approved by a moderator or admin.
Approved *bool `bun:",nullzero,notnull,default:false"`
// Reset password token that the user
// can use to reset their password.
ResetPasswordToken string `bun:",nullzero"`
// Datetime when reset password token was emailed to user.
ResetPasswordSentAt time.Time `bun:"type:timestamptz,nullzero"`
// If the login for the user is managed
// externally (e.g., via OIDC), this is a stable
// reference to the external object (e.g OIDC sub claim).
ExternalID string `bun:",nullzero,unique"`
}
User represents one signed-up user of this GoToSocial instance.
User may not necessarily be approved yet; in other words, this model is used for both active users and signed-up but not yet approved users.
Sign-ups that have been denied rather than approved are stored as DeniedUser instead.
func (*User) TwoFactorEnabled ¶
type UserMute ¶
type UserMute struct {
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created
UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated
ExpiresAt time.Time `bun:"type:timestamptz,nullzero"` // Time mute should expire. If null, should not expire.
AccountID string `bun:"type:CHAR(26),unique:user_mutes_account_id_target_account_id_uniq,notnull,nullzero"` // Who does this mute originate from?
Account *Account `bun:"-"` // Account corresponding to accountID
TargetAccountID string `bun:"type:CHAR(26),unique:user_mutes_account_id_target_account_id_uniq,notnull,nullzero"` // Who is the target of this mute?
TargetAccount *Account `bun:"-"` // Account corresponding to targetAccountID
Notifications *bool `bun:",nullzero,notnull,default:false"` // Apply mute to notifications as well as statuses.
}
UserMute refers to the muting of one account by another.
type VAPIDKeyPair ¶
type VAPIDKeyPair struct {
ID int `bun:",pk,notnull"`
Public string `bun:",notnull,nullzero"`
Private string `bun:",notnull,nullzero"`
}
VAPIDKeyPair represents the instance's VAPID keys (stored as Base64 strings). This table should only ever have one entry, with a known ID of 0.
type Visibility ¶
type Visibility enumType
Visibility represents the visibility granularity of a status.
const ( // VisibilityNone means nobody can see this. // It's only used for web status visibility. VisibilityNone Visibility = 1 // VisibilityPublic means this status will // be visible to everyone on all timelines. VisibilityPublic Visibility = 2 // VisibilityUnlocked means this status will be visible to everyone, // but will only show on home timeline to followers, and in lists. VisibilityUnlocked Visibility = 3 // VisibilityFollowersOnly means this status is viewable to followers only. VisibilityFollowersOnly Visibility = 4 // VisibilityMutualsOnly means this status // is visible to mutual followers only. VisibilityMutualsOnly Visibility = 5 // VisibilityDirect means this status is // visible only to mentioned recipients. VisibilityDirect Visibility = 6 // VisibilityDefault is used when no other setting can be found. VisibilityDefault Visibility = VisibilityUnlocked )
func (Visibility) String ¶
func (v Visibility) String() string
String returns a stringified, frontend API compatible form of Visibility.
type WebLayout ¶
type WebLayout enumType
WebLayout represents an account owner's choice for how they want their profile to be laid out via the web view, by default.
func ParseWebLayout ¶
ParseWebLayout returns a web layout from the given value.
type WebPushNotificationPolicy ¶
type WebPushNotificationPolicy enumType
WebPushNotificationPolicy represents the notification policy of a Web Push subscription. Corresponds to apimodel.WebPushNotificationPolicy.
const ( // WebPushNotificationPolicyAll allows all accounts to send notifications to the subscribing user. WebPushNotificationPolicyAll WebPushNotificationPolicy = 1 // WebPushNotificationPolicyFollowed allows accounts followed by the subscribing user to send notifications. WebPushNotificationPolicyFollowed WebPushNotificationPolicy = 2 // WebPushNotificationPolicyFollower allows accounts following the subscribing user to send notifications. WebPushNotificationPolicyFollower WebPushNotificationPolicy = 3 // WebPushNotificationPolicyNone doesn't allow any accounts to send notifications to the subscribing user. WebPushNotificationPolicyNone WebPushNotificationPolicy = 4 )
type WebPushSubscription ¶
type WebPushSubscription struct {
// ID of this subscription in the database.
ID string `bun:"type:CHAR(26),pk,nullzero"`
// AccountID of the local account that created this subscription.
AccountID string `bun:"type:CHAR(26),nullzero,notnull"`
// TokenID is the ID of the associated access token.
// There can be at most one subscription for any given access token,
TokenID string `bun:"type:CHAR(26),nullzero,notnull,unique"`
// Endpoint is the URL receiving Web Push notifications for this subscription.
Endpoint string `bun:",nullzero,notnull"`
// Auth is a Base64-encoded authentication secret.
Auth string `bun:",nullzero,notnull"`
// P256dh is a Base64-encoded Diffie-Hellman public key on the P-256 elliptic curve.
P256dh string `bun:",nullzero,notnull"`
// NotificationFlags controls which notifications are delivered to this subscription.
NotificationFlags WebPushSubscriptionNotificationFlags `bun:",notnull"`
// Policy controls which accounts are allowed to trigger notifications for this subscription.
Policy WebPushNotificationPolicy `bun:",nullzero,notnull,default:1"`
}
WebPushSubscription represents an access token's Web Push subscription. There can be at most one per access token.
type WebPushSubscriptionNotificationFlags ¶
type WebPushSubscriptionNotificationFlags int64
WebPushSubscriptionNotificationFlags is a bitfield representation of a set of NotificationType. Corresponds to apimodel.WebPushSubscriptionAlerts.
func WebPushSubscriptionNotificationFlagsFromSlice ¶
func WebPushSubscriptionNotificationFlagsFromSlice(notificationTypes []NotificationType) WebPushSubscriptionNotificationFlags
WebPushSubscriptionNotificationFlagsFromSlice packs a slice of NotificationType into a WebPushSubscriptionNotificationFlags.
func (*WebPushSubscriptionNotificationFlags) Get ¶
func (n *WebPushSubscriptionNotificationFlags) Get(notificationType NotificationType) bool
Get tests to see if a given NotificationType is included in this set of flags.
func (*WebPushSubscriptionNotificationFlags) Set ¶
func (n *WebPushSubscriptionNotificationFlags) Set(notificationType NotificationType, value bool)
Set adds or removes a given NotificationType to or from this set of flags.
func (*WebPushSubscriptionNotificationFlags) ToSlice ¶
func (n *WebPushSubscriptionNotificationFlags) ToSlice() []NotificationType
ToSlice unpacks a WebPushSubscriptionNotificationFlags into a slice of NotificationType.
type WorkerTask ¶
type WorkerTask struct {
ID uint `bun:",pk,autoincrement"`
WorkerType WorkerType `bun:",notnull"`
TaskData []byte `bun:",nullzero,notnull"`
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"`
}
WorkerTask represents a queued worker task that was persisted to the database on shutdown. This is only ever used on startup to pickup where we left off, and on shutdown to prevent queued tasks from being lost. It is simply a means to store a blob of serialized task data.
type WorkerType ¶
type WorkerType uint8
const ( DeliveryWorker WorkerType = 1 FederatorWorker WorkerType = 2 ClientWorker WorkerType = 3 )
Source Files
¶
- account.go
- accountnote.go
- accountsettings.go
- accountstats.go
- adminaction.go
- advancedmigration.go
- application.go
- block.go
- common.go
- conversation.go
- domainallow.go
- domainblock.go
- domainpermission.go
- domainpermissiondraft.go
- domainpermissionexclude.go
- domainpermissionsubscription.go
- emaildomainblock.go
- emoji.go
- emojicategory.go
- filter.go
- follow.go
- followrequest.go
- headerfilter.go
- instance.go
- interaction.go
- interactionpolicy.go
- list.go
- marker.go
- mediaattachment.go
- mention.go
- move.go
- notification.go
- poll.go
- report.go
- routersession.go
- rule.go
- scheduledstatus.go
- sinbinstatus.go
- status.go
- statusbookmark.go
- statusedit.go
- statusfave.go
- statusmute.go
- tag.go
- thread.go
- threadmute.go
- token.go
- tombstone.go
- user.go
- usermute.go
- vapidkeypair.go
- webpushsubscription.go
- workertask.go