internal

package
v0.0.0-...-7fd3dae Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: AGPL-3.0 Imports: 116 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InvalidConfigValue is the constant value for invalid config values
	// which must be changed for production configurations before successful
	// startup
	InvalidConfigValue = "INVALID CONFIG VALUE - PLEASE CHANGE THIS VALUE"

	// DefaultDebug is the default debug mode
	DefaultDebug = false

	// DefaultData is the default data directory for storage
	DefaultData = "./data"

	// DefaultTLS is the default for whether to enable TLS
	DefaultTLS = false

	// DefaultTLSKey is the default path to a TLS private key (if blank uses Let's Encrypt)
	DefaultTLSKey = ""

	// DefaultTLSCert is the default path to a TLS certificate (if blank uses Let's Encrypt)
	DefaultTLSCert = ""

	// DefaultAuth is the default auther for authenticating sessions
	DefaultAuth = "session"

	// DefaultRedirectURL is the default redirect url for the auther
	DefaultRedirectURL = "/"

	// DefaultAuthHeader is the default auth header to use for proxy auth
	DefaultAuthHeader = "X-User"

	// DefaultStore is the default data store used for accounts, sessions, etc
	DefaultStore = "bitcask://yarn.db"

	// DefaultBaseURL is the default Base URL for the app used to construct feed URLs
	DefaultBaseURL = "http://0.0.0.0:8000"

	// DefaultAdminUser is the default username to grant admin privileges to
	DefaultAdminUser = "admin"

	// DefaultAdminName is the default name of the admin user used in support requests
	DefaultAdminName = "Administrator"

	// DefaultAdminEmail is the default email of the admin user used in support requests
	DefaultAdminEmail = "support@yarn.social"

	// DefaultName is the default instance name
	DefaultName = "yarn.local"

	// DefaultMetaxxx are the default set of <meta> tags used on non-specific views
	DefaultMetaTitle       = ""
	DefaultMetaAuthor      = "Yarn.social"
	DefaultMetaKeywords    = "twtxt, twt, yarn, blog, micro-blog, microblogging, social, media, decentralised, pod"
	DefaultMetaDescription = "" /* 147-byte string literal not displayed */

	// DefaultTheme is the default theme to use for templates and static assets
	// (en empty value means to use the builtin default theme)
	DefaultTheme = ""

	// DefaultLang is the default language to use ('en' or 'zh-cn')
	DefaultLang = "auto"

	// DefaultOpenRegistrations is the default for open user registrations
	DefaultOpenRegistrations = false

	// DefaultFrontPage is the default behaviour of the pod's front page (anonymous discover view)
	DefaultFrontPage = localViewKey

	// DefaultDisableGzip is the default for disabling Gzip compression
	DefaultDisableGzip = false

	// DefaultDisableLogger is the default for disabling the Logger (access logs)
	DefaultDisableLogger = false

	// DefaultDisableMedia is the default for disabling Media support
	DefaultDisableMedia = false

	// DefaultDisableFfmpeg is the default for disabling ffmpeg support
	DefaultDisableFfmpeg = false

	// DefaultDisableArchive is the default for disabling on-disk archive support
	DefaultDisableArchive = false

	// DefaultCookieSecret is the server's default cookie secret
	DefaultCookieSecret = InvalidConfigValue

	// DefaultTwtsPerPage is the server's default twts per page to display
	DefaultTwtsPerPage = 50

	// DefaultMaxTwtLength is the default maximum length of posts permitted
	DefaultMaxTwtLength = 1024

	// DefaultMaxCacheTTL is the default maximum cache ttl of twts in memory
	DefaultMaxCacheTTL = time.Hour * 24 * 14 // 2 weeks

	// DefaultFetchInterval is the default interval used by the global feed cache
	// to control when to actually fetch and update feeds.
	DefaultFetchInterval = "@every 5m"

	// DefaultMaxCacheItems is the default maximum cache items (per feed source)
	// of twts in memory
	DefaultMaxCacheItems = DefaultTwtsPerPage * 3 // We get bored after paging thorughh > 3 pages :D

	// DefaultOpenProfiles is the default for whether or not to have open user profiles
	DefaultOpenProfiles = false

	// DefaultMaxUploadSize is the default maximum upload size permitted
	DefaultMaxUploadSize = 1 << 24 // ~16MB (enough for high-res photos)

	// DefaultSessionCacheTTL is the server's default session cache ttl
	DefaultSessionCacheTTL = 1 * time.Hour

	// DefaultSessionExpiry is the server's default session expiry time
	DefaultSessionExpiry = 240 * time.Hour // 10 days

	// DefaultTranscoderTimeout is the default vodeo transcoding timeout
	DefaultTranscoderTimeout = 10 * time.Minute // 10mins

	// DefaultMagicLinkSecret is the jwt magic link secret
	DefaultMagicLinkSecret = InvalidConfigValue

	// Default Messaging settings
	DefaultSMTPBind = "0.0.0.0:8025"
	DefaultPOP3Bind = "0.0.0.0:8110"

	// Default SMTP configuration
	DefaultSMTPHost = InvalidConfigValue
	DefaultSMTPPort = 0
	DefaultSMTPUser = InvalidConfigValue
	DefaultSMTPPass = InvalidConfigValue
	DefaultSMTPFrom = InvalidConfigValue

	// DefaultMaxFetchLimit is the maximum fetch fetch limit in bytes
	DefaultMaxFetchLimit = 1 << 20 // ~1MB (or more than enough for months)

	// DefaultMaxFeedSize is the maximum feed size before a feed is rotated (should be smaller than MaxFetchLimit)
	DefaultMaxFeedSize = DefaultMaxFetchLimit / 2

	// DefaultAPISessionTime is the server's default session time for API tokens
	DefaultAPISessionTime = 240 * time.Hour // 10 days

	// DefaultAPISigningKey is the default API JWT signing key for tokens
	DefaultAPISigningKey = InvalidConfigValue

	// MinimumCacheFetchInterval is the smallest allowable cache fetch interval for
	// production pods, an attempt to configure a pod with a smaller value than this
	// results in a configuration validation error.
	MinimumCacheFetchInterval = 59 * time.Second

	// DefaultMediaResolution is the default resolution used to downscale media (iamges)
	// (the original is also preserved and accessible via adding the query string ?full=1)
	DefaultMediaResolution = 850 // 850px width (maintaining aspect ratio)

	// DefaultAvatarResolution is the default resolution used to downscale avatars (profiles)
	DefaultAvatarResolution = 360 // 360px width (maintaining aspect ratio)
)
View Source
const (
	DayAgo   = time.Hour * 24
	WeekAgo  = DayAgo * 7
	MonthAgo = DayAgo * 30
	YearAgo  = MonthAgo * 12
)
View Source
const ArchiveDir = "archive"
View Source
const IndexDir = "index"
View Source
const (
	// MaxFailedLogins is the default maximum tolerable number of failed login attempts
	// TODO: Make this configurable via Pod Settings
	MaxFailedLogins = 3 // By default 3 failed login attempts per 5 minutes
)

Variables

View Source
var (
	// ErrInvalidCredentials is returned for invalid credentials against /auth
	ErrInvalidCredentials = errors.New("error: invalid credentials")

	// ErrInvalidToken is returned for expired or invalid tokens used in Authorizeation headers
	ErrInvalidToken = errors.New("error: invalid token")
)
View Source
var (
	ErrTwtAlreadyArchived = errors.New("error: twt already archived")
	ErrTwtNotArchived     = errors.New("error: twt not found in archived")
	ErrInvalidTwtHash     = errors.New("error: invalid twt hash")
)
View Source
var (
	Jobs        map[string]JobSpec
	StartupJobs map[string]JobSpec
)
View Source
var (
	ErrFeedAlreadyExists = errors.New("error: feed already exists by that name")
	ErrAlreadyFollows    = errors.New("error: you already follow this feed")
	ErrTooManyFeeds      = errors.New("error: you have too many feeds")
)
View Source
var (
	//go:embed logo.svg
	DefaultLogo string

	// DefaultCSS should be empty
	DefaultCSS string

	// DefaultJS should be empty
	DefaultJS string

	// Default Alert type and message
	DefaultAlertFloat   bool
	DefaultAlertGuest   bool
	DefaultAlertType    = "safe"
	DefaultAlertMessage string

	// DefaultFeedSources is the default list of external feed sources
	DefaultFeedSources = []string{
		"https://feeds.twtxt.net/we-are-feeds.txt",
	}

	// DefaultTwtPrompts are the set of default prompts  for twt text(s)
	DefaultTwtPrompts = []string{
		`What's on your mind? 🤔`,
		`Share something insightful! 💡`,
		`Good day to you! 👌 What's new? 🥳`,
		`Did something cool lately? 🤔 Share it! 🤗`,
		`Hi! 👋 Don't forget to post a Twt today! 😉`,
		`Let's have a Yarn! ✋`,
	}

	// DefaultPermittedImages is the default list of image domains
	// to permit for external images to display them inline
	DefaultPermittedImages = []string{
		`imgur\.com`,
		`giphy\.com`,
		`imgs\.xkcd\.com`,
		`reactiongifs\.com`,
		`githubusercontent\.com`,
	}

	// DefaultBlockedFeeds is the default list of feed uris that are
	// blocked and prohibuted from being fetched by the global feed cache
	DefaultBlockedFeeds = []string{
		`port70\.dk`,
		`enotty\.dk`,
		`gopher\.floodgap\.com`,
	}

	DefaultEmbedRules = ""

	// DefaultMaxCacheFetchers is the default maximun number of fetchers used
	// by the global feed cache during update cycles. This controls how quickly
	// feeds are updated in each feed cache cycle. The default is the number of
	// available CPUs on the system.
	DefaultMaxCacheFetchers = runtime.NumCPU()

	// DefaultDisplayDatesInTimezone is the default timezone date and times are display in at the Pod level for
	// anonymous or unauthenticated users or users who have not changed their timezone rpefernece.
	DefaultDisplayDatesInTimezone = "UTC"

	// DefaultDisplayTimePreference is the default Pod level time representation (12hr or 24h) overridable by Users.
	DefaultDisplayTimePreference = "12h"

	// DefaultOpenLinksInPreference is the default Pod level behaviour for opening external links (overridable by Users).
	DefaultOpenLinksInPreference = "newwindow"

	// DisplayImagesPreference is the default Pod-level image display behaviour
	// (inline or lightbox) for displaying images (overridable by Users).
	DefaultDisplayImagesPreference = "inline"

	// DisplayMedia is the default for whether or not to display media at all or just link it
	DefaultDisplayMedia = true

	// OriginalMedia is the default for whether to link or display original media or not
	OriginalMedia bool
)
View Source
var (
	ErrInvalidStore = errors.New("error: invalid store")
	ErrUserNotFound = errors.New("error: user not found")
	ErrFeedNotFound = errors.New("error: feed not found")
)
View Source
var (
	ErrInvalidFeedName  = errors.New("error: invalid feed name")
	ErrBadRequest       = errors.New("error: request failed with non-200 response")
	ErrFeedNameTooLong  = errors.New("error: feed name is too long")
	ErrInvalidUsername  = errors.New("error: invalid username")
	ErrUsernameTooLong  = errors.New("error: username is too long")
	ErrInvalidUserAgent = errors.New("error: invalid twtxt user agent")
	ErrReservedUsername = errors.New("error: username is reserved")
	ErrInvalidImage     = errors.New("error: invalid image")
	ErrInvalidAudio     = errors.New("error: invalid audio")
	ErrInvalidVideo     = errors.New("error: invalid video")
	ErrInvalidVideoSize = errors.New("error: invalid video size")
)
View Source
var (
	ErrConfigPathMissing = errors.New("error: config file missing")
)
View Source
var (
	ErrFeedImposter = errors.New("error: imposter detected, you do not own this feed")
)
View Source
var (
	ErrSendingEmail = errors.New("error: unable to send email")
)
View Source
var ValidAuthers = []string{"proxy", "session"}

Functions

func AvailableFeatures

func AvailableFeatures() []string

func BaseFromURL

func BaseFromURL(uri string) string

func CORSMiddleware

func CORSMiddleware(next httprouter.Handle) httprouter.Handle

func ChunkTwts

func ChunkTwts(twts types.Twts, chunkSize int) []types.Twts

func CleanNote

func CleanNote(s string) (string, error)

CleanNote ...

func CleanTwt

func CleanTwt(text string) string

CleanTwt cleans a twt's text, replacing new lines with spaces and stripping surrounding spaces.

func CmdExists

func CmdExists(cmd string) bool

CmdExists ...

func CreateFeed

func CreateFeed(conf *Config, db Store, user *User, name string, force bool) error

func CustomRelTime

func CustomRelTime(a, b time.Time, albl, blbl string) string

func CustomTime

func CustomTime(then time.Time) string

func DecodeHash

func DecodeHash(hash string) ([]byte, error)

func DeleteFeed

func DeleteFeed(db Store, user *User, feed *Feed) (err error)

func DeleteLastTwt

func DeleteLastTwt(conf *Config, user *User) error

func DivMod

func DivMod(n, d int) (q, r int)

func DownloadImage

func DownloadImage(conf *Config, url string, resource, name string, opts *ImageOptions) (string, error)

func ExtractHashFromSubject

func ExtractHashFromSubject(subject string) string

func FastHash

func FastHash(data []byte) string

func FastHashFile

func FastHashFile(fn string) (string, error)

func FastHashString

func FastHashString(s string) string

func FeedExists

func FeedExists(conf *Config, username string) bool

func FileExists

func FileExists(name string) bool

func FilterTwtsBy

func FilterTwtsBy(twts types.Twts, filters ...FilterFunc) (res types.Twts)

func FirstNTwts

func FirstNTwts(twts types.Twts, n int) types.Twts

func FirstTwt

func FirstTwt(twts types.Twts) types.Twt

func FormatForDateTime

func FormatForDateTime(t time.Time, timeFormat string) string

func FormatMentionsAndTags

func FormatMentionsAndTags(conf *Config, text string, format TwtTextFormat) string

FormatMentionsAndTags turns `@<nick URL>` into `<a href="URL">@nick</a>` and `#<tag URL>` into `<a href="URL">#tag</a>` and a `!<hash URL>` into a `<a href="URL">!hash</a>`.

func FormatRequest

func FormatRequest(r *http.Request) string

FormatRequest generates ascii representation of a request

func FormatTwtContextFactory

func FormatTwtContextFactory(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt, u *User) template.HTML

FormatTwtContextFactory formats a twt's context into a valid HTML snippet A Twt's Context is defined as the content of the Root Twt of the Conversation rendered in plain text up to a maximu length with an elipsis if longer...

func FormatTwtFactory

func FormatTwtFactory(conf *Config, cache *Cache, archive Archiver) func(types.Twt, types.TwtTextFormat, *User) template.HTML

FormatTwtFactory formats a twt into a valid HTML snippet

func GenerateAvatar

func GenerateAvatar(conf *Config, domainNick string) (image.Image, error)

func GenerateRandomToken

func GenerateRandomToken() string

func GenerateWhoFollowsToken

func GenerateWhoFollowsToken(feedurl string) string

func GetAllFeeds

func GetAllFeeds(conf *Config) ([]string, error)

func GetAllTwts

func GetAllTwts(conf *Config, name string) (types.Twts, error)

func GetArchivedFeeds

func GetArchivedFeeds(conf *Config, feed string) ([]string, error)

GetArchivedFeeds ...

func GetConvLength

func GetConvLength(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt, u *User) int

func GetExternalAvatar

func GetExternalAvatar(conf *Config, twter types.Twter)

func GetFeedCount

func GetFeedCount(conf *Config, name string) (int, error)

func GetFeedTypeClass

func GetFeedTypeClass(conf *Config, cache *Cache) func(uri string) string

func GetForkLength

func GetForkLength(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt, u *User) int

func GetLastTwt

func GetLastTwt(conf *Config, twter types.Twter) (twt types.Twt, offset int, err error)

func GetLastTwtFrom

func GetLastTwtFrom(conf *Config, twter types.Twter, fn string) (twt types.Twt, offset int, err error)

func GetLookupMatches

func GetLookupMatches(conf *Config, nick string, uri string) (avatar, domain string)

func GetMediaNamesFromText

func GetMediaNamesFromText(text string) []string

func GetOrMigrateUserPasswordHash

func GetOrMigrateUserPasswordHash(db Store, user *User) []byte

GetOrMigrateUserPasswordHash returns the User's Passsword Hash if available or the older but deprecated Password. The only difference really is we're switching from a `string` to a `[]byte` slice. This function is only used to transparently migrate a Yarn.social Pod's User database without any operator intervention. XXX: `User.Password“ field is Deprecated in favor of `User.PasswordHash“ TODO: Remove once all (most?) pods are on yarnd v0.17+

func GetPreviousArchivedFeed

func GetPreviousArchivedFeed(conf *Config, twter types.Twter, feed, fn string) (string, error)

func GetRootTwtFactory

func GetRootTwtFactory(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt, u *User) types.Twt

func GetTwtConvSubjectHash

func GetTwtConvSubjectHash(cache *Cache, archive Archiver, twt types.Twt) (string, string)

func GroupBySubject

func GroupBySubject(twt types.Twt) []string

func GroupByTag

func GroupByTag(twt types.Twt) (res []string)

func GroupTwtsBy

func GroupTwtsBy(twts types.Twts, g GroupFunc) (res map[string]types.Twts)

func HasExternalAvatarChanged

func HasExternalAvatarChanged(conf *Config, twter types.Twter) bool

func HasString

func HasString(a []string, x string) bool

func HostnameFromURL

func HostnameFromURL(uri string) string

func Indent

func Indent(text, indent string) string

Indent indents a block of text with an indent string

func InitJobs

func InitJobs(conf *Config)

func IntPow

func IntPow(x, y int) int

func IsAdminUserFactory

func IsAdminUserFactory(conf *Config) func(user *User) bool

IsAdminUserFactory returns a function that returns true if the user provided is the configured pod administrator, false otherwise.

func IsAudio

func IsAudio(fn string) bool

func IsFeatureEnabled

func IsFeatureEnabled(fs *FeatureFlags, name string) bool

func IsGifImage

func IsGifImage(fn string) bool

func IsImage

func IsImage(fn string) bool

func IsLocalURLFactory

func IsLocalURLFactory(conf *Config) func(url string) bool

func IsSpecialFeed

func IsSpecialFeed(feed string) bool

IsSpecialFeed returns true if the feed is one of the special feeds an admin feed or automated feed.

func IsVideo

func IsVideo(fn string) bool

func LastSeenRelTime

func LastSeenRelTime(a, b time.Time, albl, blbl string) string

func LastSeenTime

func LastSeenTime(then time.Time) string

func LastTwt

func LastTwt(twts types.Twts) types.Twt

func LineCount

func LineCount(r io.Reader) (int, error)

func MapKeys

func MapKeys[K comparable, V any](kv map[K]V) []K

func MapStrings

func MapStrings(xs []string, f func(s string) string) []string

func MapValues

func MapValues[K comparable, V any](kv map[K]V) []V

func MemoryUsage

func MemoryUsage() string

MemoryUsage returns information about thememory used by the runtime

func MergeFeed

func MergeFeed(conf *Config, feed string, body []byte, delete bool) (types.Twts, error)

func MergeFollowers

func MergeFollowers(old, new types.Followers) types.Followers

func NewCachedFeedLookup

func NewCachedFeedLookup(cache *Cache) types.FeedLookup

NewCachedFeedLookup matches an @-mention based on cahced feeds in the cache and returns the first matching Twter that matches. this should be used as the last lookup function as there could be multiple feeds in the cache with similar Twter feed names.

func NewLocalFeedLookup

func NewLocalFeedLookup(conf *Config, db Store) types.FeedLookup

NewLocalFeedLookup matches an @-mention based on a local feed on the current pod which may be another user or a user's fefed (sometimes called a persona). This should be used lower in the priority when used with a multi feed lookup.

func NewMultiFeedLookup

func NewMultiFeedLookup(feedLookupFns ...types.FeedLookup) types.FeedLookup

NewMultiFeedLookup is used to chain together multiple feed lookup functions together where the first lookup that returns a non-zero Twter is used to expand the @-mention(2) before writing to the feed.

func NewRemoteFeedLookup

func NewRemoteFeedLookup(conf *Config) types.FeedLookup

NewRemoteFeedLookup matches an @-mention based on a remote lookup and should be the last lookup function used in a multi feed lookup as the operation is time consuming as it performe outbound network requests to resolve the @-metniond(s).

func NewSessionStore

func NewSessionStore(store Store, sessionCacheTTL time.Duration) sessions.Store

func NewStats

func NewStats(name string) *expvar.Map

NewStats ...

func NewUserCreator

func NewUserCreator(config *Config, db Store) auth.UserCreator

func NewUserFollowedAsFeedLookup

func NewUserFollowedAsFeedLookup(user *User) types.FeedLookup

NewUserFollowedAsFeedLookup matches an @-mention based on the user's following list of feeds and the aliases used to follow those feeds.

func NewWebFingerResolver

func NewWebFingerResolver(conf *Config, db Store) webfinger.Resolver

func NormalizeFeedName

func NormalizeFeedName(name string) string

func NormalizeURL

func NormalizeURL(url string) string

func NormalizeUsername

func NormalizeUsername(username string) string

func ParseArchivedFeedIds

func ParseArchivedFeedIds(fns []string) ([]int, error)

ParseArchivedFeedIds ...

func PreprocessMedia

func PreprocessMedia(user *User, conf *Config, u *url.URL, title, alt, renderAs string, display, full bool) string

PreprocessMedia ...

func PrettyURL

func PrettyURL(uri string) string

func ProcessImage

func ProcessImage(conf *Config, ifn string, resource, name string, opts *ImageOptions) (string, error)

func ReadArchivedTwt

func ReadArchivedTwt(p string) (types.Twt, error)

func ReadFeedPreamble

func ReadFeedPreamble(fn string) string

func ReceiveAudio

func ReceiveAudio(r io.Reader) (string, error)

func ReceiveImage

func ReceiveImage(r io.Reader) (string, error)

func ReceiveVideo

func ReceiveVideo(r io.Reader) (string, error)

func RedirectRefererURL

func RedirectRefererURL(r *http.Request, conf *Config, defaultURL string) string

RedirectRefererURL constructs a Redirect URL from the given Request URL and possibly Referer, if the Referer's Base URL matches the Pod's Base URL will return the Referer URL otherwise the defaultURL. This is primarily used to redirect a user from a successful /login back to the page they were on.

func RemoveString

func RemoveString(xs []string, e string) []string

func RenderAudio

func RenderAudio(conf *Config, uri, title, renderAs string, full bool) string

RenderAudio ...

func RenderCSS

func RenderCSS(css string) (template.CSS, error)

RenderCSS ...

func RenderHTML

func RenderHTML(tpl string, ctx *Context) (string, error)

RenderHTML ...

func RenderImage

func RenderImage(user *User, conf *Config, uri, caption, alt, renderAs string, full bool) string

RenderImage ...

func RenderJS

func RenderJS(js string) (template.JS, error)

RenderJS ...

func RenderLogo(logo string, podName string) (template.HTML, error)

RenderLogo ...

func RenderPlainText

func RenderPlainText(tpl string, ctx interface{}) (string, error)

RenderPlainText ...

func RenderVideo

func RenderVideo(conf *Config, uri, title, renderAs string, full bool) string

RenderVideo ...

func ReplaceExt

func ReplaceExt(fn, newExt string) string

func RequestGemini

func RequestGemini(conf *Config, uri string) (*gemini.Response, error)

func RequestGopher

func RequestGopher(conf *Config, uri string) (*gopher.Response, error)

func RequestHTTP

func RequestHTTP(conf *Config, method, url string, headers http.Header) (*http.Response, error)

func ResizeGif

func ResizeGif(srcFile string, width int, height int) (*gif.GIF, error)

func ResourceExists

func ResourceExists(conf *Config, url string) bool

func RewriteFeed

func RewriteFeed(fn string, twts types.Twts) error

func RotateFeed

func RotateFeed(conf *Config, feed string) error

func RunCmd

func RunCmd(timeout time.Duration, command string, args ...string) error

RunCmd ...

func SafeParseInt

func SafeParseInt(s string, d int) int

SafeParseInt ...

func SaveFeedSources

func SaveFeedSources(feedsources *FeedSources, path string) error

func SaveGif

func SaveGif(gifImg *gif.GIF, desFile string) error

Save gif file

func SendCandidatesForDeletionEmail

func SendCandidatesForDeletionEmail(conf *Config, candidates []DeletionCandidate) error

func SendEmail

func SendEmail(conf *Config, recipients []string, replyTo, subject string, body string) error

func SendMagicLinkAuthEmail

func SendMagicLinkAuthEmail(conf *Config, user *User, email, token string) error

func SendNewUserEmail

func SendNewUserEmail(conf *Config, username string) error

func SendPasswordResetEmail

func SendPasswordResetEmail(conf *Config, user *User, email, token string) error

func SendReportAbuseEmail

func SendReportAbuseEmail(conf *Config, nick, url, name, email, category, message string) error

func SendSupportRequestEmail

func SendSupportRequestEmail(conf *Config, name, email, subject, message string) error

func Slugify

func Slugify(uri string) string

func StoreUploadedImage

func StoreUploadedImage(conf *Config, r io.Reader, resource, name string, opts *ImageOptions) (string, error)

func TextWithEllipsis

func TextWithEllipsis(text string, maxLength int) string

TextWithEllipsis formats a a string with at most `maxLength` characters using an ellipsis (...) tto indicate more content...

func TranscodeAudio

func TranscodeAudio(conf *Config, ifn string, resource, name string, opts *AudioOptions) (string, error)

func TranscodeVideo

func TranscodeVideo(conf *Config, ifn string, resource, name string, opts *VideoOptions) (string, error)

func TwtMatchesAll

func TwtMatchesAll(twt types.Twt, filters []FilterFunc) bool

func TwterFromActor

func TwterFromActor(actor *activitypub.Actor) *types.Twter

func URLForAvatar

func URLForAvatar(baseURL, username, avatarHash string) string

func URLForConvFactory

func URLForConvFactory(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt) string

func URLForExternalAvatar

func URLForExternalAvatar(conf *Config, uri string) string

func URLForExternalProfile

func URLForExternalProfile(conf *Config, nick, uri string) string

func URLForFollowers

func URLForFollowers(baseURL, username string) string

func URLForFollowing

func URLForFollowing(baseURL, username string) string

func URLForForkFactory

func URLForForkFactory(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt) string

func URLForInbox

func URLForInbox(baseURL, username string) string

func URLForMedia

func URLForMedia(baseURL, name string) string

func URLForOutbox

func URLForOutbox(baseURL, username string) string

func URLForPage

func URLForPage(baseURL, page string) string

func URLForRootConvFactory

func URLForRootConvFactory(conf *Config, cache *Cache, archive Archiver, withPager bool) func(twt types.Twt, user *User) string

func URLForTag

func URLForTag(baseURL, tag string) string

func URLForTask

func URLForTask(baseURL, uuid string) string

func URLForTwt

func URLForTwt(baseURL, hash string) string

func URLForUser

func URLForUser(baseURL, username string) string

func URLForWhoFollows

func URLForWhoFollows(baseURL string, feed types.FetchFeedRequest, feedFollowers int) string

func UniqStrings

func UniqStrings(xs []string) []string

func UniqTwts

func UniqTwts(twts types.Twts) (res types.Twts)

func UniqueKeyFor

func UniqueKeyFor(kv map[string]string, k string) string

func UnparseTwtFactory

func UnparseTwtFactory(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt) string

UnparseTwtFactory is the opposite of CleanTwt and ExpandMentions/ExpandTags

func UserURL

func UserURL(url string) string

func ValidateActor

func ValidateActor(conf *Config, profile types.Profile, to string) (*types.Twter, error)

func ValidateFeed

func ValidateFeed(conf *Config, profile types.Profile, uri string) (*types.Twter, error)

func ValidateFeedName

func ValidateFeedName(path string, name string) error

func ValidateIndieRedirectURL

func ValidateIndieRedirectURL(clientID, redirectURI string) error

ValidateIndieRedirectURL ...

func ValidateUsername

func ValidateUsername(username string) error

ValidateUsername validates the username before allowing it to be created. This ensures usernames match a defined pattern and that some usernames that are reserved are never used by users.

func WebMention

func WebMention(target, source string) error

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API ...

func NewAPI

func NewAPI(router *Router, config *Config, cache *Cache, archive Archiver, db Store, pm *passwd.Passwd, tasks *tasks.Dispatcher) *API

NewAPI ...

func (*API) AuthEndpoint

func (a *API) AuthEndpoint() httprouter.Handle

AuthEndpoint ...

func (*API) ConversationEndpoint

func (a *API) ConversationEndpoint() httprouter.Handle

ConversationEndpoint ...

func (*API) CreateToken

func (a *API) CreateToken(user *User, r *http.Request) (*Token, error)

CreateToken ...

func (*API) DebugCacheEndpoint

func (a *API) DebugCacheEndpoint() httprouter.Handle

DebugCacheEndpoint ...

func (*API) DebugDBEndpoint

func (a *API) DebugDBEndpoint() httprouter.Handle

DebugDBEndpoint ...

func (*API) DebugWebSubEndpoint

func (a *API) DebugWebSubEndpoint() httprouter.Handle

DebugWebSubEndpoint ...

func (*API) DiscoverEndpoint

func (a *API) DiscoverEndpoint() httprouter.Handle

DiscoverEndpoint ...

func (*API) ExternalProfileEndpoint

func (a *API) ExternalProfileEndpoint() httprouter.Handle

ExternalProfileEndpoint ...

func (*API) FetchTwtsEndpoint

func (a *API) FetchTwtsEndpoint() httprouter.Handle

FetchTwtsEndpoint ...

func (*API) FollowEndpoint

func (a *API) FollowEndpoint() httprouter.Handle

FollowEndpoint ...

func (*API) MentionsEndpoint

func (a *API) MentionsEndpoint() httprouter.Handle

MentionsEndpoint ...

func (*API) MuteEndpoint

func (a *API) MuteEndpoint() httprouter.Handle

MuteEndpoint ...

func (*API) OldUploadMediaEndpoint

func (a *API) OldUploadMediaEndpoint() httprouter.Handle

OldUploadMediaEndpoint ... TODO: Remove when the api_old_upload_media counter nears zero XXX: Used for Goryon < v1.0.3

func (*API) PingEndpoint

func (a *API) PingEndpoint() httprouter.Handle

PingEndpoint ...

func (*API) PodConfigEndpoint

func (a *API) PodConfigEndpoint() httprouter.Handle

PodConfigEndpoint ...

func (*API) PostEndpoint

func (a *API) PostEndpoint() httprouter.Handle

PostEndpoint ...

func (*API) ProfileEndpoint

func (a *API) ProfileEndpoint() httprouter.Handle

ProfileEndpoint ...

func (*API) RegisterEndpoint

func (a *API) RegisterEndpoint() httprouter.Handle

RegisterEndpoint ...

func (*API) ReportEndpoint

func (a *API) ReportEndpoint() httprouter.Handle

ReportEndpoint ...

func (*API) SettingsEndpoint

func (a *API) SettingsEndpoint() httprouter.Handle

SettingsEndpoint ...

func (*API) SupportEndpoint

func (a *API) SupportEndpoint() httprouter.Handle

SupportEndpoint ...

func (*API) SyncEndpoint

func (a *API) SyncEndpoint() httprouter.Handle

SyncEndpoint ...

func (*API) TimelineEndpoint

func (a *API) TimelineEndpoint() httprouter.Handle

TimelineEndpoint ...

func (*API) UnfollowEndpoint

func (a *API) UnfollowEndpoint() httprouter.Handle

UnfollowEndpoint ...

func (*API) UnmuteEndpoint

func (a *API) UnmuteEndpoint() httprouter.Handle

UnmuteEndpoint ...

func (*API) UploadMediaEndpoint

func (a *API) UploadMediaEndpoint() httprouter.Handle

UploadMediaHandler ...

func (*API) WhoAmIEndpoint

func (a *API) WhoAmIEndpoint() httprouter.Handle

WhoAmIEndpoint ...

type ActiveUsersJob

type ActiveUsersJob struct {
	// contains filtered or unexported fields
}

func (*ActiveUsersJob) Run

func (job *ActiveUsersJob) Run()

func (*ActiveUsersJob) String

func (job *ActiveUsersJob) String() string

type Alternative

type Alternative struct {
	Type  string
	Title string
	URL   string
}

type Alternatives

type Alternatives []Alternative

type AppendTwtFunc

type AppendTwtFunc func(user *User, feed *Feed, text string, args ...interface{}) (types.Twt, error)

func AppendTwtFactory

func AppendTwtFactory(conf *Config, cache *Cache, db Store) AppendTwtFunc

type Archiver

type Archiver interface {
	Del(hash string) error
	Has(hash string) bool
	Get(hash string) (types.Twt, error)
	Archive(twt types.Twt) error
	Walk() <-chan types.Twt
	Count() int64
}

Archiver is an interface for retrieving old twts from an archive storage such as an on-disk hash layout with one directory per 2-letter part of the hash sequence.

func NewDiskArchiver

func NewDiskArchiver(p string) (Archiver, error)

func NewDummyArchiver

func NewDummyArchiver() (Archiver, error)

type AudioOptions

type AudioOptions struct {
	Resample   bool
	Channels   int
	Samplerate int
	Bitrate    int
}

type AudioTask

type AudioTask struct {
	*tasks.BaseTask
	// contains filtered or unexported fields
}

func NewAudioTask

func NewAudioTask(conf *Config, fn string) *AudioTask

func (*AudioTask) Run

func (t *AudioTask) Run() error

func (*AudioTask) String

func (t *AudioTask) String() string

type BitcaskStore

type BitcaskStore struct {
	// contains filtered or unexported fields
}

BitcaskStore ...

func (*BitcaskStore) Close

func (bs *BitcaskStore) Close() error

Close ...

func (*BitcaskStore) DB

func (bs *BitcaskStore) DB() *bitcask.Bitcask

DB ...

func (*BitcaskStore) DelFeed

func (bs *BitcaskStore) DelFeed(name string) error

func (*BitcaskStore) DelSession

func (bs *BitcaskStore) DelSession(sid string) error

func (*BitcaskStore) DelUser

func (bs *BitcaskStore) DelUser(username string) error

func (*BitcaskStore) GetAllFeeds

func (bs *BitcaskStore) GetAllFeeds() ([]*Feed, error)

func (*BitcaskStore) GetAllSessions

func (bs *BitcaskStore) GetAllSessions() ([]*sessions.Session, error)

func (*BitcaskStore) GetAllUsers

func (bs *BitcaskStore) GetAllUsers() ([]*User, error)

func (*BitcaskStore) GetFeed

func (bs *BitcaskStore) GetFeed(name string) (*Feed, error)

func (*BitcaskStore) GetSession

func (bs *BitcaskStore) GetSession(sid string) (*sessions.Session, error)

func (*BitcaskStore) GetUser

func (bs *BitcaskStore) GetUser(username string) (*User, error)

func (*BitcaskStore) HasFeed

func (bs *BitcaskStore) HasFeed(name string) bool

func (*BitcaskStore) HasSession

func (bs *BitcaskStore) HasSession(sid string) bool

func (*BitcaskStore) HasUser

func (bs *BitcaskStore) HasUser(username string) bool

func (*BitcaskStore) LenFeeds

func (bs *BitcaskStore) LenFeeds() int64

func (*BitcaskStore) LenSessions

func (bs *BitcaskStore) LenSessions() int64

func (*BitcaskStore) LenUsers

func (bs *BitcaskStore) LenUsers() int64

func (*BitcaskStore) Merge

func (bs *BitcaskStore) Merge() error

Merge ...

func (*BitcaskStore) SearchFeeds

func (bs *BitcaskStore) SearchFeeds(prefix string) []string

func (*BitcaskStore) SearchUsers

func (bs *BitcaskStore) SearchUsers(prefix string) []string

func (*BitcaskStore) SetFeed

func (bs *BitcaskStore) SetFeed(name string, feed *Feed) error

func (*BitcaskStore) SetSession

func (bs *BitcaskStore) SetSession(sid string, sess *sessions.Session) error

func (*BitcaskStore) SetUser

func (bs *BitcaskStore) SetUser(username string, user *User) error

func (*BitcaskStore) Sync

func (bs *BitcaskStore) Sync() error

Sync ...

func (*BitcaskStore) SyncSession

func (bs *BitcaskStore) SyncSession(sess *sessions.Session) error

type Cache

type Cache struct {
	Version int

	List  *Cached
	Map   map[string]types.Twt
	Peers map[string]*Pod
	Feeds map[string]*Cached
	Views map[string]*Cached

	Followers map[string]types.Followers
	Twters    map[string]*types.Twter
	// contains filtered or unexported fields
}

Cache ...

func FromOldCacheFile

func FromOldCacheFile(conf *Config, fn string) (*Cache, error)

FromOldCacheFile attempts to load an oldver version of the on-disk cache stored at /path/to/data/cache -- If you change the way the `*Cache` is stored on disk by modifying `Cache.Store()` or any of the data structures, please modfy this function to support loading the previous version of the on-disk cache.

func LoadCache

func LoadCache(conf *Config) (*Cache, error)

LoadCache ...

func LoadCacheFromFile

func LoadCacheFromFile(conf *Config, fn string) (*Cache, error)

LoadCacheFromFile ...

func NewCache

func NewCache(conf *Config) *Cache

func (*Cache) Converge

func (cache *Cache) Converge(archive Archiver)

Converge ...

func (*Cache) DeleteFeeds

func (cache *Cache) DeleteFeeds(feeds types.FetchFeedRequests)

DeleteFeeds ...

func (*Cache) DeleteUserViews

func (cache *Cache) DeleteUserViews(u *User)

DeleteUserViews ...

func (*Cache) DetectClientFromRequest

func (cache *Cache) DetectClientFromRequest(req *http.Request, profile types.Profile) error

DetectClientFromRequest ...

func (*Cache) DetectClientFromResponse

func (cache *Cache) DetectClientFromResponse(res *http.Response) error

DetectClientFromResponse ...

func (*Cache) DetectPodFromUserAgent

func (cache *Cache) DetectPodFromUserAgent(ua TwtxtUserAgent) error

DetectPodFromUserAgent ...

func (*Cache) FeedCount

func (cache *Cache) FeedCount() int

func (*Cache) FetchFeeds

func (cache *Cache) FetchFeeds(conf *Config, archive Archiver, feeds types.FetchFeedRequests, publicFollowers map[types.FetchFeedRequest][]string)

FetchFeeds ...

func (*Cache) FindTwter

func (cache *Cache) FindTwter(s string) (found *types.Twter)

FindTwter locates a valid cached Twter by searching the Cache for previously fetched feeds and their Twter(s) using basic string matching TODO: Add Fuzzy matching?

func (*Cache) FollowedBy

func (cache *Cache) FollowedBy(user *User, uri string) bool

func (*Cache) GetAll

func (cache *Cache) GetAll(refresh bool) types.Twts

GetAll ...

func (*Cache) GetByURL

func (cache *Cache) GetByURL(u *User, url string, fffs ...FilterFuncFactory) types.Twts

GetByURL ...

func (*Cache) GetByUser

func (cache *Cache) GetByUser(u *User, refresh bool, fffs ...FilterFuncFactory) types.Twts

GetByUser ...

func (*Cache) GetByUserView

func (cache *Cache) GetByUserView(u *User, view string, refresh bool, fffs ...FilterFuncFactory) types.Twts

GetByUserView ...

func (*Cache) GetByView

func (cache *Cache) GetByView(key string) types.Twts

GetByView ...

func (*Cache) GetFollowerByURI

func (cache *Cache) GetFollowerByURI(user *User, uri string) *types.Follower

GetFollowerByURI ...

func (*Cache) GetFollowers

func (cache *Cache) GetFollowers(profile types.Profile) types.Followers

GetFollowers ...

func (*Cache) GetMentions

func (cache *Cache) GetMentions(u *User, refresh bool, fffs ...FilterFuncFactory) types.Twts

GetMentions ... XXX: To be removed once FeatureFilterAndLists is promoted TODO: Remove my when FeatureFilterAndLists is the default

func (*Cache) GetOldFollowers

func (cache *Cache) GetOldFollowers(profile types.Profile) map[string]string

GetOldFollowers ... XXX: Returns a map[string]string of nick -> url for APIv1 compat TODO: Remove when Mobile App is upgraded

func (*Cache) GetOrSetCachedFeed

func (cache *Cache) GetOrSetCachedFeed(url string) *Cached

GetOrSetCachedFeed ...

func (*Cache) GetPeers

func (cache *Cache) GetPeers() (peers Peers)

GetPeers ...

func (*Cache) GetTwter

func (cache *Cache) GetTwter(uri string) *types.Twter

GetTwter ...

func (*Cache) InjectFeed

func (cache *Cache) InjectFeed(url string, twt types.Twt)

InjectFeed ...

func (*Cache) IsCached

func (cache *Cache) IsCached(url string) bool

IsCached ...

func (*Cache) Lookup

func (cache *Cache) Lookup(hash string) (types.Twt, bool)

Lookup ...

func (*Cache) MarshalJSON

func (cache *Cache) MarshalJSON() ([]byte, error)

func (*Cache) PruneFollowers

func (cache *Cache) PruneFollowers(olderThan time.Duration)

PruneFollowers ...

func (*Cache) Refresh

func (cache *Cache) Refresh()

Refresh ...

func (*Cache) Reset

func (cache *Cache) Reset()

Reset ...

func (*Cache) Save

func (cache *Cache) Save() error

Save ...

func (*Cache) SetTwter

func (cache *Cache) SetTwter(uri string, twter *types.Twter)

SetTwter ...

func (*Cache) ShouldRefreshFeed

func (cache *Cache) ShouldRefreshFeed(uri string) bool

ShouldRefreshFeed ...

func (*Cache) SnipeFeed

func (cache *Cache) SnipeFeed(url string, twt types.Twt)

SnipeFeed deletes a twt from a Cache.

func (*Cache) TwtCount

func (cache *Cache) TwtCount() int

func (*Cache) UpdateFeed

func (cache *Cache) UpdateFeed(url, lastmodified string, twts types.Twts)

UpdateFeed ...

type Cached

type Cached struct {
	Twts         types.Twts
	Errors       int
	LastError    string
	LastFetched  time.Time
	LastModified string
	// contains filtered or unexported fields
}

Cached ...

func NewCached

func NewCached() *Cached

NewCached constructs an empty cached feed

func NewCachedTwts

func NewCachedTwts(twts types.Twts, lastModified string) *Cached

NewCachedTwts constructs a cached feed with the given slice of twts and a last modified timestamp

func (*Cached) GetLastFetched

func (cached *Cached) GetLastFetched() time.Time

GetLastFetched ...

func (*Cached) GetLastModified

func (cached *Cached) GetLastModified() string

GetLastModified ...

func (*Cached) GetTwts

func (cached *Cached) GetTwts() types.Twts

GetTwts ...

func (*Cached) Inject

func (cached *Cached) Inject(twt types.Twt)

Inject ...

func (*Cached) SetError

func (cached *Cached) SetError(err error)

SetError ...

func (*Cached) SetLastFetched

func (cached *Cached) SetLastFetched()

SetLastFetched ...

func (*Cached) Snipe

func (cached *Cached) Snipe(twt types.Twt)

Snipe deletes a twt from a Cached.

func (*Cached) Update

func (cached *Cached) Update(lastmodified string, twts types.Twts)

Update ...

type CandidatesByScore

type CandidatesByScore []DeletionCandidate

func (CandidatesByScore) Len

func (c CandidatesByScore) Len() int

func (CandidatesByScore) Less

func (c CandidatesByScore) Less(i, j int) bool

func (CandidatesByScore) Swap

func (c CandidatesByScore) Swap(i, j int)

type CandidatesForDeletionEmailContext

type CandidatesForDeletionEmailContext struct {
	Pod       string
	BaseURL   string
	AdminUser string

	Candidates []DeletionCandidate
}

type Config

type Config struct {
	Version SoftwareConfig

	Debug bool

	TLS     bool
	TLSKey  string
	TLSCert string

	Auth       string `json:"-"`
	AuthHeader string `json:"-"`

	Data              string `json:"-"`
	Name              string
	CSS               string
	JS                string
	Description       string
	Store             string `json:"-"`
	StartPage         string
	FrontPage         string
	Theme             string `json:"-"`
	AlertFloat        bool
	AlertGuest        bool
	AlertMessage      string
	AlertType         string
	Lang              string
	BaseURL           string
	AdminUser         string `json:"-"`
	AdminName         string `json:"-"`
	AdminEmail        string `json:"-"`
	FeedSources       []string
	CookieSecret      string `json:"-"`
	TwtPrompts        []string
	TwtsPerPage       int
	MaxUploadSize     int64
	MaxTwtLength      int
	MediaResolution   int
	AvatarResolution  int
	MaxCacheTTL       time.Duration
	FetchInterval     string
	MaxCacheItems     int
	OpenProfiles      bool
	OpenRegistrations bool
	DisableGzip       bool
	DisableLogger     bool
	DisableMedia      bool
	DisableFfmpeg     bool
	DisableArchive    bool
	SessionExpiry     time.Duration
	SessionCacheTTL   time.Duration
	TranscoderTimeout time.Duration

	MagicLinkSecret string `json:"-"`

	SMTPHost string `json:"-"`
	SMTPPort int    `json:"-"`
	SMTPUser string `json:"-"`
	SMTPPass string `json:"-"`
	SMTPFrom string `json:"-"`

	MaxCacheFetchers int
	MaxFetchLimit    int64
	MaxFeedSize      int64

	APISessionTime time.Duration `json:"-"`
	APISigningKey  string        `json:"-"`

	PermittedImages []string `json:"-"`

	BlockedFeeds []string `json:"-"`

	EmbedRules string `json:"-"`

	Features *FeatureFlags

	// Pod Level Settings (overridable by Users)
	DisplayDatesInTimezone  string
	DisplayTimePreference   string
	OpenLinksInPreference   string
	DisplayImagesPreference string
	DisplayMedia            bool
	OriginalMedia           bool

	VisibilityCompact  bool
	VisibilityReadmore bool
	LinkVerification   bool
	StripTrackingParam bool

	CustomPrimaryColor   string
	CustomSecondaryColor string
	// contains filtered or unexported fields
}

Config contains the server configuration parameters

func NewConfig

func NewConfig() *Config

func (*Config) BlockedFeed

func (c *Config) BlockedFeed(uri string) bool

BlockedFeed returns true if the feed uri matches any blocked feeds per the pod's configuration, the pod itself cannot be blocked.

func (*Config) ExternalURL

func (c *Config) ExternalURL(nick, uri string) string

func (*Config) IsLocalURL

func (c *Config) IsLocalURL(url string) bool

func (*Config) IsShadowed

func (c *Config) IsShadowed(uri string) bool

IsShadowed returns true if a feed has been Shadow Banned by the Pod Owner/Operator (poderator) This is currently functionally equivilent to Blocklisting a feed and uses the same configuration

func (*Config) LocalURL

func (c *Config) LocalURL() *url.URL

func (*Config) PermittedImage

func (c *Config) PermittedImage(domain string) (bool, bool)

PermittedImage returns true if the domain name of an image's url provided is a whiltelisted domain as per the configuration

func (*Config) RandomTwtPrompt

func (c *Config) RandomTwtPrompt() string

RandomTwtPrompt returns a random Twt Prompt for display by the UI

func (*Config) RequestTimeout

func (c *Config) RequestTimeout() time.Duration

RequestTimeout returns the configured timeout for outgoing HTTP requests. If not defined, it defaults to 30 seconds.

func (*Config) Settings

func (c *Config) Settings() *Settings

Settings returns a `Settings` struct containing pod settings that can then be persisted to disk to override some configuration options.

func (*Config) TemplatesFS

func (c *Config) TemplatesFS() fs.FS

func (*Config) URLForAvatar

func (c *Config) URLForAvatar(name, hash string) string

func (*Config) URLForMedia

func (c *Config) URLForMedia(name string) string

func (*Config) URLForTag

func (c *Config) URLForTag(tag string) string

func (*Config) URLForUser

func (c *Config) URLForUser(user string) string

func (*Config) UserURL

func (c *Config) UserURL(url string) string

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration is valid which for the most part just ensures that default secrets are actually configured correctly

type Context

type Context struct {
	Debug   bool
	Request *http.Request
	Filters []string

	CSS              template.CSS
	JS               template.JS
	BaseURL          string
	InstanceName     string
	SoftwareVersion  SoftwareConfig
	TwtsPerPage      int
	TwtPrompt        string
	MaxTwtLength     int
	AvatarResolution int
	MediaResolution  int
	RegisterDisabled bool
	OpenProfiles     bool
	FrontPage        string
	DisableMedia     bool
	DisableFfmpeg    bool
	PermittedImages  []string
	BlockedFeeds     []string
	EmbedRules       string
	EnabledFeatures  []string

	AlertFloat   bool
	AlertGuest   bool
	AlertMessage string
	AlertType    string

	Timezones []*timezones.Zoneinfo

	Subject       string
	Username      string
	User          *User
	LastTwt       types.Twt
	Profile       types.Profile
	Authenticated bool
	IsAdmin       bool

	DisplayDatesInTimezone  string
	DisplayTimePreference   string
	OpenLinksInPreference   string
	DisplayImagesPreference string
	DisplayMedia            bool
	OriginalMedia           bool

	VisibilityCompact  bool
	VisibilityReadmore bool
	LinkVerification   bool
	StripTrackingParam bool

	CustomPrimaryColor   string
	CustomSecondaryColor string

	Error       bool
	Message     string
	Callback    string
	Lang        string // language
	AcceptLangs string // accept languages
	StartPage   string
	Theme       string // not to be confused with the config.Theme
	Commit      string

	Page    string
	View    string
	Content template.HTML

	Title        string
	Meta         Meta
	Links        Links
	Alternatives Alternatives

	Twter types.Twter
	Twts  types.Twts
	Root  types.Twt

	Pager *paginator.Paginator

	LocalFeeds  []*Feed
	UserFeeds   []*Feed
	FeedSources FeedSourceMap

	// Time
	TimelineUpdatedAt time.Time
	DiscoverUpdatedAt time.Time
	LastMentionedAt   time.Time

	// Discovered Pods peering with us
	Peers Peers

	// Background Jobs
	Jobs []*cron.Entry

	// Search
	SearchQuery string

	// Tools
	Bookmarklet string

	// Report abuse
	ReportNick string
	ReportURL  string

	// Reset Password Token
	PasswordResetToken string

	// CSRF Token
	CSRFToken string

	// Login Referer
	Referer string

	// Prompt text
	PromptTitle    string
	PromptMessage  string
	PromptCallback string
	PromptApprove  string
	PromptCancel   string
	PromptTarget   string
}

Context is a "god" object that holds a bunch of data mostly used in templates TODO: Refactor the shit out of this so we don't have this giant big object!!!

func NewContext

func NewContext(s *Server, req *http.Request) *Context

NewContext reeturns a new request scoped context object mostly used by templates

func (*Context) Translate

func (ctx *Context) Translate(translator *Translator, data ...interface{})

type ContextKey

type ContextKey int

ContextKey ...

const (
	TokenContextKey ContextKey = iota
	UserContextKey
)

type CreateAdminFeedsJob

type CreateAdminFeedsJob struct {
	// contains filtered or unexported fields
}

func (*CreateAdminFeedsJob) Run

func (job *CreateAdminFeedsJob) Run()

func (*CreateAdminFeedsJob) String

func (job *CreateAdminFeedsJob) String() string

type DeleteOldSessionsJob

type DeleteOldSessionsJob struct {
	// contains filtered or unexported fields
}

func (*DeleteOldSessionsJob) Run

func (job *DeleteOldSessionsJob) Run()

func (*DeleteOldSessionsJob) String

func (job *DeleteOldSessionsJob) String() string

type DeletionCandidate

type DeletionCandidate struct {
	Username string
	Score    int
}

type DiskArchiver

type DiskArchiver struct {
	// contains filtered or unexported fields
}

DiskArchiver implements Archiver using an on-disk hash layout directory structure with one directory per 2-letter hash sequence with a single JSON encoded file per twt.

func (*DiskArchiver) Archive

func (a *DiskArchiver) Archive(twt types.Twt) error

func (*DiskArchiver) Count

func (a *DiskArchiver) Count() int64

func (*DiskArchiver) Del

func (a *DiskArchiver) Del(hash string) error

func (*DiskArchiver) Get

func (a *DiskArchiver) Get(hash string) (types.Twt, error)

func (*DiskArchiver) Has

func (a *DiskArchiver) Has(hash string) bool

func (*DiskArchiver) Walk

func (a *DiskArchiver) Walk() <-chan types.Twt

type DummyArchiver

type DummyArchiver struct{}

DummyArchiver implements Archiver using dummy implementation stubs

func (*DummyArchiver) Archive

func (a *DummyArchiver) Archive(twt types.Twt) error

func (*DummyArchiver) Count

func (a *DummyArchiver) Count() int64

func (*DummyArchiver) Del

func (a *DummyArchiver) Del(hash string) error

func (*DummyArchiver) Get

func (a *DummyArchiver) Get(hash string) (types.Twt, error)

func (*DummyArchiver) Has

func (a *DummyArchiver) Has(hash string) bool

func (*DummyArchiver) Walk

func (a *DummyArchiver) Walk() <-chan types.Twt

type EmbedRule

type EmbedRule struct {
	Pattern string `json:"pattern"`

	Source string `json:"src"`
	Class  string `json:"class"`
	Allow  string `json:"allow"`
	// contains filtered or unexported fields
}

type ErrAudioUploadFailed

type ErrAudioUploadFailed struct {
	Err error
}

func (*ErrAudioUploadFailed) Error

func (e *ErrAudioUploadFailed) Error() string

func (*ErrAudioUploadFailed) Unwrap

func (e *ErrAudioUploadFailed) Unwrap() error

type ErrCommandFailed

type ErrCommandFailed struct {
	Err    error
	Status int
}

func (*ErrCommandFailed) Error

func (e *ErrCommandFailed) Error() string

func (*ErrCommandFailed) Is

func (e *ErrCommandFailed) Is(target error) bool

func (*ErrCommandFailed) Unwrap

func (e *ErrCommandFailed) Unwrap() error

type ErrCommandKilled

type ErrCommandKilled struct {
	Err    error
	Signal syscall.Signal
}

func (*ErrCommandKilled) Error

func (e *ErrCommandKilled) Error() string

func (*ErrCommandKilled) Is

func (e *ErrCommandKilled) Is(target error) bool

func (*ErrCommandKilled) Unwrap

func (e *ErrCommandKilled) Unwrap() error

type ErrTranscodeFailed

type ErrTranscodeFailed struct {
	Err error
}

func (*ErrTranscodeFailed) Error

func (e *ErrTranscodeFailed) Error() string

func (*ErrTranscodeFailed) Unwrap

func (e *ErrTranscodeFailed) Unwrap() error

type ErrTranscodeTimeout

type ErrTranscodeTimeout struct {
	Err error
}

func (*ErrTranscodeTimeout) Error

func (e *ErrTranscodeTimeout) Error() string

func (*ErrTranscodeTimeout) Unwrap

func (e *ErrTranscodeTimeout) Unwrap() error

type ErrVideoUploadFailed

type ErrVideoUploadFailed struct {
	Err error
}

func (*ErrVideoUploadFailed) Error

func (e *ErrVideoUploadFailed) Error() string

func (*ErrVideoUploadFailed) Unwrap

func (e *ErrVideoUploadFailed) Unwrap() error

type FeatureFlags

type FeatureFlags struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

FeatureFlags describes a set of Pods optional Features and whether they are enabled or disabled

func NewFeatureFlags

func NewFeatureFlags() *FeatureFlags

func (*FeatureFlags) AsStrings

func (f *FeatureFlags) AsStrings() []string

func (*FeatureFlags) Disable

func (f *FeatureFlags) Disable(feature FeatureType)

func (*FeatureFlags) DisableAll

func (f *FeatureFlags) DisableAll(features []FeatureType)

func (*FeatureFlags) Enable

func (f *FeatureFlags) Enable(feature FeatureType)

func (*FeatureFlags) EnableAll

func (f *FeatureFlags) EnableAll(features []FeatureType)

func (*FeatureFlags) IsEnabled

func (f *FeatureFlags) IsEnabled(feature FeatureType) bool

func (*FeatureFlags) MarshalJSON

func (f *FeatureFlags) MarshalJSON() ([]byte, error)

func (*FeatureFlags) MarshalYAML

func (f *FeatureFlags) MarshalYAML() (interface{}, error)

func (*FeatureFlags) Reset

func (f *FeatureFlags) Reset()

func (*FeatureFlags) String

func (f *FeatureFlags) String() string

func (*FeatureFlags) UnmarshalJSON

func (f *FeatureFlags) UnmarshalJSON(b []byte) error

func (*FeatureFlags) UnmarshalYAML

func (f *FeatureFlags) UnmarshalYAML(unmarshal func(interface{}) error) error

type FeatureType

type FeatureType int
const (
	// FeatureInvalid is the invalid feature (0)
	FeatureInvalid FeatureType = iota
	FeatureFoo
	FeatureFilterAndLists
	FeatureWebFinger
	FeatureActivityPub
)

func FeatureFromString

func FeatureFromString(s string) (FeatureType, error)

func FeaturesFromStrings

func FeaturesFromStrings(xs []string) ([]FeatureType, error)

func (FeatureType) String

func (f FeatureType) String() string

type Feed

type Feed struct {
	Name        string
	Description string
	URL         string
	CreatedAt   time.Time

	AvatarHash string `defaulf:""`

	Followers map[string]string `default:"{}"`
	// contains filtered or unexported fields
}

Feed ...

func LoadFeed

func LoadFeed(data []byte) (feed *Feed, err error)

LoadFeed ...

func NewFeed

func NewFeed() *Feed

NewFeed ...

func (*Feed) AddFollower

func (f *Feed) AddFollower(nick, uri string)

func (*Feed) Bytes

func (f *Feed) Bytes() ([]byte, error)

func (*Feed) DelFollower

func (f *Feed) DelFollower(nick, uri string)

func (*Feed) FollowedBy

func (f *Feed) FollowedBy(url string) bool

func (*Feed) Profile

func (f *Feed) Profile(baseURL string, viewer *User) types.Profile

func (*Feed) Source

func (f *Feed) Source() types.FetchFeedRequests

func (*Feed) Twter

func (f *Feed) Twter(conf *Config) types.Twter

type FeedContext

type FeedContext struct {
	Debug bool

	InstanceName    string
	SoftwareVersion SoftwareConfig

	Profile types.Profile
	Twter   types.Twter
	Prev    string

	Authenticated bool
	Username      string
	IsAdmin       bool
	User          *User
}

func NewFeedContext

func NewFeedContext(s *Server, req *http.Request) *FeedContext

type FeedSource

type FeedSource struct {
	Name        string
	URL         string
	Avatar      string
	Description string
}

func ParseFeedSource

func ParseFeedSource(scanner *bufio.Scanner) (feedsources []FeedSource, err error)

type FeedSourceMap

type FeedSourceMap map[string][]FeedSource

type FeedSources

type FeedSources struct {
	Sources FeedSourceMap `json:"sources"`
}

func FetchFeedSources

func FetchFeedSources(conf *Config, sources []string) *FeedSources

func LoadFeedSources

func LoadFeedSources(path string) (*FeedSources, error)

type FeedType

type FeedType int

FeedType is a numeric value that defines different feed types (twtxt, activitypub, etc)

const (
	// FeedTypeTwtxt is the default feed type (twtxt)
	FeedTypeTwtxt FeedType = iota

	// FeedTypeActivityPub is the Activity Pub feed type
	FeedTypeActivityPub
)

type FilterFunc

type FilterFunc func(twt types.Twt) bool

FilterFunc ...

func FilterExcludeMe

func FilterExcludeMe(c *Cache, u *User) FilterFunc

func FilterLocalOnly

func FilterLocalOnly(c *Cache, u *User) FilterFunc

func FilterMediaOnly

func FilterMediaOnly(c *Cache, u *User) FilterFunc

func FilterMentionsMe

func FilterMentionsMe(c *Cache, u *User) FilterFunc

func FilterNoBots

func FilterNoBots(c *Cache, u *User) FilterFunc

func FilterNoOp

func FilterNoOp(c *Cache, u *User) FilterFunc

func FilterNoRSS

func FilterNoRSS(c *Cache, u *User) FilterFunc

func FilterNoReplies

func FilterNoReplies(c *Cache, u *User) FilterFunc

func FilterOutFeedsAndBotsFactory

func FilterOutFeedsAndBotsFactory(cache *Cache) FilterFunc

XXX: This function is now a bit weird XXX: Note that cache must already have its mutex held

type FilterFuncFactory

type FilterFuncFactory func(c *Cache, u *User) FilterFunc

FilterFuncFactory ...

func GetFilterFuncFactories

func GetFilterFuncFactories(fs []string) (filters []FilterFuncFactory)

type FilterTwtsFunc

type FilterTwtsFunc func(user *User, twts types.Twts) types.Twts

func FilterTwtsFactory

func FilterTwtsFactory(conf *Config) FilterTwtsFunc

FilterTwtsFactory returns a function that filters out Twts from users/feeds that a User has chosen to mute or are otherwise shadowed by the Pod (as decided by a Pod Owner/Operator).

type FixAdminFeedsJob

type FixAdminFeedsJob struct {
	// contains filtered or unexported fields
}

func (*FixAdminFeedsJob) Run

func (job *FixAdminFeedsJob) Run()

func (*FixAdminFeedsJob) String

func (job *FixAdminFeedsJob) String() string

type FrontMatter

type FrontMatter struct {
	Title       string
	Description string
}

type GroupFunc

type GroupFunc func(twt types.Twt) []string

GroupFunc ...

type HApp

type HApp struct {
	Name string
	URL  *url.URL
}

HApp ...

func GetIndieClientInfo

func GetIndieClientInfo(conf *Config, clientID string) (h HApp, err error)

GetIndieClientInfo ...

func (HApp) String

func (h HApp) String() string

type ImageOptions

type ImageOptions struct {
	Resize bool
	Width  int
	Height int
}

type ImageTask

type ImageTask struct {
	*tasks.BaseTask
	// contains filtered or unexported fields
}

func NewImageTask

func NewImageTask(conf *Config, fn string) *ImageTask

func (*ImageTask) Run

func (t *ImageTask) Run() error

func (*ImageTask) String

func (t *ImageTask) String() string

type Job

type Job interface {
	fmt.Stringer
	Run()
}

func NewActiveUsersJob

func NewActiveUsersJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewCreateAdminFeedsJob

func NewCreateAdminFeedsJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewDeleteOldSessionsJob

func NewDeleteOldSessionsJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewFixAdminFeedsJob

func NewFixAdminFeedsJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewPruneFollowersJob

func NewPruneFollowersJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewPruneUsersJob

func NewPruneUsersJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewRotateFeedsJob

func NewRotateFeedsJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewSyncStoreJob

func NewSyncStoreJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewUpdateActivityPubFollowersJob

func NewUpdateActivityPubFollowersJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewUpdateFeedSourcesJob

func NewUpdateFeedSourcesJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

func NewUpdateFeedsJob

func NewUpdateFeedsJob(conf *Config, cache *Cache, archive Archiver, db Store) Job

type JobFactory

type JobFactory func(conf *Config, cache *Cache, archive Archiver, store Store) Job

type JobSpec

type JobSpec struct {
	Schedule string
	Factory  JobFactory
}

JobSpec ...

func NewJobSpec

func NewJobSpec(schedule string, factory JobFactory) JobSpec
type Link struct {
	Href string
	Rel  string
}
type Links []Link

type MagicLinkAuthContext

type MagicLinkAuthContext struct {
	Pod     string
	BaseURL string

	Token    string
	Username string
}

type Meta

type Meta struct {
	Title       string
	Description string
	UpdatedAt   string
	Image       string
	Author      string
	URL         string
	Keywords    string
}

type Middleware

type Middleware func(httprouter.Handle) httprouter.Handle

Middleware ...

type MultiUserAgent

type MultiUserAgent struct {
	WhoFollowsURL string
	SupportURL    string
	// contains filtered or unexported fields
}

MultiUserAgent is a multi-user Twtxt client, currently only `yarnd` is such a client.

func (*MultiUserAgent) Followers

func (ua *MultiUserAgent) Followers(conf *Config) types.Followers

func (*MultiUserAgent) IsPod

func (ua *MultiUserAgent) IsPod() bool

func (*MultiUserAgent) IsPublicURL

func (ua *MultiUserAgent) IsPublicURL() bool

func (*MultiUserAgent) PodBaseURL

func (ua *MultiUserAgent) PodBaseURL() string

func (*MultiUserAgent) String

func (ua *MultiUserAgent) String() string

type NewUserEmailContext

type NewUserEmailContext struct {
	Pod       string
	BaseURL   string
	AdminUser string

	Username string
}

type Option

type Option func(*Config) error

Option is a function that takes a config struct and modifies it

func WithAPISessionTime

func WithAPISessionTime(duration time.Duration) Option

WithAPISessionTime sets the API session time for tokens

func WithAPISigningKey

func WithAPISigningKey(key string) Option

WithAPISigningKey sets the API JWT signing key for tokens

func WithAdminEmail

func WithAdminEmail(adminEmail string) Option

WithAdminEmail sets the Admin email used to contact the pod operator

func WithAdminName

func WithAdminName(adminName string) Option

WithAdminName sets the Admin name used to identify the pod operator

func WithAdminUser

func WithAdminUser(adminUser string) Option

WithAdminUser sets the Admin user used for granting special features to

func WithAuth

func WithAuth(auth string) Option

WithAuth sets the auther to use for authenticating sessions

func WithAuthHeader

func WithAuthHeader(authHeader string) Option

WithAuthHeader sets the auth header to use for proxy auth

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL sets the Base URL used for constructing feed URLs

func WithBlockedFeeds

func WithBlockedFeeds(blockedFeeds []string) Option

WithBlockedFeeds sets the list of feed uris blocked and prohibited from being fetched by the global feed cache

func WithCookieSecret

func WithCookieSecret(secret string) Option

WithCookieSecret sets the server's cookie secret

func WithData

func WithData(data string) Option

WithData sets the data directory to use for storage

func WithDebug

func WithDebug(debug bool) Option

WithDebug sets the debug mode flag

func WithDescription

func WithDescription(description string) Option

WithDescription sets the instance's description

func WithDisableArchive

func WithDisableArchive(disableArchive bool) Option

WithDisableArchive sets the disable archive flag

func WithDisableFfmpeg

func WithDisableFfmpeg(disableFfmpeg bool) Option

WithDisableFfmpeg sets the disable ffmpeg flag

func WithDisableGzip

func WithDisableGzip(disableGzip bool) Option

WithDisableGzip sets the disable Gzip flag

func WithDisableLogger

func WithDisableLogger(disableLogger bool) Option

WithDisableLogger sets the disable Logger flag

func WithDisableMedia

func WithDisableMedia(disablemedia bool) Option

WithDisableMedia sets the disable Media flag

func WithEmbedRules

func WithEmbedRules(embedRules string) Option

WithEmbedRules parses the json of URL-to-embed rewriting rules

func WithEnabledFeatures

func WithEnabledFeatures(features []FeatureType) Option

WithEnabledFeatures enables the selected features

func WithFeedSources

func WithFeedSources(feedSources []string) Option

WithFeedSources sets the feed sources to use for external feeds

func WithFetchInterval

func WithFetchInterval(fetchInterval string) Option

WithFetchInterval sets the cache fetch interval Accepts a string as parsed by `time.ParseDuration`

func WithFrontPage

func WithFrontPage(frontpage string) Option

WithFrontPage sets the behaviour of the pod's front page (anonymous discover view)

func WithMagicLinkSecret

func WithMagicLinkSecret(secret string) Option

WithMagicLinkSecret sets the MagicLinkSecert used to create password reset tokens

func WithMaxCacheFetchers

func WithMaxCacheFetchers(maxCacheFetchers int) Option

WithMaxCacheFetchers sets the maximum number of fetchers for the feed cache

func WithMaxCacheItems

func WithMaxCacheItems(maxCacheItems int) Option

WithMaxCacheItems sets the maximum cache items (per feed source) of twts in memory

func WithMaxCacheTTL

func WithMaxCacheTTL(maxCacheTTL time.Duration) Option

WithMaxCacheTTL sets the maximum cache ttl of twts in memory

func WithMaxFeedSize

func WithMaxFeedSize(size int64) Option

WithMaxFeedSize sets the maximum feed size before a feed is rotated

func WithMaxFetchLimit

func WithMaxFetchLimit(limit int64) Option

WithMaxFetchLimit sets the maximum feed fetch limit in bytes

func WithMaxTwtLength

func WithMaxTwtLength(maxTwtLength int) Option

WithMaxTwtLength sets the maximum length of posts permitted on the server

func WithMaxUploadSize

func WithMaxUploadSize(maxUploadSize int64) Option

WithMaxUploadSize sets the maximum upload size permitted by the server

func WithName

func WithName(name string) Option

WithName sets the instance's name

func WithOpenProfiles

func WithOpenProfiles(openProfiles bool) Option

WithOpenProfiles sets whether or not to have open user profiles

func WithOpenRegistrations

func WithOpenRegistrations(openRegistrations bool) Option

WithOpenRegistrations sets the open registrations flag

func WithPermittedImages

func WithPermittedImages(permittedImages []string) Option

WithPermittedImages sets the list of image domains permitted for external iamges to display inline

func WithSMTPFrom

func WithSMTPFrom(from string) Option

WithSMTPFrom sets the SMTPFrom address to use for sending email

func WithSMTPHost

func WithSMTPHost(host string) Option

WithSMTPHost sets the SMTPHost to use for sending email

func WithSMTPPass

func WithSMTPPass(pass string) Option

WithSMTPPass sets the SMTPPass to use for sending email

func WithSMTPPort

func WithSMTPPort(port int) Option

WithSMTPPort sets the SMTPPort to use for sending email

func WithSMTPUser

func WithSMTPUser(user string) Option

WithSMTPUser sets the SMTPUser to use for sending email

func WithSessionCacheTTL

func WithSessionCacheTTL(cacheTTL time.Duration) Option

WithSessionCacheTTL sets the server's session cache ttl

func WithSessionExpiry

func WithSessionExpiry(expiry time.Duration) Option

WithSessionExpiry sets the server's session expiry time

func WithStore

func WithStore(store string) Option

WithStore sets the store to use for accounts, sessions, etc.

func WithTLS

func WithTLS(tls bool) Option

WithTLS sets the tls flag

func WithTLSCert

func WithTLSCert(tlsCert string) Option

WithTLSCert sets the path to a TLS certificate

func WithTLSKey

func WithTLSKey(tlsKey string) Option

WithTLSKey sets the path to a TLS private key

func WithTheme

func WithTheme(theme string) Option

WithTheme sets the theme to use for templates and static asssets

func WithTranscoderTimeout

func WithTranscoderTimeout(timeout time.Duration) Option

WithTranscoderTimeout sets the video transcoding timeout

func WithTwtsPerPage

func WithTwtsPerPage(twtsPerPage int) Option

WithTwtsPerPage sets the server's twts per page

type Page

type Page struct {
	Content      string
	LastModified time.Time
}

type PasswordResetEmailContext

type PasswordResetEmailContext struct {
	Pod     string
	BaseURL string

	Token    string
	Username string
}

type Peers

type Peers []*Pod

func GetPeersForCached

func GetPeersForCached(cached *Cached, peers map[string]*Pod) Peers

func RandomSubsetOfPeers

func RandomSubsetOfPeers(peers Peers, pct float64) Peers

func (Peers) Len

func (peers Peers) Len() int

func (Peers) Less

func (peers Peers) Less(i, j int) bool

func (Peers) Swap

func (peers Peers) Swap(i, j int)

type Pod

type Pod struct {
	URI string `json:"-"`

	Name             string `json:"name"`
	Description      string `json:"description"`
	SoftwareVersion  string `json:"software_version"`
	BuildInformation string `json:"build_info"`

	// lastSeen records the timestamp of when we last saw this pod.
	LastSeen time.Time `json:"-"`

	// lastUpdated is used to periodically re-check the peering pod's /info endpoint in case of changes.
	LastUpdated time.Time `json:"-"`
}

func (*Pod) GetTwt

func (p *Pod) GetTwt(conf *Config, hash string) (types.Twt, error)

func (*Pod) IsZero

func (p *Pod) IsZero() bool

func (*Pod) ShouldRefresh

func (p *Pod) ShouldRefresh() bool

func (*Pod) String

func (p *Pod) String() string

type PodInfo

type PodInfo Pod

XXX: Type aliases for backwards compatibility with Cache v19

type PruneFollowersJob

type PruneFollowersJob struct {
	// contains filtered or unexported fields
}

func (*PruneFollowersJob) Run

func (job *PruneFollowersJob) Run()

func (*PruneFollowersJob) String

func (job *PruneFollowersJob) String() string

type PruneUsersJob

type PruneUsersJob struct {
	// contains filtered or unexported fields
}

func (*PruneUsersJob) Run

func (job *PruneUsersJob) Run()

func (*PruneUsersJob) String

func (job *PruneUsersJob) String() string

type ReportAbuseEmailContext

type ReportAbuseEmailContext struct {
	Pod       string
	AdminUser string

	Nick string
	URL  string

	Name     string
	Email    string
	Category string
	Message  string
}

type RotateFeedsJob

type RotateFeedsJob struct {
	// contains filtered or unexported fields
}

func (*RotateFeedsJob) Run

func (job *RotateFeedsJob) Run()

func (*RotateFeedsJob) String

func (job *RotateFeedsJob) String() string

type Router

type Router struct {
	httprouter.Router
	// contains filtered or unexported fields
}

Router ...

func NewRouter

func NewRouter() *Router

NewRouter ...

func (*Router) DELETE

func (r *Router) DELETE(path string, handle httprouter.Handle)

DELETE is a shortcut for Router.Handle("DELETE", path, handle)

func (*Router) File

func (r *Router) File(path, name string)

File serves the named file.

func (*Router) GET

func (r *Router) GET(path string, handle httprouter.Handle)

GET is a shortcut for Router.Handle("GET", path, handle)

func (*Router) Group

func (r *Router) Group(path string, m ...Middleware) *Router

Group returns new *Router with given path and middlewares. It should be used for handles which have same path prefix or common middlewares.

func (*Router) HEAD

func (r *Router) HEAD(path string, handle httprouter.Handle)

HEAD is a shortcut for Router.Handle("HEAD", path, handle)

func (*Router) Handle

func (r *Router) Handle(method, path string, handle httprouter.Handle)

Handle registers a new request handle combined with middlewares.

func (*Router) Handler

func (r *Router) Handler(method, path string, handler http.Handler)

Handler is an adapter for http.Handler.

func (*Router) HandlerFunc

func (r *Router) HandlerFunc(method, path string, handler http.HandlerFunc)

HandlerFunc is an adapter for http.HandlerFunc.

func (*Router) OPTIONS

func (r *Router) OPTIONS(path string, handle httprouter.Handle)

OPTIONS is a shortcut for Router.Handle("OPTIONS", path, handle)

func (*Router) PATCH

func (r *Router) PATCH(path string, handle httprouter.Handle)

PATCH is a shortcut for Router.Handle("PATCH", path, handle)

func (*Router) POST

func (r *Router) POST(path string, handle httprouter.Handle)

POST is a shortcut for Router.Handle("POST", path, handle)

func (*Router) PUT

func (r *Router) PUT(path string, handle httprouter.Handle)

PUT is a shortcut for Router.Handle("PUT", path, handle)

func (*Router) ServeFiles

func (r *Router) ServeFiles(path string, root http.FileSystem)

ServeFiles ...

func (*Router) ServeFilesWithCacheControl

func (r *Router) ServeFilesWithCacheControl(path string, root fs.FS)

ServeFilesWithCacheControl ...

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Router) Static

func (r *Router) Static(path, root string)

Static serves files from given root directory.

func (*Router) Use

func (r *Router) Use(m ...Middleware) *Router

Use appends new middleware to current Router.

type Server

type Server struct {

	// Factory Functions
	AppendTwt  AppendTwtFunc
	FilterTwts FilterTwtsFunc
	// contains filtered or unexported fields
}

Server ...

func NewServer

func NewServer(bind string, options ...Option) (*Server, error)

NewServer ...

func (*Server) AddCronJob

func (s *Server) AddCronJob(spec string, job cron.Job) error

AddCronJob ...

func (*Server) AddRoute

func (s *Server) AddRoute(method, path string, handler http.Handler)

AddRouter ...

func (*Server) AddShutdownHook

func (s *Server) AddShutdownHook(f func())

AddShutdownHook ...

func (*Server) AddUserHandler

func (s *Server) AddUserHandler() httprouter.Handle

AddUserHandler ...

func (*Server) AvatarHandler

func (s *Server) AvatarHandler() httprouter.Handle

AvatarHandler ...

func (*Server) BookmarkHandler

func (s *Server) BookmarkHandler() httprouter.Handle

BookmarkHandler ...

func (*Server) BookmarksHandler

func (s *Server) BookmarksHandler() httprouter.Handle

BookmarksHandler ...

func (*Server) CaptchaHandler

func (s *Server) CaptchaHandler() httprouter.Handle

CaptchaHandler ...

func (*Server) ConversationHandler

func (s *Server) ConversationHandler() httprouter.Handle

ConversationHandler ...

func (*Server) DelFeedHandler

func (s *Server) DelFeedHandler() httprouter.Handle

DelFeedHandler ...

func (*Server) DelUserHandler

func (s *Server) DelUserHandler() httprouter.Handle

DelUserHandler ...

func (*Server) DeleteFeedHandler

func (s *Server) DeleteFeedHandler() httprouter.Handle

DeleteFeedHandler...

func (*Server) DeleteHandler

func (s *Server) DeleteHandler() httprouter.Handle

DeleteHandler ...

func (*Server) DiscoverHandler

func (s *Server) DiscoverHandler() httprouter.Handle

DiscoverHandler ...

func (*Server) ExternalAvatarHandler

func (s *Server) ExternalAvatarHandler() httprouter.Handle

ExternalAvatarHandler ...

func (*Server) ExternalFollowingHandler

func (s *Server) ExternalFollowingHandler() httprouter.Handle

ExternalFollowingHandler ...

func (*Server) ExternalHandler

func (s *Server) ExternalHandler() httprouter.Handle

ExternalHandler ...

func (*Server) FeedHandler

func (s *Server) FeedHandler() httprouter.Handle

FeedHandler ...

func (*Server) FeedsHandler

func (s *Server) FeedsHandler() httprouter.Handle

FeedsHandler ...

func (*Server) FollowHandler

func (s *Server) FollowHandler() httprouter.Handle

FollowHandler ...

func (*Server) FollowersHandler

func (s *Server) FollowersHandler() httprouter.Handle

FollowersHandler ...

func (*Server) FollowingHandler

func (s *Server) FollowingHandler() httprouter.Handle

FollowingHandler ...

func (*Server) ImportHandler

func (s *Server) ImportHandler() httprouter.Handle

ImportHandler ...

func (*Server) InboxHandler

func (s *Server) InboxHandler() httprouter.Handle

InboxHandler ...

func (*Server) IndieAuthCallbackHandler

func (s *Server) IndieAuthCallbackHandler() httprouter.Handle

IndieAuthCallbackHandler ...

func (*Server) IndieAuthHandler

func (s *Server) IndieAuthHandler() httprouter.Handle

IndieAuthHandler ...

func (*Server) IndieAuthVerifyHandler

func (s *Server) IndieAuthVerifyHandler() httprouter.Handle

IndieAuthVerifyHandler ...

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe ...

func (*Server) ListsHandler

func (s *Server) ListsHandler() httprouter.Handle

ListsHandler ...

func (*Server) LoginEmailHandler

func (s *Server) LoginEmailHandler() httprouter.Handle

LoginEmailHandler ...

func (*Server) LoginHandler

func (s *Server) LoginHandler() httprouter.Handle

LoginHandler ...

func (*Server) LogoutHandler

func (s *Server) LogoutHandler() httprouter.Handle

LogoutHandler ...

func (*Server) LookupHandler

func (s *Server) LookupHandler() httprouter.Handle

LookupHandler ...

func (*Server) MagicLinkAuthHandler

func (s *Server) MagicLinkAuthHandler() httprouter.Handle

MagicLinkAuthHandler ...

func (*Server) ManageFeedHandler

func (s *Server) ManageFeedHandler() httprouter.Handle

ManageFeedHandler...

func (*Server) ManageJobsHandler

func (s *Server) ManageJobsHandler() httprouter.Handle

ManageJobsHandler ...

func (*Server) ManagePeersHandler

func (s *Server) ManagePeersHandler() httprouter.Handle

ManagePeersHandler ...

func (*Server) ManagePodHandler

func (s *Server) ManagePodHandler() httprouter.Handle

ManagePodHandler ...

func (*Server) ManageUsersHandler

func (s *Server) ManageUsersHandler() httprouter.Handle

ManageUsersHandler ...

func (*Server) MediaHandler

func (s *Server) MediaHandler() httprouter.Handle

MediaHandler ...

func (*Server) MentionsHandler

func (s *Server) MentionsHandler() httprouter.Handle

MentionsHandler ...

func (*Server) MuteHandler

func (s *Server) MuteHandler() httprouter.Handle

MuteHandler ...

func (*Server) MutedHandler

func (s *Server) MutedHandler() httprouter.Handle

MutedHandler ...

func (*Server) NewPasswordHandler

func (s *Server) NewPasswordHandler() httprouter.Handle

NewPasswordHandler ...

func (*Server) NotFoundHandler

func (s *Server) NotFoundHandler(w http.ResponseWriter, r *http.Request)

func (*Server) NotifyHandler

func (s *Server) NotifyHandler() httprouter.Handle

NotifyHandler ...

func (*Server) OutboxHandler

func (s *Server) OutboxHandler() httprouter.Handle

OutboxHandler ...

func (*Server) PageHandler

func (s *Server) PageHandler(name string) httprouter.Handle

PageHandler ...

func (*Server) PermalinkHandler

func (s *Server) PermalinkHandler() httprouter.Handle

PermalinkHandler ...

func (*Server) PodConfigHandler

func (s *Server) PodConfigHandler() httprouter.Handle

PodConfigHandler ...

func (*Server) PodInfoHandler

func (s *Server) PodInfoHandler() httprouter.Handle

PodInfoHandler ...

func (*Server) PodLogoHandler

func (s *Server) PodLogoHandler() httprouter.Handle

PodLogoHandler ...

func (*Server) PostHandler

func (s *Server) PostHandler() httprouter.Handle

PostHandler handles the creation/modification/deletion of a twt.

TODO: Support deleting/patching last feed (`postas`) twt too.

func (*Server) ProfileHandler

func (s *Server) ProfileHandler() httprouter.Handle

ProfileHandler ...

func (*Server) RefreshCacheHandler

func (s *Server) RefreshCacheHandler() httprouter.Handle

RefreshCacheHandler ...

func (*Server) RegisterHandler

func (s *Server) RegisterHandler() httprouter.Handle

RegisterHandler ...

func (*Server) ReportHandler

func (s *Server) ReportHandler() httprouter.Handle

ReportHandler ...

func (*Server) ResetPasswordHandler

func (s *Server) ResetPasswordHandler() httprouter.Handle

ResetPasswordHandler ...

func (*Server) ResetPasswordMagicLinkHandler

func (s *Server) ResetPasswordMagicLinkHandler() httprouter.Handle

ResetPasswordMagicLinkHandler ...

func (*Server) RobotsHandler

func (s *Server) RobotsHandler() httprouter.Handle

RobotsHandler ...

func (*Server) RstUserHandler

func (s *Server) RstUserHandler() httprouter.Handle

RstUserHandler ...

func (*Server) Run

func (s *Server) Run() (err error)

Run ...

func (*Server) SearchHandler

func (s *Server) SearchHandler() httprouter.Handle

SearchHandler ...

func (*Server) SettingsAddLinkHandler

func (s *Server) SettingsAddLinkHandler() httprouter.Handle

SettingsAddLinkHandler ...

func (*Server) SettingsHandler

func (s *Server) SettingsHandler() httprouter.Handle

SettingsHandler ...

func (*Server) SettingsRemoveLinkHandler

func (s *Server) SettingsRemoveLinkHandler() httprouter.Handle

SettingsRemoveLinkHandler ...

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown ...

func (*Server) SupportHandler

func (s *Server) SupportHandler() httprouter.Handle

SupportHandler ...

func (*Server) SyndicationHandler

func (s *Server) SyndicationHandler() httprouter.Handle

SyndicationHandler ...

func (*Server) TaskHandler

func (s *Server) TaskHandler() httprouter.Handle

TaskHandler ...

func (*Server) TimelineHandler

func (s *Server) TimelineHandler() httprouter.Handle

TimelineHandler ...

func (*Server) TwtxtHandler

func (s *Server) TwtxtHandler() httprouter.Handle

TwtxtHandler ...

func (*Server) UnfollowHandler

func (s *Server) UnfollowHandler() httprouter.Handle

UnfollowHandler ...

func (*Server) UnmuteHandler

func (s *Server) UnmuteHandler() httprouter.Handle

UnmuteHandler ...

func (*Server) UploadMediaHandler

func (s *Server) UploadMediaHandler() httprouter.Handle

UploadMediaHandler ...

func (*Server) UserConfigHandler

func (s *Server) UserConfigHandler() httprouter.Handle

UserConfigHandler ...

func (*Server) WebFingerHandler

func (s *Server) WebFingerHandler() httprouter.Handle

WebFingerHandler ...

func (*Server) WebMentionHandler

func (s *Server) WebMentionHandler() httprouter.Handle

WebMentionHandler ...

func (*Server) WebSubHandler

func (s *Server) WebSubHandler() httprouter.Handle

WebSubHandler ...

func (*Server) WhoFollowsHandler

func (s *Server) WhoFollowsHandler() httprouter.Handle

WhoFollowsHandler ...

type SessionStore

type SessionStore struct {
	// contains filtered or unexported fields
}

SessionStore ...

func (*SessionStore) DelSession

func (s *SessionStore) DelSession(sid string) error

func (*SessionStore) GetAllSessions

func (s *SessionStore) GetAllSessions() ([]*sessions.Session, error)

func (*SessionStore) GetSession

func (s *SessionStore) GetSession(sid string) (*sessions.Session, error)

func (*SessionStore) HasSession

func (s *SessionStore) HasSession(sid string) bool

func (*SessionStore) LenSessions

func (s *SessionStore) LenSessions() int64

func (*SessionStore) SetSession

func (s *SessionStore) SetSession(sid string, sess *sessions.Session) error

func (*SessionStore) SyncSession

func (s *SessionStore) SyncSession(sess *sessions.Session) error

type Settings

type Settings struct {
	Name        string `yaml:"pod_name"`
	CSS         string `yaml:"pod_css"`
	JS          string `yaml:"pod_js"`
	Description string `yaml:"pod_description"`

	AlertFloat   bool   `yaml:"pod_alert_float"`
	AlertGuest   bool   `yaml:"pod_alert_guest"`
	AlertMessage string `yaml:"pod_alert_message"`
	AlertType    string `yaml:"pod_alert_type"`

	MaxTwtLength     int `yaml:"max_twt_length"`
	TwtsPerPage      int `yaml:"twts_per_page"`
	MediaResolution  int `yaml:"media_resolution"`
	AvatarResolution int `yaml:"avatar_resolution"`

	OpenProfiles      bool `yaml:"open_profiles"`
	OpenRegistrations bool `yaml:"open_registrations"`

	FrontPage string `yaml:"front_page"`

	// XXX: Deprecated fields (See: https://git.mills.io/yarnsocial/yarn/pulls/711)
	// TODO: Remove post v0.14.x
	BlacklistedFeeds  []string `yaml:"blacklisted_feeds"`
	WhitelistedImages []string `yaml:"whitelisted_images"`

	BlockedFeeds    []string      `yaml:"blocked_feeds"`
	PermittedImages []string      `yaml:"permitted_images"`
	EmbedRules      string        `yaml:"embed_rules"`
	Features        *FeatureFlags `yaml:"features"`

	// Pod Level Settings (overridable by Users)
	DisplayDatesInTimezone  string `yaml:"display_dates_in_timezone"`
	DisplayTimePreference   string `yaml:"display_time_preference"`
	OpenLinksInPreference   string `yaml:"open_links_in_preference"`
	DisplayImagesPreference string `yaml:"display_images_preference"`
	DisplayMedia            bool   `yaml:"display_media"`
	OriginalMedia           bool   `yaml:"original_media"`

	VisibilityCompact  bool `yaml:"visibility_compact"`
	VisibilityReadmore bool `yaml:"visibility_readmore"`
	LinkVerification   bool `yaml:"link_verification"`
	StripTrackingParam bool `yaml:"strip_trackingparam"`

	CustomPrimaryColor   string `yaml:"custom_primarycolor"`
	CustomSecondaryColor string `yaml:"custom_secondarycolor"`
}

Settings contains Pod Settings that can be customised via the Web UI

func LoadSettings

func LoadSettings(path string) (*Settings, error)

LoadSettings loads pod settings from the given path

func (*Settings) Save

func (s *Settings) Save(path string) error

Save saves the pod settings to the given path

type SingleUserAgent

type SingleUserAgent struct {
	Nick string
	URI  string
	// contains filtered or unexported fields
}

SingleUserAgent is a single Twtxt User Agent whether it be `tt`, `jenny` or a single-user `yarnd` client.

func (*SingleUserAgent) Followers

func (ua *SingleUserAgent) Followers(conf *Config) types.Followers

func (*SingleUserAgent) IsPod

func (ua *SingleUserAgent) IsPod() bool

func (*SingleUserAgent) IsPublicURL

func (ua *SingleUserAgent) IsPublicURL() bool

func (*SingleUserAgent) PodBaseURL

func (ua *SingleUserAgent) PodBaseURL() string

func (*SingleUserAgent) String

func (ua *SingleUserAgent) String() string

type SoftwareConfig

type SoftwareConfig struct {
	Software string

	FullVersion string
	Version     string
	Commit      string
	Build       string

	Author    string
	License   string
	Copyright string
}

SoftwareConfig contains the server version information

type Store

type Store interface {
	DB() *bitcask.Bitcask

	Merge() error
	Close() error
	Sync() error

	DelFeed(name string) error
	HasFeed(name string) bool
	GetFeed(name string) (*Feed, error)
	SetFeed(name string, user *Feed) error
	LenFeeds() int64
	SearchFeeds(prefix string) []string
	GetAllFeeds() ([]*Feed, error)

	DelUser(username string) error
	HasUser(username string) bool
	GetUser(username string) (*User, error)
	SetUser(username string, user *User) error
	LenUsers() int64
	SearchUsers(prefix string) []string
	GetAllUsers() ([]*User, error)

	GetSession(sid string) (*sessions.Session, error)
	SetSession(sid string, sess *sessions.Session) error
	HasSession(sid string) bool
	DelSession(sid string) error
	SyncSession(sess *sessions.Session) error
	LenSessions() int64
	GetAllSessions() ([]*sessions.Session, error)
}

func NewStore

func NewStore(store string) (Store, error)

type StoreFactory

type StoreFactory func() (Store, error)

type SupportRequestEmailContext

type SupportRequestEmailContext struct {
	Pod       string
	AdminUser string

	Name    string
	Email   string
	Subject string
	Message string
}

type SyncStoreJob

type SyncStoreJob struct {
	// contains filtered or unexported fields
}

func (*SyncStoreJob) Run

func (job *SyncStoreJob) Run()

func (*SyncStoreJob) String

func (job *SyncStoreJob) String() string

type TTLCache

type TTLCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTTLCache

func NewTTLCache(ttl time.Duration) *TTLCache

func (*TTLCache) Dec

func (cache *TTLCache) Dec(k string) int

func (*TTLCache) Del

func (cache *TTLCache) Del(k string)

func (*TTLCache) Get

func (cache *TTLCache) Get(k string) int

func (*TTLCache) GetString

func (cache *TTLCache) GetString(k string) string

func (*TTLCache) Inc

func (cache *TTLCache) Inc(k string) int

func (*TTLCache) Reset

func (cache *TTLCache) Reset(k string) int

func (*TTLCache) Set

func (cache *TTLCache) Set(k string, v int) int

func (*TTLCache) SetString

func (cache *TTLCache) SetString(k string, v string) string

type TemplateManager

type TemplateManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTemplateManager

func NewTemplateManager(conf *Config, translator *Translator, cache *Cache, archive Archiver) (*TemplateManager, error)

func (*TemplateManager) Add

func (m *TemplateManager) Add(name string, template *template.Template)

func (*TemplateManager) Exec

func (m *TemplateManager) Exec(name string, ctx *Context) (io.WriterTo, error)

func (*TemplateManager) LoadTemplates

func (m *TemplateManager) LoadTemplates() error

type TimeVar

type TimeVar struct {
	// contains filtered or unexported fields
}

TimeVar ...

func (*TimeVar) Add

func (o *TimeVar) Add(duration time.Duration)

Add ...

func (*TimeVar) Set

func (o *TimeVar) Set(date time.Time)

Set ...

func (*TimeVar) String

func (o *TimeVar) String() string

String ...

type Token

type Token struct {
	Signature string
	Value     string
	UserAgent string
	CreatedAt time.Time
	ExpiresAt time.Time
}

Token ...

type Translator

type Translator struct {
	Bundle *i18n.Bundle
}

func NewTranslator

func NewTranslator() (*Translator, error)

func (*Translator) Translate

func (t *Translator) Translate(ctx *Context, msgID string, data ...interface{}) string

Translate 翻译

type TwtFromNote

type TwtFromNote func(note *activitypub.Note) (types.Twt, error)

TwtFromNote ...

func TwtFromNoteFactory

func TwtFromNoteFactory(conf *Config, cache *Cache, archive Archiver) TwtFromNote

TwtFromNoteFactory ...

type TwtTextFormat

type TwtTextFormat int

TwtTextFormat represents the format of which the twt text gets formatted to

const (
	// MarkdownFmt to use markdown format
	MarkdownFmt TwtTextFormat = iota
	// HTMLFmt to use HTML format
	HTMLFmt
	// TextFmt to use for og:description
	TextFmt
)

type TwtxtUserAgent

type TwtxtUserAgent interface {
	fmt.Stringer

	// IsPod returns true if the Twtxt client's User-Agent appears to be a Yarn.social pod (single or multi-user).
	IsPod() bool

	// PodBaseURL returns the base URL of the client's User-Agent if it appears to be a Yarn.social pod (single or multi-user).
	PodBaseURL() string

	// IsPublicURL returns true if the Twtxt client's User-Agent is from what appears to be the public internet.
	IsPublicURL() bool

	// Followers returns a list of followers for this client follows, in the case of a
	// single user agent, it is simply a list of itself, with a multi-user agent the
	// client (i.e: a `yarnd` pod) is aksed who followers the user/feed by requesting
	// the whoFollows resource
	Followers(conf *Config) types.Followers
}

TwtxtUserAgent ...

func ParseUserAgent

func ParseUserAgent(ua string) (TwtxtUserAgent, error)

type URI

type URI struct {
	Type string
	Path string
}

func ParseURI

func ParseURI(uri string) (*URI, error)

func (URI) IsZero

func (u URI) IsZero() bool

func (URI) String

func (u URI) String() string

type URLProcessor

type URLProcessor struct {
	Images []string
	// contains filtered or unexported fields
}

func (*URLProcessor) RenderNodeHook

func (up *URLProcessor) RenderNodeHook(w io.Writer, node ast.Node, entering bool) (ast.WalkStatus, bool)

type UpdateActivityPubFollowersJob

type UpdateActivityPubFollowersJob struct {
	// contains filtered or unexported fields
}

func (*UpdateActivityPubFollowersJob) Run

func (job *UpdateActivityPubFollowersJob) Run()

func (*UpdateActivityPubFollowersJob) String

func (job *UpdateActivityPubFollowersJob) String() string

type UpdateFeedSourcesJob

type UpdateFeedSourcesJob struct {
	// contains filtered or unexported fields
}

func (*UpdateFeedSourcesJob) Run

func (job *UpdateFeedSourcesJob) Run()

func (*UpdateFeedSourcesJob) String

func (job *UpdateFeedSourcesJob) String() string

type UpdateFeedsJob

type UpdateFeedsJob struct {
	// contains filtered or unexported fields
}

func (*UpdateFeedsJob) Run

func (job *UpdateFeedsJob) Run()

func (*UpdateFeedsJob) String

func (job *UpdateFeedsJob) String() string

type User

type User struct {
	Username string
	// XXX: `User.Password“ field is Deprecated in favor of `User.PasswordHash“
	// TODO: Remove once all (most?) pods are on yarnd v0.17+
	Password     string `json:",omitempty"`
	PasswordHash []byte
	Tagline      string
	URL          string
	CreatedAt    time.Time
	LastSeenAt   time.Time

	StartPage  string `default:"#origin"`
	Theme      string `default:"auto"`
	Lang       string `default:""`
	Recovery   string `default:""`
	AvatarHash string `default:""`

	DisplayDatesInTimezone    string `default:"UTC"`
	DisplayTimePreference     string `default:"24h"`
	OpenLinksInPreference     string `default:"newwindow"`
	DisplayTimelinePreference string `default:"list"`
	DisplayImagesPreference   string `default:"inline"`
	DisplayMedia              bool   `default:"true"`
	OriginalMedia             bool   `default:"false"`

	VisibilityCompact  bool `default:"false"`
	VisibilityReadmore bool `default:"false"`
	LinkVerification   bool `default:"false"`
	StripTrackingParam bool `default:"false"`

	CustomPrimaryColor   string `default:""`
	CustomSecondaryColor string `default:""`

	IsFollowingPubliclyVisible bool `default:"true"`
	IsBookmarksPubliclyVisible bool `default:"true"`

	Feeds []string `default:"[]"`

	Bookmarks map[string]string `default:"{}"`
	Followers map[string]string `default:"{}"`
	Following map[string]string `default:"{}"`
	Links     map[string]string `default:"{}"`
	Muted     map[string]string `default:"{}"`
	// contains filtered or unexported fields
}

User ...

func GetUserFromTwter

func GetUserFromTwter(conf *Config, db Store, twter types.Twter) (*User, error)

func GetUserFromURL

func GetUserFromURL(conf *Config, db Store, url string) (*User, error)

func LoadUser

func LoadUser(data []byte) (user *User, err error)

func NewUser

func NewUser() *User

NewUser ...

func (*User) AddFollower

func (u *User) AddFollower(nick, uri string)
func (u *User) AddLink(title, url string)

func (*User) Bookmark

func (u *User) Bookmark(hash string)

func (*User) Bookmarked

func (u *User) Bookmarked(hash string) bool

func (*User) Bytes

func (u *User) Bytes() ([]byte, error)

func (*User) DelFollower

func (u *User) DelFollower(nick, uri string)

func (*User) DisplayTimeFormat

func (u *User) DisplayTimeFormat() string

func (*User) Filter

func (u *User) Filter(twts []types.Twt) (filtered []types.Twt)

func (*User) Follow

func (u *User) Follow(alias, uri string) error

func (*User) FollowAndValidate

func (u *User) FollowAndValidate(conf *Config, uri string) error

func (*User) FollowedBy

func (u *User) FollowedBy(url string) bool

func (*User) Follows

func (u *User) Follows(url string) bool

func (*User) FollowsAs

func (u *User) FollowsAs(url string) string

func (*User) HasMuted

func (u *User) HasMuted(value string) bool

func (*User) Is

func (u *User) Is(url string) bool

func (*User) IsZero

func (u *User) IsZero() bool

func (*User) Mute

func (u *User) Mute(key, value string)

func (*User) OwnsFeed

func (u *User) OwnsFeed(name string) bool

func (*User) Profile

func (u *User) Profile(baseURL string, viewer *User) types.Profile
func (u *User) RemoveLink(title string)

func (*User) Reply

func (u *User) Reply(twt types.Twt) string

func (*User) Source

func (u *User) Source() types.FetchFeedRequests

func (*User) Sources

func (u *User) Sources() types.FetchFeedRequests

func (*User) String

func (u *User) String() string

func (*User) Twter

func (u *User) Twter(conf *Config) types.Twter

func (*User) Unfollow

func (u *User) Unfollow(conf *Config, alias string) error

func (*User) Unmute

func (u *User) Unmute(key string)

type VideoOptions

type VideoOptions struct {
	Resize bool
	Size   int
}

type VideoTask

type VideoTask struct {
	*tasks.BaseTask
	// contains filtered or unexported fields
}

func NewVideoTask

func NewVideoTask(conf *Config, fn string) *VideoTask

func (*VideoTask) Run

func (t *VideoTask) Run() error

func (*VideoTask) String

func (t *VideoTask) String() string

type YarndUserAgent

type YarndUserAgent struct {
	Name       string
	SupportURL string
	// contains filtered or unexported fields
}

YarndUserAgent is a generic `yarnd` client.

func (*YarndUserAgent) Followers

func (ua *YarndUserAgent) Followers(conf *Config) types.Followers

func (*YarndUserAgent) IsPod

func (ua *YarndUserAgent) IsPod() bool

func (*YarndUserAgent) IsPublicURL

func (ua *YarndUserAgent) IsPublicURL() bool

func (*YarndUserAgent) PodBaseURL

func (ua *YarndUserAgent) PodBaseURL() string

func (*YarndUserAgent) String

func (ua *YarndUserAgent) String() string

Directories

Path Synopsis
Package activitypub implements ActivityPub types, handling and c2s (client-to-server) functionality
Package activitypub implements ActivityPub types, handling and c2s (client-to-server) functionality

Jump to

Keyboard shortcuts

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