service

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2025 License: AGPL-3.0 Imports: 104 Imported by: 0

Documentation

Overview

Package service includes all of the services used in Emissary. This maps loosely to the "Use Cases" concept in the "Clean Architecture" design pattern (https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)

Services include server-level singletons that are used by every domain (such as themes, templates, etc) and domain-level services that have unique instances for each domain.

* Server-level serivces are created by the server.Factory and are passed by reference to each domain factory.

* Domain-level services are created by the domain.Factory, and typically require a connection to a database table, which is why they are not global.

Index

Constants

View Source
const DefinitionEmail = "EMAIL"

DefinitionEmail marks a filesystem that contains an Email definition.

View Source
const DefinitionRegistration = "REGISTRATION"

DefinitionRegistration marks a filesystem that contains a Registration process definition

View Source
const DefinitionTemplate = "TEMPLATE"

DefinitionEmail marks a filesystem that contains a stream Template definition.

View Source
const DefinitionTheme = "THEME"

DefinitionEmail marks a filesystem that contains a domain Theme definition.

View Source
const DefinitionWidget = "WIDGET"

DefinitionWidget marks a filesystem that contains a Widget definition.

Variables

This section is empty.

Functions

func ParseProfileURL

func ParseProfileURL(value string) (urlValue *url.URL, userID primitive.ObjectID, objectType string, objectID primitive.ObjectID, err error)

func ParseProfileURL_AsFollowing

func ParseProfileURL_AsFollowing(value string) (primitive.ObjectID, primitive.ObjectID, error)

func ParseProfileURL_UserID

func ParseProfileURL_UserID(value string) (primitive.ObjectID, error)

func RangeFunc added in v0.7.0

func RangeFunc[T any](it data.Iterator, new func() T) iter.Seq[T]

RangeFunc converts a data.Iterator into a Go 1.23 RangeFunc (https://go.dev/blog/range-functions)

func WatchStreams

func WatchStreams(collection *mongo.Collection, result chan<- primitive.ObjectID)

WatchStreams initiates a mongodb change stream to on every updates to Stream data objects

Types

type ActivityStream

type ActivityStream struct {
	// contains filtered or unexported fields
}

ActivityStream implements the Hannibal HTTP client interface, and provides a cache for ActivityStream documents.

func NewActivityStream

func NewActivityStream() ActivityStream

NewActivityStream creates a new ActivityStream service

func (*ActivityStream) CacheClient added in v0.7.0

func (service *ActivityStream) CacheClient() *ascache.Client

func (*ActivityStream) Delete

func (service *ActivityStream) Delete(url string) error

Delete removes a single document from the database by its URL

func (*ActivityStream) Load

func (service *ActivityStream) Load(url string, options ...any) (streams.Document, error)

Load implements the Hannibal `Client` interface, and returns a streams.Document from the cache.

func (*ActivityStream) NewDocument added in v0.6.0

func (service *ActivityStream) NewDocument(document map[string]any) streams.Document

func (*ActivityStream) PurgeCache added in v0.6.0

func (service *ActivityStream) PurgeCache() error

PurgeCache removes all expired documents from the cache

func (*ActivityStream) Put added in v0.6.0

func (service *ActivityStream) Put(document streams.Document)

Put adds a single document to the ActivityStream cache

func (*ActivityStream) QueryAnnouncesBeforeDate added in v0.6.0

func (service *ActivityStream) QueryAnnouncesBeforeDate(relationHref string, maxDate int64, done <-chan struct{}) <-chan streams.Document

func (*ActivityStream) QueryLikesBeforeDate added in v0.6.0

func (service *ActivityStream) QueryLikesBeforeDate(relationHref string, maxDate int64, done <-chan struct{}) <-chan streams.Document

func (*ActivityStream) QueryRepliesAfterDate added in v0.6.0

func (service *ActivityStream) QueryRepliesAfterDate(inReplyTo string, minDate int64, done <-chan struct{}) <-chan streams.Document

QueryRepliesAfterDate returns a slice of streams.Document values that are replies to the specified document, and were published after the specified date.

func (*ActivityStream) QueryRepliesBeforeDate added in v0.6.0

func (service *ActivityStream) QueryRepliesBeforeDate(inReplyTo string, maxDate int64, done <-chan struct{}) <-chan streams.Document

QueryRepliesBeforeDate returns a slice of streams.Document values that are replies to the specified document, and were published before the specified date.

func (*ActivityStream) Refresh

func (service *ActivityStream) Refresh(domainService *Domain, collection *mongo.Collection, hostname string)

Refresh updates the ActivityStream service with new dependencies

func (*ActivityStream) SearchActors added in v0.6.0

func (service *ActivityStream) SearchActors(queryString string) ([]model.ActorSummary, error)

type Attachment

type Attachment struct {
	// contains filtered or unexported fields
}

Attachment manages all interactions with the Attachment collection

func NewAttachment

func NewAttachment() Attachment

NewAttachment returns a fully populated Attachment service

func (*Attachment) Close

func (service *Attachment) Close()

Close stops any background processes controlled by this service

func (*Attachment) Count added in v0.7.0

func (service *Attachment) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Attachment) Delete

func (service *Attachment) Delete(attachment *model.Attachment, note string) error

Delete removes an Attachment from the database (virtual delete)

func (*Attachment) DeleteAll

func (service *Attachment) DeleteAll(objectType string, objectID primitive.ObjectID, note string) error

DeleteAll removes all attachments from the provided object/type (virtual delete)

func (*Attachment) DeleteByCriteria added in v0.7.0

func (service *Attachment) DeleteByCriteria(objectType string, objectID primitive.ObjectID, criteria exp.Expression, note string) error

DeleteByCriteria removes all attachments from the provided object/type within a criteria expression (virtual delete)

func (*Attachment) DeleteByID

func (service *Attachment) DeleteByID(objectType string, objectID primitive.ObjectID, attachmentID primitive.ObjectID, note string) error

func (*Attachment) List

func (service *Attachment) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Attachments who match the provided criteria

func (*Attachment) Load

func (service *Attachment) Load(criteria exp.Expression, result *model.Attachment) error

Load retrieves an Attachment from the database

func (*Attachment) LoadByID

func (service *Attachment) LoadByID(objectType string, objectID primitive.ObjectID, attachmentID primitive.ObjectID, result *model.Attachment) error

func (*Attachment) LoadFirstByObjectID

func (service *Attachment) LoadFirstByObjectID(objectType string, objectID primitive.ObjectID) (model.Attachment, error)

func (*Attachment) MakeRoom added in v0.7.0

func (service *Attachment) MakeRoom(objectType string, objectID primitive.ObjectID, category string, action string, maximum int, addCount int) error

MakeRoom removes attachments (by object and category) that exceed the provided maximum.

func (*Attachment) New

func (service *Attachment) New() model.Attachment

New creates a newly initialized Attachment that is ready to use

func (*Attachment) ObjectDelete added in v0.7.0

func (service *Attachment) ObjectDelete(object data.Object, note string) error

ObjectDelete removes an Attachment from the database (generically)

func (*Attachment) ObjectID added in v0.7.0

func (service *Attachment) ObjectID(object data.Object) primitive.ObjectID

ObjectID retrieves the AttachmentID from the provided object

func (*Attachment) ObjectList added in v0.7.0

func (service *Attachment) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

ObjectList returns an iterator of Attachments that match the provided criteria (generically)

func (*Attachment) ObjectLoad added in v0.7.0

func (service *Attachment) ObjectLoad(criteria exp.Expression) (data.Object, error)

ObjectLoad retrieves an Attachment from the database (generically)

func (*Attachment) ObjectNew added in v0.7.0

func (service *Attachment) ObjectNew() data.Object

New returns a fully initialized model.Attachment as a data.Object.

func (*Attachment) ObjectQuery added in v0.7.0

func (service *Attachment) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

ObjectQuery returns a slice of Attachments that match the provided criteria (generically)

func (*Attachment) ObjectSave added in v0.7.0

func (service *Attachment) ObjectSave(object data.Object, note string) error

ObjectSave adds/updates an Attachment in the database (generically)

func (*Attachment) ObjectType added in v0.7.0

func (service *Attachment) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Attachment) ObjectUserCan added in v0.7.0

func (service *Attachment) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

ObjectUserCan returns true if the current user has permission to perform the requested action on the provided Attachment

func (*Attachment) Query

func (service *Attachment) Query(criteria exp.Expression, options ...option.Option) ([]model.Attachment, error)

func (*Attachment) QueryByCategory added in v0.7.0

func (service *Attachment) QueryByCategory(objectType string, objectID primitive.ObjectID, category string) ([]model.Attachment, error)

QueryByCategory returns all Attachments that match the provided object (type and ID). If the "category" parameter is provided, then only Attachments with that category will be returned.

func (*Attachment) QueryByObjectID

func (service *Attachment) QueryByObjectID(objectType string, objectID primitive.ObjectID) ([]model.Attachment, error)

QueryByObjectID returns all Attachments that match the provided object (type and ID)

func (*Attachment) Refresh

func (service *Attachment) Refresh(collection data.Collection, mediaServer mediaserver.MediaServer, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Attachment) Save

func (service *Attachment) Save(attachment *model.Attachment, note string) error

Save adds/updates an Attachment in the database

func (*Attachment) Schema

func (service *Attachment) Schema() schema.Schema

Schema returns the schema that this service uses to validate Attachments

type AuthorSetter added in v0.6.0

type AuthorSetter interface {
	SetAuthor(object data.Object, authorID primitive.ObjectID) error
}

type Config

type Config struct {
}

Config service (will) manage server-wide configuration

type Connection added in v0.7.0

type Connection struct {
	// contains filtered or unexported fields
}

Connection manages all interactions with the Connection collection

func NewConnection added in v0.7.0

func NewConnection() Connection

NewConnection returns a fully populated Connection service

func (*Connection) AllAsMap added in v0.7.0

func (service *Connection) AllAsMap() mapof.Object[model.Connection]

func (*Connection) Close added in v0.7.0

func (service *Connection) Close()

Close stops any background processes controlled by this service

func (*Connection) Count added in v0.7.0

func (service *Connection) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Connection) Delete added in v0.7.0

func (service *Connection) Delete(group *model.Connection, note string) error

Delete removes an Connection from the database (virtual delete)

func (*Connection) List added in v0.7.0

func (service *Connection) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Connections who match the provided criteria

func (*Connection) Load added in v0.7.0

func (service *Connection) Load(criteria exp.Expression, result *model.Connection) error

Load retrieves an Connection from the database

func (*Connection) LoadByProvider added in v0.7.0

func (service *Connection) LoadByProvider(providerID string, connection *model.Connection) error

LoadByProvider loads a Connection that matches the given provider.

func (*Connection) LoadOrCreateByProvider added in v0.7.0

func (service *Connection) LoadOrCreateByProvider(providerID string) (model.Connection, error)

LoadOrCreateByProvider loads a Connection that matches the given provider. If no Connection is found, a new one is created.

func (*Connection) ObjectDelete added in v0.7.0

func (service *Connection) ObjectDelete(object data.Object, comment string) error

func (*Connection) ObjectID added in v0.7.0

func (service *Connection) ObjectID(object data.Object) primitive.ObjectID

func (*Connection) ObjectList added in v0.7.0

func (service *Connection) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Connection) ObjectLoad added in v0.7.0

func (service *Connection) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Connection) ObjectNew added in v0.7.0

func (service *Connection) ObjectNew() data.Object

New returns a fully initialized model.Connection as a data.Object.

func (*Connection) ObjectQuery added in v0.7.0

func (service *Connection) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Connection) ObjectSave added in v0.7.0

func (service *Connection) ObjectSave(object data.Object, comment string) error

func (*Connection) ObjectType added in v0.7.0

func (service *Connection) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Connection) ObjectUserCan added in v0.7.0

func (service *Connection) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Connection) Query added in v0.7.0

func (service *Connection) Query(criteria exp.Expression, options ...option.Option) ([]model.Connection, error)

func (*Connection) QueryAll added in v0.7.0

func (service *Connection) QueryAll(options ...option.Option) ([]model.Connection, error)

func (*Connection) Refresh added in v0.7.0

func (service *Connection) Refresh(collection data.Collection)

Refresh updates any stateful data that is cached inside this service.

func (*Connection) Save added in v0.7.0

func (service *Connection) Save(group *model.Connection, note string) error

Save adds/updates an Connection in the database

func (*Connection) Schema added in v0.7.0

func (service *Connection) Schema() schema.Schema

type Content

type Content struct {
	// contains filtered or unexported fields
}

func NewContent

func NewContent(editorJS *goeditorjs.HTMLEngine) Content
func (service *Content) ApplyLinks(content *model.Content)

func (*Content) ApplyTags added in v0.6.0

func (service *Content) ApplyTags(content *model.Content, base string, tags []string)

func (*Content) Format added in v0.6.0

func (service *Content) Format(content *model.Content)

func (*Content) FormatByExtension added in v0.6.0

func (service *Content) FormatByExtension(extension string) string

func (*Content) New

func (service *Content) New(format string, raw string) model.Content

func (*Content) NewByExtension added in v0.6.0

func (service *Content) NewByExtension(extension string, raw string) model.Content

type Domain

type Domain struct {
	// contains filtered or unexported fields
}

Domain service manages all access to the singleton model.Domain in the database

func NewDomain

func NewDomain() Domain

NewDomain returns a fully initialized Domain service

func (*Domain) ActivityPubActor added in v0.7.0

func (service *Domain) ActivityPubActor() (outbox.Actor, error)

ActivityPubActor returns an ActivityPub Actor object ** WHICH INCLUDES ENCRYPTION KEYS ** for the provided User.

func (*Domain) ActorID added in v0.7.0

func (service *Domain) ActorID() string

ActorID returns the URL for this domain/actor

func (*Domain) Close

func (service *Domain) Close()

Close stops the following service watcher

func (*Domain) Count added in v0.7.0

func (service *Domain) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Domain) Get

func (service *Domain) Get() model.Domain

Load retrieves an Domain from the database (or in-memory cache)

func (*Domain) GetOAuthToken

func (service *Domain) GetOAuthToken(providerID string) (model.Connection, *oauth2.Token, error)

GetAuthToken retrieves the OAuth token for the specified provider. If the token has expired then it is refreshed (and saved) automatically before returning.

func (*Domain) GetPointer added in v0.6.0

func (service *Domain) GetPointer() *model.Domain

func (*Domain) HasRegistrationForm added in v0.7.0

func (service *Domain) HasRegistrationForm() bool

HasRegistrationForm returns TRUE if this domain allows new users to sign up.

func (*Domain) Hostname added in v0.7.0

func (service *Domain) Hostname() string

Hostname returns the domain-only name (no protocol)

func (*Domain) IsLocalhost added in v0.7.0

func (service *Domain) IsLocalhost() bool

IsLocalhost returns TRUE if the current domain is a local domain (localhost, 127.0.0.1, *.local, etc.)

func (*Domain) LoadDomain added in v0.6.0

func (service *Domain) LoadDomain() (model.Domain, error)

func (*Domain) LoadRegistration added in v0.7.0

func (service *Domain) LoadRegistration() model.Registration

func (*Domain) LoadWebFinger added in v0.7.0

func (service *Domain) LoadWebFinger(username string) (digit.Resource, error)

func (*Domain) ManualProvider

func (service *Domain) ManualProvider(providerID string) (providers.ManualProvider, bool)

ManualProvider returns the external.ManualProvider that matches the given providerID

func (*Domain) NewOAuthClient

func (service *Domain) NewOAuthClient(providerID string) (model.Connection, error)

NewOAuthState generates and returns a new OAuth state for the specified provider

func (*Domain) OAuthClientCallbackURL added in v0.6.0

func (service *Domain) OAuthClientCallbackURL(providerID string) string

OAuthClientCallbackURL returns the specific callback URL to use for this host and provider.

func (*Domain) OAuthCodeURL

func (service *Domain) OAuthCodeURL(providerID string) (string, error)

OAuthCodeURL generates a new (unique) OAuth state and AuthCodeURL for the specified provider

func (*Domain) OAuthExchange

func (service *Domain) OAuthExchange(providerID string, state string, code string) error

OAuthExchange trades a temporary OAuth code for a valid OAuth token

func (*Domain) OAuthProvider

func (service *Domain) OAuthProvider(providerID string) (providers.OAuthProvider, bool)

OAuthProvider returns the external.OAuthProvider that matches the given providerID

func (*Domain) ObjectDelete

func (service *Domain) ObjectDelete(object data.Object, note string) error

func (*Domain) ObjectID

func (service *Domain) ObjectID(object data.Object) primitive.ObjectID

func (*Domain) ObjectList

func (service *Domain) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Domain) ObjectLoad

func (service *Domain) ObjectLoad(_ exp.Expression) (data.Object, error)

func (*Domain) ObjectNew

func (service *Domain) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*Domain) ObjectQuery

func (service *Domain) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Domain) ObjectSave

func (service *Domain) ObjectSave(object data.Object, note string) error

func (*Domain) ObjectType

func (service *Domain) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Domain) ObjectUserCan

func (service *Domain) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Domain) PrivateKey added in v0.7.0

func (service *Domain) PrivateKey() (*rsa.PrivateKey, error)

PrivateKey returns the private key for this domain/actor

func (*Domain) Provider

func (service *Domain) Provider(providerID string) (providers.Provider, bool)

Provider returns the external Provider that matches the given providerID

func (*Domain) PublicKeyID added in v0.7.0

func (service *Domain) PublicKeyID() string

PublicKeyID returns the URL for the public key for this domain/actor

func (*Domain) PublicKeyPEM added in v0.7.0

func (service *Domain) PublicKeyPEM() (string, error)

PublicKeyPEM returns the PEM-encoded public key for this domain/actor

func (*Domain) Ready

func (service *Domain) Ready() bool

Ready returns TRUE if the service is ready to use

func (*Domain) Refresh

func (service *Domain) Refresh(collection data.Collection, configuration config.Domain, activityStream *ActivityStream, connectionService *Connection, providerService *Provider, registrationService *Registration, themeService *Theme, userService *User, funcMap template.FuncMap, hostname string)

Refresh updates any stateful data that is cached inside this service.

func (*Domain) Save

func (service *Domain) Save(domain model.Domain, note string) error

Save updates the value of this domain in the database (and in-memory cache)

func (*Domain) Schema

func (service *Domain) Schema() schema.Schema

func (*Domain) Start added in v0.7.0

func (service *Domain) Start() error

Init domain guarantees that a domain record exists in the database. It returns A COPY of the service domain.

func (*Domain) Theme

func (service *Domain) Theme() model.Theme

type DomainEmail

type DomainEmail struct {
	// contains filtered or unexported fields
}

func NewDomainEmail

func NewDomainEmail(serverEmail *ServerEmail) DomainEmail

func (*DomainEmail) Refresh

func (service *DomainEmail) Refresh(configuration config.Domain, domainService *Domain, sterankoService *steranko.Steranko)

func (*DomainEmail) SendFollowerActivity added in v0.7.0

func (service *DomainEmail) SendFollowerActivity(follower model.Follower, activity mapof.Any) error

func (*DomainEmail) SendFollowerConfirmation added in v0.7.0

func (service *DomainEmail) SendFollowerConfirmation(actor model.PersonLink, follower *model.Follower) error

func (*DomainEmail) SendPasswordReset

func (service *DomainEmail) SendPasswordReset(user *model.User) error

SendPasswordReset sends a passowrd reset email to the user. This method swallows errors so that it can be run asynchronously.

func (*DomainEmail) SendWelcome

func (service *DomainEmail) SendWelcome(txn model.RegistrationTxn) error

SendWelcome sends a welcome email to the user. This method returns an error so that it CAN NOT be run asynchronously.

type EncryptionKey

type EncryptionKey struct {
	// contains filtered or unexported fields
}

EncryptionKey defines a service that tracks the (possibly external) accounts an internal User is encryptionKey.

func NewEncryptionKey

func NewEncryptionKey() EncryptionKey

NewEncryptionKey returns a fully initialized EncryptionKey service

func (*EncryptionKey) Close

func (service *EncryptionKey) Close()

Close stops any background processes controlled by this service

func (*EncryptionKey) Count added in v0.7.0

func (service *EncryptionKey) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*EncryptionKey) Create

func (service *EncryptionKey) Create(parentType string, parentID primitive.ObjectID) (model.EncryptionKey, error)

func (*EncryptionKey) Delete

func (service *EncryptionKey) Delete(encryptionKey *model.EncryptionKey, note string) error

Delete removes an EncryptionKey from the database (virtual delete)

func (*EncryptionKey) GetPrivateKey

func (service *EncryptionKey) GetPrivateKey(encryptionKey *model.EncryptionKey) (*rsa.PrivateKey, error)

func (*EncryptionKey) GetPublicKey

func (service *EncryptionKey) GetPublicKey(encryptionKey *model.EncryptionKey) (*rsa.PublicKey, error)

func (*EncryptionKey) KeyID

func (service *EncryptionKey) KeyID(encryptionKey *model.EncryptionKey) string

KeyID returns the publicly accessible URL of this EncryptionKey

func (*EncryptionKey) List

func (service *EncryptionKey) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the EncryptionKeys who match the provided criteria

func (*EncryptionKey) Load

func (service *EncryptionKey) Load(criteria exp.Expression, encryptionKey *model.EncryptionKey) error

Load retrieves an EncryptionKey from the database

func (*EncryptionKey) LoadByParentID added in v0.6.0

func (service *EncryptionKey) LoadByParentID(parentType string, parentID primitive.ObjectID, encryptionKey *model.EncryptionKey) error

LoadByID tries to load the EncryptionKey from the database. If no key exists for the designated user, then a new one is generated.

func (*EncryptionKey) OwnerID

func (service *EncryptionKey) OwnerID(encryptionKey *model.EncryptionKey) string

OwnerID returns the publicly accessible URL of the Actor who owns this EncryptionKey

func (*EncryptionKey) Refresh

func (service *EncryptionKey) Refresh(collection data.Collection, host string)

Refresh updates any stateful data that is cached inside this service.

func (*EncryptionKey) Save

func (service *EncryptionKey) Save(encryptionKey *model.EncryptionKey, note string) error

Save adds/updates an EncryptionKey in the database

func (*EncryptionKey) Sign

func (service *EncryptionKey) Sign(message []byte, encryptionKey *model.EncryptionKey) ([]byte, error)

func (*EncryptionKey) Verify

func (service *EncryptionKey) Verify(message []byte, signature []byte, encryptionKey *model.EncryptionKey) error

type Filesystem

type Filesystem struct {
	// contains filtered or unexported fields
}

Filesystem is a service that multiplexes between different filesystems. Currently works with embedded filesystems and file:// URIs

func NewFilesystem

func NewFilesystem(embedded fs.FS) Filesystem

NewFilesytem returns a fully initialized Filesystem service

func (*Filesystem) GetAfero

func (filesystem *Filesystem) GetAfero(folder mapof.String) (afero.Fs, error)

GetAfero returns READ/WRITE a filesystem. It works with file:// URIs

func (*Filesystem) GetAferos

func (filesystem *Filesystem) GetAferos(folders ...mapof.String) []afero.Fs

GetAferos returns multiple afero filesystems

func (*Filesystem) GetFS

func (filesystem *Filesystem) GetFS(folder mapof.String) (fs.FS, error)

GetFS returns a READONLY Filesystem. It works with embed:// and file:// URIs

func (*Filesystem) GetFSs

func (filesystem *Filesystem) GetFSs(folders ...mapof.String) []fs.FS

GetFSs returns multiple fs.FS filesystems

func (*Filesystem) Watch

func (filesystem *Filesystem) Watch(folder mapof.String, changes chan<- bool, done <-chan channel.Done) error

Watch listens to changes to this filesystem with implementation-specific adapters. Currently only supports file:// URIs

type Folder

type Folder struct {
	// contains filtered or unexported fields
}

Folder manages all interactions with a user's Folder

func NewFolder

func NewFolder() Folder

NewFolder returns a fully populated Folder service

func (*Folder) CalculateUnreadCount added in v0.6.0

func (service *Folder) CalculateUnreadCount(userID primitive.ObjectID, folderID primitive.ObjectID) error

CalculateUnreadCount counts the number of items in a folder that were created AFTER the provided minRank, then updates the folder's "unreadCount" and "readDate" fields

func (*Folder) Close

func (service *Folder) Close()

Close stops any background processes controlled by this service

func (*Folder) Count added in v0.7.0

func (service *Folder) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Folder) CreateDefaultFolders

func (service *Folder) CreateDefaultFolders(userID primitive.ObjectID) error

func (*Folder) Delete

func (service *Folder) Delete(folder *model.Folder, note string) error

Delete removes an Folder from the database (virtual delete)

func (*Folder) List

func (service *Folder) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Folders that match the provided criteria

func (*Folder) ListByUserID

func (service *Folder) ListByUserID(userID primitive.ObjectID) (data.Iterator, error)

ListByUserID returns an iterator containing all of the Folders for a given user

func (*Folder) Load

func (service *Folder) Load(criteria exp.Expression, result *model.Folder) error

Load retrieves an Folder from the database

func (*Folder) LoadByID

func (service *Folder) LoadByID(userID primitive.ObjectID, folderID primitive.ObjectID, result *model.Folder) error

LoadByID loads a single stream that matches the provided ID

func (*Folder) LoadByLabel

func (service *Folder) LoadByLabel(userID primitive.ObjectID, label string, result *model.Folder) error

LoadByLabel loads a single stream that matches the provided label

func (*Folder) LoadByOriginURL

func (service *Folder) LoadByOriginURL(userID primitive.ObjectID, originURL string, result *model.Folder) error

LoadBySource locates a single stream that matches the provided OriginURL

func (*Folder) LoadByToken

func (service *Folder) LoadByToken(userID primitive.ObjectID, token string, result *model.Folder) error

LoadByToken loads a single stream that matches the provided token

func (*Folder) New

func (service *Folder) New() model.Folder

New creates a newly initialized Folder that is ready to use

func (*Folder) ObjectDelete

func (service *Folder) ObjectDelete(object data.Object, comment string) error

func (*Folder) ObjectID

func (service *Folder) ObjectID(object data.Object) primitive.ObjectID

func (*Folder) ObjectList

func (service *Folder) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Folder) ObjectLoad

func (service *Folder) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Folder) ObjectNew

func (service *Folder) ObjectNew() data.Object

New returns a fully initialized model.Group as a data.Object.

func (*Folder) ObjectQuery

func (service *Folder) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Folder) ObjectSave

func (service *Folder) ObjectSave(object data.Object, comment string) error

func (*Folder) ObjectType

func (service *Folder) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Folder) ObjectUserCan

func (service *Folder) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Folder) Query

func (service *Folder) Query(criteria exp.Expression, options ...option.Option) ([]model.Folder, error)

Query returns a slice of Folders that math the provided criteria

func (*Folder) QueryByUserID

func (service *Folder) QueryByUserID(userID primitive.ObjectID) ([]model.Folder, error)

QueryByUserID returns all folders for a given user

func (*Folder) ReCalculateUnreadCountFromFolder added in v0.6.0

func (service *Folder) ReCalculateUnreadCountFromFolder(userID primitive.ObjectID, folderID primitive.ObjectID) error

func (*Folder) Refresh

func (service *Folder) Refresh(collection data.Collection, themeService *Theme, domainService *Domain, inboxService *Inbox)

Refresh updates any stateful data that is cached inside this service.

func (*Folder) Save

func (service *Folder) Save(folder *model.Folder, note string) error

Save adds/updates an Folder in the database

func (*Folder) Schema

func (service *Folder) Schema() schema.Schema

func (*Folder) SetUnreadCount added in v0.6.0

func (service *Folder) SetUnreadCount(userID primitive.ObjectID, folderID primitive.ObjectID, unreadCount int) error

SetUnreadCount uses an optimized query to update the the "readDate" and "unreadCount" of a particular folder

type FolderLookupProvider

type FolderLookupProvider struct {
	// contains filtered or unexported fields
}

func NewFolderLookupProvider

func NewFolderLookupProvider(folderService *Folder, userID primitive.ObjectID) FolderLookupProvider

func (FolderLookupProvider) Add

func (service FolderLookupProvider) Add(name string) (string, error)

func (FolderLookupProvider) Get

func (service FolderLookupProvider) Get() []form.LookupCode

func (FolderLookupProvider) Group

func (service FolderLookupProvider) Group(name string) form.LookupGroup

type Follower

type Follower struct {
	// contains filtered or unexported fields
}

func NewFollower

func NewFollower() Follower

NewFollower returns a fully initialized Follower service

func (*Follower) ActivityPubFollowersChannel added in v0.6.0

func (service *Follower) ActivityPubFollowersChannel(parentType string, parentID primitive.ObjectID) (<-chan model.Follower, error)

ActivityPubFollowersChannel returns a channel containing all of the Followers of specific parentID who use ActivityPub for updates

func (*Follower) ActivityPubID

func (service *Follower) ActivityPubID(follower *model.Follower) string

func (*Follower) ActivityPubObjectID

func (service *Follower) ActivityPubObjectID(follower *model.Follower) string

func (*Follower) AsJSONLD

func (service *Follower) AsJSONLD(follower *model.Follower) mapof.Any

func (*Follower) Channel added in v0.6.0

func (service *Follower) Channel(criteria exp.Expression, options ...option.Option) (<-chan model.Follower, error)

Channel returns a channel containing all of the Followers who match the provided criteria

func (*Follower) Close

func (service *Follower) Close()

Close stops any background processes controlled by this service

func (*Follower) Count added in v0.7.0

func (service *Follower) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Follower) Delete

func (service *Follower) Delete(follower *model.Follower, note string) error

Delete removes an Follower from the database (virtual delete)

func (*Follower) EmailFollowersChannel added in v0.7.0

func (service *Follower) EmailFollowersChannel(parentType string, parentID primitive.ObjectID) (<-chan model.Follower, error)

func (*Follower) FollowersChannel added in v0.6.0

func (service *Follower) FollowersChannel(parentType string, parentID primitive.ObjectID) (<-chan model.Follower, error)

FollowersChannel returns a channel containing all of the Followers of specific parentID

func (*Follower) IsActivityPubFollower added in v0.6.0

func (service *Follower) IsActivityPubFollower(parentType string, parentID primitive.ObjectID, followerURL string) bool

IsActivityPubFollower searches

func (*Follower) List

func (service *Follower) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Followers who match the provided criteria

func (*Follower) ListActivityPub

func (service *Follower) ListActivityPub(parentID primitive.ObjectID, options ...option.Option) (data.Iterator, error)

ListActivityPub returns an iterator containing all of the Followers of specific parentID

func (*Follower) ListByParent added in v0.6.0

func (service *Follower) ListByParent(parentID primitive.ObjectID, options ...option.Option) (data.Iterator, error)

ListByParent returns an iterator containing all of the Followers of specific parentID

func (*Follower) Load

func (service *Follower) Load(criteria exp.Expression, follower *model.Follower) error

Load retrieves an Follower from the database

func (*Follower) LoadByActivityPubFollower

func (service *Follower) LoadByActivityPubFollower(parentType string, parentID primitive.ObjectID, followerURL string, follower *model.Follower) error

func (*Follower) LoadByActor

func (service *Follower) LoadByActor(parentID primitive.ObjectID, actorID string, follower *model.Follower) error

LoadByActor retrieves an Follower from the database by parentID and actorID

func (*Follower) LoadBySecret added in v0.7.0

func (service *Follower) LoadBySecret(followerID primitive.ObjectID, secret string, follower *model.Follower) error

LoadBySecret loads a follower based on the FollowerID. It confirms that the secret value matches

func (*Follower) LoadByToken

func (service *Follower) LoadByToken(parentID primitive.ObjectID, token string, follower *model.Follower) error

LoadByToken loads a follower using either the FollowerID (if an ObjectID is passed) or the Actor's ProfileURL

func (*Follower) LoadByWebSub

func (service *Follower) LoadByWebSub(objectType string, parentID primitive.ObjectID, callback string, result *model.Follower) error

LoadByWebSub retrieves a follower based on the parentID and callback

func (*Follower) LoadOrCreate

func (service *Follower) LoadOrCreate(parentID primitive.ObjectID, actorID string) (model.Follower, error)

func (*Follower) LoadOrCreateByWebSub added in v0.6.0

func (service *Follower) LoadOrCreateByWebSub(objectType string, parentID primitive.ObjectID, callback string) (model.Follower, error)

LoadOrCreateByWebSub finds a follower based on the parentID and callback. If no follower is found, a new record is created.

func (*Follower) LoadParentActor added in v0.7.0

func (service *Follower) LoadParentActor(follower *model.Follower) (model.PersonLink, error)

func (*Follower) LoadPendingEmailFollower added in v0.7.0

func (service *Follower) LoadPendingEmailFollower(followerID primitive.ObjectID, secret string, follower *model.Follower) error

func (*Follower) NewActivityPubFollower

func (service *Follower) NewActivityPubFollower(parentType string, parentID primitive.ObjectID, actor streams.Document, follower *model.Follower) error

func (*Follower) ObjectDelete

func (service *Follower) ObjectDelete(object data.Object, comment string) error

func (*Follower) ObjectID

func (service *Follower) ObjectID(object data.Object) primitive.ObjectID

func (*Follower) ObjectList

func (service *Follower) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Follower) ObjectLoad

func (service *Follower) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Follower) ObjectNew

func (service *Follower) ObjectNew() data.Object

New returns a fully initialized model.Group as a data.Object.

func (*Follower) ObjectQuery

func (service *Follower) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Follower) ObjectSave

func (service *Follower) ObjectSave(object data.Object, comment string) error

func (*Follower) ObjectType

func (service *Follower) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Follower) ObjectUserCan

func (service *Follower) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Follower) Query

func (service *Follower) Query(criteria exp.Expression, options ...option.Option) ([]model.Follower, error)

func (*Follower) QueryByParent added in v0.7.0

func (service *Follower) QueryByParent(parentType string, parentID primitive.ObjectID, options ...option.Option) ([]model.Follower, error)

func (*Follower) QueryByParentAndDate added in v0.6.0

func (service *Follower) QueryByParentAndDate(parentType string, parentID primitive.ObjectID, method string, maxCreateDate int64, pageSize int) ([]model.Follower, error)

func (*Follower) Range added in v0.7.0

func (service *Follower) Range(criteria exp.Expression, options ...option.Option) (iter.Seq[model.Follower], error)

Range returns a Go 1.23 RangeFunc that iterates over the Followers who match the provided criteria

func (*Follower) RangeByTags added in v0.7.0

func (service *Follower) RangeByTags(tags ...string) (iter.Seq[model.Follower], error)

func (*Follower) Refresh

func (service *Follower) Refresh(collection data.Collection, userService *User, streamService *Stream, ruleService *Rule, domainEmail *DomainEmail, activityService *ActivityStream, queue *queue.Queue, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Follower) RemoteActor added in v0.6.0

func (service *Follower) RemoteActor(follower *model.Follower) (streams.Document, error)

RemoteActor returns the ActivityStream document for a remote Actor for a specific Follower

func (*Follower) Save

func (service *Follower) Save(follower *model.Follower, note string) error

Save adds/updates an Follower in the database

func (*Follower) Schema

func (service *Follower) Schema() schema.Schema

func (*Follower) SendFollowConfirmation added in v0.7.0

func (service *Follower) SendFollowConfirmation(follower *model.Follower) error

SendFollowConfirmation sends an email to an email-type follower with a link to confirm their subscription. Subscriptions are not "ACTIVE" until confirmed.

func (*Follower) WebSubFollowersChannel added in v0.6.0

func (service *Follower) WebSubFollowersChannel(parentType string, parentID primitive.ObjectID) (<-chan model.Follower, error)

WebSubFollowersChannel returns a channel containing all of the Followers of specific parentID who use WebSub for updates

type Following

type Following struct {
	// contains filtered or unexported fields
}

Following manages all interactions with the Following collection

func NewFollowing

func NewFollowing() Following

NewFollowing returns a fully populated Following service.

func (*Following) ActivityPubActorID

func (service *Following) ActivityPubActorID(following *model.Following) string

ActivityPubActorID returns the public URL (ID) of the actor being followed

func (*Following) ActivityPubID

func (service *Following) ActivityPubID(following *model.Following) string

ActivityPubID returns the public URL (ID) of a Following record

func (*Following) AsJSONLD

func (service *Following) AsJSONLD(following *model.Following) mapof.Any

AsJSONLD returns a Following record as a JSON-LD object

func (*Following) Close

func (service *Following) Close()

Close stops the following service watcher

func (*Following) Connect

func (service *Following) Connect(following model.Following) error

Connect attempts to connect to a new URL and determines how to follow it.

func (*Following) Count added in v0.7.0

func (service *Following) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Following) Delete

func (service *Following) Delete(following *model.Following, note string) error

Delete removes an Following from the database (virtual delete)

func (*Following) Disconnect

func (service *Following) Disconnect(following *model.Following)

func (*Following) GetFollowingID added in v0.6.0

func (service *Following) GetFollowingID(userID primitive.ObjectID, uri string) (string, error)

func (*Following) List

func (service *Following) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Following who match the provided criteria

func (*Following) ListActivityPub

func (service *Following) ListActivityPub(userID primitive.ObjectID, options ...option.Option) (data.Iterator, error)

func (*Following) ListByUserID

func (service *Following) ListByUserID(userID primitive.ObjectID) (data.Iterator, error)

ListByUserID returns an iterator of all following for a given userID

func (*Following) ListPollable

func (service *Following) ListPollable() (data.Iterator, error)

ListPollable returns an iterator of all following that are ready to be polled

func (*Following) Load

func (service *Following) Load(criteria exp.Expression, result *model.Following) error

Load retrieves an Following from the database

func (*Following) LoadByID

func (service *Following) LoadByID(userID primitive.ObjectID, followingID primitive.ObjectID, result *model.Following) error

LoadByID retrieves an Following from the database. UserID is required to prevent people from snooping on other's following.

func (*Following) LoadByToken

func (service *Following) LoadByToken(userID primitive.ObjectID, token string, result *model.Following) error

LoadByToken loads an individual following using a string version of the following ID

func (*Following) LoadByURL

func (service *Following) LoadByURL(userID primitive.ObjectID, profileUrl string, result *model.Following) error

LoadByURL loads an individual following using the target URL that is being followed

func (*Following) New

func (service *Following) New() model.Following

New creates a newly initialized Following that is ready to use

func (*Following) ObjectDelete

func (service *Following) ObjectDelete(object data.Object, note string) error

func (*Following) ObjectID

func (service *Following) ObjectID(object data.Object) primitive.ObjectID

ObjectID returns the ID of a following object

func (*Following) ObjectList

func (service *Following) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Following) ObjectLoad

func (service *Following) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Following) ObjectNew

func (service *Following) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*Following) ObjectQuery

func (service *Following) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Following) ObjectSave

func (service *Following) ObjectSave(object data.Object, note string) error

func (*Following) ObjectType

func (service *Following) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Following) ObjectUserCan

func (service *Following) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Following) PurgeInbox

func (service *Following) PurgeInbox(following model.Following) error

PurgeInbox removes all inbox items that are past their expiration date. TODO: LOW: Should this be in the Inbox service?

func (*Following) Query

func (service *Following) Query(criteria exp.Expression, options ...option.Option) ([]model.Following, error)

Query returns an iterator containing all of the Following who match the provided criteria

func (*Following) QueryByFolder

func (service *Following) QueryByFolder(userID primitive.ObjectID, folderID primitive.ObjectID) ([]model.FollowingSummary, error)

QueryByFolder returns a slice of all following for a given user

func (*Following) QueryByFolderAndExp added in v0.6.0

func (service *Following) QueryByFolderAndExp(userID primitive.ObjectID, folderID primitive.ObjectID, criteria exp.Expression) ([]model.FollowingSummary, error)

QueryByFolderAndExp returns a slice of all following for a given user

func (*Following) QueryByUser

func (service *Following) QueryByUser(userID primitive.ObjectID) ([]model.FollowingSummary, error)

QueryByUser returns a slice of all following for a given user

func (*Following) Refresh

func (service *Following) Refresh(collection data.Collection, streamService *Stream, userService *User, inboxService *Inbox, folderService *Folder, keyService *EncryptionKey, activityService *ActivityStream, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Following) RefreshAndConnect added in v0.6.0

func (service *Following) RefreshAndConnect(following model.Following)

func (*Following) Save

func (service *Following) Save(following *model.Following, note string) error

Save adds/updates an Following in the database

func (*Following) SaveMessage added in v0.6.0

func (service *Following) SaveMessage(following *model.Following, document streams.Document, originType string) error

saveToInbox adds/updates an individual Message based on an RSS item. It returns TRUE if a new record was created

func (*Following) Schema

func (service *Following) Schema() schema.Schema

func (*Following) SetStatusFailure added in v0.6.0

func (service *Following) SetStatusFailure(following *model.Following, statusMessage string) error

SetStatusFailure updates a Following record to the "Failure" status and increments the error count.

func (*Following) SetStatusLoading added in v0.6.0

func (service *Following) SetStatusLoading(following *model.Following) error

SetStatusLoading updates a Following record with the "Loading" status

func (*Following) SetStatusSuccess added in v0.6.0

func (service *Following) SetStatusSuccess(following *model.Following) error

SetStatusSuccess updates a Following record with the "Success" status and resets the error count to zero.

func (*Following) Start

func (service *Following) Start()

Start begins the background scheduler that checks each following according to its own polling frequency TODO: HIGH: Need to make this configurable on a per-physical-server basis so that clusters can work together without hammering the Following collection.

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group manages all interactions with the Group collection

func NewGroup

func NewGroup() Group

NewGroup returns a fully populated Group service

func (*Group) Close

func (service *Group) Close()

Close stops any background processes controlled by this service

func (*Group) Count

func (service *Group) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Group) Delete

func (service *Group) Delete(group *model.Group, note string) error

Delete removes an Group from the database (virtual delete)

func (*Group) List

func (service *Group) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Groups who match the provided criteria

func (*Group) ListAsOptions

func (service *Group) ListAsOptions() []form.LookupCode

func (*Group) ListByGroup

func (service *Group) ListByGroup(group string) (data.Iterator, error)

ListByGroup returns all groups that match a provided group name

func (*Group) ListByIDs

func (service *Group) ListByIDs(groupIDs ...primitive.ObjectID) ([]model.Group, error)

func (*Group) Load

func (service *Group) Load(criteria exp.Expression, result *model.Group) error

Load retrieves an Group from the database

func (*Group) LoadByID

func (service *Group) LoadByID(groupID primitive.ObjectID, result *model.Group) error

LoadByID loads a single model.Group object that matches the provided groupID

func (*Group) LoadByToken

func (service *Group) LoadByToken(token string, result *model.Group) error

LoadByToken loads a single Group object that matches the provided token

func (*Group) ObjectDelete

func (service *Group) ObjectDelete(object data.Object, comment string) error

func (*Group) ObjectID

func (service *Group) ObjectID(object data.Object) primitive.ObjectID

func (*Group) ObjectList

func (service *Group) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Group) ObjectLoad

func (service *Group) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Group) ObjectNew

func (service *Group) ObjectNew() data.Object

New returns a fully initialized model.Group as a data.Object.

func (*Group) ObjectQuery

func (service *Group) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Group) ObjectSave

func (service *Group) ObjectSave(object data.Object, comment string) error

func (*Group) ObjectType

func (service *Group) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Group) ObjectUserCan

func (service *Group) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Group) Query

func (service *Group) Query(criteria exp.Expression, options ...option.Option) ([]model.Group, error)

func (*Group) Refresh

func (service *Group) Refresh(collection data.Collection)

Refresh updates any stateful data that is cached inside this service.

func (*Group) Save

func (service *Group) Save(group *model.Group, note string) error

Save adds/updates an Group in the database

func (*Group) Schema

func (service *Group) Schema() schema.Schema

func (*Group) Startup added in v0.6.0

func (service *Group) Startup(theme *model.Theme) error

type GroupLookupProvider

type GroupLookupProvider struct {
	// contains filtered or unexported fields
}

func NewGroupLookupProvider

func NewGroupLookupProvider(groupService *Group) GroupLookupProvider

func (GroupLookupProvider) Add

func (service GroupLookupProvider) Add(name string) (string, error)

func (GroupLookupProvider) Get

func (service GroupLookupProvider) Get() []form.LookupCode

type Icons

type Icons struct{}

func (Icons) Get

func (service Icons) Get(name string) string

func (Icons) Write

func (service Icons) Write(name string, writer io.Writer)

type Inbox

type Inbox struct {
	// contains filtered or unexported fields
}

Inbox manages all Inbox records for a User. This includes Inbox and Outbox

func NewInbox

func NewInbox() Inbox

NewInbox returns a fully populated Inbox service

func (*Inbox) CalculateRank

func (service *Inbox) CalculateRank(message *model.Message)

CalculateRank generates a unique rank for the message based on the PublishDate and the number of messages that already exist in the database with this PublishDate.

func (*Inbox) Close

func (service *Inbox) Close()

Close stops any background processes controlled by this service

func (*Inbox) Count added in v0.7.0

func (service *Inbox) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Inbox) CountUnreadMessages added in v0.6.0

func (service *Inbox) CountUnreadMessages(userID primitive.ObjectID, folderID primitive.ObjectID) (int, error)

CountUnreadMessages counts the number of messages for a user/folder that are marked "unread".

func (*Inbox) Delete

func (service *Inbox) Delete(message *model.Message, note string) error

Delete removes an Inbox from the database (virtual delete)

func (*Inbox) DeleteByFolder

func (service *Inbox) DeleteByFolder(userID primitive.ObjectID, folderID primitive.ObjectID) error

func (*Inbox) DeleteByOrigin

func (service *Inbox) DeleteByOrigin(internalID primitive.ObjectID, note string) error

func (*Inbox) DeleteMany

func (service *Inbox) DeleteMany(criteria exp.Expression, note string) error

DeleteMany removes all child streams from the provided stream (virtual delete)

func (*Inbox) List

func (service *Inbox) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Activities that match the provided criteria

func (*Inbox) ListByFolder

func (service *Inbox) ListByFolder(userID primitive.ObjectID, folderID primitive.ObjectID) (data.Iterator, error)

func (*Inbox) ListByFollowingID

func (service *Inbox) ListByFollowingID(userID primitive.ObjectID, followingID primitive.ObjectID) (data.Iterator, error)

func (*Inbox) Load

func (service *Inbox) Load(criteria exp.Expression, result *model.Message) error

Load retrieves an Inbox from the database

func (*Inbox) LoadByID

func (service *Inbox) LoadByID(userID primitive.ObjectID, messageID primitive.ObjectID, result *model.Message) error

func (*Inbox) LoadByRank

func (service *Inbox) LoadByRank(userID primitive.ObjectID, folderID primitive.ObjectID, rankExpression exp.Expression, result *model.Message, options ...option.Option) error

func (*Inbox) LoadByURL

func (service *Inbox) LoadByURL(userID primitive.ObjectID, url string, result *model.Message) error

LoadByURL returns the first message that matches the provided UserID and URL

func (*Inbox) LoadOldestUnread added in v0.6.0

func (service *Inbox) LoadOldestUnread(userID primitive.ObjectID, message *model.Message) error

func (*Inbox) LoadSibling added in v0.6.0

func (service *Inbox) LoadSibling(folderID primitive.ObjectID, rank int64, following string, direction string) (model.Message, error)

LoadSibling searches for the previous/next sibling to the provided message criteria.

func (*Inbox) LoadUnreadByURL added in v0.6.0

func (service *Inbox) LoadUnreadByURL(userID primitive.ObjectID, url string, result *model.Message) error

LoadUnreadByURL returns the first UNREAD message that matches the provided UserID and URL

func (*Inbox) MarkMuted added in v0.6.0

func (service *Inbox) MarkMuted(message *model.Message) error

func (*Inbox) MarkRead added in v0.6.0

func (service *Inbox) MarkRead(message *model.Message) error

MarkRead updates a message to "READ" status and recalculates statistics

func (*Inbox) MarkReadByDate added in v0.6.0

func (service *Inbox) MarkReadByDate(userID primitive.ObjectID, rank int64) error

func (*Inbox) MarkUnmuted added in v0.6.0

func (service *Inbox) MarkUnmuted(message *model.Message) error

func (*Inbox) MarkUnread added in v0.6.0

func (service *Inbox) MarkUnread(message *model.Message) error

MarkRead updates a message to "UNREAD" status and recalculates statistics

func (*Inbox) New

func (service *Inbox) New() model.Message

New creates a newly initialized Inbox that is ready to use

func (*Inbox) ObjectDelete

func (service *Inbox) ObjectDelete(object data.Object, note string) error

func (*Inbox) ObjectID

func (service *Inbox) ObjectID(object data.Object) primitive.ObjectID

func (*Inbox) ObjectList

func (service *Inbox) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Inbox) ObjectLoad

func (service *Inbox) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Inbox) ObjectNew

func (service *Inbox) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*Inbox) ObjectQuery

func (service *Inbox) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Inbox) ObjectSave

func (service *Inbox) ObjectSave(object data.Object, note string) error

func (*Inbox) ObjectType

func (service *Inbox) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Inbox) ObjectUserCan

func (service *Inbox) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Inbox) Query

func (service *Inbox) Query(criteria exp.Expression, options ...option.Option) ([]model.Message, error)

Query returns a slice containing all of the Activities that match the provided criteria

func (*Inbox) QueryByUserID

func (service *Inbox) QueryByUserID(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.Message, error)

func (*Inbox) QueryPurgeable

func (service *Inbox) QueryPurgeable(following *model.Following) ([]model.Message, error)

QueryPurgeable returns a list of Inboxs that are older than the purge date for this following TODO: HIGH: ReadDate is gone. Need another way to purge messages.

func (*Inbox) Refresh

func (service *Inbox) Refresh(collection data.Collection, ruleService *Rule, folderService *Folder, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Inbox) Save

func (service *Inbox) Save(message *model.Message, note string) error

Save adds/updates an Inbox in the database

func (*Inbox) Schema

func (service *Inbox) Schema() schema.Schema

func (*Inbox) UpdateInboxFolders

func (service *Inbox) UpdateInboxFolders(userID primitive.ObjectID, followingID primitive.ObjectID, folderID primitive.ObjectID)

type JWT

type JWT struct {
	// contains filtered or unexported fields
}

JWT is a service that generates and validates JWT keys.

func NewJWT added in v0.6.0

func NewJWT() JWT

func (*JWT) Close added in v0.6.0

func (service *JWT) Close()

func (*JWT) FindKey added in v0.7.0

func (service *JWT) FindKey(token *jwt.Token) (any, error)

FindKey returns the key named in the token. It uses a cache to store frequently used keys, and a database for persistent storage. This method is a part of the steranko.KeyService interface.

func (*JWT) GetCurrentKey added in v0.7.0

func (service *JWT) GetCurrentKey() (string, any, error)

GetCurrentKey returns a the currently in-use encryption key. This method is a part of the steranko.KeyService interface.

func (*JWT) Parse added in v0.6.0

func (service *JWT) Parse(request *http.Request) (*jwt.Token, error)

Parse retrieves a JWT token from the request, and parses it into a JWT token. This method is a part of the steranko.KeyService interface.

func (*JWT) ParseString added in v0.6.0

func (service *JWT) ParseString(tokenString string) (*jwt.Token, error)

func (*JWT) Refresh added in v0.6.0

func (service *JWT) Refresh(collection data.Collection, keyEncryptingKey []byte)

type Locator

type Locator struct {
	// contains filtered or unexported fields
}

func NewLocator

func NewLocator(userService *User, streamService *Stream, host string) Locator

func (Locator) GetObjectFromURL

func (service Locator) GetObjectFromURL(value string) (string, primitive.ObjectID, error)

GetObjectFromURL parses a URL and verifies the existence of the referenced object.

type LookupProvider

type LookupProvider struct {
	// contains filtered or unexported fields
}

func NewLookupProvider

func NewLookupProvider(domainService *Domain, folderService *Folder, groupService *Group, registrationService *Registration, searchTagService *SearchTag, templateService *Template, themeService *Theme, userID primitive.ObjectID) LookupProvider

func (LookupProvider) Group

func (service LookupProvider) Group(path string) form.LookupGroup

type Mention

type Mention struct {
	// contains filtered or unexported fields
}

Mention defines a service that can send and receive mention data

func NewMention

func NewMention() Mention

NewMention returns a fully initialized Mention service

func (*Mention) Close

func (service *Mention) Close()

Close stops any background processes controlled by this service

func (*Mention) Count added in v0.7.0

func (service *Mention) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Mention) Delete

func (service *Mention) Delete(mention *model.Mention, note string) error

Delete removes an Mention from the database (virtual delete)

func (*Mention) DiscoverEndpoint

func (service *Mention) DiscoverEndpoint(url string) (string, error)

DiscoverEndpoint tries to find the Mention endpoint for the provided URL

func (service *Mention) FindLinks(body string) []string

func (*Mention) GetPageInfo added in v0.6.0

func (service *Mention) GetPageInfo(body *bytes.Buffer, originURL string, mention *model.Mention) error

TODO: HIGH: This should use a common service to get URL data from Microformats, OpenGraph, JSON-LD, etc.

func (*Mention) List

func (service *Mention) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Mentions that match the provided criteria

func (*Mention) Load

func (service *Mention) Load(criteria exp.Expression, mention *model.Mention) error

Load retrieves an Mention from the database

func (*Mention) LoadByOrigin added in v0.6.0

func (service *Mention) LoadByOrigin(objectType string, objectID primitive.ObjectID, originURL string, result *model.Mention) error

LoadByOrigin loads an existing Mention by its type/objectID/origin URL

func (*Mention) LoadOrCreate added in v0.6.0

func (service *Mention) LoadOrCreate(objectType string, objectID primitive.ObjectID, originURL string) (model.Mention, error)

LoadOrCreate loads an existing Mention or creates a new one if it doesn't exist

func (*Mention) ObjectDelete

func (service *Mention) ObjectDelete(object data.Object, comment string) error

func (*Mention) ObjectID

func (service *Mention) ObjectID(object data.Object) primitive.ObjectID

func (*Mention) ObjectList

func (service *Mention) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Mention) ObjectLoad

func (service *Mention) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Mention) ObjectNew

func (service *Mention) ObjectNew() data.Object

New returns a fully initialized model.Group as a data.Object.

func (*Mention) ObjectQuery

func (service *Mention) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Mention) ObjectSave

func (service *Mention) ObjectSave(object data.Object, comment string) error

func (*Mention) ObjectType

func (service *Mention) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Mention) ObjectUserCan

func (service *Mention) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Mention) ParseURL added in v0.6.0

func (service *Mention) ParseURL(target string) (objectType string, token string, err error)

TODO: LOW: This should just use the Locator service. ParseURL inspects a target URL and determines what kind of object it is and what the token is.

func (*Mention) Query

func (service *Mention) Query(criteria exp.Expression, options ...option.Option) ([]model.Mention, error)

Query returns a slice containing all of the Mentions that match the provided criteria

func (*Mention) QueryByObjectID

func (service *Mention) QueryByObjectID(objectID primitive.ObjectID, options ...option.Option) ([]model.Mention, error)

func (*Mention) Refresh

func (service *Mention) Refresh(collection data.Collection, ruleService *Rule, activityService *ActivityStream, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Mention) Save

func (service *Mention) Save(mention *model.Mention, note string) error

Save adds/updates an Mention in the database

func (*Mention) Schema

func (service *Mention) Schema() schema.Schema

func (*Mention) Send

func (service *Mention) Send(source string, target string) error

Send will send a mention to the target's endpoint

func (*Mention) Verify

func (service *Mention) Verify(source string, target string, buffer io.Writer) error

Verify confirms that the source document includes a link to the target document

type ModelService

type ModelService interface {
	ObjectType() string
	ObjectID(data.Object) primitive.ObjectID
	ObjectNew() data.Object
	ObjectQuery(any, exp.Expression, ...option.Option) error
	ObjectList(exp.Expression, ...option.Option) (data.Iterator, error)
	ObjectLoad(exp.Expression) (data.Object, error)
	ObjectSave(data.Object, string) error
	ObjectDelete(data.Object, string) error
	ObjectUserCan(data.Object, model.Authorization, string) error
	Count(exp.Expression) (int64, error)
	Schema() schema.Schema
}

ModelService interface wraps the generic Object-* functions that standard services provide

type OAuthClient added in v0.6.0

type OAuthClient struct {
	// contains filtered or unexported fields
}

OAuthClient manages all interactions with the OAuthClient collection

func NewOAuthClient added in v0.6.0

func NewOAuthClient() OAuthClient

NewOAuthClient returns a fully populated OAuthClient service.

func (*OAuthClient) Close added in v0.6.0

func (service *OAuthClient) Close()

Close stops any background processes controlled by this service

func (*OAuthClient) Count added in v0.7.0

func (service *OAuthClient) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*OAuthClient) Delete added in v0.6.0

func (service *OAuthClient) Delete(app *model.OAuthClient, note string) error

Delete removes an OAuthClient from the database (virtual delete)

func (*OAuthClient) Iterator added in v0.6.0

func (service *OAuthClient) Iterator(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

Iterator returns an iterator containing all of the OAuthClients that match the provided criteria

func (*OAuthClient) Load added in v0.6.0

func (service *OAuthClient) Load(criteria exp.Expression, application *model.OAuthClient) error

Load retrieves an OAuthClient from the database

func (*OAuthClient) LoadByClientID added in v0.6.0

func (service *OAuthClient) LoadByClientID(clientID primitive.ObjectID, client *model.OAuthClient) error

LoadByClientID loads a single application using the "client_id" field (which is just a stringified ObjectID)

func (*OAuthClient) Query added in v0.6.0

func (service *OAuthClient) Query(criteria exp.Expression, options ...option.Option) ([]model.OAuthClient, error)

Query returns an slice containing all of the OAuthClients that match the provided criteria

func (*OAuthClient) Refresh added in v0.6.0

func (service *OAuthClient) Refresh(collection data.Collection, oauthUserTokenService *OAuthUserToken, host string)

Refresh updates any stateful data that is cached inside this service.

func (*OAuthClient) Save added in v0.6.0

func (service *OAuthClient) Save(app *model.OAuthClient, note string) error

Save adds/updates an OAuthClient in the database

func (*OAuthClient) Schema added in v0.6.0

func (service *OAuthClient) Schema() schema.Schema

func (*OAuthClient) ValidateClientSecret added in v0.6.0

func (service *OAuthClient) ValidateClientSecret(clientID primitive.ObjectID, clientSecret string) error

type OAuthUserToken added in v0.6.0

type OAuthUserToken struct {
	// contains filtered or unexported fields
}

OAuthUserToken manages all interactions with the OAuthUserToken collection

func NewOAuthUserToken added in v0.6.0

func NewOAuthUserToken() OAuthUserToken

NewOAuthUserToken returns a fully populated OAuthUserToken service.

func (*OAuthUserToken) Close added in v0.6.0

func (service *OAuthUserToken) Close()

Close stops any background processes controlled by this service

func (*OAuthUserToken) Count added in v0.7.0

func (service *OAuthUserToken) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*OAuthUserToken) Create added in v0.6.0

func (service *OAuthUserToken) Create(client model.OAuthClient, authorization model.Authorization, transaction model.OAuthAuthorizationRequest) (model.OAuthUserToken, error)

Create creates a new OAuthUserToken for the provided application and authorization

func (*OAuthUserToken) CreateFromUser added in v0.6.0

func (service *OAuthUserToken) CreateFromUser(user *model.User, clientID primitive.ObjectID, scope string) (model.OAuthUserToken, error)

func (*OAuthUserToken) Delete added in v0.6.0

func (service *OAuthUserToken) Delete(application *model.OAuthUserToken, note string) error

Delete removes an OAuthUserToken from the database (virtual delete)

func (*OAuthUserToken) DeleteByClient added in v0.6.0

func (service *OAuthUserToken) DeleteByClient(clientID primitive.ObjectID, note string) error

func (*OAuthUserToken) DeleteMany added in v0.6.0

func (service *OAuthUserToken) DeleteMany(criteria exp.Expression, note string) error

DeleteMany removes all child streams from the provided stream (virtual delete)

func (*OAuthUserToken) Iterator added in v0.6.0

func (service *OAuthUserToken) Iterator(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

Iterator returns an iterator containing all of the OAuthUserTokens that match the provided criteria

func (*OAuthUserToken) JWT added in v0.6.0

func (service *OAuthUserToken) JWT(userID primitive.ObjectID, scopes string) (string, error)

JWT encodes an OAuthUserToken as a new JWT.

func (*OAuthUserToken) Load added in v0.6.0

func (service *OAuthUserToken) Load(criteria exp.Expression, application *model.OAuthUserToken) error

Load retrieves an OAuthUserToken from the database

func (*OAuthUserToken) LoadByClientAndCode added in v0.6.0

func (service *OAuthUserToken) LoadByClientAndCode(userTokenID primitive.ObjectID, clientID primitive.ObjectID, clientSecret string, result *model.OAuthUserToken) error

func (*OAuthUserToken) LoadByClientAndToken added in v0.6.0

func (service *OAuthUserToken) LoadByClientAndToken(clientID primitive.ObjectID, clientSecret string, token string, result *model.OAuthUserToken) error

func (*OAuthUserToken) LoadByUserAndClient added in v0.6.0

func (service *OAuthUserToken) LoadByUserAndClient(userID primitive.ObjectID, clientID primitive.ObjectID, result *model.OAuthUserToken) error

func (*OAuthUserToken) Query added in v0.6.0

func (service *OAuthUserToken) Query(criteria exp.Expression, options ...option.Option) ([]model.OAuthUserToken, error)

Query returns an slice containing all of the OAuthUserTokens that match the provided criteria

func (*OAuthUserToken) Refresh added in v0.6.0

func (service *OAuthUserToken) Refresh(collection data.Collection, oauthClientService *OAuthClient, jwtService *JWT, host string)

Refresh updates any stateful data that is cached inside this service.

func (*OAuthUserToken) Save added in v0.6.0

func (service *OAuthUserToken) Save(application *model.OAuthUserToken, note string) error

Save adds/updates an OAuthUserToken in the database

func (*OAuthUserToken) Schema added in v0.6.0

func (service *OAuthUserToken) Schema() schema.Schema

type Outbox added in v0.6.0

type Outbox struct {
	// contains filtered or unexported fields
}

Outbox manages all Outbox records for a User. This includes Outbox and Outbox

func NewOutbox added in v0.6.0

func NewOutbox() Outbox

NewOutbox returns a fully populated Outbox service

func (*Outbox) Close added in v0.6.0

func (service *Outbox) Close()

Close stops any background processes controlled by this service

func (*Outbox) Count added in v0.7.0

func (service *Outbox) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Outbox) Delete added in v0.6.0

func (service *Outbox) Delete(outboxMessage *model.OutboxMessage, note string) error

Delete removes an Outbox from the database (virtual delete)

func (*Outbox) DeleteByParentID added in v0.7.0

func (service *Outbox) DeleteByParentID(parentType string, parentID primitive.ObjectID) error

func (*Outbox) DeleteByURL added in v0.6.0

func (service *Outbox) DeleteByURL(parentType string, parentID primitive.ObjectID, url string) error

func (*Outbox) List added in v0.6.0

func (service *Outbox) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Activities that match the provided criteria

func (*Outbox) ListByParentID added in v0.7.0

func (service *Outbox) ListByParentID(parentType string, parentID primitive.ObjectID) (data.Iterator, error)

func (*Outbox) Load added in v0.6.0

func (service *Outbox) Load(criteria exp.Expression, result *model.OutboxMessage) error

Load retrieves an Outbox from the database

func (*Outbox) LoadByURL added in v0.6.0

func (service *Outbox) LoadByURL(parentType string, parentID primitive.ObjectID, url string, result *model.OutboxMessage) error

func (*Outbox) LoadOrCreate added in v0.6.0

func (service *Outbox) LoadOrCreate(parentType string, parentID primitive.ObjectID, url string) (model.OutboxMessage, error)

func (*Outbox) New added in v0.6.0

func (service *Outbox) New() model.OutboxMessage

New creates a newly initialized Outbox that is ready to use

func (*Outbox) ObjectDelete added in v0.7.0

func (service *Outbox) ObjectDelete(object data.Object, note string) error

func (*Outbox) ObjectID added in v0.7.0

func (service *Outbox) ObjectID(object data.Object) primitive.ObjectID

func (*Outbox) ObjectList added in v0.7.0

func (service *Outbox) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Outbox) ObjectLoad added in v0.7.0

func (service *Outbox) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Outbox) ObjectNew added in v0.7.0

func (service *Outbox) ObjectNew() data.Object

New returns a fully initialized model.OutboxMessage as a data.Object.

func (*Outbox) ObjectQuery added in v0.7.0

func (service *Outbox) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Outbox) ObjectSave added in v0.7.0

func (service *Outbox) ObjectSave(object data.Object, note string) error

func (*Outbox) ObjectType added in v0.7.0

func (service *Outbox) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Outbox) ObjectUserCan added in v0.7.0

func (service *Outbox) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Outbox) Publish added in v0.6.0

func (service *Outbox) Publish(actor *outbox.Actor, parentType string, parentID primitive.ObjectID, activity mapof.Any) error

Publish adds an OutboxMessage to the Actor's Outbox and sends notifications to all Followers.

func (*Outbox) Query added in v0.6.0

func (service *Outbox) Query(criteria exp.Expression, options ...option.Option) ([]model.OutboxMessage, error)

Query returns a slice containing all of the Activities that match the provided criteria

func (*Outbox) QueryByParentAndDate added in v0.7.0

func (service *Outbox) QueryByParentAndDate(parentType string, parentID primitive.ObjectID, maxDate int64, maxRows int) ([]model.OutboxMessageSummary, error)

func (*Outbox) QueryByParentID added in v0.6.0

func (service *Outbox) QueryByParentID(parentType string, parentID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.OutboxMessage, error)

func (*Outbox) Refresh added in v0.6.0

func (service *Outbox) Refresh(collection data.Collection, streamService *Stream, activityService *ActivityStream, followerService *Follower, templateService *Template, userService *User, domainEmail *DomainEmail, queue *queue.Queue)

Refresh updates any stateful data that is cached inside this service.

func (*Outbox) Save added in v0.6.0

func (service *Outbox) Save(outboxMessage *model.OutboxMessage, note string) error

Save adds/updates an Outbox in the database

func (*Outbox) Schema added in v0.7.0

func (service *Outbox) Schema() schema.Schema

func (*Outbox) UnPublish added in v0.6.0

func (service *Outbox) UnPublish(actor *outbox.Actor, parentType string, parentID primitive.ObjectID, url string) error

UnPublish deletes an OutboxMessage from the Outbox, and sends notifications to all Followers

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider service manages all access to external services

func NewProvider

func NewProvider(providers []config.Provider) Provider

NewProvider returns a fully initialized Provider service

func (*Provider) GetProvider

func (service *Provider) GetProvider(providerID string) (providers.Provider, bool)

GetProvider returns a populated adapter for the given provider

func (*Provider) Refresh

func (service *Provider) Refresh(providers []config.Provider)

Refresh updates the list of clients

type RSS

type RSS struct {
	// contains filtered or unexported fields
}

RSS service generates RSS feeds of the available streams in the database

func NewRSS

func NewRSS(streamService *Stream, host string) *RSS

NewRSS returns a fully initialized RSS service

func (RSS) Feed

func (rss RSS) Feed(criteria ...exp.Expression) (*feeds.JSONFeed, error)

Feed generates an RSS data feed based on the provided query criteria. This feed has a lot of incomplete data at the top level, so we're expecting the handler that calls this to fill in the rest of the gaps before it passes the values back to the requester.

func (RSS) Item

func (rss RSS) Item(stream model.Stream) *feeds.JSONItem

Item converts a single model.Stream into a feeds.JSONItem

type Registration added in v0.7.0

type Registration struct {
	// contains filtered or unexported fields
}

Registration service manages new user registrations

func NewRegistration added in v0.7.0

func NewRegistration(funcMap template.FuncMap) Registration

NewRegistration returns a fully initialized Registration service

func (*Registration) Add added in v0.7.0

func (service *Registration) Add(registrationID string, filesystem fs.FS, definition []byte) error

Add loads a registration definition from a filesystem, and adds it to the in-memory library.

func (*Registration) List added in v0.7.0

func (service *Registration) List() []form.LookupCode

List returns all registrations that match the provided criteria

func (*Registration) Load added in v0.7.0

func (service *Registration) Load(registrationID string) (model.Registration, error)

func (*Registration) Register added in v0.7.0

func (service *Registration) Register(groupService *Group, userService *User, domain *model.Domain, txn model.RegistrationTxn) (model.User, error)

func (*Registration) UpdateRegistration added in v0.7.0

func (service *Registration) UpdateRegistration(groupService *Group, userService *User, domain *model.Domain, source string, sourceID string, txn model.RegistrationTxn) error

UpdateRegistration updates an existing User with new data from a Registration Transaction

func (*Registration) Validate added in v0.7.0

func (service *Registration) Validate(userService *User, domain *model.Domain, txn model.RegistrationTxn) error

type Response added in v0.6.0

type Response struct {
	// contains filtered or unexported fields
}

Response defines a service that can send and receive response data

func NewResponse added in v0.6.0

func NewResponse() Response

NewResponse returns a fully initialized Response service

func (*Response) Close added in v0.6.0

func (service *Response) Close()

Close stops any background processes controlled by this service

func (*Response) Count added in v0.7.0

func (service *Response) Count(criteria exp.Expression) (int64, error)

Count returns the number of Responses that match the provided criteria

func (*Response) CountByContent added in v0.6.0

func (service *Response) CountByContent(objectID string) (mapof.Int, error)

func (*Response) Delete added in v0.6.0

func (service *Response) Delete(response *model.Response, note string) error

Delete removes an Response from the database (hard delete)

func (*Response) List added in v0.6.0

func (service *Response) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Responses that match the provided criteria

func (*Response) Load added in v0.6.0

func (service *Response) Load(criteria exp.Expression, response *model.Response) error

Load retrieves an Response from the database

func (*Response) LoadByActorAndObject added in v0.6.0

func (service *Response) LoadByActorAndObject(actor string, object string, responseType string, response *model.Response) error

func (*Response) LoadByID added in v0.6.0

func (service *Response) LoadByID(responseID primitive.ObjectID, response *model.Response) error

func (*Response) LoadByUserAndObject added in v0.6.0

func (service *Response) LoadByUserAndObject(userID primitive.ObjectID, object string, responseType string, response *model.Response) error

func (*Response) ObjectDelete added in v0.6.0

func (service *Response) ObjectDelete(object data.Object, note string) error

func (*Response) ObjectID added in v0.6.0

func (service *Response) ObjectID(object data.Object) primitive.ObjectID

func (*Response) ObjectList added in v0.6.0

func (service *Response) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Response) ObjectLoad added in v0.6.0

func (service *Response) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Response) ObjectNew added in v0.6.0

func (service *Response) ObjectNew() data.Object

New returns a fully initialized model.Response as a data.Object.

func (*Response) ObjectQuery added in v0.6.0

func (service *Response) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Response) ObjectSave added in v0.6.0

func (service *Response) ObjectSave(object data.Object, note string) error

func (*Response) ObjectType added in v0.6.0

func (service *Response) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Response) ObjectUserCan added in v0.6.0

func (service *Response) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Response) Query added in v0.6.0

func (service *Response) Query(criteria exp.Expression, options ...option.Option) ([]model.Response, error)

Query returns a slice containing all of the Responses that match the provided criteria

func (*Response) QueryByObjectAndDate added in v0.6.0

func (service *Response) QueryByObjectAndDate(objectID string, responseType string, maxDate int64, pageSize int) ([]model.Response, error)

func (*Response) QueryByUserAndDate added in v0.6.0

func (service *Response) QueryByUserAndDate(userID primitive.ObjectID, responseType string, maxDate int64, pageSize int) ([]model.Response, error)

func (*Response) QueryByUserAndObject added in v0.6.0

func (service *Response) QueryByUserAndObject(userID primitive.ObjectID, object string, options ...option.Option) ([]model.Response, error)

func (*Response) Refresh added in v0.6.0

func (service *Response) Refresh(collection data.Collection, userService *User, outboxService *Outbox, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Response) Save added in v0.6.0

func (service *Response) Save(response *model.Response, note string) error

Save adds/updates an Response in the database

func (*Response) Schema added in v0.6.0

func (service *Response) Schema() schema.Schema

func (*Response) SetResponse added in v0.6.0

func (service *Response) SetResponse(user *model.User, url string, responseType string, content string) error

SetResponse is the preferred way of creating/updating a Response. It includes the business logic to search for an existing response, and delete it if one exists already (publishing UNDO actions in the process).

func (*Response) UnsetResponse added in v0.6.0

func (service *Response) UnsetResponse(user *model.User, url string, responseType string) error

UnsetReponse removes a reponse based on the User, URL, and Response Type

type Rule added in v0.6.0

type Rule struct {
	// contains filtered or unexported fields
}

Rule defines a service that manages all content rules created and imported by Users.

func NewRule added in v0.6.0

func NewRule() Rule

NewRule returns a fully initialized Rule service

func (*Rule) ActivityPubActorURL added in v0.6.0

func (service *Rule) ActivityPubActorURL(rule model.Rule) string

func (*Rule) ActivityPubURL added in v0.6.0

func (service *Rule) ActivityPubURL(rule model.Rule) string

func (*Rule) Channel added in v0.6.0

func (service *Rule) Channel(criteria exp.Expression, options ...option.Option) (<-chan model.Rule, error)

Channel returns a channel that will stream all of the Rules that match the provided criteria

func (*Rule) Close added in v0.6.0

func (service *Rule) Close()

Close stops any background processes controlled by this service

func (*Rule) Count added in v0.7.0

func (service *Rule) Count(criteria exp.Expression) (int64, error)

func (*Rule) Delete added in v0.6.0

func (service *Rule) Delete(rule *model.Rule, note string) error

Delete removes an Rule from the database (virtual delete)

func (*Rule) Filter added in v0.6.0

func (service *Rule) Filter(userID primitive.ObjectID, options ...RuleFilterOption) RuleFilter

func (*Rule) JSONLD added in v0.6.0

func (service *Rule) JSONLD(rule model.Rule) mapof.Any

JSONLD returns a JSON-LD representation of the provided Rule

func (*Rule) JSONLDGetter added in v0.6.0

func (service *Rule) JSONLDGetter(rule model.Rule) RuleJSONLDGetter

JSONLDGetter returns a new JSONLDGetter for the provided stream

func (*Rule) List added in v0.6.0

func (service *Rule) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Rules that match the provided criteria

func (*Rule) Load added in v0.6.0

func (service *Rule) Load(criteria exp.Expression, rule *model.Rule) error

Load retrieves an Rule from the database

func (*Rule) LoadByFollowing added in v0.6.0

func (service *Rule) LoadByFollowing(userID primitive.ObjectID, followingID primitive.ObjectID, ruleType string, trigger string, rule *model.Rule) error

LoadByFollowing retrieves a single Rule that maches the provided User, Following, RuleType, and Trigger

func (*Rule) LoadByID added in v0.6.0

func (service *Rule) LoadByID(userID primitive.ObjectID, ruleID primitive.ObjectID, rule *model.Rule) error

func (*Rule) LoadByToken added in v0.6.0

func (service *Rule) LoadByToken(userID primitive.ObjectID, token string, rule *model.Rule) error

func (*Rule) LoadByTrigger added in v0.6.0

func (service *Rule) LoadByTrigger(userID primitive.ObjectID, ruleType string, trigger string, rule *model.Rule) error

LoadByTrigger retrieves a single Rule that maches the provided User, RuleType, and Trigger

func (*Rule) ObjectDelete added in v0.6.0

func (service *Rule) ObjectDelete(object data.Object, comment string) error

func (*Rule) ObjectID added in v0.6.0

func (service *Rule) ObjectID(object data.Object) primitive.ObjectID

func (*Rule) ObjectList added in v0.6.0

func (service *Rule) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Rule) ObjectLoad added in v0.6.0

func (service *Rule) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Rule) ObjectNew added in v0.6.0

func (service *Rule) ObjectNew() data.Object

New returns a fully initialized model.Group as a data.Object.

func (*Rule) ObjectQuery added in v0.6.0

func (service *Rule) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Rule) ObjectSave added in v0.6.0

func (service *Rule) ObjectSave(object data.Object, comment string) error

func (*Rule) ObjectType added in v0.6.0

func (service *Rule) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Rule) ObjectUserCan added in v0.6.0

func (service *Rule) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Rule) Query added in v0.6.0

func (service *Rule) Query(criteria exp.Expression, options ...option.Option) ([]model.Rule, error)

Query returns an slice of allthe Rules that match the provided criteria

func (*Rule) QueryBlockedActors added in v0.6.0

func (service *Rule) QueryBlockedActors(userID primitive.ObjectID) ([]model.Rule, error)

QueryBlockedActors returns all Actors blocked by this User (or by the Domain on behalf of the User)

func (*Rule) QueryByActor added in v0.6.0

func (service *Rule) QueryByActor(userID primitive.ObjectID, actorID string) ([]model.RuleSummary, error)

QueryByActor retrieves a slice of RuleSummaries that match the provided User and Actor

func (*Rule) QueryByActorAndActions added in v0.6.0

func (service *Rule) QueryByActorAndActions(userID primitive.ObjectID, actorID string, actions ...string) ([]model.RuleSummary, error)

QueryByActorAndActions retrieves a slice of RuleSummaries that match the provided User, Actor, and potential actions

func (*Rule) QueryByType added in v0.6.0

func (service *Rule) QueryByType(userID primitive.ObjectID, ruleType string, criteria exp.Expression, options ...option.Option) ([]model.Rule, error)

func (*Rule) QueryByTypeActor added in v0.6.0

func (service *Rule) QueryByTypeActor(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.Rule, error)

func (*Rule) QueryByTypeContent added in v0.6.0

func (service *Rule) QueryByTypeContent(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.Rule, error)

func (*Rule) QueryByTypeDomain added in v0.6.0

func (service *Rule) QueryByTypeDomain(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.Rule, error)

func (*Rule) QueryDomainBlocks added in v0.6.0

func (service *Rule) QueryDomainBlocks() ([]model.Rule, error)

QueryDomainBlocks returns all external domains blocked by this Instance/Domain.

func (*Rule) QueryPublic added in v0.6.0

func (service *Rule) QueryPublic(userID primitive.ObjectID, maxDate int64, options ...option.Option) ([]model.Rule, error)

QueryPublic returns a collection of Rules that are marked Public, in reverse chronological order.

func (*Rule) QuerySummary added in v0.6.0

func (service *Rule) QuerySummary(criteria exp.Expression, options ...option.Option) ([]model.RuleSummary, error)

QuerySummary returns an slice of allthe Rules that match the provided criteria

func (*Rule) Refresh added in v0.6.0

func (service *Rule) Refresh(collection data.Collection, outboxService *Outbox, userService *User, queue *queue.Queue, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Rule) Save added in v0.6.0

func (service *Rule) Save(rule *model.Rule, note string) error

Save adds/updates an Rule in the database

func (*Rule) Schema added in v0.6.0

func (service *Rule) Schema() schema.Schema

type RuleFilter added in v0.6.0

type RuleFilter struct {
	// contains filtered or unexported fields
}

RuleFilter is a temporary object that filters ActivityStream documents based on the User- and Domain-Rules that are active for a given UserID. Each RuleFilter can be used as many times as needed for a single User and HTTP Request. RuleFilters are not thread-safe, and should not be shared between goroutines.

func NewRuleFilter added in v0.6.0

func NewRuleFilter(ruleService *Rule, userID primitive.ObjectID, options ...RuleFilterOption) RuleFilter

NewRuleFilter returns a fully initialized RuleFilter that is keyed to a specific User.

func (*RuleFilter) Allow added in v0.6.0

func (filter *RuleFilter) Allow(document *streams.Document) bool

Allow returns TRUE if this document is allowed past all User and Domain filters. The document is passed as a pointer because it MAY BE MODIFIED by the filter, for instance, to add a label or other metadata.

func (*RuleFilter) AllowSend added in v0.6.0

func (filter *RuleFilter) AllowSend(actorID string) bool

AllowSend returns TRUE if this actorID is allowed to receive messages.

func (*RuleFilter) Channel added in v0.6.0

func (filter *RuleFilter) Channel(ch <-chan streams.Document) <-chan streams.Document

Channel returns a channel of all documents that are allowed by User/Domain filters. Documents may be modified by filters in the process, for instance, to add content warning labels.

func (*RuleFilter) ChannelSend added in v0.6.0

func (filter *RuleFilter) ChannelSend(ch <-chan model.Follower) <-chan string

ChannelSend inspects the channel of recipients to see if they should receive messages or not.

func (*RuleFilter) Disallow added in v0.6.0

func (filter *RuleFilter) Disallow(document *streams.Document) bool

Disallow returns TRUE if a document is NOT allowed past all User and Domain filters.

func (*RuleFilter) Slice added in v0.6.0

func (filter *RuleFilter) Slice(documents []streams.Document) []streams.Document

Slice returns a slice of all documents from the input that are allowed by User/Domain filters. Documents may be modified by filters in the process, for instance, to add content warning labels.

type RuleFilterOption added in v0.6.0

type RuleFilterOption func(*RuleFilter)

RuleFilterOption defines a functional option that modifies the behavior of a RuleFilter object

func IgnoreBlocks added in v0.6.0

func IgnoreBlocks() RuleFilterOption

IgnoreBlocks returns a RuleFilterOption that prevents `Block` -type rules from being executed

func IgnoreLabels added in v0.6.0

func IgnoreLabels() RuleFilterOption

IgnoreLabels returns a RuleFilterOption that prevents `Label` -type rules from being executed

func IgnoreMutes added in v0.6.0

func IgnoreMutes() RuleFilterOption

IgnoreMutes returns a RuleFilterOption that prevents `Mute` -type rules from being executed

func WithBlocksOnly added in v0.6.0

func WithBlocksOnly() RuleFilterOption

WithLabelsOnly returns a RuleFilterOption that allows ONLY `Block` -type rules, and ignores all others.

func WithLabelsOnly added in v0.6.0

func WithLabelsOnly() RuleFilterOption

WithLabelsOnly returns a RuleFilterOption that allows ONLY `Label` -type rules, and ignores all others.

func WithMutesOnly added in v0.6.0

func WithMutesOnly() RuleFilterOption

WithLabelsOnly returns a RuleFilterOption that allows ONLY `Mute` -type rules, and ignores all others.

type RuleJSONLDGetter added in v0.6.0

type RuleJSONLDGetter struct {
	// contains filtered or unexported fields
}

RuleJSONLDGetter wraps the Rule service and a model.Rule to provide a JSONLDGetter interface

func NewRuleJSONLDGetter added in v0.6.0

func NewRuleJSONLDGetter(service *Rule, rule model.Rule) RuleJSONLDGetter

NewRuleJSONLDGetter returns a fully initialized RuleJSONLDGetter

func (RuleJSONLDGetter) Created added in v0.6.0

func (getter RuleJSONLDGetter) Created() int64

Created returns the creation date of the wrapped Rule

func (RuleJSONLDGetter) GetJSONLD added in v0.6.0

func (getter RuleJSONLDGetter) GetJSONLD() mapof.Any

GetJSONLD returns a JSON-LD representation of the wrapped Rule

type Scheduler

type Scheduler struct {
}
type Search struct {
	// contains filtered or unexported fields
}

Search defines a service that manages all searchable pages in a domain.

func NewSearch added in v0.7.0

func NewSearch() Search

NewSearch returns a fully initialized Search service

func (*Search) Close added in v0.7.0

func (service *Search) Close()

Close stops any background processes controlled by this service

func (*Search) Count added in v0.7.0

func (service *Search) Count(criteria exp.Expression) (int64, error)

func (*Search) Delete added in v0.7.0

func (service *Search) Delete(searchResult *model.SearchResult, note string) error

Delete removes an Search from the database (HARD DELETE)

func (*Search) DeleteByURL added in v0.7.0

func (service *Search) DeleteByURL(url string) error

eleteByURL removes a SearchResult from the database that matches the provided URL

func (*Search) List added in v0.7.0

func (service *Search) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Searchs that match the provided criteria

func (*Search) Load added in v0.7.0

func (service *Search) Load(criteria exp.Expression, searchResult *model.SearchResult) error

Load retrieves an Search from the database

func (*Search) LoadByURL added in v0.7.0

func (service *Search) LoadByURL(url string, searchResult *model.SearchResult) error

func (*Search) Query added in v0.7.0

func (service *Search) Query(criteria exp.Expression, options ...option.Option) ([]model.SearchResult, error)

Query returns an slice of allthe Searchs that match the provided criteria

func (*Search) Range added in v0.7.0

func (service *Search) Range(criteria exp.Expression, options ...option.Option) (iter.Seq[model.SearchResult], error)

func (*Search) RangeByTags added in v0.7.0

func (service *Search) RangeByTags(tags ...string) (iter.Seq[model.SearchResult], error)

func (*Search) Refresh added in v0.7.0

func (service *Search) Refresh(collection data.Collection, searchTagService *SearchTag, host string)

Refresh updates any stateful data that is cached inside this service.

func (*Search) Save added in v0.7.0

func (service *Search) Save(searchResult *model.SearchResult, note string) error

Save adds/updates an Search in the database

func (*Search) Shuffle added in v0.7.0

func (service *Search) Shuffle(tags ...string) error

Shuffle updates the "shuffle" field for all SearchResults that match the provided tags

func (*Search) Sync added in v0.7.0

func (service *Search) Sync(searchResult model.SearchResult) error

func (*Search) UnmarshalMap added in v0.7.0

func (service *Search) UnmarshalMap(original map[string]any) model.SearchResult

type SearchTag added in v0.7.0

type SearchTag struct {
	// contains filtered or unexported fields
}

SearchTag defines a service that manages all searchable tags in a domain.

func NewSearchTag added in v0.7.0

func NewSearchTag() SearchTag

NewSearchTag returns a fully initialized SearchTag service

func (*SearchTag) Close added in v0.7.0

func (service *SearchTag) Close()

Close stops any background processes controlled by this service

func (*SearchTag) Count added in v0.7.0

func (service *SearchTag) Count(criteria exp.Expression) (int64, error)

func (*SearchTag) Delete added in v0.7.0

func (service *SearchTag) Delete(searchTag *model.SearchTag, note string) error

Delete removes an SearchTag from the database (virtual delete)

func (*SearchTag) List added in v0.7.0

func (service *SearchTag) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the SearchTags that match the provided criteria

func (*SearchTag) ListGroups added in v0.7.0

func (service *SearchTag) ListGroups() []form.LookupCode

ListGroups returns a distinct list of all the groups that are used by SearchTags

func (*SearchTag) Load added in v0.7.0

func (service *SearchTag) Load(criteria exp.Expression, searchTag *model.SearchTag) error

Load retrieves an SearchTag from the database

func (*SearchTag) LoadByID added in v0.7.0

func (service *SearchTag) LoadByID(searchTagID primitive.ObjectID, searchTag *model.SearchTag) error

func (*SearchTag) LoadByValue added in v0.7.0

func (service *SearchTag) LoadByValue(value string, searchTag *model.SearchTag) error

func (*SearchTag) LoadWithOptions added in v0.7.0

func (service *SearchTag) LoadWithOptions(criteria exp.Expression, searchTag *model.SearchTag, options ...option.Option) error

LoadWithOptions retrieves a single SearchTag from the database, with additional options

func (*SearchTag) NormalizeTags added in v0.7.0

func (service *SearchTag) NormalizeTags(tagNames ...string) (sliceof.String, sliceof.String, error)

NormalizeTags takes a list of tag names and verifies it against tags in the database. Tags using canonical names will be returned. Blocked tags will not be included. If a tag does not exist in the database, then the provided name will be used.

func (*SearchTag) ObjectDelete added in v0.7.0

func (service *SearchTag) ObjectDelete(object data.Object, comment string) error

func (*SearchTag) ObjectID added in v0.7.0

func (service *SearchTag) ObjectID(object data.Object) primitive.ObjectID

func (*SearchTag) ObjectList added in v0.7.0

func (service *SearchTag) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*SearchTag) ObjectLoad added in v0.7.0

func (service *SearchTag) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*SearchTag) ObjectNew added in v0.7.0

func (service *SearchTag) ObjectNew() data.Object

New returns a fully initialized model.Group as a data.Object.

func (*SearchTag) ObjectQuery added in v0.7.0

func (service *SearchTag) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*SearchTag) ObjectSave added in v0.7.0

func (service *SearchTag) ObjectSave(object data.Object, comment string) error

func (*SearchTag) ObjectType added in v0.7.0

func (service *SearchTag) ObjectType() string

ObjectType returns the type of object that this service manages

func (*SearchTag) ObjectUserCan added in v0.7.0

func (service *SearchTag) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*SearchTag) Query added in v0.7.0

func (service *SearchTag) Query(criteria exp.Expression, options ...option.Option) ([]model.SearchTag, error)

Query returns an slice of allthe SearchTags that match the provided criteria

func (*SearchTag) QueryByValue added in v0.7.0

func (service *SearchTag) QueryByValue(values []string, options ...option.Option) (sliceof.Object[model.SearchTag], error)

QueryByValue returns all tags in a list

func (*SearchTag) Refresh added in v0.7.0

func (service *SearchTag) Refresh(collection data.Collection, host string)

Refresh updates any stateful data that is cached inside this service.

func (*SearchTag) Save added in v0.7.0

func (service *SearchTag) Save(searchTag *model.SearchTag, note string) error

Save adds/updates an SearchTag in the database

func (*SearchTag) Schema added in v0.7.0

func (service *SearchTag) Schema() schema.Schema

func (*SearchTag) Upsert added in v0.7.0

func (service *SearchTag) Upsert(tagName string) error

Upsert verifies that a SearchTag exists in the database, and creates it if it does not.

type ServerEmail

type ServerEmail struct {
	// contains filtered or unexported fields
}

func NewServerEmail

func NewServerEmail(filesystemService Filesystem, funcMap template.FuncMap, locations []mapof.String) ServerEmail

func (*ServerEmail) Add added in v0.7.0

func (service *ServerEmail) Add(filesystem fs.FS, definition []byte) error

func (*ServerEmail) Refresh

func (service *ServerEmail) Refresh()

func (*ServerEmail) Send

func (service *ServerEmail) Send(smtpConnection config.SMTPConnection, owner config.Owner, emailID string, model string, data mapof.Any) error

type SterankoUserService

type SterankoUserService struct {
	// contains filtered or unexported fields
}

SterankoUserService is a wrapper/adapter that makes the User service compatable with Steranko.

func NewSterankoUserService

func NewSterankoUserService(userService *User, domainEmail *DomainEmail) SterankoUserService

NewSterankoUserService returns a fully populated SterankoUserService.

func (SterankoUserService) Close

func (service SterankoUserService) Close()

Close is required to implement the steranko.UserService interface

func (SterankoUserService) Delete

func (service SterankoUserService) Delete(user steranko.User, comment string) error

Delete removes a single User from the database

func (SterankoUserService) Load

func (service SterankoUserService) Load(username string, result steranko.User) error

Load retrieves a single User from the database

func (SterankoUserService) New

func (service SterankoUserService) New() steranko.User

New creates a newly initialized User that is ready to use

func (SterankoUserService) NewClaims

func (service SterankoUserService) NewClaims() jwt.Claims

NewClaims creates a new JWT claim object

func (SterankoUserService) RequestPasswordReset

func (service SterankoUserService) RequestPasswordReset(user steranko.User) error

RequestPasswordReset is not currently implemented in this service. (TODO)

func (SterankoUserService) Save

func (service SterankoUserService) Save(user steranko.User, comment string) error

Save inserts/updates a single User in the database

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream manages all interactions with the Stream collection

func NewStream

func NewStream() Stream

NewStream returns a fully populated Stream service.

func (*Stream) ActivityPubActor added in v0.6.0

func (service *Stream) ActivityPubActor(streamID primitive.ObjectID, withFollowers bool) (outbox.Actor, error)

ActivityPubActor returns an ActivityPub Actor object ** WHICH INCLUDES ENCRYPTION KEYS ** for the provided Stream.

func (*Stream) ActivityPubURL added in v0.6.0

func (service *Stream) ActivityPubURL(streamID primitive.ObjectID) string

func (*Stream) CalcContext added in v0.6.0

func (service *Stream) CalcContext(stream *model.Stream)

CalcContext calculates the conversational context for a given stream, IF it can be determined.

func (*Stream) CalcParentIDs added in v0.6.0

func (service *Stream) CalcParentIDs(stream *model.Stream) error

CalcParentIDs scans the parent chain of a stream and generates a "breadcrumbs" slice of all of this Stream's parents

func (*Stream) CalculateTags added in v0.7.0

func (service *Stream) CalculateTags(stream *model.Stream)

func (*Stream) Close

func (service *Stream) Close()

Close stops any background processes controlled by this service

func (*Stream) Count

func (service *Stream) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Stream) Delete

func (service *Stream) Delete(stream *model.Stream, note string) error

Delete removes an Stream from the database (virtual delete)

func (*Stream) DeleteByParent

func (service *Stream) DeleteByParent(parentID primitive.ObjectID, note string) error

func (*Stream) DeleteMany

func (service *Stream) DeleteMany(criteria exp.Expression, note string) error

DeleteMany removes all child streams from the provided stream (virtual delete)

func (*Stream) DeleteRelatedDuplicate

func (service *Stream) DeleteRelatedDuplicate(parentID primitive.ObjectID, originalStreamID primitive.ObjectID) error

Delete RelatedDuplicate hard deletes any inbox/outbox streams that point to the same original.

func (*Stream) HashtagAsJSONLD added in v0.7.0

func (service *Stream) HashtagAsJSONLD(tag string) mapof.String

HashtagAsJSONLD returns a JSON-LD map document that represents a hashtag

func (*Stream) JSONLD added in v0.6.0

func (service *Stream) JSONLD(stream *model.Stream) mapof.Any

GetJSONLD returns a map document that conforms to the ActivityStreams 2.0 spec. This map will still need to be marshalled into JSON

func (*Stream) JSONLDGetter added in v0.6.0

func (service *Stream) JSONLDGetter(stream *model.Stream) StreamJSONLDGetter

JSONLDGetter returns a new JSONLDGetter for the provided stream

func (*Stream) List

func (service *Stream) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Streams that match the provided criteria

func (*Stream) ListByParent

func (service *Stream) ListByParent(parentID primitive.ObjectID) (data.Iterator, error)

ListByParent returns all Streams that match a particular parentID

func (*Stream) ListByTemplate

func (service *Stream) ListByTemplate(template string) (data.Iterator, error)

ListByTemplate returns all `Streams` that use a particular `Template`

func (*Stream) ListNavigation

func (service *Stream) ListNavigation() (data.Iterator, error)

ListNavigation returns all Streams of type FOLDER at the top of the hierarchy

func (*Stream) Load

func (service *Stream) Load(criteria exp.Expression, stream *model.Stream) error

Load retrieves an Stream from the database

func (*Stream) LoadByID

func (service *Stream) LoadByID(streamID primitive.ObjectID, result *model.Stream) error

LoadByID returns a single `Stream` that matches the provided streamID

func (*Stream) LoadByToken

func (service *Stream) LoadByToken(token string, result *model.Stream) error

LoadByToken returns a single `Stream` that matches a particular `Token`

func (*Stream) LoadByURL

func (service *Stream) LoadByURL(streamURL string, result *model.Stream) error

LoadByURL returns a single `Stream` that matches the provided URL

func (*Stream) LoadFirstAttachment

func (service *Stream) LoadFirstAttachment(streamID primitive.ObjectID) (model.Attachment, error)

func (*Stream) LoadFirstSibling

func (service *Stream) LoadFirstSibling(parentID primitive.ObjectID, result *model.Stream) error

func (*Stream) LoadLastSibling

func (service *Stream) LoadLastSibling(parentID primitive.ObjectID, result *model.Stream) error

func (*Stream) LoadNavigationByID

func (service *Stream) LoadNavigationByID(streamID primitive.ObjectID, result *model.Stream) error

LoadNavigationByID locates a single stream in the top level of the site hierarchy

func (*Stream) LoadNextSibling

func (service *Stream) LoadNextSibling(parentID primitive.ObjectID, rank int, result *model.Stream) error

func (*Stream) LoadParent

func (service *Stream) LoadParent(stream *model.Stream, parent *model.Stream) error

LoadParent returns the Stream that is the parent of the provided Stream

func (*Stream) LoadPrevSibling

func (service *Stream) LoadPrevSibling(parentID primitive.ObjectID, rank int, result *model.Stream) error

func (*Stream) LoadWebFinger

func (service *Stream) LoadWebFinger(token string) (digit.Resource, error)

func (*Stream) LoadWithOptions

func (service *Stream) LoadWithOptions(criteria exp.Expression, result *model.Stream, options ...option.Option) error

func (*Stream) MaxRank

func (service *Stream) MaxRank(parentID primitive.ObjectID) (int, error)

MaxRank returns the maximum rank of all children of a stream

func (*Stream) New

func (service *Stream) New() model.Stream

New returns a new Stream that uses the named template.

func (*Stream) ObjectDelete

func (service *Stream) ObjectDelete(object data.Object, note string) error

func (*Stream) ObjectID

func (service *Stream) ObjectID(object data.Object) primitive.ObjectID

func (*Stream) ObjectList

func (service *Stream) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Stream) ObjectLoad

func (service *Stream) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Stream) ObjectNew

func (service *Stream) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*Stream) ObjectQuery

func (service *Stream) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Stream) ObjectSave

func (service *Stream) ObjectSave(object data.Object, note string) error

func (*Stream) ObjectType

func (service *Stream) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Stream) ObjectUserCan

func (service *Stream) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Stream) ParsePath added in v0.6.0

func (service *Stream) ParsePath(uri *url.URL) (string, string, error)

ParsePathextracts the Stream token and actionID from a URL

func (*Stream) ParseURL added in v0.6.0

func (service *Stream) ParseURL(streamURL string) (primitive.ObjectID, error)

ParseURL validates that a URL matches the current server, and then extracts the streamID from it.

func (*Stream) Publish added in v0.6.0

func (service *Stream) Publish(user *model.User, stream *model.Stream, outbox bool) error

Publish marks this stream as "published"

func (*Stream) PurgeDeleted

func (service *Stream) PurgeDeleted(ancestorID primitive.ObjectID) error

PurgeDeleted hard deletes all items with the given ancestor that have already been soft-deleted

func (*Stream) Query

func (service *Stream) Query(criteria exp.Expression, options ...option.Option) ([]model.Stream, error)

Query returns an slice containing all of the Streams that match the provided criteria

func (*Stream) QueryByAncestorAndDate added in v0.6.0

func (service *Stream) QueryByAncestorAndDate(streamID primitive.ObjectID, publishedDate int64, pageSize int) ([]model.Stream, error)

QueryByParentAndDate returns a slice of Streams that are ANY DEPTH below the provided StreamID

func (*Stream) QueryByParentAndDate added in v0.6.0

func (service *Stream) QueryByParentAndDate(streamID primitive.ObjectID, publishedDate int64, pageSize int) ([]model.Stream, error)

QueryByParentAndDate returns a slice of Streams that are DIRECT CHILDREN of the provided StreamID

func (*Stream) QueryByUser added in v0.6.0

func (service *Stream) QueryByUser(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.Stream, error)

func (*Stream) QuerySummary

func (service *Stream) QuerySummary(criteria exp.Expression, options ...option.Option) ([]model.StreamSummary, error)

QuerySummary returns an slice containing StreamSummaries for all of the Streams that match the provided criteria

func (*Stream) Range added in v0.7.0

func (service *Stream) Range(criteria exp.Expression, options ...option.Option) (iter.Seq[model.Stream], error)

Range returns a Go 1.23 RangeFunc that iterates over the Streams that match the provided criteria

func (*Stream) RangeAll added in v0.7.0

func (service *Stream) RangeAll() (iter.Seq[model.StreamSummary], error)

RangeAll returns a RangeFunc over all streams

func (*Stream) RangePublished added in v0.7.0

func (service *Stream) RangePublished() (iter.Seq[model.Stream], error)

RangePublished returns a RangeFunc over all streams that are currently published

func (*Stream) RangeSummary added in v0.7.0

func (service *Stream) RangeSummary(criteria exp.Expression, options ...option.Option) (iter.Seq[model.StreamSummary], error)

RangeSummary returns a Go 1.23 RangeFunc that iterates over the Stream Summaries that match the provided criteria

func (*Stream) Refresh

func (service *Stream) Refresh(collection data.Collection, domainService *Domain, searchTagService *SearchTag, templateService *Template, draftService *StreamDraft, outboxService *Outbox, attachmentService *Attachment, activityStream *ActivityStream, contentService *Content, keyService *EncryptionKey, followerService *Follower, ruleService *Rule, userService *User, webhookService *Webhook, mediaserver mediaserver.MediaServer, queue *queue.Queue, host string, streamUpdateChannel chan primitive.ObjectID)

Refresh updates any stateful data that is cached inside this service.

func (*Stream) RestoreDeleted

func (service *Stream) RestoreDeleted(ancestorID primitive.ObjectID) error

RestoreDeleted un-deletes all soft-deleted records underneath a common ancestor.

func (*Stream) Save

func (service *Stream) Save(stream *model.Stream, note string) error

Save adds/updates an Stream in the database

func (*Stream) Schema

func (service *Stream) Schema() schema.Schema

func (*Stream) SearchResult added in v0.7.0

func (service *Stream) SearchResult(stream *model.Stream) model.SearchResult

SearchResult returns a SearchResult object that represents this Stream in the search index

func (*Stream) SetAttributedTo added in v0.7.0

func (service *Stream) SetAttributedTo(user *model.User)

func (*Stream) SetLocationChild added in v0.6.0

func (service *Stream) SetLocationChild(template *model.Template, stream *model.Stream, parent *model.Stream) error

SetLocationChild sets a Stream to be a child of another Stream

func (*Stream) SetLocationOutbox added in v0.6.0

func (service *Stream) SetLocationOutbox(template *model.Template, stream *model.Stream, userID primitive.ObjectID) error

SetLocationInbox sets a Stream's location to be a User's outbox

func (*Stream) SetLocationTop added in v0.6.0

func (service *Stream) SetLocationTop(template *model.Template, stream *model.Stream) error

SetLocationTop sets a Stream to be a top-level navigation item

func (*Stream) Startup added in v0.6.0

func (service *Stream) Startup(theme *model.Theme) error

func (*Stream) UnPublish added in v0.6.0

func (service *Stream) UnPublish(user *model.User, stream *model.Stream, outbox bool) error

UnPublish marks this stream as "published"

func (*Stream) UserCan added in v0.6.0

func (service *Stream) UserCan(authorization *model.Authorization, stream *model.Stream, actionID string) error

UserCan checks a user's permission to perform an action on a Stream. If not allowed, then the returned error describes why the access was denied.

type StreamArchive added in v0.7.0

type StreamArchive struct {
	// contains filtered or unexported fields
}

StreamArchive defines a service that manages all content streamArchives created and imported by Users.

func NewStreamArchive added in v0.7.0

func NewStreamArchive() StreamArchive

NewStreamArchive returns a fully initialized StreamArchive service

func (*StreamArchive) Close added in v0.7.0

func (service *StreamArchive) Close()

Close stops any background processes controlled by this service

func (*StreamArchive) Create added in v0.7.0

func (service *StreamArchive) Create(stream *model.Stream, options StreamArchiveOptions) error

Create makes a ZIP archive of a stream (and potentially its descendants) and saves it to the export cache

func (*StreamArchive) Delete added in v0.7.0

func (service *StreamArchive) Delete(streamID primitive.ObjectID, token string) error

Delete removes a ZIP archive from the export cache.

func (*StreamArchive) Exists added in v0.7.0

func (service *StreamArchive) Exists(streamID primitive.ObjectID, token string) (bool, bool)

Exists returns TRUE if the specified ZIP archive exists in the export cache. This duplicates and extends the standard afero Exists() method by ALSO checking if the file has a ZERO length. This happens on AWS when multiple requests are made while the file is still being written

func (*StreamArchive) ExistsTemp added in v0.7.0

func (service *StreamArchive) ExistsTemp(streamID primitive.ObjectID, token string) bool

ExistsTemp returns TRUE if a tempfile archive exists in the export cache

func (*StreamArchive) Read added in v0.7.0

func (service *StreamArchive) Read(streamID primitive.ObjectID, token string, writer io.Writer) error

Read retrieves a ZIP archive from the export cache. If the file does not exist, then it returns an error

func (*StreamArchive) Refresh added in v0.7.0

func (service *StreamArchive) Refresh(streamService *Stream, attachmentService *Attachment, mediaserver mediaserver.MediaServer, exportCache afero.Fs, queue *queue.Queue, host string)

Refresh updates any stateful data that is cached inside this service.

type StreamArchiveOptions added in v0.7.0

type StreamArchiveOptions struct {
	Token       string
	Depth       int
	JSON        bool
	Attachments bool
	Metadata    []translate.Pipeline
}

StreamArchiveOptions defines the options for making a StreamArchive ZIP file

func (StreamArchiveOptions) HasNext added in v0.7.0

func (options StreamArchiveOptions) HasNext() bool

HasNext returns TRUE if the depth of this export is greater than zero

func (StreamArchiveOptions) Next added in v0.7.0

Next returns a new StreamArchiveOptions object that is one level deeper than the current object

func (StreamArchiveOptions) Pipeline added in v0.7.0

func (options StreamArchiveOptions) Pipeline() translate.Pipeline

Pipeline returns the Metadata pipeline for the current export level. If a pipeline has not been defined, then an empty pipeline is returned

type StreamDraft

type StreamDraft struct {
	// contains filtered or unexported fields
}

StreamDraft manages all interactions with the StreamDraft collection

func NewStreamDraft

func NewStreamDraft() StreamDraft

NewStreamDraft returns a fully populated StreamDraft service.

func (*StreamDraft) Close

func (service *StreamDraft) Close()

Close stops any background processes controlled by this service

func (*StreamDraft) Count added in v0.7.0

func (service *StreamDraft) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*StreamDraft) Delete

func (service *StreamDraft) Delete(draft *model.Stream, _note string) error

Delete removes an StreamDraft from the database (hard delete)

func (*StreamDraft) Load

func (service *StreamDraft) Load(criteria exp.Expression, result *model.Stream) error

Load either: 1) loads a valid draft from the database, or 2) creates a new draft and returns it instead

func (*StreamDraft) LoadByID

func (service *StreamDraft) LoadByID(streamID primitive.ObjectID, result *model.Stream) error

LoadByID returns a single Stream that matches a particular StreamID

func (*StreamDraft) New

func (service *StreamDraft) New() model.Stream

New creates a newly initialized StreamDraft that is ready to use

func (*StreamDraft) ObjectDelete

func (service *StreamDraft) ObjectDelete(object data.Object, comment string) error

func (*StreamDraft) ObjectID

func (service *StreamDraft) ObjectID(object data.Object) primitive.ObjectID

func (*StreamDraft) ObjectList

func (service *StreamDraft) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*StreamDraft) ObjectLoad

func (service *StreamDraft) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*StreamDraft) ObjectNew

func (service *StreamDraft) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*StreamDraft) ObjectQuery

func (service *StreamDraft) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*StreamDraft) ObjectSave

func (service *StreamDraft) ObjectSave(object data.Object, comment string) error

func (*StreamDraft) ObjectType

func (service *StreamDraft) ObjectType() string

ObjectType returns the type of object that this service manages

func (*StreamDraft) ObjectUserCan

func (service *StreamDraft) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*StreamDraft) Promote

func (service *StreamDraft) Promote(streamID primitive.ObjectID, stateID string) (model.Stream, error)

func (*StreamDraft) Refresh

func (service *StreamDraft) Refresh(collection data.Collection, templateService *Template, streamService *Stream)

Refresh updates any stateful data that is cached inside this service.

func (*StreamDraft) Save

func (service *StreamDraft) Save(draft *model.Stream, note string) error

save adds/updates an StreamDraft in the database

func (*StreamDraft) Schema

func (service *StreamDraft) Schema() schema.Schema

type StreamJSONLDGetter added in v0.6.0

type StreamJSONLDGetter struct {
	// contains filtered or unexported fields
}

StreamJSONLDGetter wraps the Stream service and a model.Stream to provide a JSONLDGetter interface

func NewStreamJSONLDGetter added in v0.6.0

func NewStreamJSONLDGetter(streamService *Stream, stream *model.Stream) StreamJSONLDGetter

NewStreamJSONLDGetter returns a fully initialized StreamJSONLDGetter

func (StreamJSONLDGetter) Created added in v0.6.0

func (getter StreamJSONLDGetter) Created() int64

Created returns the creation date of the wrapped Stream

func (StreamJSONLDGetter) GetJSONLD added in v0.6.0

func (getter StreamJSONLDGetter) GetJSONLD() mapof.Any

GetJSONLD returns a JSON-LD representation of the wrapped Stream

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template service manages all of the templates in the system, and merges them with data to form fully populated HTML pages.

func NewTemplate

func NewTemplate(filesystemService Filesystem, registrationService *Registration, emailService *ServerEmail, themeService *Theme, widgetService *Widget, funcMap template.FuncMap, locations []mapof.String) *Template

NewTemplate returns a fully initialized Template service.

func (*Template) Add

func (service *Template) Add(templateID string, filesystem fs.FS, definition []byte) error

func (*Template) List

func (service *Template) List(filter func(*model.Template) bool) []form.LookupCode

List returns all templates that match the provided criteria

func (*Template) ListByContainer

func (service *Template) ListByContainer(containedByRole string) []form.LookupCode

ListByContainer returns all model.Templates that match the provided "containedByRole" value

func (*Template) ListByContainerLimited

func (service *Template) ListByContainerLimited(containedByRole string, limitRoles sliceof.String) []form.LookupCode

ListByContainerLimited returns all model.Templates that match the provided "containedByRole" value AND whose TemplateRoles are present in the "limitRoles" list. If the "limited" list is empty, then all otherwise-valid templates are returned.

func (*Template) ListByTemplateRole added in v0.7.0

func (service *Template) ListByTemplateRole(templateRole string) []form.LookupCode

ListByTemplateRole returns all model.Templates that match the provided "TemplateRole" value

func (*Template) Load

func (service *Template) Load(templateID string) (model.Template, error)

Load retrieves an Template from the database

func (*Template) LoadAdmin

func (service *Template) LoadAdmin(templateID string) (model.Template, error)

func (*Template) Refresh

func (service *Template) Refresh(locations sliceof.Object[mapof.String])

type TemplateLike added in v0.7.0

type TemplateLike interface {
	Execute(writer io.Writer, data any) error
}

type Theme

type Theme struct {
	// contains filtered or unexported fields
}

Theme service manages the global site theme that is stored in a particular path of the filesystem.

func NewTheme

func NewTheme(templateService *Template, contentService *Content, funcMap template.FuncMap) Theme

NewTheme returns a fully initialized Theme service.

func (*Theme) Add

func (service *Theme) Add(themeID string, filesystem fs.FS, definition []byte) error

func (*Theme) GetTheme

func (service *Theme) GetTheme(themeID string) model.Theme

func (*Theme) List

func (service *Theme) List() []model.Theme

func (*Theme) ListActive added in v0.6.0

func (service *Theme) ListActive() []model.Theme

func (*Theme) ListSorted added in v0.6.0

func (service *Theme) ListSorted() []model.Theme

type ThemeLookupProvider

type ThemeLookupProvider struct {
	// contains filtered or unexported fields
}

func NewThemeLookupProvider

func NewThemeLookupProvider(themeService *Theme) ThemeLookupProvider

func (ThemeLookupProvider) Get

func (service ThemeLookupProvider) Get() []form.LookupCode

type User

type User struct {
	// contains filtered or unexported fields
}

User manages all interactions with the User collection

func NewUser

func NewUser() User

NewUser returns a fully populated User service

func (*User) ActivityPubActor

func (service *User) ActivityPubActor(userID primitive.ObjectID, withFollowers bool) (outbox.Actor, error)

ActivityPubActor returns an ActivityPub Actor object ** WHICH INCLUDES ENCRYPTION KEYS ** for the provided User.

func (*User) ActivityPubPublicKeyURL

func (service *User) ActivityPubPublicKeyURL(userID primitive.ObjectID) string

func (*User) ActivityPubURL

func (service *User) ActivityPubURL(userID primitive.ObjectID) string

func (*User) CalcFollowerCount

func (service *User) CalcFollowerCount(userID primitive.ObjectID)

func (*User) CalcFollowingCount

func (service *User) CalcFollowingCount(userID primitive.ObjectID)

func (*User) CalcRuleCount added in v0.6.0

func (service *User) CalcRuleCount(userID primitive.ObjectID)

func (*User) CalcUsername added in v0.7.0

func (service *User) CalcUsername(user *model.User) error

func (*User) CalculateTags added in v0.7.0

func (service *User) CalculateTags(user *model.User)

func (*User) Close

func (service *User) Close()

Close stops any background processes controlled by this service

func (User) Count

func (service User) Count(criteria exp.Expression) (int64, error)

Count returns the number of Users who match the provided criteria

func (*User) CreateIntentURL added in v0.7.0

func (service *User) CreateIntentURL() string

func (*User) Delete

func (service *User) Delete(user *model.User, note string) error

Delete removes an User from the database (virtual delete)

func (*User) DeleteAvatar added in v0.6.0

func (service *User) DeleteAvatar(user *model.User, note string) error

func (*User) DislikeIntentURL added in v0.7.0

func (service *User) DislikeIntentURL() string

func (*User) FollowIntentURL added in v0.7.0

func (service *User) FollowIntentURL() string

func (*User) LikeIntentURL added in v0.7.0

func (service *User) LikeIntentURL() string

func (*User) List

func (service *User) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Users who match the provided criteria

func (*User) ListByGroup

func (service *User) ListByGroup(group string) (data.Iterator, error)

ListByGroup returns all users that match a provided group name

func (*User) ListByIdentities

func (service *User) ListByIdentities(identities []string) (data.Iterator, error)

ListByIdentities returns all users that appear in the list of identities

func (*User) ListOwners

func (service *User) ListOwners() (data.Iterator, error)

func (*User) ListOwnersAsSlice

func (service *User) ListOwnersAsSlice() []model.UserSummary

func (*User) ListUsernameOrOwner added in v0.6.0

func (service *User) ListUsernameOrOwner(username string) (data.Iterator, error)

func (*User) Load

func (service *User) Load(criteria exp.Expression, result *model.User) error

Load retrieves an User from the database

func (*User) LoadByEmail added in v0.7.0

func (service *User) LoadByEmail(email string, result *model.User) error

LoadByEmail loads a single model.User object that matches the provided email address

func (*User) LoadByID

func (service *User) LoadByID(userID primitive.ObjectID, result *model.User) error

LoadByID loads a single model.User object that matches the provided userID

func (*User) LoadByMapID added in v0.7.0

func (service *User) LoadByMapID(key string, value string, result *model.User) error

LoadByMapID loads a single model.User object that matches the provided mapID key/value

func (*User) LoadByProfileURL added in v0.6.0

func (service *User) LoadByProfileURL(profileUrl string, result *model.User) error

LoadByProfileURL loads a single model.User object that matches the provided profile URL

func (*User) LoadByResetCode

func (service *User) LoadByResetCode(userID string, code string, user *model.User) error

func (*User) LoadByToken

func (service *User) LoadByToken(token string, result *model.User) error

LoadByUsername loads a single model.User object that matches the provided token. If the "token" is a valid ObjectID, then it attempts to load by that userID. If the "token" is not a valid ObjectID (or if the first attempt fails), then it tries to load by username.

func (*User) LoadByUsername

func (service *User) LoadByUsername(username string, result *model.User) error

LoadByUsername loads a single model.User object that matches the provided username

func (*User) LoadByUsernameOrEmail

func (service *User) LoadByUsernameOrEmail(usernameOrEmail string, result *model.User) error

LoadByUsernameOrEmail loads a single model.User object that matches the provided username or email address

func (*User) LoadWebFinger

func (service *User) LoadWebFinger(username string) (digit.Resource, error)

func (*User) MakeNewPasswordResetCode

func (service *User) MakeNewPasswordResetCode(user *model.User) error

MakeNewPasswordResetCode generates a new password reset code for the provided user.

func (*User) ObjectDelete

func (service *User) ObjectDelete(object data.Object, note string) error

func (*User) ObjectID

func (service *User) ObjectID(object data.Object) primitive.ObjectID

func (*User) ObjectList

func (service *User) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*User) ObjectLoad

func (service *User) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*User) ObjectNew

func (service *User) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*User) ObjectQuery

func (service *User) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*User) ObjectSave

func (service *User) ObjectSave(object data.Object, note string) error

func (*User) ObjectType

func (service *User) ObjectType() string

ObjectType returns the type of object that this service manages

func (*User) ObjectUserCan

func (service *User) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*User) ParseProfileURL

func (service *User) ParseProfileURL(value string) (primitive.ObjectID, error)

ParseProfileURL parses (or looks up) the correct UserID from a given URL. Unlike the package-level ParseProfileURL, this method can resolve usernames into objectIDs because it has access to the database server.

func (*User) Query added in v0.6.0

func (service *User) Query(criteria exp.Expression, options ...option.Option) ([]model.User, error)

Query returns an slice containing all of the Users who match the provided criteria

func (*User) QueryBlockedActors added in v0.6.0

func (service *User) QueryBlockedActors(userID primitive.ObjectID, criteria exp.Expression) ([]model.User, error)

TODO: MEDIUM: this function is wickedly inefficient Should probably use a RuleFilter here.

func (*User) Range added in v0.7.0

func (service *User) Range(criteria exp.Expression, options ...option.Option) (iter.Seq[model.User], error)

Range returns an iterator containing all of the Users who match the provided criteria

func (*User) RangeAll added in v0.7.0

func (service *User) RangeAll() (iter.Seq[model.User], error)

func (*User) Refresh

func (service *User) Refresh(userCollection data.Collection, followerCollection data.Collection, followingCollection data.Collection, ruleCollection data.Collection, attachmentService *Attachment, domainService *Domain, emailService *DomainEmail, folderService *Folder, followerService *Follower, keyService *EncryptionKey, ruleService *Rule, searchTagService *SearchTag, streamService *Stream, templateService *Template, webhookService *Webhook, queue *queue.Queue, activityStream *ActivityStream, host string)

Refresh updates any stateful data that is cached inside this service.

func (*User) RemoteFollowURL

func (service *User) RemoteFollowURL() string

func (*User) Save

func (service *User) Save(user *model.User, note string) error

Save adds/updates an User in the database

func (*User) Schema

func (service *User) Schema() schema.Schema

func (*User) SearchResult added in v0.7.0

func (service *User) SearchResult(user *model.User) model.SearchResult

func (*User) SendPasswordResetEmail

func (service *User) SendPasswordResetEmail(user *model.User)

SendPasswordResetEmail generates a new password reset code and sends a welcome email to a new user. If there is a problem sending the email, then the new code is not saved.

func (*User) SetOwner

func (service *User) SetOwner(owner config.Owner) error

type Webhook added in v0.7.0

type Webhook struct {
	// contains filtered or unexported fields
}

Webhook service sends outbound webhooks

func NewWebhook added in v0.7.0

func NewWebhook() Webhook

NewWebhook returns a new instance of the Webhook service

func (*Webhook) Count added in v0.7.0

func (service *Webhook) Count(criteria exp.Expression) (int64, error)

Count returns the number of records that match the provided criteria

func (*Webhook) Delete added in v0.7.0

func (service *Webhook) Delete(webhook *model.Webhook, note string) error

Delete removes an Webhook from the database (virtual delete)

func (*Webhook) DeleteMany added in v0.7.0

func (service *Webhook) DeleteMany(criteria exp.Expression, note string) error

DeleteMany removes all child webhooks from the provided webhook (virtual delete)

func (*Webhook) List added in v0.7.0

func (service *Webhook) List(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

List returns an iterator containing all of the Webhooks that match the provided criteria

func (*Webhook) Load added in v0.7.0

func (service *Webhook) Load(criteria exp.Expression, webhook *model.Webhook) error

Load retrieves an Webhook from the database

func (*Webhook) LoadByID added in v0.7.0

func (service *Webhook) LoadByID(webhookID primitive.ObjectID, result *model.Webhook) error

func (*Webhook) New added in v0.7.0

func (service *Webhook) New() model.Webhook

New returns a new Webhook that uses the named template.

func (*Webhook) ObjectDelete added in v0.7.0

func (service *Webhook) ObjectDelete(object data.Object, note string) error

func (*Webhook) ObjectID added in v0.7.0

func (service *Webhook) ObjectID(object data.Object) primitive.ObjectID

func (*Webhook) ObjectList added in v0.7.0

func (service *Webhook) ObjectList(criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*Webhook) ObjectLoad added in v0.7.0

func (service *Webhook) ObjectLoad(criteria exp.Expression) (data.Object, error)

func (*Webhook) ObjectNew added in v0.7.0

func (service *Webhook) ObjectNew() data.Object

New returns a fully initialized model.Stream as a data.Object.

func (*Webhook) ObjectQuery added in v0.7.0

func (service *Webhook) ObjectQuery(result any, criteria exp.Expression, options ...option.Option) error

func (*Webhook) ObjectSave added in v0.7.0

func (service *Webhook) ObjectSave(object data.Object, note string) error

func (*Webhook) ObjectType added in v0.7.0

func (service *Webhook) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Webhook) ObjectUserCan added in v0.7.0

func (service *Webhook) ObjectUserCan(object data.Object, authorization model.Authorization, action string) error

func (*Webhook) Query added in v0.7.0

func (service *Webhook) Query(criteria exp.Expression, options ...option.Option) ([]model.Webhook, error)

Query returns an slice containing all of the Webhooks that match the provided criteria

func (*Webhook) QueryByEvent added in v0.7.0

func (service *Webhook) QueryByEvent(event string) ([]model.Webhook, error)

func (*Webhook) Refresh added in v0.7.0

func (service *Webhook) Refresh(collection data.Collection, queue *queue.Queue)

func (*Webhook) Save added in v0.7.0

func (service *Webhook) Save(webhook *model.Webhook, note string) error

Save adds/updates an Webhook in the database

func (*Webhook) Schema added in v0.7.0

func (service *Webhook) Schema() schema.Schema

func (*Webhook) Send added in v0.7.0

func (service *Webhook) Send(getter model.WebhookDataGetter, events ...string)

Send delivers the webhook to all the external webhook URLs that are listening to the given event

type Widget

type Widget struct {
	// contains filtered or unexported fields
}

Widget service manages the global, in-memory library of widget templates that can be applied to any Stream

func NewWidget

func NewWidget(funcMap template.FuncMap) Widget

NewWidget returns a fully initialized Widget service.

func (*Widget) Add

func (service *Widget) Add(widgetID string, filesystem fs.FS, definition []byte) error

Add loads a widget definition from a filesystem, and adds it to the in-memory library.

func (*Widget) Get

func (service *Widget) Get(widgetID string) (model.Widget, bool)

Get returns a widget definition from the in-memory library.

func (*Widget) IsValidWidgetType

func (service *Widget) IsValidWidgetType(widgetType string) bool

func (*Widget) List

func (service *Widget) List() []form.LookupCode

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳