domain

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FALSE dbBool = iota
	TRUE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Id             uuid.UUID
	Username       string
	Publickey      string
	CreatedAt      time.Time
	FirstTimeLogin dbBool
	WebPublicKey   string
	WebPrivateKey  string
	// ActivityPub fields
	DisplayName string
	Summary     string
	AvatarURL   string
	// Admin fields
	IsAdmin bool
	Muted   bool
	Banned  bool
	// Connection tracking
	LastIP string
}

func (*Account) ToString

func (acc *Account) ToString() string

type Activity

type Activity struct {
	Id           uuid.UUID
	ActivityURI  string
	ActivityType string // Follow, Create, Like, Announce, Undo, etc.
	ActorURI     string
	ObjectURI    string // ActivityPub object id (canonical URI, returns JSON)
	ObjectURL    string // ActivityPub object url (human-readable web UI link)
	InReplyTo    string // For Create activities, the URI this is a reply to (indexed for fast lookups)
	RawJSON      string
	Processed    bool
	CreatedAt    time.Time
	Local        bool // true if originated from this server
	FromRelay    bool // true if forwarded by a relay
	ReplyCount   int  // Denormalized reply count
	LikeCount    int  // Denormalized like count
	BoostCount   int  // Denormalized boost count
}

Activity represents an ActivityPub activity (for logging/deduplication)

type Ban added in v1.6.0

type Ban struct {
	Id            string    `json:"id"`              // Account ID of banned user
	Username      string    `json:"username"`        // Username for reference
	IPAddress     string    `json:"ip_address"`      // IP address at time of ban
	PublicKeyHash string    `json:"public_key_hash"` // SHA256 hash of SSH public key
	Reason        string    `json:"reason"`          // Reason for ban
	BannedAt      time.Time `json:"banned_at"`       // When the ban was created
}

Ban represents a banned user with their IP address and SSH public key

type Boost added in v1.4.1

type Boost struct {
	Id              uuid.UUID
	AccountId       uuid.UUID // Who boosted (local account, nil for remote booster)
	RemoteAccountId uuid.UUID // Who boosted (remote account, nil for local booster)
	NoteId          uuid.UUID // Which local note was boosted (nil if boosting remote post)
	ObjectURI       string    // URI of the boosted object (for remote posts)
	URI             string    // ActivityPub Announce activity URI
	CreatedAt       time.Time
}

Boost represents a boost/reblog/announce on a note

type DeliveryQueueItem

type DeliveryQueueItem struct {
	Id           uuid.UUID
	InboxURI     string
	ActivityJSON string // The complete activity to deliver
	Attempts     int
	NextRetryAt  time.Time
	CreatedAt    time.Time
}

DeliveryQueueItem represents an item in the delivery queue

type Follow

type Follow struct {
	Id              uuid.UUID
	AccountId       uuid.UUID // Can be local or remote account
	TargetAccountId uuid.UUID // Can be local or remote account
	URI             string    // ActivityPub Follow activity URI (empty for local follows)
	CreatedAt       time.Time
	Accepted        bool
	IsLocal         bool // true if this is a local-only follow
}

Follow represents a follow relationship

type GlobalTimelinePost added in v1.6.0

type GlobalTimelinePost struct {
	NoteId           string
	Username         string
	UserDomain       string
	ProfileURL       string
	ObjectURI        string // ActivityPub object id (canonical URI, for replies/likes)
	ObjectURL        string // ActivityPub object url (human-readable web UI link, preferred for display)
	IsRemote         bool
	Message          string
	ProcessedContent string // Pre-processed content for terminal display (cached to avoid re-processing in View)
	CreatedAt        time.Time
	ReplyCount       int
	LikeCount        int
	BoostCount       int
	BoostedBy        string // if non-empty, this post was boosted by this user (e.g., "@alice" or "@bob@domain")
}

GlobalTimelinePost represents a post in the global timeline (local + federated)

type HomePost added in v1.4.0

type HomePost struct {
	ID               uuid.UUID
	Author           string // @user (local) or @user@domain (remote)
	Content          string
	ProcessedContent string // Pre-processed content for terminal display (cached to avoid re-processing in View)
	Time             time.Time
	ObjectURI        string    // ActivityPub object id (canonical URI, returns JSON)
	ObjectURL        string    // ActivityPub object url (human-readable web UI link, preferred for display)
	IsLocal          bool      // true = local note, false = remote activity
	NoteID           uuid.UUID // only set for local posts (for editing/deleting)
	ReplyCount       int       // number of replies to this post
	LikeCount        int       // number of likes on this post
	BoostCount       int       // number of boosts on this post
	BoostedBy        string    // if non-empty, this post was boosted by this user (e.g., "@alice" or "@bob@domain")
}

HomePost represents a unified post in the home timeline (either local or remote)

type InfoBox added in v1.5.0

type InfoBox struct {
	Id        uuid.UUID `json:"id"`
	Title     string    `json:"title"`     // Title of the info box (supports HTML for icons)
	Content   string    `json:"content"`   // Content in markdown format
	OrderNum  int       `json:"order_num"` // Display order (lower numbers first)
	Enabled   bool      `json:"enabled"`   // Whether this box is shown
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

InfoBox represents a customizable information box shown on the web index page

type Like

type Like struct {
	Id        uuid.UUID
	AccountId uuid.UUID // Who liked (can be local or remote)
	NoteId    uuid.UUID // Which note was liked
	URI       string    // ActivityPub Like activity URI
	CreatedAt time.Time
}

Like represents a like/favorite on a note

type Note

type Note struct {
	Id        uuid.UUID
	CreatedBy string
	Message   string
	CreatedAt time.Time
	EditedAt  *time.Time // When the note was last edited (nil if never edited)
	// ActivityPub fields
	Visibility     string // "public", "unlisted", "followers", "direct"
	InReplyToURI   string // URI of the note this is replying to
	ObjectURI      string // ActivityPub object URI
	Federated      bool   // Whether to federate this note
	Sensitive      bool   // Contains sensitive content
	ContentWarning string // Content warning text
	// Engagement counters
	ReplyCount int // Number of replies
	LikeCount  int // Number of likes
	BoostCount int // Number of boosts
}

func (*Note) ToString

func (note *Note) ToString() string

type NoteMention added in v1.4.0

type NoteMention struct {
	Id                uuid.UUID
	NoteId            uuid.UUID
	MentionedActorURI string // The ActivityPub actor URI of the mentioned user
	MentionedUsername string // The username part (@username@domain -> username)
	MentionedDomain   string // The domain part (@username@domain -> domain)
	CreatedAt         time.Time
}

NoteMention represents a @user@domain mention in a note

type Notification added in v1.4.3

type Notification struct {
	Id               uuid.UUID
	AccountId        uuid.UUID        // The local user receiving the notification
	NotificationType NotificationType // follow, like, reply, mention
	ActorId          uuid.UUID        // The account that triggered the notification (local or remote)
	ActorUsername    string           // Denormalized for display (e.g., "alice")
	ActorDomain      string           // Denormalized for display (e.g., "mastodon.social", empty for local)
	NoteId           uuid.UUID        // Reference to the note (for like/reply/mention)
	NoteURI          string           // ActivityPub URI of the note
	NotePreview      string           // First 100 chars of note content
	Read             bool             // Whether the notification has been read
	CreatedAt        time.Time
}

Notification represents a user notification

func (*Notification) ActorHandle added in v1.4.3

func (n *Notification) ActorHandle() string

ActorHandle returns the formatted @user or @user@domain string

func (*Notification) Summary added in v1.4.3

func (n *Notification) Summary() string

Summary returns a one-line summary of the notification

func (*Notification) TypeIcon added in v1.4.3

func (n *Notification) TypeIcon() string

TypeIcon returns an emoji icon for the notification type

func (*Notification) TypeLabel added in v1.4.3

func (n *Notification) TypeLabel() string

TypeLabel returns a human-readable label for the notification type

type NotificationType added in v1.4.3

type NotificationType string

NotificationType represents the type of notification

const (
	NotificationFollow  NotificationType = "follow"
	NotificationLike    NotificationType = "like"
	NotificationBoost   NotificationType = "boost"
	NotificationReply   NotificationType = "reply"
	NotificationMention NotificationType = "mention"
)

type Relay added in v1.4.2

type Relay struct {
	Id         uuid.UUID
	ActorURI   string // The relay's actor URI (e.g., https://relay.example.com/actor)
	InboxURI   string // The relay's inbox URI for delivering activities
	FollowURI  string // The URI of our Follow activity (needed for Undo)
	Name       string // Display name from relay actor profile
	Status     string // pending, active, failed
	Paused     bool   // If true, incoming notes are logged but not saved
	CreatedAt  time.Time
	AcceptedAt *time.Time // When the relay accepted our Follow request
}

Relay represents an ActivityPub relay subscription

type RemoteAccount

type RemoteAccount struct {
	Id            uuid.UUID
	Username      string
	Domain        string
	ActorURI      string
	DisplayName   string
	Summary       string
	InboxURI      string
	OutboxURI     string
	PublicKeyPem  string
	AvatarURL     string
	LastFetchedAt time.Time
}

RemoteAccount represents a cached federated user

type SaveNote

type SaveNote struct {
	UserId       uuid.UUID
	Message      string
	InReplyToURI string // URI of parent post (empty for top-level posts)
}

type SearchResult added in v1.7.1

type SearchResult struct {
	ID         uuid.UUID
	Author     string // @user or @user@domain
	Snippet    string // FTS5 snippet with highlight markers (<<…>>)
	Time       time.Time
	ObjectURI  string
	ObjectURL  string
	IsLocal    bool
	NoteID     uuid.UUID // Only set for local notes
	SourceID   string    // ID in posts_fts (notes.id or activities.id)
	SourceType string    // "note" or "activity"
}

SearchResult represents a post found via full-text search

type ServerMessage added in v1.5.2

type ServerMessage struct {
	Id         int       `json:"id"`          // Always 1 (single row table)
	Message    string    `json:"message"`     // The message text
	Enabled    bool      `json:"enabled"`     // Whether to show the message in TUI
	WebEnabled bool      `json:"web_enabled"` // Whether to show the message in web UI
	UpdatedAt  time.Time `json:"updated_at"`  // Last update timestamp
}

ServerMessage represents a message from the server admin displayed in the TUI and web UI Only one server message can be active at a time

type TermsAndConditions added in v1.6.3

type TermsAndConditions struct {
	Id        int
	Content   string
	UpdatedAt time.Time
}

Terms and Conditions

type UserTermsAcceptance added in v1.6.3

type UserTermsAcceptance struct {
	Id         int
	UserId     uuid.UUID
	TermsId    int
	AcceptedAt time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL