Documentation ¶
Index ¶
- type Actions
- type Processor
- func (p *Processor) AccountAction(ctx context.Context, adminAcct *gtsmodel.Account, ...) (string, gtserror.WithCode)
- func (p *Processor) Actions() *Actions
- func (p *Processor) DomainKeysExpire(ctx context.Context, adminAcct *gtsmodel.Account, domain string) (string, gtserror.WithCode)
- func (p *Processor) DomainPermissionCreate(ctx context.Context, permissionType gtsmodel.DomainPermissionType, ...) (*apimodel.DomainPermission, string, gtserror.WithCode)
- func (p *Processor) DomainPermissionDelete(ctx context.Context, permissionType gtsmodel.DomainPermissionType, ...) (*apimodel.DomainPermission, string, gtserror.WithCode)
- func (p *Processor) DomainPermissionGet(ctx context.Context, permissionType gtsmodel.DomainPermissionType, id string, ...) (*apimodel.DomainPermission, gtserror.WithCode)
- func (p *Processor) DomainPermissionsGet(ctx context.Context, permissionType gtsmodel.DomainPermissionType, ...) ([]*apimodel.DomainPermission, gtserror.WithCode)
- func (p *Processor) DomainPermissionsImport(ctx context.Context, permissionType gtsmodel.DomainPermissionType, ...) (*apimodel.MultiStatus, gtserror.WithCode)
- func (p *Processor) EmailTest(ctx context.Context, account *gtsmodel.Account, toAddress string) gtserror.WithCode
- func (p *Processor) EmojiCategoriesGet(ctx context.Context) ([]*apimodel.EmojiCategory, gtserror.WithCode)
- func (p *Processor) EmojiCreate(ctx context.Context, account *gtsmodel.Account, user *gtsmodel.User, ...) (*apimodel.Emoji, gtserror.WithCode)
- func (p *Processor) EmojiDelete(ctx context.Context, id string) (*apimodel.AdminEmoji, gtserror.WithCode)
- func (p *Processor) EmojiGet(ctx context.Context, account *gtsmodel.Account, user *gtsmodel.User, id string) (*apimodel.AdminEmoji, gtserror.WithCode)
- func (p *Processor) EmojiUpdate(ctx context.Context, id string, form *apimodel.EmojiUpdateRequest) (*apimodel.AdminEmoji, gtserror.WithCode)
- func (p *Processor) EmojisGet(ctx context.Context, account *gtsmodel.Account, user *gtsmodel.User, ...) (*apimodel.PageableResponse, gtserror.WithCode)
- func (p *Processor) MediaPrune(ctx context.Context, mediaRemoteCacheDays int) gtserror.WithCode
- func (p *Processor) MediaRefetch(ctx context.Context, requestingAccount *gtsmodel.Account, domain string) gtserror.WithCode
- func (p *Processor) ReportGet(ctx context.Context, account *gtsmodel.Account, id string) (*apimodel.AdminReport, gtserror.WithCode)
- func (p *Processor) ReportResolve(ctx context.Context, account *gtsmodel.Account, id string, ...) (*apimodel.AdminReport, gtserror.WithCode)
- func (p *Processor) ReportsGet(ctx context.Context, account *gtsmodel.Account, resolved *bool, ...) (*apimodel.PageableResponse, gtserror.WithCode)
- func (p *Processor) RuleCreate(ctx context.Context, form *apimodel.InstanceRuleCreateRequest) (*apimodel.AdminInstanceRule, gtserror.WithCode)
- func (p *Processor) RuleDelete(ctx context.Context, id string) (*apimodel.AdminInstanceRule, gtserror.WithCode)
- func (p *Processor) RuleGet(ctx context.Context, id string) (*apimodel.AdminInstanceRule, gtserror.WithCode)
- func (p *Processor) RuleUpdate(ctx context.Context, id string, form *apimodel.InstanceRuleCreateRequest) (*apimodel.AdminInstanceRule, gtserror.WithCode)
- func (p *Processor) RulesGet(ctx context.Context) ([]*apimodel.AdminInstanceRule, gtserror.WithCode)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶ added in v0.12.0
type Actions struct {
// contains filtered or unexported fields
}
func (*Actions) GetRunning ¶ added in v0.12.0
func (a *Actions) GetRunning() []*gtsmodel.AdminAction
GetRunning sounds like a threat, but it actually just returns all of the currently running actions held by the Actions struct, ordered by ID descending.
func (*Actions) Run ¶ added in v0.12.0
func (a *Actions) Run( ctx context.Context, action *gtsmodel.AdminAction, f func(context.Context) gtserror.MultiError, ) gtserror.WithCode
Run runs the given admin action by executing the supplied function.
Run handles locking, action insertion and updating, so you don't have to!
If an action is already running which overlaps/conflicts with the given action, an ErrorWithCode 409 will be returned.
If execution of the provided function returns errors, the errors will be updated on the provided admin action in the database.
func (*Actions) TotalRunning ¶ added in v0.12.0
TotalRunning is a sequel to the classic 1972 environmental-themed science fiction film Silent Running, starring Bruce Dern.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func New ¶
func New(state *state.State, converter *typeutils.Converter, mediaManager *media.Manager, transportController transport.Controller, emailSender email.Sender) Processor
New returns a new admin processor.
func (*Processor) AccountAction ¶ added in v0.2.2
func (*Processor) DomainKeysExpire ¶ added in v0.12.0
func (p *Processor) DomainKeysExpire( ctx context.Context, adminAcct *gtsmodel.Account, domain string, ) (string, gtserror.WithCode)
DomainKeysExpire iterates through all accounts belonging to the given domain, and expires the public key of each account found this way.
The PublicKey for each account will be re-fetched next time a signed request from that account is received.
func (*Processor) DomainPermissionCreate ¶ added in v0.12.0
func (p *Processor) DomainPermissionCreate( ctx context.Context, permissionType gtsmodel.DomainPermissionType, adminAcct *gtsmodel.Account, domain string, obfuscate bool, publicComment string, privateComment string, subscriptionID string, ) (*apimodel.DomainPermission, string, gtserror.WithCode)
DomainPermissionCreate creates an instance-level permission targeting the given domain, and then processes any side effects of the permission creation.
If the same permission type already exists for the domain, side effects will be retried.
Return values for this function are the new or existing domain permission, the ID of the admin action resulting from this call, and/or an error if something goes wrong.
func (*Processor) DomainPermissionDelete ¶ added in v0.12.0
func (p *Processor) DomainPermissionDelete( ctx context.Context, permissionType gtsmodel.DomainPermissionType, adminAcct *gtsmodel.Account, domainBlockID string, ) (*apimodel.DomainPermission, string, gtserror.WithCode)
DomainPermissionDelete removes one domain block with the given ID, and processes side effects of removing the block asynchronously.
Return values for this function are the deleted domain block, the ID of the admin action resulting from this call, and/or an error if something goes wrong.
func (*Processor) DomainPermissionGet ¶ added in v0.12.0
func (p *Processor) DomainPermissionGet( ctx context.Context, permissionType gtsmodel.DomainPermissionType, id string, export bool, ) (*apimodel.DomainPermission, gtserror.WithCode)
DomainPermissionGet returns one domain permission with the given id and type.
If export is true, the format will be suitable for writing out to an export.
func (*Processor) DomainPermissionsGet ¶ added in v0.12.0
func (p *Processor) DomainPermissionsGet( ctx context.Context, permissionType gtsmodel.DomainPermissionType, account *gtsmodel.Account, export bool, ) ([]*apimodel.DomainPermission, gtserror.WithCode)
DomainPermissionsGet returns all existing domain permissions of the requested type. If export is true, the format will be suitable for writing out to an export.
func (*Processor) DomainPermissionsImport ¶ added in v0.12.0
func (p *Processor) DomainPermissionsImport( ctx context.Context, permissionType gtsmodel.DomainPermissionType, account *gtsmodel.Account, domainsF *multipart.FileHeader, ) (*apimodel.MultiStatus, gtserror.WithCode)
DomainPermissionsImport handles the import of multiple domain permissions, by calling the DomainPermissionCreate function for each domain in the provided file. Will return a slice of processed domain permissions.
In the case of total failure, a gtserror.WithCode will be returned so that the caller can respond appropriately. In the case of partial or total success, a MultiStatus model will be returned, which contains information about success + failure count, so that the caller can retry any failures as they wish.
func (*Processor) EmailTest ¶ added in v0.8.0
func (p *Processor) EmailTest(ctx context.Context, account *gtsmodel.Account, toAddress string) gtserror.WithCode
EmailTest sends a generic test email to the given toAddress (which should be a valid email address). To help callers differentiate between proper errors and the smtp errors they're likely fishing for, will return 422 + help text on an SMTP error, or error 500 otherwise.
func (*Processor) EmojiCategoriesGet ¶ added in v0.6.0
func (p *Processor) EmojiCategoriesGet(ctx context.Context) ([]*apimodel.EmojiCategory, gtserror.WithCode)
EmojiCategoriesGet returns all custom emoji categories that exist on this instance.
func (*Processor) EmojiCreate ¶
func (p *Processor) EmojiCreate(ctx context.Context, account *gtsmodel.Account, user *gtsmodel.User, form *apimodel.EmojiCreateRequest) (*apimodel.Emoji, gtserror.WithCode)
EmojiCreate creates a custom emoji on this instance.
func (*Processor) EmojiDelete ¶ added in v0.6.0
func (p *Processor) EmojiDelete(ctx context.Context, id string) (*apimodel.AdminEmoji, gtserror.WithCode)
EmojiDelete deletes one emoji from the database, with the given id.
func (*Processor) EmojiGet ¶ added in v0.6.0
func (p *Processor) EmojiGet(ctx context.Context, account *gtsmodel.Account, user *gtsmodel.User, id string) (*apimodel.AdminEmoji, gtserror.WithCode)
EmojiGet returns the admin view of one custom emoji with the given id.
func (*Processor) EmojiUpdate ¶ added in v0.6.0
func (p *Processor) EmojiUpdate(ctx context.Context, id string, form *apimodel.EmojiUpdateRequest) (*apimodel.AdminEmoji, gtserror.WithCode)
EmojiUpdate updates one emoji with the given id, using the provided form parameters.
func (*Processor) EmojisGet ¶ added in v0.6.0
func (p *Processor) EmojisGet( ctx context.Context, account *gtsmodel.Account, user *gtsmodel.User, domain string, includeDisabled bool, includeEnabled bool, shortcode string, maxShortcodeDomain string, minShortcodeDomain string, limit int, ) (*apimodel.PageableResponse, gtserror.WithCode)
EmojisGet returns an admin view of custom emojis, filtered with the given parameters.
func (*Processor) MediaPrune ¶ added in v0.3.4
MediaPrune triggers a non-blocking prune of unused media, orphaned, uncaching remote and fixing cache states.
func (*Processor) MediaRefetch ¶ added in v0.7.0
func (p *Processor) MediaRefetch(ctx context.Context, requestingAccount *gtsmodel.Account, domain string) gtserror.WithCode
MediaRefetch forces a refetch of remote emojis.
func (*Processor) ReportGet ¶ added in v0.7.0
func (p *Processor) ReportGet(ctx context.Context, account *gtsmodel.Account, id string) (*apimodel.AdminReport, gtserror.WithCode)
ReportGet returns one report, with the given ID.
func (*Processor) ReportResolve ¶ added in v0.7.0
func (p *Processor) ReportResolve(ctx context.Context, account *gtsmodel.Account, id string, actionTakenComment *string) (*apimodel.AdminReport, gtserror.WithCode)
ReportResolve marks a report with the given id as resolved, and stores the provided actionTakenComment (if not null). If the report creator is from this instance, an email will be sent to them to let them know that the report is resolved.
func (*Processor) ReportsGet ¶ added in v0.7.0
func (p *Processor) ReportsGet( ctx context.Context, account *gtsmodel.Account, resolved *bool, accountID string, targetAccountID string, maxID string, sinceID string, minID string, limit int, ) (*apimodel.PageableResponse, gtserror.WithCode)
ReportsGet returns all reports stored on this instance, with the given parameters.
func (*Processor) RuleCreate ¶ added in v0.12.0
func (p *Processor) RuleCreate(ctx context.Context, form *apimodel.InstanceRuleCreateRequest) (*apimodel.AdminInstanceRule, gtserror.WithCode)
RuleCreate adds a new rule to the instance.
func (*Processor) RuleDelete ¶ added in v0.12.0
func (p *Processor) RuleDelete(ctx context.Context, id string) (*apimodel.AdminInstanceRule, gtserror.WithCode)
RuleDelete deletes an existing rule.
func (*Processor) RuleGet ¶ added in v0.12.0
func (p *Processor) RuleGet(ctx context.Context, id string) (*apimodel.AdminInstanceRule, gtserror.WithCode)
RuleGet returns one rule, with the given ID.
func (*Processor) RuleUpdate ¶ added in v0.12.0
func (p *Processor) RuleUpdate(ctx context.Context, id string, form *apimodel.InstanceRuleCreateRequest) (*apimodel.AdminInstanceRule, gtserror.WithCode)
RuleUpdate updates text for an existing rule.