service

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: AGPL-3.0 Imports: 82 Imported by: 0

Documentation

Index

Constants

View Source
const DefinitionEmail = "EMAIL"

DefinitionEmail marks a filesystem that contains an Email 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 WatchStreams

func WatchStreams(collection *mongo.Collection, result chan<- model.Stream)

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 manages all interactions with a user's ActivityStream

func NewActivityStream

func NewActivityStream(collection data.Collection) ActivityStream

NewActivityStream returns a fully populated ActivityStream service

func (*ActivityStream) Close

func (service *ActivityStream) Close()

Close stops any background processes controlled by this service

func (*ActivityStream) Delete

func (service *ActivityStream) Delete(activityStream *model.ActivityStream, note string) error

Delete removes an ActivityStream from the database (virtual delete)

func (*ActivityStream) List

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

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

func (*ActivityStream) ListByContainer

func (service *ActivityStream) ListByContainer(userID primitive.ObjectID, container model.ActivityStreamContainer, criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*ActivityStream) ListInbox

func (service *ActivityStream) ListInbox(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*ActivityStream) ListOutbox

func (service *ActivityStream) ListOutbox(userID primitive.ObjectID, criteria exp.Expression, options ...option.Option) (data.Iterator, error)

func (*ActivityStream) Load

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

Load retrieves an ActivityStream from the database

func (*ActivityStream) LoadFromContainer

func (service *ActivityStream) LoadFromContainer(userID primitive.ObjectID, container model.ActivityStreamContainer, activityStreamID primitive.ObjectID, activityStream *model.ActivityStream) error

func (*ActivityStream) LoadFromInbox

func (service *ActivityStream) LoadFromInbox(activityStreamID primitive.ObjectID, userID primitive.ObjectID, activityStream *model.ActivityStream) error

func (*ActivityStream) LoadFromOutbox

func (service *ActivityStream) LoadFromOutbox(activityStreamID primitive.ObjectID, userID primitive.ObjectID, activityStream *model.ActivityStream) error

func (*ActivityStream) New

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

New creates a newly initialized ActivityStream that is ready to use

func (*ActivityStream) ObjectDelete

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

func (*ActivityStream) ObjectID

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

func (*ActivityStream) ObjectList

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

func (*ActivityStream) ObjectLoad

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

func (*ActivityStream) ObjectNew

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

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

func (*ActivityStream) ObjectQuery

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

func (*ActivityStream) ObjectSave

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

func (*ActivityStream) ObjectType

func (service *ActivityStream) ObjectType() string

ObjectType returns the type of object that this service manages

func (*ActivityStream) ObjectUserCan

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

func (*ActivityStream) Query

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

Query returns a slice of ActivityStreams that math the provided criteria

func (*ActivityStream) Refresh

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

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

func (*ActivityStream) Save

func (service *ActivityStream) Save(activityStream *model.ActivityStream, note string) error

Save adds/updates an ActivityStream in the database

func (*ActivityStream) Schema

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

type Attachment

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

Attachment manages all interactions with the Attachment collection

func NewAttachment

func NewAttachment(collection data.Collection, mediaServer mediaserver.MediaServer) 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) 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

DeleteByStream removes all attachments from the provided stream (virtual delete)

func (*Attachment) DeleteByID

func (service *Attachment) DeleteByID(objectType string, objectID primitive.ObjectID, attachmentID primitive.ObjectID) 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) (model.Attachment, error)

func (*Attachment) LoadFirstByObjectID

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

func (*Attachment) New

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

New creates a newly initialized Attachment that is ready to use

func (*Attachment) Query

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

func (*Attachment) QueryByObjectID

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

func (*Attachment) Refresh

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

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

type Block

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

Block defines a service that manages all content blocks created and imported by Users.

func NewBlock

func NewBlock(collection data.Collection, userService *User) Block

NewBlock returns a fully initialized Block service

func (*Block) AllowDocument

func (service *Block) AllowDocument(userID primitive.ObjectID, document *model.DocumentLink) (bool, error)

AllowSender returns TRUE if the designated User accepts the Document (based on their blocklist settings)

func (*Block) AllowSender

func (service *Block) AllowSender(userID primitive.ObjectID, person *model.PersonLink) (bool, error)

AllowSender returns TRUE if the designated User accepts documents from this sender (based on their blocklist settings)

func (*Block) Close

func (service *Block) Close()

Close stops any background processes controlled by this service

func (*Block) Delete

func (service *Block) Delete(block *model.Block, note string) error

Delete removes an Block from the database (virtual delete)

func (*Block) List

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

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

func (*Block) Load

func (service *Block) Load(criteria exp.Expression, block *model.Block) error

Load retrieves an Block from the database

func (*Block) LoadByToken

func (service *Block) LoadByToken(userID primitive.ObjectID, token string, block *model.Block) error

func (*Block) ObjectDelete

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

func (*Block) ObjectID

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

func (*Block) ObjectList

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

func (*Block) ObjectLoad

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

func (*Block) ObjectNew

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

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

func (*Block) ObjectQuery

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

func (*Block) ObjectSave

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

func (*Block) ObjectType

func (service *Block) ObjectType() string

ObjectType returns the type of object that this service manages

func (*Block) ObjectUserCan

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

func (*Block) Refresh

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

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

func (*Block) Save

func (service *Block) Save(block *model.Block, note string) error

Save adds/updates an Block in the database

func (*Block) Schema

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

type Config

type Config struct {
}

Config service (will) manage server-wide configuration

type Content

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

func NewContent

func NewContent(editorJS *goeditorjs.HTMLEngine) Content

func (*Content) New

func (service *Content) New(format 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(collection data.Collection, configuration config.Domain, themeService *Theme, userService *User, providerService *Provider, funcMap template.FuncMap) Domain

NewDomain returns a fully initialized Domain service

func (*Domain) ActiveClients

func (service *Domain) ActiveClients() []model.Client

ActiveClients returns all active Clients for this domain

func (*Domain) Client

func (service *Domain) Client(providerID string) model.Client

func (*Domain) Close

func (service *Domain) Close()

Close stops the following service watcher

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.Client, *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) LoadOrCreateDomain

func (service *Domain) LoadOrCreateDomain() 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.Client, error)

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

func (*Domain) OAuthCallbackURL

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

OAuthCallbackURL 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) Provider

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

Provider returns the external Provider that matches the given providerID

func (*Domain) ReadOAuthClient

func (service *Domain) ReadOAuthClient(providerID string) (model.Client, bool)

ReadOAuthState returns the OAuth state for the specified provider WITHOUT changing the current value. THIS SHOULD NOT BE USED TO ACCESS OAUTH TOKENS because they may be expired. Use GetOAuthToken for that.

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)

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) Theme

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

type DomainEmail

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

func NewDomainEmail

func NewDomainEmail(serverEmail *ServerEmail, configuration config.Domain) DomainEmail

func (*DomainEmail) Refresh

func (service *DomainEmail) Refresh(configuration config.Domain)

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(user *model.User) 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(collection data.Collection, host string) 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) Create

func (service *EncryptionKey) Create(userID 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) LoadByID

func (service *EncryptionKey) LoadByID(userID primitive.ObjectID, encryptionKey *model.EncryptionKey) error

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)

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 config.Folder) (afero.Fs, error)

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

func (*Filesystem) GetAferos

func (filesystem *Filesystem) GetAferos(folders ...config.Folder) []afero.Fs

GetAferos returns multiple afero filesystems

func (*Filesystem) GetFS

func (filesystem *Filesystem) GetFS(folder config.Folder) (fs.FS, error)

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

func (*Filesystem) GetFSs

func (filesystem *Filesystem) GetFSs(folders ...config.Folder) []fs.FS

GetFSs returns multiple fs.FS filesystems

func (*Filesystem) Watch

func (filesystem *Filesystem) Watch(folder config.Folder, changed chan<- bool, closed <-chan bool) 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(collection data.Collection, inboxService *Inbox) Folder

NewFolder returns a fully populated Folder service

func (*Folder) Close

func (service *Folder) Close()

Close stops any background processes controlled by this service

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) Refresh

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

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

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(collection data.Collection, userService *User, host string) Follower

NewFollower returns a fully initialized Follower service

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) Close

func (service *Follower) Close()

Close stops any background processes controlled by this service

func (*Follower) Delete

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

Delete removes an Follower from the database (virtual delete)

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) ListWebSub

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

ListWebSub 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(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

func (*Follower) LoadByToken

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

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) LoadByWebSubUnique

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

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

func (*Follower) LoadOrCreate

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

func (*Follower) NewActivityPubFollower

func (service *Follower) NewActivityPubFollower(user *model.User, actor streams.Document) 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) QueryAllURLs

func (service *Follower) QueryAllURLs(criteria exp.Expression) ([]string, error)

func (*Follower) Refresh

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

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

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

type Following

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

Following manages all interactions with the Following collection

func NewFollowing

func NewFollowing(collection data.Collection, streamService *Stream, userService *User, inboxService *Inbox, keyService *EncryptionKey, host string) Following

NewFollowing returns a fully populated Following service.

func (*Following) ActivityPubActorID

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

func (*Following) ActivityPubID

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

func (*Following) AsJSONLD

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

func (*Following) CallbackURL

func (service *Following) CallbackURL() string

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) 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) 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(parentID primitive.ObjectID, profileUrl string, result *model.Following) error

LoadByURL loads an infividual 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) 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)

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

func (*Following) Save

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

Save adds/updates an Following in the database

func (*Following) Schema

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

func (*Following) SetStatus

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

SetStatus updates the status (and statusMessage) of a Following record.

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(collection data.Collection) 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(ctx context.Context, criteria exp.Expression) (int, error)

Count returns the number of (non-deleted) records in the User collection

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

LoadByGroupname 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

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(collection data.Collection) Inbox

NewInbox returns a fully populated Inbox service

func (*Inbox) CalculateRank

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

func (*Inbox) Close

func (service *Inbox) Close()

Close stops any background processes controlled by this service

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

func (*Inbox) LoadOrCreate

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

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

func (*Inbox) Refresh

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

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) SetReadDate

func (service *Inbox) SetReadDate(userID primitive.ObjectID, token string, readDate int64) error

SetReadDate updates the readDate for a single Inbox IF it is not already read

func (*Inbox) UpdateInboxFolders

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

type JWT

type JWT struct {
}

JWT is a service that generates and validates JWT keys.

func (JWT) FindJWTKey

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

func (JWT) NewJWTKey

func (service JWT) NewJWTKey() (string, any)

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(themeService *Theme, groupService *Group, folderService *Folder, 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(collection data.Collection) 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) 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) 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) 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) ParseMicroformats

func (service *Mention) ParseMicroformats(source io.Reader, originURL string) model.Mention

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)

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
	Schema() schema.Schema
}

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

type Origin

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

Origin service polls external Stream origins for new external Streams.

func NewOrigin

func NewOrigin(domainService *Domain, streamService *Stream, providerService *Provider) Origin

NewOrigin returns a fully initialized Origin service

func (*Origin) Close

func (service *Origin) Close()

func (*Origin) Poll

func (service *Origin) Poll(providerID string) <-chan model.Stream

func (*Origin) PollAll

func (service *Origin) PollAll() <-chan model.Stream

func (*Origin) Refresh

func (service *Origin) Refresh(domainService *Domain, streamService *Stream, providerService *Provider)

func (*Origin) Save

func (service *Origin) Save(streams <-chan model.Stream) error

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) GetGiphyProvider

func (service *Provider) GetGiphyProvider() providers.Giphy

func (*Provider) GetProvider

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

GetProvider returns a populated adapter for the given provider

func (*Provider) GetStripeProvider

func (service *Provider) GetStripeProvider() providers.Stripe

GetStripeProvider returns a populated Stripe adapter

func (*Provider) Refresh

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

Refresh updates the list of clients

type Publisher

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

func NewPublisher

func NewPublisher(streamService *Stream, followerService *Follower, userService *User) Publisher

func (Publisher) Publish

func (service Publisher) Publish(stream *model.Stream, userID primitive.ObjectID, objectType string) error

func (Publisher) Unpublish

func (service Publisher) Unpublish(stream *model.Stream, userID primitive.ObjectID, objectType string) error

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 Scheduler

type Scheduler struct {
}

type ServerEmail

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

func NewServerEmail

func NewServerEmail(filesystemService Filesystem, funcMap template.FuncMap, locations []config.Folder) ServerEmail

func (*ServerEmail) Refresh

func (service *ServerEmail) Refresh(locations []config.Folder)

func (*ServerEmail) Send

func (service *ServerEmail) Send(smtpConnection config.SMTPConnection, templateName string, from string, to []string, subject string, data 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(collection data.Collection, templateService *Template, attachmentService *Attachment, hostName string, streamUpdateChannel chan model.Stream) Stream

NewStream returns a fully populated Stream service.

func (*Stream) Close

func (service *Stream) Close()

Close stops any background processes controlled by this service

func (*Stream) Count

func (service *Stream) Count(ctx context.Context, criteria exp.Expression) (int, error)

Count returns the number of (non-deleted) records in the Stream collection

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) 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) LoadByOriginID

func (service *Stream) LoadByOriginID(originID primitive.ObjectID, result *model.Stream) error

LoadByOriginID returns a single `Stream` that matches the provided `Origin.InternalID`

func (*Stream) LoadByProductID

func (service *Stream) LoadByProductID(productID string, result *model.Stream) error

LoadByProductID returns a single `Stream` with custom data matching the provided `Data.productId`

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(targetURL string, result *model.Stream) error

LoadByURL returns a single stream that matches the domain and path of 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, options option.Option, result *model.Stream) error

func (*Stream) MaxRank

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

MaxRank returns the maximum rank of all children of a stream

func (*Stream) New

func (service *Stream) New(navigationID string, parentID primitive.ObjectID, templateID string) (model.Stream, model.Template, error)

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) Outbox

func (service *Stream) Outbox(ownerID primitive.ObjectID, criteria exp.Expression, options ...option.Option) ([]model.StreamSummary, error)

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) 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) Refresh

func (service *Stream) Refresh(hostName string, collection data.Collection, draftService *StreamDraft)

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

type StreamDraft

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

StreamDraft manages all interactions with the StreamDraft collection

func NewStreamDraft

func NewStreamDraft(collection data.Collection, streamService *Stream) 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) 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) LoadByToken

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

LoadByToken returns a single Stream that matches a particular Token

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)

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 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, themeService *Theme, widgetService *Widget, funcMap template.FuncMap, locations []config.Folder) *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, limits sliceof.String) []form.LookupCode

ListByContainerLimited returns all model.Templates that match the provided "containedByRole" value AND are present in the "limited" list. If the "limited" list is empty, then all otherwise-valid templates are returned.

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 []config.Folder)

func (*Template) Schema

func (service *Template) Schema(templateID string) (schema.Schema, error)

Schema returns the Schema associated with this Stream

func (*Template) State

func (service *Template) State(templateID string, stateID string) (model.State, error)

State returns the detailed State information associated with this Stream

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(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

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(userCollection data.Collection, followerCollection data.Collection, followingCollection data.Collection, blockCollection data.Collection, streamService *Stream, keyService *EncryptionKey, emailService *DomainEmail, folderService *Folder, host string) User

NewUser returns a fully populated User service

func (*User) ActivityPubActor

func (service *User) ActivityPubActor(userID primitive.ObjectID) (pub.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) CalcBlockCount

func (service *User) CalcBlockCount(userID primitive.ObjectID) error

func (*User) CalcFollowerCount

func (service *User) CalcFollowerCount(userID primitive.ObjectID) error

func (*User) CalcFollowingCount

func (service *User) CalcFollowingCount(userID primitive.ObjectID) error

func (*User) Close

func (service *User) Close()

Close stops any background processes controlled by this service

func (*User) Count

func (service *User) Count(ctx context.Context, criteria exp.Expression) (int, error)

Count returns the number of (non-deleted) records in the User collection

func (*User) Delete

func (service *User) Delete(user *model.User, note string) error

Delete removes an User from the database (virtual delete)

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) Load

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

Load retrieves an User from the database

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) 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

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

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) Refresh

func (service *User) Refresh(userCollection data.Collection, followerCollection data.Collection, followingCollection data.Collection, blockCollection data.Collection)

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

func (*User) RemoteFollowURL

func (service *User) RemoteFollowURL() string

func (*User) ResetPassword

func (service *User) ResetPassword(user *model.User, resetCode string, newPassword string) error

ResetPassword resets the password for the provided user

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) 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) SendWelcomeEmail

func (service *User) SendWelcomeEmail(user *model.User)

SendWelcomeEmail 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 UserStream

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

UserStream manages all interactions with UserStream data.

func NewUserStream

func NewUserStream(collection data.Collection, ctx context.Context) UserStream

NewUserStream returns a fully initialized UserStream service

func (*UserStream) Delete

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

Delete removes an UserStream from the database (virtual delete)

func (*UserStream) List

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

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

func (*UserStream) Load

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

Load retrieves an UserStream from the database

func (UserStream) LoadByUserAndStream

func (service UserStream) LoadByUserAndStream(userID primitive.ObjectID, streamID primitive.ObjectID) (model.UserStream, error)

func (*UserStream) Save

func (service *UserStream) Save(stream *model.UserStream, note string) error

Save adds/updates an UserStream in the database

func (UserStream) VoteCount

func (service UserStream) VoteCount(streamID primitive.ObjectID) ([]queries.VoteCountResult, error)

VoteCount returns the totals for all votes for the designated stream

func (UserStream) VoteDetail

func (service UserStream) VoteDetail(streamID primitive.ObjectID) ([]queries.VoteDetailResult, error)

VoteDetails returns a list of users and their vote for the designated stream

func (UserStream) VoteRunes

func (service UserStream) VoteRunes() []string

VoteRunes returns the default runes to be used for "votes"

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