Documentation
¶
Index ¶
- func GetActor(actor string, conf *util.AppConfig) (error, string)
- func GetFollowersCollection(actor string, conf *util.AppConfig, followerURIs []string) string
- func GetFollowersPage(actor string, conf *util.AppConfig, followerURIs []string, page int) string
- func GetFollowingCollection(actor string, conf *util.AppConfig, followingURIs []string) string
- func GetFollowingPage(actor string, conf *util.AppConfig, followingURIs []string, page int) string
- func GetNodeInfo20(conf *util.AppConfig) string
- func GetNodeInfo21(conf *util.AppConfig) string
- func GetNoteObject(noteId uuid.UUID, conf *util.AppConfig) (error, string)
- func GetOutbox(actor string, page int, conf *util.AppConfig) (error, string)
- func GetRSS(conf *util.AppConfig, username string) (string, error)
- func GetRSSItem(conf *util.AppConfig, id uuid.UUID) (string, error)
- func GetWebFingerNotFound() string
- func GetWebfinger(user string, conf *util.AppConfig) (error, string)
- func GetWellKnownNodeInfo(conf *util.AppConfig) string
- func HandleGlobalTimeline(c *gin.Context, conf *util.AppConfig)
- func HandleIndex(c *gin.Context, conf *util.AppConfig)
- func HandleProfile(c *gin.Context, conf *util.AppConfig)
- func HandleSinglePost(c *gin.Context, conf *util.AppConfig)
- func HandleTagFeed(c *gin.Context, conf *util.AppConfig)
- func HandleUploadForm(c *gin.Context, conf *util.AppConfig)
- func HandleUploadSubmit(c *gin.Context, conf *util.AppConfig)
- func IsHTMLRequest(accept string) bool
- func MaxBytesMiddleware(maxBytes int64) gin.HandlerFunc
- func ParsePageParam(pageStr string) int
- func RateLimitMiddleware(rl *RateLimiter) gin.HandlerFunc
- func ResolveWebFinger(username, domain string) (string, error)
- func Router(conf *util.AppConfig) (*gin.Engine, error)
- func ServeAvatar(c *gin.Context, conf *util.AppConfig)
- type IndexPageData
- type InfoBoxView
- type NodeInfo20
- type NodeInfoLink
- type NodeInfoMetadata
- type NodeInfoServices
- type NodeInfoSoftware
- type NodeInfoUsage
- type NodeInfoUsers
- type PostView
- type ProfilePageData
- type RateLimiter
- type ServerMessageView
- type SinglePostPageData
- type TagPageData
- type UserView
- type WebFingerResponse
- type WellKnownNodeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFollowersCollection ¶ added in v1.2.2
GetFollowersCollection returns an ActivityPub OrderedCollection of followers Always uses paging for compatibility with Mastodon and other servers
func GetFollowersPage ¶ added in v1.2.2
GetFollowersPage returns an OrderedCollectionPage for followers
func GetFollowingCollection ¶ added in v1.2.2
GetFollowingCollection returns an ActivityPub OrderedCollection of following Always uses paging for compatibility with Mastodon and other servers
func GetFollowingPage ¶ added in v1.2.2
GetFollowingPage returns an OrderedCollectionPage for following
func GetNodeInfo20 ¶ added in v1.2.2
GetNodeInfo20 returns a NodeInfo 2.0 JSON response
func GetNodeInfo21 ¶ added in v1.6.1
GetNodeInfo21 returns a NodeInfo 2.1 JSON response NodeInfo 2.1 adds repository and homepage fields to software
func GetNoteObject ¶
GetNoteObject returns a Note object as ActivityPub JSON
func GetOutbox ¶ added in v1.1.0
GetOutbox returns an ActivityPub OrderedCollection of a user's public posts This allows remote servers to discover posts without following the user
func GetWebFingerNotFound ¶
func GetWebFingerNotFound() string
GetWebFingerNotFound returns a 404 response
func GetWebfinger ¶
GetWebfinger returns WebFinger JSON for a local user
func GetWellKnownNodeInfo ¶ added in v1.2.2
GetWellKnownNodeInfo returns the /.well-known/nodeinfo discovery document
func HandleGlobalTimeline ¶ added in v1.6.0
func HandleUploadForm ¶ added in v1.5.0
HandleUploadForm shows the upload form for a valid token
func HandleUploadSubmit ¶ added in v1.5.0
HandleUploadSubmit processes the uploaded file
func IsHTMLRequest ¶ added in v1.5.0
IsHTMLRequest determines if an Accept header indicates a browser/HTML request rather than an ActivityPub client request. ActivityPub clients typically send:
- application/activity+json
- application/ld+json; profile="https://www.w3.org/ns/activitystreams"
- application/json
Browsers typically send:
- text/html
- */* (default)
- empty string
func MaxBytesMiddleware ¶ added in v1.1.0
func MaxBytesMiddleware(maxBytes int64) gin.HandlerFunc
MaxBytesMiddleware limits the size of request bodies
func ParsePageParam ¶ added in v1.1.0
ParsePageParam extracts the page parameter from a query string
func RateLimitMiddleware ¶ added in v1.1.0
func RateLimitMiddleware(rl *RateLimiter) gin.HandlerFunc
RateLimitMiddleware creates a Gin middleware for rate limiting
func ResolveWebFinger ¶
ResolveWebFinger resolves a user@domain to an ActivityPub actor URI Example: ResolveWebFinger("alice", "mastodon.social") -> "https://mastodon.social/users/alice"
Types ¶
type IndexPageData ¶ added in v1.1.0
type InfoBoxView ¶ added in v1.5.0
type NodeInfo20 ¶ added in v1.2.2
type NodeInfo20 struct {
Version string `json:"version"`
Software NodeInfoSoftware `json:"software"`
Protocols []string `json:"protocols"`
Services NodeInfoServices `json:"services"`
OpenRegistrations bool `json:"openRegistrations"`
Usage NodeInfoUsage `json:"usage"`
Metadata NodeInfoMetadata `json:"metadata"`
}
NodeInfo20 represents the NodeInfo 2.0 schema See: https://nodeinfo.diaspora.software/schema.html
type NodeInfoLink ¶ added in v1.2.2
type NodeInfoMetadata ¶ added in v1.2.2
type NodeInfoServices ¶ added in v1.2.2
type NodeInfoSoftware ¶ added in v1.2.2
type NodeInfoUsage ¶ added in v1.2.2
type NodeInfoUsage struct {
Users NodeInfoUsers `json:"users"`
LocalPosts int `json:"localPosts"`
}
type NodeInfoUsers ¶ added in v1.2.2
type PostView ¶ added in v1.1.0
type PostView struct {
NoteId string
Username string
UserDomain string // Domain for remote users (empty for local)
ProfileURL string // Full profile URL
PostURL string // Permalink to the post (web URL for display)
ObjectURI string // ActivityPub canonical URI (for API calls)
IsRemote bool // True if federated user
Message string
MessageHTML template.HTML // HTML-rendered message with clickable links
TimeAgo string
CreatedAt time.Time // For chronological sorting
InReplyToURI string // URI of parent post if this is a reply
ReplyCount int // Number of replies to this post
LikeCount int // Number of likes on this post
BoostCount int // Number of boosts on this post
Likers []string // Usernames who liked this post
Boosters []string // Usernames who boosted this post
BoostedBy string // If non-empty, this post was boosted by this user
}
type ProfilePageData ¶ added in v1.1.0
type RateLimiter ¶ added in v1.1.0
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter holds rate limiters for different IP addresses
func NewRateLimiter ¶ added in v1.1.0
func NewRateLimiter(r rate.Limit, b int) *RateLimiter
NewRateLimiter creates a new rate limiter r is requests per second, b is burst size
type ServerMessageView ¶ added in v1.6.1
type ServerMessageView struct {
Message string // Plain text message
MessageHTML template.HTML // Markdown-rendered HTML
Enabled bool
WebEnabled bool
}
ServerMessageView is the view model for server messages with rendered HTML
type SinglePostPageData ¶ added in v1.2.3
type SinglePostPageData struct {
Title string
Host string
SSHPort int
Version string
Post PostView
User UserView
ParentPost *PostView // Parent post if this is a reply (nil if not a reply)
Replies []PostView // Replies to this post
InfoBoxes []InfoBoxView
ServerMessage *ServerMessageView
}
type TagPageData ¶ added in v1.4.0
type WebFingerResponse ¶
type WebFingerResponse struct {
Subject string `json:"subject"`
Links []struct {
Rel string `json:"rel"`
Type string `json:"type"`
Href string `json:"href"`
} `json:"links"`
}
WebFingerResponse represents the response from a WebFinger query
type WellKnownNodeInfo ¶ added in v1.2.2
type WellKnownNodeInfo struct {
Links []NodeInfoLink `json:"links"`
}
WellKnownNodeInfo represents the /.well-known/nodeinfo response