domain

package
v0.7.539 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const QRByteModeCapacity = 2953

QRByteModeCapacity is the maximum payload (bytes) that fits in a QR code at version 40 with error correction level 'L' in byte mode. The desktop UI renders the AuthNodeInfo envelope as a pairing QR; JSON payloads larger than this cannot be encoded and the QR modal renders blank.

View Source
const RetweetPrefix = "RT:"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthNodeInfo

type AuthNodeInfo struct {
	UserId         string   `json:"user_id"`
	Token          string   `json:"token"`
	PSK            string   `json:"psk"`
	ID             string   `json:"node_id"`
	Addresses      []string `json:"addresses"`
	Role           string   `json:"role"`
	BootstrapPeers []string `json:"bootstrap_peers"`
	Network        string   `json:"network,omitempty"`
}

AuthNodeInfo defines model for AuthNodeInfo.

func (AuthNodeInfo) LogSize added in v0.6.249

func (a AuthNodeInfo) LogSize()

LogSize logs the JSON-encoded size of the AuthNodeInfo and warns when it exceeds QRByteModeCapacity, surfacing pairing-QR overflow in node logs before users hit a blank QR modal.

type Bookmark added in v0.7.403

type Bookmark struct {
	UserId      string    `json:"user_id"`
	TweetId     string    `json:"tweet_id"`
	OwnerUserId string    `json:"owner_user_id"`
	CreatedAt   time.Time `json:"created_at"`
}

Bookmark defines model for Bookmark — the local pin a user puts on someone's tweet. The owner id is stored alongside so the timeline render can fetch the tweet without an extra resolution round-trip.

type Chat

type Chat struct {
	CreatedAt   time.Time `json:"created_at"`
	Id          string    `json:"id"`
	OtherUserId string    `json:"other_user_id"`
	OwnerId     string    `json:"owner_id"`
	LastMessage string    `json:"last_message"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Chat defines model for Chat.

type ChatMessage

type ChatMessage struct {
	ChatId     string    `json:"chat_id"`
	CreatedAt  time.Time `json:"created_at"`
	Id         string    `json:"id"`
	ReceiverId string    `json:"receiver_id"`
	SenderId   string    `json:"sender_id"`
	Text       string    `json:"text"`
	Status     string    `json:"status,omitempty"`
}

ChatMessage defines model for ChatMessage.

type Device added in v0.6.263

type Device struct {
	ID         ID                 `json:"id"`
	CreatedAt  time.Time          `json:"created_at"`
	NodeId     warpnet.WarpPeerID `json:"node_id"`
	Token      string             `json:"token"`
	Platform   string             `json:"platform"`
	LastActive time.Time          `json:"last_active"`
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

func (*Error) Error

func (e *Error) Error() string

type Filter added in v0.7.26

type Filter struct {
	Id        string          `json:"id"`
	UserId    string          `json:"user_id"`
	Title     string          `json:"title"`
	Context   []FilterContext `json:"context"`
	Action    FilterAction    `json:"action"`
	ExpiresAt *time.Time      `json:"expires_at,omitempty"`
	Keywords  []FilterKeyword `json:"keywords"`
}

type FilterAction added in v0.7.26

type FilterAction string

FilterAction is what happens to a tweet that matches a filter.

const (
	FilterActionWarn FilterAction = "warn"
	FilterActionHide FilterAction = "hide"
)

type FilterContext added in v0.7.26

type FilterContext string

Filter is a per-user keyword/regex filter. Filters apply at timeline-read time; they're never replicated to peers. Keywords are stored as an embedded slice (Mastodon models them as a sub-resource with their own ids — we keep the same shape on the wire but the storage is one record per filter). FilterContext is where a content filter applies. Closed enum — only these values are accepted on the wire. Note: there is no "account" context in Warpnet — Warpnet has users and nodes, not accounts. Warpnet has no "public" context either — every tweet is public by default, so a filter on a "public" timeline would be redundant.

const (
	FilterContextHome          FilterContext = "home"
	FilterContextNotifications FilterContext = "notifications"
	FilterContextThread        FilterContext = "thread"
)

type FilterKeyword added in v0.7.26

type FilterKeyword struct {
	Id        string `json:"id"`
	Keyword   string `json:"keyword"`
	WholeWord bool   `json:"whole_word"`
}

FilterKeyword is a single match rule on a filter.

type ID added in v0.5.83

type ID = string

type Identity

type Identity struct {
	Owner Owner  `json:"owner"`
	Token string `json:"token"`
	PSK   string `json:"psk"`
}

Identity defines model for Identity.

type Like

type Like struct {
	TweetId string `json:"tweet_id"`
	UserId  string `json:"user_id"`
}

Like defines model for Like.

type LikedTweet added in v0.7.403

type LikedTweet struct {
	UserId      string    `json:"user_id"`
	TweetId     string    `json:"tweet_id"`
	OwnerUserId string    `json:"owner_user_id"`
	CreatedAt   time.Time `json:"created_at"`
}

LikedTweet defines model for LikedTweet — one entry of a user's "tweets I liked" index. OwnerUserId is the tweet author's id, stored alongside so clients can fetch the tweet without an extra resolution round-trip.

type ModelType added in v0.3.163

type ModelType string
const LLAMAGuard3 ModelType = "LlamaGuard3"

type ModerationObjectType added in v0.5.30

type ModerationObjectType int
const (
	ModerationUserType ModerationObjectType = iota
	ModerationTweetType
	ModerationReplyType
	ModerationImageType
)

func (ModerationObjectType) String added in v0.5.134

func (t ModerationObjectType) String() string

type ModerationResult added in v0.5.30

type ModerationResult bool

type Notification added in v0.5.30

type Notification struct {
	Type        NotificationType `json:"type"`
	Id          string           `json:"id"`
	Text        string           `json:"text"`
	RecepientId string           `json:"user_id"`
	ActorId     string           `json:"actor_id,omitempty"`
	TweetId     string           `json:"tweet_id,omitempty"`
	IsRead      bool             `json:"is_read"`
	CreatedAt   time.Time        `json:"created_at"`
}

type NotificationSettings added in v0.7.483

type NotificationSettings struct {
	EmailEnabled bool   `json:"email_enabled"`
	Recipient    string `json:"recipient"`
	SMTPHost     string `json:"smtp_host"`
	SMTPPort     int    `json:"smtp_port"`
	SMTPUsername string `json:"smtp_username"`
	SMTPPassword string `json:"smtp_password"`
	SMTPUseTLS   bool   `json:"smtp_use_tls"`
	// Types is the per-notification-type email toggle. A type absent from
	// the map (or false) means "do not email for this type".
	Types map[NotificationType]bool `json:"types"`
}

NotificationSettings holds a user's per-node notification preferences, including the email channel. SMTP credentials are the user's own (bring-your-own): the node connects to them to relay email. The whole local store is encrypted at rest, so the SMTP password lives here in plaintext form only inside the encrypted DB.

type NotificationType added in v0.5.30

type NotificationType string
const (
	NotificationModerationType NotificationType = "moderation"
	NotificationRetweetType    NotificationType = "retweet"
	NotificationFollowType     NotificationType = "follow"
	NotificationLikeType       NotificationType = "like"
	NotificationMentionType    NotificationType = "mention"
	NotificationReplyType      NotificationType = "reply"
	NotificationMessageType    NotificationType = "message"
	NotificationNewUserType    NotificationType = "new_user"
)

func (NotificationType) String added in v0.5.30

func (n NotificationType) String() string

type Owner

type Owner struct {
	CreatedAt       time.Time `json:"created_at"`
	NodeId          string    `json:"node_id"`
	UserId          string    `json:"user_id"`
	RedundantUserID string    `json:"id"`
	Username        string    `json:"username"`
}

Owner defines model for Owner.

type Tweet

type Tweet struct {
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    *time.Time `json:"updated_at,omitempty"`
	Id           string     `json:"id"`
	ParentId     *string    `json:"parent_id,omitempty"`
	ParentUserId *string    `json:"parent_user_id,omitempty"`

	// RetweetedBy retweeted by user id
	RetweetedBy   *string          `json:"retweeted_by,omitempty"`
	RootId        string           `json:"root_id"`
	Text          string           `json:"text"`
	UserId        string           `json:"user_id"`
	Username      string           `json:"username"`
	ImageKeys     []string         `json:"image_keys,omitempty"`
	Network       string           `json:"network"`
	Moderation    *TweetModeration `json:"moderation,omitempty"`
	Pinned        bool             `json:"pinned,omitempty"`
	QuotedTweetId *string          `json:"quoted_tweet_id,omitempty"`
	QuotedUserId  *string          `json:"quoted_user_id,omitempty"`
}

Tweet defines model for Tweet.

ParentId is the parent TWEET id (not a user id) for replies; nil for top-level tweets and for replies that hang directly off RootId. A tweet with a non-nil ParentId is a reply: it lives inside its RootId thread instead of the author's timeline. ParentUserId is the parent tweet's author id — the routing key used to forward a reply to the node hosting the parent so the thread stays consistent across peers.

func (*Tweet) IsModerated added in v0.5.134

func (t *Tweet) IsModerated() bool

func (*Tweet) IsReply added in v0.7.381

func (t *Tweet) IsReply() bool

IsReply reports whether the tweet is a reply, i.e. it hangs off a parent tweet inside a thread rather than being a top-level timeline tweet.

type TweetEdit added in v0.7.26

type TweetEdit struct {
	Id              string    `json:"id"`
	OriginalTweetId string    `json:"original_tweet_id"`
	UserId          string    `json:"user_id"`
	Text            string    `json:"text"`
	EditedAt        time.Time `json:"edited_at"`
}

TweetEdit is an immutable revision row. Tweets are mutated in-place (Tweet.Text rewritten) and a TweetEdit is appended for each edit so the client can show "edited at X" history. EditedAt = the moment the edit was committed; the original tweet's CreatedAt stays untouched.

type TweetModeration added in v0.3.147

type TweetModeration struct {
	ModeratorID ID               `json:"moderator_id"`
	Model       ModelType        `json:"model"`
	IsOk        ModerationResult `json:"is_ok"`
	Reason      *string          `json:"reason"`
	TimeAt      time.Time        `json:"time_at"`
}

type User

type User struct {
	// Avatar mime type + "," + base64
	AvatarKey string `json:"avatar_key,omitempty"`

	// BackgroundImage mime type + "," + base64
	BackgroundImageKey string     `json:"background_image_key"`
	Bio                string     `json:"bio"`
	Birthdate          string     `json:"birthdate"`
	CreatedAt          time.Time  `json:"created_at"`
	UpdatedAt          *time.Time `json:"updated_at,omitempty"`
	FollowingsCount    int64      `json:"followings_count"`
	FollowersCount     int64      `json:"followers_count"`
	Id                 string     `json:"id"`
	IsOffline          bool       `json:"isOffline"`
	LastSeen           *time.Time `json:"last_seen,omitempty"`
	NodeId             string     `json:"node_id"`
	Network            string     `json:"network"`
	// Role mirrors NodeInfo.Role: "" for a regular user, "business" for a
	// business account. Stamped from the node's NodeInfo when the user is
	// cached (discovery) so clients can badge business accounts.
	Role          string            `json:"role,omitempty"`
	RoundTripTime int64             `json:"rtt"`
	TweetsCount   int64             `json:"tweets_count"`
	Username      string            `json:"username"`
	Website       *string           `json:"website,omitempty"`
	Moderation    *UserModeration   `json:"moderation"`
	Metadata      map[string]string `json:"metadata"`
	// Locked is the "manually-approve followers" flag. When true, an
	// inbound follow lands in the follow-request queue instead of being
	// accepted automatically.
	Locked bool `json:"locked,omitempty"`
}

User defines model for User.

type UserModeration added in v0.3.110

type UserModeration struct {
	IsModerated bool      `json:"is_moderated"`
	Model       ModelType `json:"model"`
	IsOk        bool      `json:"is_ok"`
	Reason      *string   `json:"reason"`
	Strikes     uint8     `json:"strikes"`
	TimeAt      time.Time `json:"time_at"`
}

Jump to

Keyboard shortcuts

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