Documentation ¶
Overview ¶
Package types provides common data types used across all Betula, all conveniently collected in a single box for resolving import cycles nicely.
Index ¶
Constants ¶
const ActivityType = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
const OtherActivityType = "application/activity+json"
const (
PostsPerPage uint = 64
)
const TimeLayout = "2006-01-02 15:04:05"
TimeLayout is the time layout used across Betula.
Variables ¶
This section is empty.
Functions ¶
func CanonicalTagName ¶ added in v0.8.0
func CleanerLink ¶ added in v1.1.0
Same as CleanerLinkParts, but merges the parts back into one url.
func CleanerLinkParts ¶ added in v1.2.0
CleanerLinkParts returns the link a with https:// or http:// prefix and the / suffix, percent-encoding reversed and Punycode decoded.
Link is returned in two parts: scheme + authority and the rest (path, query, fragment).
Types ¶
type Actor ¶ added in v1.2.0
type Actor struct { ID string `json:"id"` Inbox string `json:"inbox"` PreferredUsername string `json:"preferredUsername"` DisplayedName string `json:"name"` Summary string `json:"summary,omitempty"` PublicKey struct { ID string `json:"id"` Owner string `json:"owner"` PublicKeyPEM string `json:"publicKeyPem"` } `json:"publicKey,omitempty"` SubscriptionStatus SubscriptionRelation `json:"-"` // Set manually Domain string `json:"-"` // Set manually }
type Post ¶
type Post struct { // ID is a unique identifier of the post. Do not set this field by yourself. ID int // CreationTime is like 2006-01-02 15:04:05. CreationTime string // Tags are the tags this post has. Do not set this field by yourself. Tags []Tag // URL is a URL with any protocol. URL string // Title is a name for the link. Title string // Description is a Mycomarkup-formatted document. Currently, just unescaped plain text. Description string // Visibility sets who can see the post. Visibility Visibility // RepostOf is URL of the post reposted. Nil if this is an original post. RepostOf *string }
Post is a link, along with some data.
type PostGroup ¶ added in v1.2.0
func GroupPostsByDate ¶ added in v1.2.0
GroupPostsByDate groups the posts by date. The dates are strings like 2024-01-10. This function expects the input posts to be sorted by date.
type RepostInfo ¶ added in v1.1.0
type Settings ¶ added in v0.7.0
type Settings struct { NetworkHost string NetworkPort uint // SiteName is a plaintext name of the site. SiteName string // SiteTitle is a hypertext title shown in the top left corner, in a <h1>. SiteTitle template.HTML SiteDescriptionMycomarkup string SiteURL string CustomCSS string FederationEnabled bool }
type SubscriptionRelation ¶ added in v1.2.0
type SubscriptionRelation string
const ( SubscriptionNone SubscriptionRelation = "" SubscriptionTheyFollow SubscriptionRelation = "follower" SubscriptionIFollow SubscriptionRelation = "following" SubscriptionMutual SubscriptionRelation = "mutual" SubscriptionPending SubscriptionRelation = "pending" SubscriptionPendingMutual SubscriptionRelation = "pending mutual" // yours pending, theirs accepted )
func (SubscriptionRelation) IsPending ¶ added in v1.2.0
func (sr SubscriptionRelation) IsPending() bool
func (SubscriptionRelation) TheyFollowUs ¶ added in v1.2.0
func (sr SubscriptionRelation) TheyFollowUs() bool
type Tag ¶ added in v0.8.0
func TagsFromStringSlice ¶ added in v1.1.0
type Visibility ¶
type Visibility int
Visibility determines where the post is seen.
const ( // Private posts are only seen by the author. Private Visibility = iota // Public posts are seen by everyone, and are federated. Public )
func VisibilityFromString ¶
func VisibilityFromString(s string) Visibility
VisibilityFromString turns a string into a Visbility.