Documentation
¶
Index ¶
- func FetchRemoteActor(actorURI string) (*domain.RemoteAccount, error)
- func FetchRemoteActorWithDeps(actorURI string, client HTTPClient, database Database) (*domain.RemoteAccount, error)
- func GetOrFetchActor(actorURI string) (*domain.RemoteAccount, error)
- func GetOrFetchActorWithDeps(actorURI string, client HTTPClient, database Database) (*domain.RemoteAccount, error)
- func HandleInbox(w http.ResponseWriter, r *http.Request, username string, conf *util.AppConfig)
- func HandleInboxWithDeps(w http.ResponseWriter, r *http.Request, username string, conf *util.AppConfig, ...)
- func ParsePrivateKey(pemString string) (*rsa.PrivateKey, error)
- func ParsePublicKey(pemString string) (*rsa.PublicKey, error)
- func SendAccept(localAccount *domain.Account, remoteActor *domain.RemoteAccount, ...) error
- func SendAcceptWithDeps(localAccount *domain.Account, remoteActor *domain.RemoteAccount, ...) error
- func SendActivity(activity any, inboxURI string, localAccount *domain.Account, ...) error
- func SendActivityWithDeps(activity any, inboxURI string, localAccount *domain.Account, ...) error
- func SendAnnounce(localAccount *domain.Account, noteURI string, announceURI string, ...) error
- func SendAnnounceWithDeps(localAccount *domain.Account, noteURI string, announceURI string, ...) error
- func SendCreate(note *domain.Note, localAccount *domain.Account, conf *util.AppConfig) error
- func SendCreateWithDeps(note *domain.Note, localAccount *domain.Account, conf *util.AppConfig, ...) error
- func SendDelete(noteId uuid.UUID, localAccount *domain.Account, conf *util.AppConfig) error
- func SendDeleteWithDeps(noteId uuid.UUID, localAccount *domain.Account, conf *util.AppConfig, ...) error
- func SendFollow(localAccount *domain.Account, remoteActorURI string, conf *util.AppConfig) error
- func SendFollowWithDeps(localAccount *domain.Account, remoteActorURI string, conf *util.AppConfig, ...) error
- func SendLike(localAccount *domain.Account, noteURI string, conf *util.AppConfig) error
- func SendLikeWithDeps(localAccount *domain.Account, noteURI string, conf *util.AppConfig, ...) error
- func SendRelayFollow(localAccount *domain.Account, relayActorURI string, conf *util.AppConfig) error
- func SendRelayFollowWithDeps(localAccount *domain.Account, relayActorURI string, conf *util.AppConfig, ...) error
- func SendRelayUnfollow(localAccount *domain.Account, relay *domain.Relay, conf *util.AppConfig) error
- func SendRelayUnfollowWithDeps(localAccount *domain.Account, relay *domain.Relay, conf *util.AppConfig, ...) error
- func SendUndo(localAccount *domain.Account, follow *domain.Follow, ...) error
- func SendUndoAnnounce(localAccount *domain.Account, noteURI string, announceURI string, ...) error
- func SendUndoAnnounceWithDeps(localAccount *domain.Account, noteURI string, announceURI string, ...) error
- func SendUndoLike(localAccount *domain.Account, noteURI string, likeURI string, ...) error
- func SendUndoLikeWithDeps(localAccount *domain.Account, noteURI string, likeURI string, ...) error
- func SendUndoWithDeps(localAccount *domain.Account, follow *domain.Follow, ...) error
- func SendUpdate(note *domain.Note, localAccount *domain.Account, conf *util.AppConfig) error
- func SendUpdateWithDeps(note *domain.Note, localAccount *domain.Account, conf *util.AppConfig, ...) error
- func SignRequest(req *http.Request, privateKey *rsa.PrivateKey, keyId string) error
- func StartDeliveryWorker(conf *util.AppConfig) func()
- func VerifyRequest(req *http.Request, publicKeyPem string) (string, error)
- type Activity
- type ActorResponse
- type DBWrapper
- func (w *DBWrapper) AcceptFollowByURI(uri string) error
- func (w *DBWrapper) CreateActivity(activity *domain.Activity) error
- func (w *DBWrapper) CreateBoost(boost *domain.Boost) error
- func (w *DBWrapper) CreateBoostFromRemote(boost *domain.Boost) error
- func (w *DBWrapper) CreateFollow(follow *domain.Follow) error
- func (w *DBWrapper) CreateLike(like *domain.Like) error
- func (w *DBWrapper) CreateNoteMention(mention *domain.NoteMention) error
- func (w *DBWrapper) CreateNotification(notification *domain.Notification) error
- func (w *DBWrapper) CreateRelay(relay *domain.Relay) error
- func (w *DBWrapper) CreateRemoteAccount(acc *domain.RemoteAccount) error
- func (w *DBWrapper) DecrementBoostCountByNoteId(noteId uuid.UUID) error
- func (w *DBWrapper) DecrementBoostCountByObjectURI(objectURI string) error
- func (w *DBWrapper) DecrementLikeCountByNoteId(noteId uuid.UUID) error
- func (w *DBWrapper) DeleteActivity(id uuid.UUID) error
- func (w *DBWrapper) DeleteBoostByAccountAndNote(accountId, noteId uuid.UUID) error
- func (w *DBWrapper) DeleteBoostByRemoteAccountAndObjectURI(remoteAccountId uuid.UUID, objectURI string) error
- func (w *DBWrapper) DeleteDelivery(id uuid.UUID) error
- func (w *DBWrapper) DeleteFollowByURI(uri string) error
- func (w *DBWrapper) DeleteFollowsByRemoteAccountId(remoteAccountId uuid.UUID) error
- func (w *DBWrapper) DeleteLikeByAccountAndNote(accountId, noteId uuid.UUID) error
- func (w *DBWrapper) DeleteRelay(id uuid.UUID) error
- func (w *DBWrapper) DeleteRemoteAccount(id uuid.UUID) error
- func (w *DBWrapper) EnqueueDelivery(item *domain.DeliveryQueueItem) error
- func (w *DBWrapper) HasBoost(accountId, noteId uuid.UUID) (bool, error)
- func (w *DBWrapper) HasBoostFromRemote(remoteAccountId uuid.UUID, objectURI string) (bool, error)
- func (w *DBWrapper) HasLike(accountId, noteId uuid.UUID) (bool, error)
- func (w *DBWrapper) HasLikeByURI(uri string) (bool, error)
- func (w *DBWrapper) IncrementBoostCountByNoteId(noteId uuid.UUID) error
- func (w *DBWrapper) IncrementLikeCountByNoteId(noteId uuid.UUID) error
- func (w *DBWrapper) IncrementReplyCountByURI(parentURI string) error
- func (w *DBWrapper) IsRemoteAccountFollowed(remoteAccountId uuid.UUID) (bool, error)
- func (w *DBWrapper) ReadAccById(id uuid.UUID) (error, *domain.Account)
- func (w *DBWrapper) ReadAccByUsername(username string) (error, *domain.Account)
- func (w *DBWrapper) ReadActiveRelays() (error, *[]domain.Relay)
- func (w *DBWrapper) ReadActiveUnpausedRelays() (error, *[]domain.Relay)
- func (w *DBWrapper) ReadActivityByObjectURI(objectURI string) (error, *domain.Activity)
- func (w *DBWrapper) ReadActivityByURI(uri string) (error, *domain.Activity)
- func (w *DBWrapper) ReadFollowByAccountIds(accountId, targetAccountId uuid.UUID) (error, *domain.Follow)
- func (w *DBWrapper) ReadFollowByURI(uri string) (error, *domain.Follow)
- func (w *DBWrapper) ReadFollowersByAccountId(accountId uuid.UUID) (error, *[]domain.Follow)
- func (w *DBWrapper) ReadLikeByAccountAndNote(accountId, noteId uuid.UUID) (error, *domain.Like)
- func (w *DBWrapper) ReadNoteByURI(objectURI string) (error, *domain.Note)
- func (w *DBWrapper) ReadPendingDeliveries(limit int) (error, *[]domain.DeliveryQueueItem)
- func (w *DBWrapper) ReadRelayByActorURI(actorURI string) (error, *domain.Relay)
- func (w *DBWrapper) ReadRemoteAccountByActorURI(actorURI string) (error, *domain.RemoteAccount)
- func (w *DBWrapper) ReadRemoteAccountById(id uuid.UUID) (error, *domain.RemoteAccount)
- func (w *DBWrapper) ReadRemoteAccountByURI(uri string) (error, *domain.RemoteAccount)
- func (w *DBWrapper) UpdateActivity(activity *domain.Activity) error
- func (w *DBWrapper) UpdateDeliveryAttempt(id uuid.UUID, attempts int, nextRetry time.Time) error
- func (w *DBWrapper) UpdateRelayStatus(id uuid.UUID, status string, acceptedAt *time.Time) error
- func (w *DBWrapper) UpdateRemoteAccount(acc *domain.RemoteAccount) error
- type Database
- type DefaultHTTPClient
- type DeliveryDeps
- type FollowActivity
- type HTTPClient
- type InboxDeps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchRemoteActor ¶
func FetchRemoteActor(actorURI string) (*domain.RemoteAccount, error)
FetchRemoteActor fetches an actor from a remote server and stores in cache. This is the production wrapper that uses the default HTTP client and database.
func FetchRemoteActorWithDeps ¶ added in v1.3.2
func FetchRemoteActorWithDeps(actorURI string, client HTTPClient, database Database) (*domain.RemoteAccount, error)
FetchRemoteActorWithDeps fetches an actor from a remote server and stores in cache. This version accepts dependencies for testing.
func GetOrFetchActor ¶
func GetOrFetchActor(actorURI string) (*domain.RemoteAccount, error)
GetOrFetchActor returns actor from cache or fetches if not cached/stale. This is the production wrapper that uses the default HTTP client and database.
func GetOrFetchActorWithDeps ¶ added in v1.3.2
func GetOrFetchActorWithDeps(actorURI string, client HTTPClient, database Database) (*domain.RemoteAccount, error)
GetOrFetchActorWithDeps returns actor from cache or fetches if not cached/stale. This version accepts dependencies for testing.
func HandleInbox ¶
HandleInbox processes incoming ActivityPub activities
func HandleInboxWithDeps ¶ added in v1.3.2
func HandleInboxWithDeps(w http.ResponseWriter, r *http.Request, username string, conf *util.AppConfig, deps *InboxDeps)
HandleInboxWithDeps processes incoming ActivityPub activities. This version accepts dependencies for testing.
func ParsePrivateKey ¶
func ParsePrivateKey(pemString string) (*rsa.PrivateKey, error)
ParsePrivateKey converts PEM string to *rsa.PrivateKey Supports both PKCS#1 (old format) and PKCS#8 (new format) for backwards compatibility
func ParsePublicKey ¶
ParsePublicKey converts PEM string to *rsa.PublicKey Supports both PKIX (PKCS#8) and PKCS#1 formats for backwards compatibility
func SendAccept ¶
func SendAccept(localAccount *domain.Account, remoteActor *domain.RemoteAccount, followID string, conf *util.AppConfig) error
SendAccept sends an Accept activity in response to a Follow. This is the production wrapper that uses the default HTTP client.
func SendAcceptWithDeps ¶ added in v1.3.2
func SendAcceptWithDeps(localAccount *domain.Account, remoteActor *domain.RemoteAccount, followID string, conf *util.AppConfig, client HTTPClient) error
SendAcceptWithDeps sends an Accept activity in response to a Follow. This version accepts dependencies for testing.
func SendActivity ¶
func SendActivity(activity any, inboxURI string, localAccount *domain.Account, conf *util.AppConfig) error
SendActivity sends an activity to a remote inbox. This is the production wrapper that uses the default HTTP client.
func SendActivityWithDeps ¶ added in v1.3.2
func SendActivityWithDeps(activity any, inboxURI string, localAccount *domain.Account, conf *util.AppConfig, client HTTPClient) error
SendActivityWithDeps sends an activity to a remote inbox. This version accepts dependencies for testing.
func SendAnnounce ¶ added in v1.6.0
func SendAnnounce(localAccount *domain.Account, noteURI string, announceURI string, conf *util.AppConfig) error
SendAnnounce sends an Announce activity (boost) for a note. This is the production wrapper that uses the default HTTP client and database.
func SendAnnounceWithDeps ¶ added in v1.6.0
func SendAnnounceWithDeps(localAccount *domain.Account, noteURI string, announceURI string, conf *util.AppConfig, client HTTPClient, database Database) error
SendAnnounceWithDeps sends an Announce activity (boost) for a note. This version accepts dependencies for testing.
func SendCreate ¶
SendCreate sends a Create activity for a new note. This is the production wrapper that uses the default database.
func SendCreateWithDeps ¶ added in v1.3.2
func SendCreateWithDeps(note *domain.Note, localAccount *domain.Account, conf *util.AppConfig, database Database) error
SendCreateWithDeps sends a Create activity for a new note. This version accepts dependencies for testing.
func SendDelete ¶
SendDelete sends a Delete activity to all followers when a note is deleted. This is the production wrapper that uses the default database.
func SendDeleteWithDeps ¶ added in v1.3.2
func SendDeleteWithDeps(noteId uuid.UUID, localAccount *domain.Account, conf *util.AppConfig, database Database) error
SendDeleteWithDeps sends a Delete activity to all followers when a note is deleted. This version accepts dependencies for testing.
func SendFollow ¶
SendFollow sends a Follow activity to a remote actor. This is the production wrapper that uses the default HTTP client and database.
func SendFollowWithDeps ¶ added in v1.3.2
func SendFollowWithDeps(localAccount *domain.Account, remoteActorURI string, conf *util.AppConfig, client HTTPClient, database Database) error
SendFollowWithDeps sends a Follow activity to a remote actor. This version accepts dependencies for testing.
func SendLike ¶ added in v1.4.1
SendLike sends a Like activity for a note. This is the production wrapper that uses the default HTTP client and database.
func SendLikeWithDeps ¶ added in v1.4.1
func SendLikeWithDeps(localAccount *domain.Account, noteURI string, conf *util.AppConfig, client HTTPClient, database Database) error
SendLikeWithDeps sends a Like activity for a note. This version accepts dependencies for testing.
func SendRelayFollow ¶ added in v1.4.2
func SendRelayFollow(localAccount *domain.Account, relayActorURI string, conf *util.AppConfig) error
SendRelayFollow subscribes to a relay by sending a Follow activity. This is the production wrapper that uses the default HTTP client and database.
func SendRelayFollowWithDeps ¶ added in v1.4.2
func SendRelayFollowWithDeps(localAccount *domain.Account, relayActorURI string, conf *util.AppConfig, client HTTPClient, database Database) error
SendRelayFollowWithDeps subscribes to a relay by sending a Follow activity. This version accepts dependencies for testing.
func SendRelayUnfollow ¶ added in v1.4.2
func SendRelayUnfollow(localAccount *domain.Account, relay *domain.Relay, conf *util.AppConfig) error
SendRelayUnfollow unsubscribes from a relay by sending an Undo Follow activity. This is the production wrapper that uses the default HTTP client.
func SendRelayUnfollowWithDeps ¶ added in v1.4.2
func SendRelayUnfollowWithDeps(localAccount *domain.Account, relay *domain.Relay, conf *util.AppConfig, client HTTPClient) error
SendRelayUnfollowWithDeps unsubscribes from a relay by sending an Undo Follow activity. This version accepts dependencies for testing.
func SendUndo ¶ added in v1.2.2
func SendUndo(localAccount *domain.Account, follow *domain.Follow, remoteActor *domain.RemoteAccount, conf *util.AppConfig) error
SendUndo sends an Undo activity for a Follow (i.e., unfollow). This is the production wrapper that uses the default HTTP client.
func SendUndoAnnounce ¶ added in v1.6.0
func SendUndoAnnounce(localAccount *domain.Account, noteURI string, announceURI string, conf *util.AppConfig) error
SendUndoAnnounce sends an Undo activity for an Announce (i.e., unboost). This is the production wrapper that uses the default HTTP client and database.
func SendUndoAnnounceWithDeps ¶ added in v1.6.0
func SendUndoAnnounceWithDeps(localAccount *domain.Account, noteURI string, announceURI string, conf *util.AppConfig, client HTTPClient, database Database) error
SendUndoAnnounceWithDeps sends an Undo activity for an Announce (i.e., unboost). This version accepts dependencies for testing.
func SendUndoLike ¶ added in v1.4.1
func SendUndoLike(localAccount *domain.Account, noteURI string, likeURI string, conf *util.AppConfig) error
SendUndoLike sends an Undo activity for a Like (i.e., unlike). This is the production wrapper that uses the default HTTP client and database.
func SendUndoLikeWithDeps ¶ added in v1.4.1
func SendUndoLikeWithDeps(localAccount *domain.Account, noteURI string, likeURI string, conf *util.AppConfig, client HTTPClient, database Database) error
SendUndoLikeWithDeps sends an Undo activity for a Like (i.e., unlike). This version accepts dependencies for testing.
func SendUndoWithDeps ¶ added in v1.3.2
func SendUndoWithDeps(localAccount *domain.Account, follow *domain.Follow, remoteActor *domain.RemoteAccount, conf *util.AppConfig, client HTTPClient) error
SendUndoWithDeps sends an Undo activity for a Follow (i.e., unfollow). This version accepts dependencies for testing.
func SendUpdate ¶
SendUpdate sends an Update activity to all followers when a note is edited. This is the production wrapper that uses the default database.
func SendUpdateWithDeps ¶ added in v1.3.2
func SendUpdateWithDeps(note *domain.Note, localAccount *domain.Account, conf *util.AppConfig, database Database) error
SendUpdateWithDeps sends an Update activity to all followers when a note is edited. This version accepts dependencies for testing.
func SignRequest ¶
SignRequest signs an outgoing HTTP request with the given private key keyId format: "https://example.com/users/alice#main-key"
func StartDeliveryWorker ¶
StartDeliveryWorker starts a background worker that processes the delivery queue. Returns a stop function that can be called to gracefully stop the worker.
Types ¶
type Activity ¶
type Activity struct {
Context any `json:"@context"`
ID string `json:"id"`
Type string `json:"type"`
Actor string `json:"actor"`
Object any `json:"object"`
}
Activity represents a generic ActivityPub activity
type ActorResponse ¶
type ActorResponse struct {
Context any `json:"@context"`
ID string `json:"id"`
Type string `json:"type"`
PreferredUsername string `json:"preferredUsername"`
Name string `json:"name"`
Summary string `json:"summary"`
Inbox string `json:"inbox"`
Outbox string `json:"outbox"`
Icon struct {
Type string `json:"type"`
MediaType string `json:"mediaType"`
URL string `json:"url"`
} `json:"icon"`
PublicKey struct {
ID string `json:"id"`
Owner string `json:"owner"`
PublicKeyPem string `json:"publicKeyPem"`
} `json:"publicKey"`
}
ActorResponse represents the JSON structure of an ActivityPub actor
type DBWrapper ¶ added in v1.3.2
type DBWrapper struct {
// contains filtered or unexported fields
}
DBWrapper wraps the real database to implement the Database interface. This adapter allows the production code to use the existing db.GetDB() singleton while also supporting dependency injection for tests.
func NewDBWrapper ¶ added in v1.3.2
func NewDBWrapper() *DBWrapper
NewDBWrapper creates a new database wrapper around the singleton database
func (*DBWrapper) AcceptFollowByURI ¶ added in v1.3.2
func (*DBWrapper) CreateActivity ¶ added in v1.3.2
func (*DBWrapper) CreateBoost ¶ added in v1.4.1
func (*DBWrapper) CreateBoostFromRemote ¶ added in v1.6.0
func (*DBWrapper) CreateFollow ¶ added in v1.3.2
func (*DBWrapper) CreateLike ¶ added in v1.4.1
func (*DBWrapper) CreateNoteMention ¶ added in v1.4.0
func (w *DBWrapper) CreateNoteMention(mention *domain.NoteMention) error
func (*DBWrapper) CreateNotification ¶ added in v1.4.3
func (w *DBWrapper) CreateNotification(notification *domain.Notification) error
func (*DBWrapper) CreateRelay ¶ added in v1.4.2
func (*DBWrapper) CreateRemoteAccount ¶ added in v1.3.2
func (w *DBWrapper) CreateRemoteAccount(acc *domain.RemoteAccount) error
func (*DBWrapper) DecrementBoostCountByNoteId ¶ added in v1.4.1
func (*DBWrapper) DecrementBoostCountByObjectURI ¶ added in v1.6.0
func (*DBWrapper) DecrementLikeCountByNoteId ¶ added in v1.4.1
func (*DBWrapper) DeleteActivity ¶ added in v1.3.2
func (*DBWrapper) DeleteBoostByAccountAndNote ¶ added in v1.4.1
func (*DBWrapper) DeleteBoostByRemoteAccountAndObjectURI ¶ added in v1.6.0
func (*DBWrapper) DeleteDelivery ¶ added in v1.3.2
func (*DBWrapper) DeleteFollowByURI ¶ added in v1.3.2
func (*DBWrapper) DeleteFollowsByRemoteAccountId ¶ added in v1.3.2
func (*DBWrapper) DeleteLikeByAccountAndNote ¶ added in v1.4.1
func (*DBWrapper) DeleteRemoteAccount ¶ added in v1.3.2
func (*DBWrapper) EnqueueDelivery ¶ added in v1.3.2
func (w *DBWrapper) EnqueueDelivery(item *domain.DeliveryQueueItem) error
func (*DBWrapper) HasBoostFromRemote ¶ added in v1.6.0
func (*DBWrapper) HasLikeByURI ¶ added in v1.4.1
func (*DBWrapper) IncrementBoostCountByNoteId ¶ added in v1.4.1
func (*DBWrapper) IncrementLikeCountByNoteId ¶ added in v1.4.1
func (*DBWrapper) IncrementReplyCountByURI ¶ added in v1.4.0
func (*DBWrapper) IsRemoteAccountFollowed ¶ added in v1.6.0
func (*DBWrapper) ReadAccById ¶ added in v1.3.2
func (*DBWrapper) ReadAccByUsername ¶ added in v1.3.2
func (*DBWrapper) ReadActiveRelays ¶ added in v1.4.2
func (*DBWrapper) ReadActiveUnpausedRelays ¶ added in v1.4.2
func (*DBWrapper) ReadActivityByObjectURI ¶ added in v1.3.2
func (*DBWrapper) ReadActivityByURI ¶ added in v1.4.2
func (*DBWrapper) ReadFollowByAccountIds ¶ added in v1.3.2
func (*DBWrapper) ReadFollowByURI ¶ added in v1.3.2
func (*DBWrapper) ReadFollowersByAccountId ¶ added in v1.3.2
func (*DBWrapper) ReadLikeByAccountAndNote ¶ added in v1.4.1
func (*DBWrapper) ReadNoteByURI ¶ added in v1.4.0
func (*DBWrapper) ReadPendingDeliveries ¶ added in v1.3.2
func (w *DBWrapper) ReadPendingDeliveries(limit int) (error, *[]domain.DeliveryQueueItem)
func (*DBWrapper) ReadRelayByActorURI ¶ added in v1.4.2
func (*DBWrapper) ReadRemoteAccountByActorURI ¶ added in v1.3.2
func (w *DBWrapper) ReadRemoteAccountByActorURI(actorURI string) (error, *domain.RemoteAccount)
func (*DBWrapper) ReadRemoteAccountById ¶ added in v1.3.2
func (*DBWrapper) ReadRemoteAccountByURI ¶ added in v1.3.2
func (w *DBWrapper) ReadRemoteAccountByURI(uri string) (error, *domain.RemoteAccount)
func (*DBWrapper) UpdateActivity ¶ added in v1.3.2
func (*DBWrapper) UpdateDeliveryAttempt ¶ added in v1.3.2
func (*DBWrapper) UpdateRelayStatus ¶ added in v1.4.2
func (*DBWrapper) UpdateRemoteAccount ¶ added in v1.3.2
func (w *DBWrapper) UpdateRemoteAccount(acc *domain.RemoteAccount) error
type Database ¶ added in v1.3.2
type Database interface {
// Account operations
ReadAccByUsername(username string) (error, *domain.Account)
ReadAccById(id uuid.UUID) (error, *domain.Account)
// Remote account operations
ReadRemoteAccountByURI(uri string) (error, *domain.RemoteAccount)
ReadRemoteAccountById(id uuid.UUID) (error, *domain.RemoteAccount)
ReadRemoteAccountByActorURI(actorURI string) (error, *domain.RemoteAccount)
CreateRemoteAccount(acc *domain.RemoteAccount) error
UpdateRemoteAccount(acc *domain.RemoteAccount) error
DeleteRemoteAccount(id uuid.UUID) error
// Follow operations
CreateFollow(follow *domain.Follow) error
ReadFollowByURI(uri string) (error, *domain.Follow)
ReadFollowByAccountIds(accountId, targetAccountId uuid.UUID) (error, *domain.Follow)
DeleteFollowByURI(uri string) error
AcceptFollowByURI(uri string) error
ReadFollowersByAccountId(accountId uuid.UUID) (error, *[]domain.Follow)
DeleteFollowsByRemoteAccountId(remoteAccountId uuid.UUID) error
// Activity operations
CreateActivity(activity *domain.Activity) error
UpdateActivity(activity *domain.Activity) error
ReadActivityByURI(uri string) (error, *domain.Activity)
ReadActivityByObjectURI(objectURI string) (error, *domain.Activity)
DeleteActivity(id uuid.UUID) error
// Note operations (for replies)
ReadNoteByURI(objectURI string) (error, *domain.Note)
// Mention operations
CreateNoteMention(mention *domain.NoteMention) error
// Engagement count operations
IncrementReplyCountByURI(parentURI string) error
// Like operations
CreateLike(like *domain.Like) error
HasLikeByURI(uri string) (bool, error)
HasLike(accountId, noteId uuid.UUID) (bool, error)
ReadLikeByAccountAndNote(accountId, noteId uuid.UUID) (error, *domain.Like)
DeleteLikeByAccountAndNote(accountId, noteId uuid.UUID) error
IncrementLikeCountByNoteId(noteId uuid.UUID) error
DecrementLikeCountByNoteId(noteId uuid.UUID) error
// Boost operations
CreateBoost(boost *domain.Boost) error
HasBoost(accountId, noteId uuid.UUID) (bool, error)
DeleteBoostByAccountAndNote(accountId, noteId uuid.UUID) error
IncrementBoostCountByNoteId(noteId uuid.UUID) error
DecrementBoostCountByNoteId(noteId uuid.UUID) error
// Remote boost operations (for boosts from followed remote users)
IsRemoteAccountFollowed(remoteAccountId uuid.UUID) (bool, error)
CreateBoostFromRemote(boost *domain.Boost) error
HasBoostFromRemote(remoteAccountId uuid.UUID, objectURI string) (bool, error)
DeleteBoostByRemoteAccountAndObjectURI(remoteAccountId uuid.UUID, objectURI string) error
DecrementBoostCountByObjectURI(objectURI string) error
// Delivery queue operations
EnqueueDelivery(item *domain.DeliveryQueueItem) error
ReadPendingDeliveries(limit int) (error, *[]domain.DeliveryQueueItem)
UpdateDeliveryAttempt(id uuid.UUID, attempts int, nextRetry time.Time) error
DeleteDelivery(id uuid.UUID) error
// Relay operations
CreateRelay(relay *domain.Relay) error
ReadActiveRelays() (error, *[]domain.Relay)
ReadActiveUnpausedRelays() (error, *[]domain.Relay)
ReadRelayByActorURI(actorURI string) (error, *domain.Relay)
UpdateRelayStatus(id uuid.UUID, status string, acceptedAt *time.Time) error
DeleteRelay(id uuid.UUID) error
// Notification operations
CreateNotification(notification *domain.Notification) error
}
Database defines the database operations required by the ActivityPub package. This interface allows for dependency injection and testing with mock implementations.
type DefaultHTTPClient ¶ added in v1.3.2
type DefaultHTTPClient struct {
// contains filtered or unexported fields
}
DefaultHTTPClient is the default HTTP client used in production
func NewDefaultHTTPClient ¶ added in v1.3.2
func NewDefaultHTTPClient(timeout time.Duration) *DefaultHTTPClient
NewDefaultHTTPClient creates a new default HTTP client with the specified timeout
type DeliveryDeps ¶ added in v1.3.2
type DeliveryDeps struct {
Database Database
HTTPClient HTTPClient
}
DeliveryDeps holds dependencies for delivery operations
type FollowActivity ¶
type FollowActivity struct {
Context any `json:"@context"`
ID string `json:"id"`
Type string `json:"type"`
Actor string `json:"actor"`
Object string `json:"object"` // URI of the person being followed
}
FollowActivity represents an ActivityPub Follow activity
type HTTPClient ¶ added in v1.3.2
HTTPClient defines the HTTP client operations required by the ActivityPub package. This interface allows for dependency injection and testing with mock implementations.
type InboxDeps ¶ added in v1.3.2
type InboxDeps struct {
Database Database
HTTPClient HTTPClient
}
InboxDeps holds dependencies for inbox handlers (for testing)