Documentation ¶
Overview ¶
Package webaccount provides a web app for users to view and change their account settings, and to import/export email.
Index ¶
- func Handler(cookiePath string, isForwarded bool) func(w http.ResponseWriter, r *http.Request)
- func ImportManage()
- type Account
- func (Account) Account(ctx context.Context) (account config.Account, storageUsed, storageLimit int64, ...)
- func (Account) AccountSaveFullName(ctx context.Context, fullName string)
- func (Account) AutomaticJunkFlagsSave(ctx context.Context, enabled bool, ...)
- func (Account) DestinationSave(ctx context.Context, destName string, oldDest, newDest config.Destination)
- func (Account) FromIDLoginAddressesSave(ctx context.Context, loginAddresses []string)
- func (Account) ImportAbort(ctx context.Context, importToken string) error
- func (Account) IncomingWebhookSave(ctx context.Context, url, authorization string)
- func (Account) IncomingWebhookTest(ctx context.Context, urlStr, authorization string, data webhook.Incoming) (code int, response string, errmsg string)
- func (Account) JunkFilterSave(ctx context.Context, junkFilter *config.JunkFilter)
- func (Account) KeepRetiredPeriodsSave(ctx context.Context, ...)
- func (w Account) Login(ctx context.Context, loginToken, username, password string) store.CSRFToken
- func (w Account) LoginPrep(ctx context.Context) string
- func (w Account) Logout(ctx context.Context)
- func (Account) OutgoingWebhookSave(ctx context.Context, url, authorization string, events []string)
- func (Account) OutgoingWebhookTest(ctx context.Context, urlStr, authorization string, data webhook.Outgoing) (code int, response string, errmsg string)
- func (Account) RejectsSave(ctx context.Context, mailbox string, keep bool)
- func (Account) SetPassword(ctx context.Context, password string)
- func (Account) SuppressionAdd(ctx context.Context, address string, manual bool, reason string) (suppression webapi.Suppression)
- func (Account) SuppressionList(ctx context.Context) (suppressions []webapi.Suppression)
- func (Account) SuppressionRemove(ctx context.Context, address string)
- func (Account) Types() (importProgress ImportProgress)
- type ImportProgress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶ added in v0.0.9
Handler returns a handler for the webaccount endpoints, customized for the cookiePath.
func ImportManage ¶
func ImportManage()
ImportManage should be run as a goroutine, it manages imports of mboxes/maildirs, propagating progress over SSE connections.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account exports web API functions for the account web interface. All its methods are exported under api/. Function calls require valid HTTP Authentication credentials of a user.
func (Account) Account ¶
func (Account) Account(ctx context.Context) (account config.Account, storageUsed, storageLimit int64, suppressions []webapi.Suppression)
Account returns information about the account. StorageUsed is the sum of the sizes of all messages, in bytes. StorageLimit is the maximum storage that can be used, or 0 if there is no limit.
func (Account) AccountSaveFullName ¶
AccountSaveFullName saves the full name (used as display name in email messages) for the account.
func (Account) AutomaticJunkFlagsSave ¶ added in v0.0.11
func (Account) AutomaticJunkFlagsSave(ctx context.Context, enabled bool, junkRegexp, neutralRegexp, notJunkRegexp string)
AutomaticJunkFlagsSave saves settings for automatically marking messages as junk/nonjunk when moved to mailboxes matching certain regular expressions.
func (Account) DestinationSave ¶
func (Account) DestinationSave(ctx context.Context, destName string, oldDest, newDest config.Destination)
DestinationSave updates a destination. OldDest is compared against the current destination. If it does not match, an error is returned. Otherwise newDest is saved and the configuration reloaded.
func (Account) FromIDLoginAddressesSave ¶ added in v0.0.11
FromIDLoginAddressesSave saves new login addresses to enable unique SMTP MAIL FROM addresses ("fromid") for deliveries from the queue.
func (Account) ImportAbort ¶
ImportAbort aborts an import that is in progress. If the import exists and isn't finished, no changes will have been made by the import.
func (Account) IncomingWebhookSave ¶ added in v0.0.11
IncomingWebhookSave saves a new webhook url for incoming deliveries. If url is empty, the webhook is disabled. If authorization is not empty, it is used in the Authorization header in requests.
func (Account) IncomingWebhookTest ¶ added in v0.0.11
func (Account) IncomingWebhookTest(ctx context.Context, urlStr, authorization string, data webhook.Incoming) (code int, response string, errmsg string)
IncomingWebhookTest makes a test webhook HTTP delivery request to urlStr, with optional authorization header. If the HTTP call is made, this function returns non-error regardless of HTTP status code.
func (Account) JunkFilterSave ¶ added in v0.0.12
func (Account) JunkFilterSave(ctx context.Context, junkFilter *config.JunkFilter)
JunkFilterSave saves junk filter settings. If junkFilter is nil, the junk filter is disabled. Otherwise all fields except Threegrams are stored.
func (Account) KeepRetiredPeriodsSave ¶ added in v0.0.11
func (Account) KeepRetiredPeriodsSave(ctx context.Context, keepRetiredMessagePeriod, keepRetiredWebhookPeriod time.Duration)
KeepRetiredPeriodsSave saves periods to save retired messages and webhooks.
func (Account) Login ¶ added in v0.0.9
Login returns a session token for the credentials, or fails with error code "user:badLogin". Call LoginPrep to get a loginToken.
func (Account) LoginPrep ¶ added in v0.0.9
LoginPrep returns a login token, and also sets it as cookie. Both must be present in the call to Login.
func (Account) OutgoingWebhookSave ¶ added in v0.0.11
OutgoingWebhookSave saves a new webhook url for outgoing deliveries. If url is empty, the webhook is disabled. If authorization is non-empty it is used for the Authorization header in HTTP requests. Events specifies the outgoing events to be delivered, or all if empty/nil.
func (Account) OutgoingWebhookTest ¶ added in v0.0.11
func (Account) OutgoingWebhookTest(ctx context.Context, urlStr, authorization string, data webhook.Outgoing) (code int, response string, errmsg string)
OutgoingWebhookTest makes a test webhook call to urlStr, with optional authorization. If the HTTP request is made this call will succeed also for non-2xx HTTP status codes.
func (Account) RejectsSave ¶ added in v0.0.11
RejectsSave saves the RejectsMailbox and KeepRejects settings.
func (Account) SetPassword ¶
SetPassword saves a new password for the account, invalidating the previous password. Sessions are not interrupted, and will keep working. New login attempts must use the new password. Password must be at least 8 characters.
func (Account) SuppressionAdd ¶ added in v0.0.11
func (Account) SuppressionAdd(ctx context.Context, address string, manual bool, reason string) (suppression webapi.Suppression)
SuppressionAdd adds an email address to the suppression list.
func (Account) SuppressionList ¶ added in v0.0.11
func (Account) SuppressionList(ctx context.Context) (suppressions []webapi.Suppression)
SuppressionList lists the addresses on the suppression list of this account.
func (Account) SuppressionRemove ¶ added in v0.0.11
SuppressionRemove removes the email address from the suppression list.
func (Account) Types ¶ added in v0.0.9
func (Account) Types() (importProgress ImportProgress)
Types exposes types not used in API method signatures, such as the import form upload.
type ImportProgress ¶ added in v0.0.9
type ImportProgress struct { // For fetching progress, or cancelling an import. Token string }
ImportProgress is returned after uploading a file to import.