Documentation
¶
Index ¶
- Constants
- Variables
- func AddFeedOwnership(db Store, user *User, feed *Feed) (err error)
- func AppendSpecial(conf *Config, db Store, specialUsername, text string, args ...interface{}) (types.Twt, error)
- func AppendTwt(conf *Config, db Store, user *User, text string, args ...interface{}) (types.Twt, error)
- func CleanTwt(text string) string
- func CmdExists(cmd string) bool
- func CreateFeed(conf *Config, db Store, user *User, name string, force bool) error
- func DeleteLastTwt(conf *Config, user *User) error
- func DetachFeedFromOwner(db Store, user *User, feed *Feed) (err error)
- func DownloadImage(conf *Config, url string, resource, name string, opts *ImageOptions) (string, error)
- func FastHash(s string) string
- func FeedExists(conf *Config, username string) bool
- func FileExists(name string) bool
- func FilterTwts(user *User, twts types.Twts) (filtered types.Twts)
- func FormatForDateTime(t time.Time) string
- func FormatMentionsAndTags(conf *Config, text string, format TwtTextFormat) string
- func FormatRequest(r *http.Request) string
- func FormatTwtFactory(conf *Config) func(twt types.Twt) template.HTML
- func GenerateAvatar(conf *Config, username string) (image.Image, error)
- func GenerateRandomToken() string
- func GenerateToken(feedurl string) string
- func GetAllFeeds(conf *Config) ([]string, error)
- func GetAllTwts(conf *Config, name string) (types.Twts, error)
- func GetExternalAvatar(conf *Config, nick, uri string) string
- func GetFeedCount(conf *Config, name string) (int, error)
- func GetLastTwt(conf *Config, user *User) (twt types.Twt, offset int, err error)
- func GetMediaNamesFromText(text string) []string
- func HasString(a []string, x string) bool
- func HostnameFromURL(uri string) string
- func ImageToPng(fn string) error
- func Indent(text, indent string) string
- func InitJobs(conf *Config)
- func IntPow(x, y int) int
- func IsAdminUserFactory(conf *Config) func(user *User) bool
- func IsAudio(fn string) bool
- func IsExternalFeedFactory(conf *Config) func(url string) bool
- func IsImage(fn string) bool
- func IsLocalURLFactory(conf *Config) func(url string) bool
- func IsVideo(fn string) bool
- func LineCount(r io.Reader) (int, error)
- func MapStrings(xs []string, f func(s string) string) []string
- func NewCreateAdminFeedsJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewCreateBotsJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewDeleteOldSessionsJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewFeedLookup(conf *Config, db Store, user *User) types.FeedLookup
- func NewMboxHandler(config *Config, db Store, pm passwords.Passwords, msgs *MessagesCache, ...) popart.Handler
- func NewRemoveEmailsJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewStats(name string) *expvar.Map
- func NewStatsJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewSyncStoreJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewUpdateFeedSourcesJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NewUpdateFeedsJob(conf *Config, blogs *BlogsCache, cache *Cache, archive Archiver, db Store) cron.Job
- func NormalizeFeedName(name string) string
- func NormalizeURL(url string) string
- func NormalizeUsername(username string) string
- func PreprocessMedia(conf *Config, u *url.URL, alt string) string
- func PrettyURL(uri string) string
- func ProcessImage(conf *Config, ifn string, resource, name string, opts *ImageOptions) (string, error)
- func ReceiveAudio(r io.Reader) (string, error)
- func ReceiveImage(r io.Reader) (string, error)
- func ReceiveVideo(r io.Reader) (string, error)
- func RedirectRefererURL(r *http.Request, conf *Config, defaultURL string) string
- func RemoveFeedOwnership(db Store, user *User, feed *Feed) (err error)
- func RemoveString(xs []string, e string) []string
- func RenderAudio(conf *Config, uri string) string
- func RenderHTML(tpl string, ctx *Context) (string, error)
- func RenderPlainText(tpl string, ctx *Context) (string, error)
- func RenderVideo(conf *Config, uri string) string
- func ReplaceExt(fn, newExt string) string
- func Request(conf *Config, method, url string, headers http.Header) (*http.Response, error)
- func ResourceExists(conf *Config, url string) bool
- func RunCmd(timeout time.Duration, command string, args ...string) error
- func SafeParseInt(s string, d int) int
- func SaveFeedSources(feedsources *FeedSources, path string) error
- func SendEmail(conf *Config, recipients []string, replyTo, subject string, body string) error
- func SendPasswordResetEmail(conf *Config, user *User, email, token string) error
- func SendReportAbuseEmail(conf *Config, nick, url, name, email, category, message string) error
- func SendSupportRequestEmail(conf *Config, name, email, subject, message string) error
- func Slugify(uri string) string
- func StoreUploadedImage(conf *Config, r io.Reader, resource, name string, opts *ImageOptions) (string, error)
- func StringKeys(kv map[string]string) []string
- func StringValues(kv map[string]string) []string
- func TranscodeAudio(conf *Config, ifn string, resource, name string, opts *AudioOptions) (string, error)
- func TranscodeVideo(conf *Config, ifn string, resource, name string, opts *VideoOptions) (string, error)
- func URLForAvatar(baseURL string, username string) string
- func URLForBlogFactory(conf *Config, blogs *BlogsCache) func(twt types.Twt) string
- func URLForBlogs(baseURL, author string) string
- func URLForConvFactory(conf *Config, cache *Cache, archive Archiver) func(twt types.Twt) string
- func URLForExternalAvatar(conf *Config, uri string) string
- func URLForExternalProfile(conf *Config, nick, uri string) string
- func URLForPage(baseURL, page string) string
- func URLForTag(baseURL, tag string) string
- func URLForTask(baseURL, uuid string) string
- func URLForTwt(baseURL, hash string) string
- func URLForUser(baseURL, username string) string
- func URLForWhoFollows(baseURL string, feed types.Feed, feedFollowers int) string
- func UniqStrings(xs []string) []string
- func UnparseTwtFactory(conf *Config) func(text string) string
- func UserURL(url string) string
- func ValidateFeed(conf *Config, nick, url string) error
- func ValidateFeedName(path string, name string) error
- func ValidateUsername(username string) error
- func WebMention(target, source string) error
- type API
- func (a *API) AuthEndpoint() httprouter.Handle
- func (a *API) ConversationEndpoint() httprouter.Handle
- func (a *API) CreateToken(user *User, r *http.Request) (*Token, error)
- func (a *API) DiscoverEndpoint() httprouter.Handle
- func (a *API) ExternalProfileEndpoint() httprouter.Handle
- func (a *API) FetchTwtsEndpoint() httprouter.Handle
- func (a *API) FollowEndpoint() httprouter.Handle
- func (a *API) MentionsEndpoint() httprouter.Handle
- func (a *API) MuteEndpoint() httprouter.Handle
- func (a *API) OldUploadMediaEndpoint() httprouter.Handle
- func (a *API) PingEndpoint() httprouter.Handle
- func (a *API) PodConfigEndpoint() httprouter.Handle
- func (a *API) PostEndpoint() httprouter.Handle
- func (a *API) ProfileEndpoint() httprouter.Handle
- func (a *API) RegisterEndpoint() httprouter.Handle
- func (a *API) ReportEndpoint() httprouter.Handle
- func (a *API) SettingsEndpoint() httprouter.Handle
- func (a *API) SupportEndpoint() httprouter.Handle
- func (a *API) TimelineEndpoint() httprouter.Handle
- func (a *API) UnfollowEndpoint() httprouter.Handle
- func (a *API) UnmuteEndpoint() httprouter.Handle
- func (a *API) UploadMediaEndpoint() httprouter.Handle
- type Archiver
- type AudioOptions
- type AudioTask
- type BaseTask
- func (t *BaseTask) Done()
- func (t *BaseTask) Error() error
- func (t *BaseTask) Fail(err error) error
- func (t *BaseTask) ID() string
- func (t *BaseTask) Result() TaskResult
- func (t *BaseTask) SetData(key, val string)
- func (t *BaseTask) SetState(state TaskState)
- func (t *BaseTask) State() TaskState
- func (t *BaseTask) String() string
- type BitcaskStore
- func (bs *BitcaskStore) Close() error
- func (bs *BitcaskStore) DelFeed(name string) error
- func (bs *BitcaskStore) DelSession(sid string) error
- func (bs *BitcaskStore) DelToken(signature string) error
- func (bs *BitcaskStore) DelUser(username string) error
- func (bs *BitcaskStore) GetAllFeeds() ([]*Feed, error)
- func (bs *BitcaskStore) GetAllSessions() ([]*session.Session, error)
- func (bs *BitcaskStore) GetAllUsers() ([]*User, error)
- func (bs *BitcaskStore) GetFeed(name string) (*Feed, error)
- func (bs *BitcaskStore) GetSession(sid string) (*session.Session, error)
- func (bs *BitcaskStore) GetToken(signature string) (*Token, error)
- func (bs *BitcaskStore) GetUser(username string) (*User, error)
- func (bs *BitcaskStore) GetUserTokens(user *User) ([]*Token, error)
- func (bs *BitcaskStore) HasFeed(name string) bool
- func (bs *BitcaskStore) HasSession(sid string) bool
- func (bs *BitcaskStore) HasUser(username string) bool
- func (bs *BitcaskStore) LenFeeds() int64
- func (bs *BitcaskStore) LenSessions() int64
- func (bs *BitcaskStore) LenTokens() int64
- func (bs *BitcaskStore) LenUsers() int64
- func (bs *BitcaskStore) Merge() error
- func (bs *BitcaskStore) SearchFeeds(prefix string) []string
- func (bs *BitcaskStore) SearchUsers(prefix string) []string
- func (bs *BitcaskStore) SetFeed(name string, feed *Feed) error
- func (bs *BitcaskStore) SetSession(sid string, sess *session.Session) error
- func (bs *BitcaskStore) SetToken(signature string, tkn *Token) error
- func (bs *BitcaskStore) SetUser(username string, user *User) error
- func (bs *BitcaskStore) Sync() error
- func (bs *BitcaskStore) SyncSession(sess *session.Session) error
- type BlogPost
- func BlogPostFromFile(conf *Config, fn string) (*BlogPost, error)
- func BlogPostFromParams(conf *Config, p httprouter.Params) *BlogPost
- func NewBlogPost(author, title string) *BlogPost
- func WriteBlog(conf *Config, user *User, title, content string) (*BlogPost, error)
- func WriteBlogAs(conf *Config, feed string, title, content string) (*BlogPost, error)
- func (b *BlogPost) Bytes() []byte
- func (b *BlogPost) Content() string
- func (b *BlogPost) Created() time.Time
- func (b *BlogPost) Delete(conf *Config) error
- func (b *BlogPost) Draft() bool
- func (b *BlogPost) Filename(ext string) string
- func (b *BlogPost) Hash() string
- func (b *BlogPost) Load(conf *Config) error
- func (b *BlogPost) Modified() time.Time
- func (b *BlogPost) Publish()
- func (b *BlogPost) Published() time.Time
- func (b *BlogPost) Reset()
- func (b *BlogPost) Save(conf *Config) error
- func (b *BlogPost) String() string
- func (b *BlogPost) URL(baseURL string) string
- func (b *BlogPost) Write(p []byte) (int, error)
- func (b *BlogPost) WriteString(s string) (int, error)
- type BlogPosts
- type BlogsCache
- func (cache *BlogsCache) Add(blogPost *BlogPost)
- func (cache *BlogsCache) Count() int
- func (cache *BlogsCache) Delete(hash string)
- func (cache *BlogsCache) Get(hash string) (*BlogPost, bool)
- func (cache *BlogsCache) GetAll() BlogPosts
- func (cache *BlogsCache) Has(hash string) bool
- func (cache *BlogsCache) Store(path string) error
- func (cache *BlogsCache) UpdateBlogs(conf *Config)
- type Cache
- func (cache *Cache) Count() int
- func (cache *Cache) Delete(feeds types.Feeds)
- func (cache *Cache) FetchTwts(conf *Config, archive Archiver, feeds types.Feeds, ...)
- func (cache *Cache) GetAll() types.Twts
- func (cache *Cache) GetByPrefix(prefix string, refresh bool) types.Twts
- func (cache *Cache) GetByURL(url string) types.Twts
- func (cache *Cache) GetMentions(u *User) (twts types.Twts)
- func (cache *Cache) IsCached(url string) bool
- func (cache *Cache) Lookup(hash string) (types.Twt, bool)
- func (cache *Cache) Store(path string) error
- type Cached
- type Config
- func (c *Config) ExternalURL(nick, uri string) string
- func (c *Config) IsLocalURL(url string) bool
- func (c *Config) LocalURL() *url.URL
- func (c *Config) RandomTwtPrompt() string
- func (c *Config) Settings() *Settings
- func (c *Config) URLForTag(tag string) string
- func (c *Config) URLForUser(user string) string
- func (c *Config) UserURL(url string) string
- func (c *Config) Validate() error
- func (c *Config) WhitelistedDomain(domain string) (bool, bool)
- type Context
- type ContextKey
- type CreateAdminFeedsJob
- type CreateBotsJob
- type DeleteOldSessionsJob
- type DiskArchiver
- type Dispatcher
- type ErrAudioUploadFailed
- type ErrCommandFailed
- type ErrCommandKilled
- type ErrTranscodeFailed
- type ErrTranscodeTimeout
- type ErrVideoUploadFailed
- type Feed
- type FeedSource
- type FeedSourceMap
- type FeedSources
- type FrontMatter
- type FuncTask
- type ImageOptions
- type ImageTask
- type JobFactory
- type JobSpec
- type Message
- type Messages
- type MessagesCache
- type Meta
- type Middleware
- type NullArchiver
- type OldBlogsCache
- type OldCache
- type Option
- func WithAPISessionTime(duration time.Duration) Option
- func WithAPISigningKey(key string) Option
- func WithAdminEmail(adminEmail string) Option
- func WithAdminName(adminName string) Option
- func WithAdminUser(adminUser string) Option
- func WithBaseURL(baseURL string) Option
- func WithCookieSecret(secret string) Option
- func WithData(data string) Option
- func WithDebug(debug bool) Option
- func WithDescription(description string) Option
- func WithFeedSources(feedSources []string) Option
- func WithFetchInterval(fetchInterval string) Option
- func WithMagicLinkSecret(secret string) Option
- func WithMaxCacheItems(maxCacheItems int) Option
- func WithMaxCacheTTL(maxCacheTTL time.Duration) Option
- func WithMaxFetchLimit(limit int64) Option
- func WithMaxTwtLength(maxTwtLength int) Option
- func WithMaxUploadSize(maxUploadSize int64) Option
- func WithName(name string) Option
- func WithOpenProfiles(openProfiles bool) Option
- func WithOpenRegistrations(openRegistrations bool) Option
- func WithPOP3Bind(pop3Bind string) Option
- func WithParser(parser string) Option
- func WithSMTPBind(smtpBind string) Option
- func WithSMTPFrom(from string) Option
- func WithSMTPHost(host string) Option
- func WithSMTPPass(pass string) Option
- func WithSMTPPort(port int) Option
- func WithSMTPUser(user string) Option
- func WithSessionCacheTTL(cacheTTL time.Duration) Option
- func WithSessionExpiry(expiry time.Duration) Option
- func WithStore(store string) Option
- func WithTheme(theme string) Option
- func WithTranscoderTimeout(timeout time.Duration) Option
- func WithTwtsPerPage(twtsPerPage int) Option
- func WithWhitelistedDomains(whitelistedDomains []string) Option
- type POP3Service
- type PasswordResetEmailContext
- type RemoveEmailsJob
- type ReportAbuseEmailContext
- type Router
- func (r *Router) DELETE(path string, handle httprouter.Handle)
- func (r *Router) File(path, name string)
- func (r *Router) GET(path string, handle httprouter.Handle)
- func (r *Router) Group(path string, m ...Middleware) *Router
- func (r *Router) HEAD(path string, handle httprouter.Handle)
- func (r *Router) Handle(method, path string, handle httprouter.Handle)
- func (r *Router) Handler(method, path string, handler http.Handler)
- func (r *Router) HandlerFunc(method, path string, handler http.HandlerFunc)
- func (r *Router) OPTIONS(path string, handle httprouter.Handle)
- func (r *Router) PATCH(path string, handle httprouter.Handle)
- func (r *Router) POST(path string, handle httprouter.Handle)
- func (r *Router) PUT(path string, handle httprouter.Handle)
- func (r *Router) ServeFilesWithCacheControl(path string, root fs.FS)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Static(path, root string)
- func (r *Router) Use(m ...Middleware) *Router
- type SMTPService
- type Server
- func (s *Server) AddCronJob(spec string, job cron.Job) error
- func (s *Server) AddRoute(method, path string, handler http.Handler)
- func (s *Server) AddShutdownHook(f func())
- func (s *Server) AddUserHandler() httprouter.Handle
- func (s *Server) ArchiveFeedHandler() httprouter.Handle
- func (s *Server) AvatarHandler() httprouter.Handle
- func (s *Server) BookmarkHandler() httprouter.Handle
- func (s *Server) BookmarksHandler() httprouter.Handle
- func (s *Server) CaptchaHandler() httprouter.Handle
- func (s *Server) ConversationHandler() httprouter.Handle
- func (s *Server) CreateOrUpdateBlogHandler() httprouter.Handle
- func (s *Server) DelUserHandler() httprouter.Handle
- func (s *Server) DeleteAccountHandler() httprouter.Handle
- func (s *Server) DeleteAllHandler() httprouter.Handle
- func (s *Server) DeleteBlogHandler() httprouter.Handle
- func (s *Server) DeleteMessagesHandler() httprouter.Handle
- func (s *Server) DeleteTokenHandler() httprouter.Handle
- func (s *Server) DiscoverHandler() httprouter.Handle
- func (s *Server) EditBlogHandler() httprouter.Handle
- func (s *Server) ExternalAvatarHandler() httprouter.Handle
- func (s *Server) ExternalHandler() httprouter.Handle
- func (s *Server) FeedHandler() httprouter.Handle
- func (s *Server) FeedsHandler() httprouter.Handle
- func (s *Server) FollowHandler() httprouter.Handle
- func (s *Server) FollowersHandler() httprouter.Handle
- func (s *Server) FollowingHandler() httprouter.Handle
- func (s *Server) ImportHandler() httprouter.Handle
- func (s *Server) ListBlogsHandler() httprouter.Handle
- func (s *Server) ListMessagesHandler() httprouter.Handle
- func (s *Server) ListenAndServe() error
- func (s *Server) LoginHandler() httprouter.Handle
- func (s *Server) LogoutHandler() httprouter.Handle
- func (s *Server) LookupHandler() httprouter.Handle
- func (s *Server) ManageFeedHandler() httprouter.Handle
- func (s *Server) ManagePodHandler() httprouter.Handle
- func (s *Server) ManageUsersHandler() httprouter.Handle
- func (s *Server) MediaHandler() httprouter.Handle
- func (s *Server) MentionsHandler() httprouter.Handle
- func (s *Server) MuteHandler() httprouter.Handle
- func (s *Server) NewPasswordHandler() httprouter.Handle
- func (s *Server) NotFoundHandler(w http.ResponseWriter, r *http.Request)
- func (s *Server) OldAvatarHandler() httprouter.Handle
- func (s *Server) OldTwtxtHandler() httprouter.Handle
- func (s *Server) PageHandler(name string) httprouter.Handle
- func (s *Server) PermalinkHandler() httprouter.Handle
- func (s *Server) PodConfigHandler() httprouter.Handle
- func (s *Server) PostHandler() httprouter.Handle
- func (s *Server) ProfileHandler() httprouter.Handle
- func (s *Server) PublishBlogHandler() httprouter.Handle
- func (s *Server) RegisterHandler() httprouter.Handle
- func (s *Server) ReportHandler() httprouter.Handle
- func (s *Server) ResetPasswordHandler() httprouter.Handle
- func (s *Server) ResetPasswordMagicLinkHandler() httprouter.Handle
- func (s *Server) RobotsHandler() httprouter.Handle
- func (s *Server) RstUserHandler() httprouter.Handle
- func (s *Server) Run() (err error)
- func (s *Server) SearchHandler() httprouter.Handle
- func (s *Server) SendMessageHandler() httprouter.Handle
- func (s *Server) SettingsHandler() httprouter.Handle
- func (s *Server) Shutdown(ctx context.Context) error
- func (s *Server) SupportHandler() httprouter.Handle
- func (s *Server) SyndicationHandler() httprouter.Handle
- func (s *Server) TaskHandler() httprouter.Handle
- func (s *Server) TimelineHandler() httprouter.Handle
- func (s *Server) TransferFeedHandler() httprouter.Handle
- func (s *Server) TwtxtHandler() httprouter.Handle
- func (s *Server) UnfollowHandler() httprouter.Handle
- func (s *Server) UnmuteHandler() httprouter.Handle
- func (s *Server) UploadMediaHandler() httprouter.Handle
- func (s *Server) UserConfigHandler() httprouter.Handle
- func (s *Server) ViewBlogHandler() httprouter.Handle
- func (s *Server) ViewMessageHandler() httprouter.Handle
- func (s *Server) WebMentionHandler() httprouter.Handle
- func (s *Server) WhoFollowsHandler() httprouter.Handle
- type SessionStore
- func (s *SessionStore) Count() int
- func (s *SessionStore) DelSession(sid string) error
- func (s *SessionStore) GetAllSessions() ([]*session.Session, error)
- func (s *SessionStore) GetSession(sid string) (*session.Session, error)
- func (s *SessionStore) HasSession(sid string) bool
- func (s *SessionStore) SetSession(sid string, sess *session.Session) error
- func (s *SessionStore) SyncSession(sess *session.Session) error
- type Settings
- type StatsJob
- type Store
- type SupportRequestEmailContext
- type SyncStoreJob
- type TTLCache
- func (cache *TTLCache) Dec(k string) int
- func (cache *TTLCache) Get(k string) int
- func (cache *TTLCache) GetString(k string) string
- func (cache *TTLCache) Inc(k string) int
- func (cache *TTLCache) Reset(k string) int
- func (cache *TTLCache) Set(k string, v int) int
- func (cache *TTLCache) SetString(k string, v string) string
- type Task
- type TaskData
- type TaskResult
- type TaskState
- type TemplateManager
- type TimeVar
- type Token
- type Translator
- type TwtTextFormat
- type TwtxtUserAgent
- type URI
- type UpdateFeedSourcesJob
- type UpdateFeedsJob
- type User
- func (u *User) AddFollower(nick, url string)
- func (u *User) AddToken(token *Token)
- func (u *User) Bookmark(hash string)
- func (u *User) Bookmarked(hash string) bool
- func (u *User) Bytes() ([]byte, error)
- func (u *User) Filter(twts []types.Twt) (filtered []types.Twt)
- func (u *User) Follow(nick, url string)
- func (u *User) FollowAndValidate(conf *Config, nick, url string) error
- func (u *User) FollowedBy(url string) bool
- func (u *User) Follows(url string) bool
- func (u *User) HasMuted(url string) bool
- func (u *User) HasToken(token string) bool
- func (u *User) Is(url string) bool
- func (u *User) Mute(nick, url string)
- func (u *User) OwnsFeed(name string) bool
- func (u *User) Profile(baseURL string, viewer *User) types.Profile
- func (u *User) Reply(twt types.Twt) string
- func (u *User) Source() types.Feeds
- func (u *User) Sources() types.Feeds
- func (u *User) String() string
- func (u *User) Twter() types.Twter
- func (u *User) Unmute(nick string)
- type VideoOptions
- type VideoTask
- type Worker
Constants ¶
const ( MediaResolution = 720 // 720x576 AvatarResolution = 360 // 360x360 AsyncTaskLimit = 5 MaxFailedLogins = 3 // By default 3 failed login attempts per 5 minutes )
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 // DefaultParser is the default Twt parser used by the backend DefaultParser = "lextwt" // DefaultData is the default data directory for storage DefaultData = "./data" // DefaultStore is the default data store used for accounts, sessions, etc DefaultStore = "bitcask://twtxt.db" // DefaultBaseURL is the default Base URL for the app used to construct feed URLs DefaultBaseURL = "http://0.0.0.0:8000" // DefaultAdminXXX is the default admin user / pod operator DefaultAdminUser = "admin" DefaultAdminName = "Administrator" DefaultAdminEmail = "support@twt.social" // DefaultName is the default instance name DefaultName = "twtxt.net" // DefaultLogo is the default logo (SVG) // DefaultLogo = `<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" height="56px"><path fill="currentColor" d="M633.43 429.23c0 118.38-49.76 184.72-138.87 184.72-53 0-92.04-25.37-108.62-67.32h-2.6v203.12H250V249.7h133.67v64.72h2.28c17.24-43.9 55.3-69.92 107-69.92 90.4 0 140.48 66.02 140.48 184.73zm-136.6 0c0-49.76-22.1-81.96-56.9-81.96s-56.9 32.2-57.24 82.28c.33 50.4 22.1 81.63 57.24 81.63 35.12 0 56.9-31.87 56.9-81.95zM682.5 547.5c0-37.32 30.18-67.5 67.5-67.5s67.5 30.18 67.5 67.5S787.32 615 750 615s-67.5-30.18-67.5-67.5z"></path></svg>` DefaultLogo = `` /* 3718-byte string literal not displayed */ // DefaultMetaxxx are the default set of <meta> tags used on non-specific views DefaultMetaTitle = "" DefaultMetaAuthor = "twtxt.net / twt.social" DefaultMetaKeywords = "twtxt, twt, blog, micro-blogging, social, media, decentralised, pod" DefaultMetaDescription = "" /* 128-byte string literal not displayed */ // DefaultTheme is the default theme to use ('light' or 'dark') DefaultTheme = "auto" // DefaultLang is the default language to use ('en' or 'zh-cn') DefaultLang = "auto" // DefaultOpenRegistrations is the default for open user registrations DefaultOpenRegistrations = false // DefaultRegisterMessage is the default message displayed when registrations are disabled DefaultRegisterMessage = "" // 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 = 288 // DefaultMaxCacheTTL is the default maximum cache ttl of twts in memory DefaultMaxCacheTTL = time.Hour * 24 * 10 // 10 days 28 days 28 days 28 days // 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 // DefaultMsgPerPage is the server's default msgs per page to display DefaultMsgsPerPage = 20 // 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 = "smtp.gmail.com" DefaultSMTPPort = 587 DefaultSMTPUser = InvalidConfigValue DefaultSMTPPass = InvalidConfigValue DefaultSMTPFrom = InvalidConfigValue // DefaultMaxFetchLimit is the maximum fetch fetch limit in bytes DefaultMaxFetchLimit = 1 << 21 // ~2MB (or more than enough for a year) // 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 )
Variables ¶
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") )
var ( ErrTwtAlreadyArchived = errors.New("error: twt already archived") ErrTwtNotArchived = errors.New("error: twt not found in archived") ErrInvalidTwtHash = errors.New("error: invalid twt hash") )
var ( Jobs map[string]JobSpec StartupJobs map[string]JobSpec )
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") )
var ( // DefaultFeedSources is the default list of external feed sources DefaultFeedSources = []string{ "https://feeds.twtxt.net/we-are-feeds.txt", "https://raw.githubusercontent.com/jointwt/we-are-twtxt/master/we-are-bots.txt", "https://raw.githubusercontent.com/jointwt/we-are-twtxt/master/we-are-twtxt.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!`, } // DefaultWhitelistedDomains is the default list of domains to whitelist for external images DefaultWhitelistedDomains = []string{ `imgur\.com`, `giphy\.com`, `imgs\.xkcd\.com`, `tube\.mills\.io`, `reactiongifs\.com`, `githubusercontent\.com`, } )
var ( ErrInvalidStore = errors.New("error: invalid store") ErrUserNotFound = errors.New("error: user not found") ErrTokenNotFound = errors.New("error: token not found") ErrFeedNotFound = errors.New("error: feed not found") ErrInvalidSession = errors.New("error: invalid session") )
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") )
var (
ErrConfigPathMissing = errors.New("error: config file missing")
)
var (
ErrFeedImposter = errors.New("error: imposter detected, you do not own this feed")
)
var (
ErrInvalidBlogPath = errors.New("error: invalid blog path")
)
var (
ErrSendingEmail = errors.New("error: unable to send email")
)
Functions ¶
func AppendSpecial ¶
func CleanTwt ¶
CleanTwt cleans a twt's text, replacing new lines with spaces and stripping surrounding spaces.
func CreateFeed ¶
func DeleteLastTwt ¶
func DownloadImage ¶
func FeedExists ¶
func FileExists ¶
func FilterTwts ¶
FilterTwts filters out Twts from users/feeds that a User has chosen to mute
func FormatForDateTime ¶
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 ¶
FormatRequest generates ascii representation of a request
func FormatTwtFactory ¶
FormatTwtFactory formats a twt into a valid HTML snippet
func GenerateRandomToken ¶
func GenerateRandomToken() string
func GenerateToken ¶
func GetAllFeeds ¶
func GetExternalAvatar ¶
func GetMediaNamesFromText ¶
func HostnameFromURL ¶
func ImageToPng ¶
func IsAdminUserFactory ¶
IsAdminUserFactory returns a function that returns true if the user provided is the configured pod administrator, false otherwise.
func IsExternalFeedFactory ¶
func IsLocalURLFactory ¶
func NewCreateAdminFeedsJob ¶
func NewCreateBotsJob ¶
func NewDeleteOldSessionsJob ¶
func NewFeedLookup ¶
func NewFeedLookup(conf *Config, db Store, user *User) types.FeedLookup
func NewMboxHandler ¶
func NewMboxHandler(config *Config, db Store, pm passwords.Passwords, msgs *MessagesCache, tasks *Dispatcher) popart.Handler
func NewRemoveEmailsJob ¶
func NewStatsJob ¶
func NewSyncStoreJob ¶
func NewUpdateFeedSourcesJob ¶
func NewUpdateFeedsJob ¶
func NormalizeFeedName ¶
func NormalizeURL ¶
func NormalizeUsername ¶
func PreprocessMedia ¶
PreprocessMedia ...
func ProcessImage ¶
func RedirectRefererURL ¶
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 RenderPlainText ¶
RenderPlainText ...
func ReplaceExt ¶
func ResourceExists ¶
func SaveFeedSources ¶
func SaveFeedSources(feedsources *FeedSources, path string) error
func SendPasswordResetEmail ¶
func SendReportAbuseEmail ¶
func SendSupportRequestEmail ¶
func StoreUploadedImage ¶
func StringKeys ¶
func StringValues ¶
func TranscodeAudio ¶
func TranscodeVideo ¶
func URLForAvatar ¶
func URLForBlogFactory ¶
func URLForBlogFactory(conf *Config, blogs *BlogsCache) func(twt types.Twt) string
func URLForBlogs ¶
func URLForConvFactory ¶
func URLForExternalAvatar ¶
func URLForExternalProfile ¶
func URLForPage ¶
func URLForTask ¶
func URLForUser ¶
func URLForWhoFollows ¶
func UniqStrings ¶
func UnparseTwtFactory ¶
UnparseTwtFactory is the opposite of CleanTwt and ExpandMentions/ExpandTags
func ValidateFeed ¶
func ValidateFeedName ¶
func ValidateUsername ¶
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 ¶
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 passwords.Passwords, tasks *Dispatcher) *API
NewAPI ...
func (*API) ConversationEndpoint ¶
func (a *API) ConversationEndpoint() httprouter.Handle
ConversationEndpoint ...
func (*API) CreateToken ¶
CreateToken ...
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) MentionsEndpoint ¶
func (a *API) MentionsEndpoint() httprouter.Handle
MentionsEndpoint ...
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) PodConfigEndpoint ¶
func (a *API) PodConfigEndpoint() httprouter.Handle
PodConfigEndpoint ...
func (*API) RegisterEndpoint ¶
func (a *API) RegisterEndpoint() httprouter.Handle
RegisterEndpoint ...
func (*API) SettingsEndpoint ¶
func (a *API) SettingsEndpoint() httprouter.Handle
SettingsEndpoint ...
func (*API) TimelineEndpoint ¶
func (a *API) TimelineEndpoint() httprouter.Handle
TimelineEndpoint ...
func (*API) UnfollowEndpoint ¶
func (a *API) UnfollowEndpoint() httprouter.Handle
UnfollowEndpoint ...
func (*API) UploadMediaEndpoint ¶
func (a *API) UploadMediaEndpoint() httprouter.Handle
UploadMediaHandler ...
type Archiver ¶
type Archiver interface {
Del(hash string) error
Has(hash string) bool
Get(hash string) (types.Twt, error)
Archive(twt types.Twt) error
Count() (int, error)
}
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 NewNullArchiver ¶
type AudioOptions ¶
type AudioTask ¶
type AudioTask struct {
*BaseTask
// contains filtered or unexported fields
}
func NewAudioTask ¶
type BaseTask ¶
type BaseTask struct {
// contains filtered or unexported fields
}
func NewBaseTask ¶
func NewBaseTask() *BaseTask
func (*BaseTask) Result ¶
func (t *BaseTask) Result() TaskResult
type BitcaskStore ¶
type BitcaskStore struct {
// contains filtered or unexported fields
}
BitcaskStore ...
func (*BitcaskStore) DelFeed ¶
func (bs *BitcaskStore) DelFeed(name string) error
func (*BitcaskStore) DelSession ¶
func (bs *BitcaskStore) DelSession(sid string) error
func (*BitcaskStore) DelToken ¶
func (bs *BitcaskStore) DelToken(signature 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() ([]*session.Session, error)
func (*BitcaskStore) GetAllUsers ¶
func (bs *BitcaskStore) GetAllUsers() ([]*User, error)
func (*BitcaskStore) GetSession ¶
func (bs *BitcaskStore) GetSession(sid string) (*session.Session, error)
func (*BitcaskStore) GetUserTokens ¶
func (bs *BitcaskStore) GetUserTokens(user *User) ([]*Token, 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) LenTokens ¶
func (bs *BitcaskStore) LenTokens() int64
func (*BitcaskStore) LenUsers ¶
func (bs *BitcaskStore) LenUsers() int64
func (*BitcaskStore) SearchFeeds ¶
func (bs *BitcaskStore) SearchFeeds(prefix string) []string
func (*BitcaskStore) SearchUsers ¶
func (bs *BitcaskStore) SearchUsers(prefix string) []string
func (*BitcaskStore) SetSession ¶
func (bs *BitcaskStore) SetSession(sid string, sess *session.Session) error
func (*BitcaskStore) SetToken ¶
func (bs *BitcaskStore) SetToken(signature string, tkn *Token) error
func (*BitcaskStore) SyncSession ¶
func (bs *BitcaskStore) SyncSession(sess *session.Session) error
type BlogPost ¶
type BlogPost struct {
Author string `json:"author"`
Year int `json:"year"`
Month int `json:"month"`
Date int `json:"date"`
Slug string `json:"slub"`
Title string `json:"title"`
PublishedAt time.Time `json:"published_at"`
// contains filtered or unexported fields
}
func BlogPostFromParams ¶
func BlogPostFromParams(conf *Config, p httprouter.Params) *BlogPost
func NewBlogPost ¶
func WriteBlogAs ¶
type BlogsCache ¶
BlogsCache ...
type Cache ¶
Cache ...
func (*Cache) FetchTwts ¶
func (cache *Cache) FetchTwts(conf *Config, archive Archiver, feeds types.Feeds, publicFollowers map[types.Feed][]string)
FetchTwts ...
func (*Cache) GetByPrefix ¶
GetByPrefix ...
func (*Cache) GetMentions ¶
GetMentions ...
type Cached ¶
type Cached struct {
Twts types.Twts
Lastmodified string
// contains filtered or unexported fields
}
Cached ...
type Config ¶
type Config struct {
Debug bool
Parser string
Data string
Name string
Logo string
Description string
Store string
Theme string
Lang string
BaseURL string
AdminUser string
AdminName string
AdminEmail string
FeedSources []string
RegisterMessage string
CookieSecret string
TwtPrompts []string
TwtsPerPage int
MaxUploadSize int64
MaxTwtLength int
MaxCacheTTL time.Duration
FetchInterval string
MaxCacheItems int
MsgsPerPage int
OpenProfiles bool
OpenRegistrations bool
SessionExpiry time.Duration
SessionCacheTTL time.Duration
TranscoderTimeout time.Duration
MagicLinkSecret string
SMTPBind string
POP3Bind string
SMTPHost string
SMTPPort int
SMTPUser string
SMTPPass string
SMTPFrom string
MaxFetchLimit int64
APISessionTime time.Duration
APISigningKey string
WhitelistedDomains []string
// contains filtered or unexported fields
}
Config contains the server configuration parameters
func (*Config) ExternalURL ¶
func (*Config) IsLocalURL ¶
func (*Config) RandomTwtPrompt ¶
RandomTwtPrompt returns a random Twt Prompt for display by the UI
func (*Config) Settings ¶
Settings returns a `Settings` struct containing pod settings that can then be persisted to disk to override some configuration options.
func (*Config) URLForUser ¶
type Context ¶
type Context struct {
Config string
Debug bool
Logo template.HTML
BaseURL string
InstanceName string
SoftwareVersion string
TwtsPerPage int
TwtPrompt string
MaxTwtLength int
RegisterDisabled bool
OpenProfiles bool
RegisterDisabledMessage string
Timezones []*timezones.Zoneinfo
Reply string
Username string
User *User
Tokens []*Token
LastTwt types.Twt
Profile types.Profile
Authenticated bool
IsAdmin bool
Error bool
Message string
Lang string // language
AcceptLangs string // accept languages
Theme string
Commit string
Page string
Content template.HTML
Title string
Meta Meta
Links types.Links
Alternatives types.Alternatives
Messages Messages
NewMessages int
Twter types.Twter
Twts types.Twts
BlogPost *BlogPost
BlogPosts BlogPosts
Feeds []*Feed
FeedSources FeedSourceMap
Pager *paginator.Paginator
// Report abuse
ReportNick string
ReportURL string
// Reset Password Token
PasswordResetToken string
// CSRF Token
CSRFToken string
}
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()
type CreateBotsJob ¶
type CreateBotsJob struct {
// contains filtered or unexported fields
}
func (*CreateBotsJob) Run ¶
func (job *CreateBotsJob) Run()
type DeleteOldSessionsJob ¶
type DeleteOldSessionsJob struct {
// contains filtered or unexported fields
}
func (*DeleteOldSessionsJob) Run ¶
func (job *DeleteOldSessionsJob) Run()
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) Count ¶
func (a *DiskArchiver) Count() (int, error)
func (*DiskArchiver) Del ¶
func (a *DiskArchiver) Del(hash string) error
func (*DiskArchiver) Has ¶
func (a *DiskArchiver) Has(hash string) bool
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher maintains a pool for available workers and a task queue that workers will process
func NewDispatcher ¶
func NewDispatcher(maxWorkers int, maxQueue int) *Dispatcher
NewDispatcher creates a new dispatcher with the given number of workers and buffers the task queue based on maxQueue. It also initializes the channels for the worker pool and task queue
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(task Task) (string, error)
Dispatch pushes the given task into the task queue. The first available worker will perform the task
func (*Dispatcher) DispatchFunc ¶
func (d *Dispatcher) DispatchFunc(f func() error) (string, error)
DispatchFunc pushes the given func into the task queue by first wrapping it with a `TaskFunc` task.
func (*Dispatcher) Lookup ¶
func (d *Dispatcher) Lookup(id string) (Task, bool)
Lookup returns the matching `Task` given its id
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start()
Start creates and starts workers, adding them to the worker pool. Then, it starts a select loop to wait for tasks to be dispatched to available workers
func (*Dispatcher) Stop ¶
func (d *Dispatcher) Stop()
Stop ends execution for all workers and closes all channels, then removes all workers
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 ¶
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 ¶
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 Feed ¶
type Feed struct {
Name string
Description string
URL string
CreatedAt time.Time
Followers map[string]string `default:"{}"`
// contains filtered or unexported fields
}
Feed ...
func (*Feed) AddFollower ¶
func (*Feed) FollowedBy ¶
type FeedSource ¶
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 FrontMatter ¶
type FrontMatter struct {
Title string
}
type FuncTask ¶
type FuncTask struct {
*BaseTask
// contains filtered or unexported fields
}
func NewFuncTask ¶
type ImageOptions ¶
type ImageTask ¶
type ImageTask struct {
*BaseTask
// contains filtered or unexported fields
}
func NewImageTask ¶
type JobFactory ¶
type JobSpec ¶
type JobSpec struct {
Schedule string
Factory JobFactory
}
JobSpec ...
func NewJobSpec ¶
func NewJobSpec(schedule string, factory JobFactory) JobSpec
type Message ¶
type MessagesCache ¶
type MessagesCache struct {
MessageCounts map[string]int
// contains filtered or unexported fields
}
MessagesCache ...
func LoadMessagesCache ¶
func LoadMessagesCache(path string) (*MessagesCache, error)
LoadMessagesCache ...
type NullArchiver ¶
type NullArchiver struct{}
NullArchiver implements Archiver using dummy implementation stubs
func (*NullArchiver) Count ¶
func (a *NullArchiver) Count() (int, error)
func (*NullArchiver) Del ¶
func (a *NullArchiver) Del(hash string) error
func (*NullArchiver) Has ¶
func (a *NullArchiver) Has(hash string) bool
type Option ¶
Option is a function that takes a config struct and modifies it
func WithAPISessionTime ¶
WithAPISessionTime sets the API session time for tokens
func WithAPISigningKey ¶
WithAPISigningKey sets the API JWT signing key for tokens
func WithAdminEmail ¶
WithAdminEmail sets the Admin email used to contact the pod operator
func WithAdminName ¶
WithAdminName sets the Admin name used to identify the pod operator
func WithAdminUser ¶
WithAdminUser sets the Admin user used for granting special features to
func WithBaseURL ¶
WithBaseURL sets the Base URL used for constructing feed URLs
func WithCookieSecret ¶
WithCookieSecret sets the server's cookie secret
func WithDescription ¶
WithDescription sets the instance's description
func WithFeedSources ¶
WithFeedSources sets the feed sources to use for external feeds
func WithFetchInterval ¶
WithFetchInterval sets the cache fetch interval Uses a cron syntax. See: github.com/robfig/cron
func WithMagicLinkSecret ¶
WithMagicLinkSecret sets the MagicLinkSecert used to create password reset tokens
func WithMaxCacheItems ¶
WithMaxCacheItems sets the maximum cache items (per feed source) of twts in memory
func WithMaxCacheTTL ¶
WithMaxCacheTTL sets the maximum cache ttl of twts in memory
func WithMaxFetchLimit ¶
WithMaxFetchLimit sets the maximum feed fetch limit in bytes
func WithMaxTwtLength ¶
WithMaxTwtLength sets the maximum length of posts permitted on the server
func WithMaxUploadSize ¶
WithMaxUploadSize sets the maximum upload size permitted by the server
func WithOpenProfiles ¶
WithOpenProfiles sets whether or not to have open user profiles
func WithOpenRegistrations ¶
WithOpenRegistrations sets the open registrations flag
func WithPOP3Bind ¶
WithPOP3Bind sets the interface and port to use for POP3
func WithParser ¶
WithParser sets the parser used by the backend
func WithSMTPBind ¶
WithSMTPBind sets the interface and port to bind to for SMTP
func WithSMTPFrom ¶
WithSMTPFrom sets the SMTPFrom address to use for sending email
func WithSMTPHost ¶
WithSMTPHost sets the SMTPHost to use for sending email
func WithSMTPPass ¶
WithSMTPPass sets the SMTPPass to use for sending email
func WithSMTPPort ¶
WithSMTPPort sets the SMTPPort to use for sending email
func WithSMTPUser ¶
WithSMTPUser sets the SMTPUser to use for sending email
func WithSessionCacheTTL ¶
WithSessionCacheTTL sets the server's session cache ttl
func WithSessionExpiry ¶
WithSessionExpiry sets the server's session expiry time
func WithTranscoderTimeout ¶
WithTranscoderTimeout sets the video transcoding timeout
func WithTwtsPerPage ¶
WithTwtsPerPage sets the server's twts per page
func WithWhitelistedDomains ¶
WithWhitelistedDomains sets the list of domains whitelisted and permitted for external iamges
type POP3Service ¶
type POP3Service struct {
// contains filtered or unexported fields
}
func NewPOP3Service ¶
func NewPOP3Service(config *Config, db Store, pm passwords.Passwords, msgs *MessagesCache, tasks *Dispatcher) *POP3Service
NewPOP3Service ...
func (*POP3Service) ListenAndServe ¶
func (s *POP3Service) ListenAndServe() error
func (*POP3Service) Start ¶
func (s *POP3Service) Start()
func (*POP3Service) Stop ¶
func (s *POP3Service) Stop()
type RemoveEmailsJob ¶
type RemoveEmailsJob struct {
// contains filtered or unexported fields
}
func (*RemoveEmailsJob) Run ¶
func (job *RemoveEmailsJob) Run()
type ReportAbuseEmailContext ¶
type Router ¶
type Router struct {
httprouter.Router
// contains filtered or unexported fields
}
Router ...
func (*Router) DELETE ¶
func (r *Router) DELETE(path string, handle httprouter.Handle)
DELETE is a shortcut for Router.Handle("DELETE", path, handle)
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) 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) ServeFilesWithCacheControl ¶
ServeFilesWithCacheControl ...
func (*Router) Use ¶
func (r *Router) Use(m ...Middleware) *Router
Use appends new middleware to current Router.
type SMTPService ¶
type SMTPService struct {
// contains filtered or unexported fields
}
func NewSMTPService ¶
func NewSMTPService(config *Config, db Store, pm passwords.Passwords, msgs *MessagesCache, tasks *Dispatcher) *SMTPService
NewSMTPService ...
func (*SMTPService) ListenAndServe ¶
func (s *SMTPService) ListenAndServe() error
func (*SMTPService) Start ¶
func (s *SMTPService) Start()
func (*SMTPService) Stop ¶
func (s *SMTPService) Stop()
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server ...
func (*Server) AddCronJob ¶
AddCronJob ...
func (*Server) AddUserHandler ¶
func (s *Server) AddUserHandler() httprouter.Handle
AddUserHandler ...
func (*Server) ArchiveFeedHandler ¶
func (s *Server) ArchiveFeedHandler() httprouter.Handle
ArchiveFeedHandler...
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) CreateOrUpdateBlogHandler ¶
func (s *Server) CreateOrUpdateBlogHandler() httprouter.Handle
CreateorUpdateBlogHandler ...
func (*Server) DelUserHandler ¶
func (s *Server) DelUserHandler() httprouter.Handle
DelUserHandler ...
func (*Server) DeleteAccountHandler ¶
func (s *Server) DeleteAccountHandler() httprouter.Handle
DeleteAccountHandler ...
func (*Server) DeleteAllHandler ¶
func (s *Server) DeleteAllHandler() httprouter.Handle
DeleteAllHandler ...
func (*Server) DeleteBlogHandler ¶
func (s *Server) DeleteBlogHandler() httprouter.Handle
DeleteBlogHandler ...
func (*Server) DeleteMessagesHandler ¶
func (s *Server) DeleteMessagesHandler() httprouter.Handle
DeleteMessagesHandler ...
func (*Server) DeleteTokenHandler ¶
func (s *Server) DeleteTokenHandler() httprouter.Handle
DeleteTokenHandler ...
func (*Server) DiscoverHandler ¶
func (s *Server) DiscoverHandler() httprouter.Handle
DiscoverHandler ...
func (*Server) EditBlogHandler ¶
func (s *Server) EditBlogHandler() httprouter.Handle
EditBlogHandler ...
func (*Server) ExternalAvatarHandler ¶
func (s *Server) ExternalAvatarHandler() httprouter.Handle
ExternalAvatarHandler ...
func (*Server) ExternalHandler ¶
func (s *Server) ExternalHandler() httprouter.Handle
ExternalHandler ...
func (*Server) FollowersHandler ¶
func (s *Server) FollowersHandler() httprouter.Handle
FollowersHandler ...
func (*Server) FollowingHandler ¶
func (s *Server) FollowingHandler() httprouter.Handle
FollowingHandler ...
func (*Server) ListBlogsHandler ¶
func (s *Server) ListBlogsHandler() httprouter.Handle
ListBlogsHandler ...
func (*Server) ListMessagesHandler ¶
func (s *Server) ListMessagesHandler() httprouter.Handle
ListMessagesHandler ...
func (*Server) ManageFeedHandler ¶
func (s *Server) ManageFeedHandler() httprouter.Handle
ManageFeedHandler...
func (*Server) ManagePodHandler ¶
func (s *Server) ManagePodHandler() httprouter.Handle
ManagePodHandler ...
func (*Server) ManageUsersHandler ¶
func (s *Server) ManageUsersHandler() httprouter.Handle
ManageUsersHandler ...
func (*Server) MentionsHandler ¶
func (s *Server) MentionsHandler() httprouter.Handle
MentionsHandler ...
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) OldAvatarHandler ¶
func (s *Server) OldAvatarHandler() httprouter.Handle
OldAvatarHandler ... Redirect old URIs (twtxt <= v0.1.0) of the form /user/<nick>/avatar.png -> /user/<nick>/avatar TODO: Remove this after v1
func (*Server) OldTwtxtHandler ¶
func (s *Server) OldTwtxtHandler() httprouter.Handle
OldTwtxtHandler ... Redirect old URIs (twtxt <= v0.0.8) of the form /u/<nick> -> /user/<nick>/twtxt.txt TODO: Remove this after v1
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) ProfileHandler ¶
func (s *Server) ProfileHandler() httprouter.Handle
ProfileHandler ...
func (*Server) PublishBlogHandler ¶
func (s *Server) PublishBlogHandler() httprouter.Handle
PublishBlogHandler ...
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler() httprouter.Handle
RegisterHandler ...
func (*Server) ResetPasswordHandler ¶
func (s *Server) ResetPasswordHandler() httprouter.Handle
ResetPasswordHandler ...
func (*Server) ResetPasswordMagicLinkHandler ¶
func (s *Server) ResetPasswordMagicLinkHandler() httprouter.Handle
ResetPasswordMagicLinkHandler ...
func (*Server) RstUserHandler ¶
func (s *Server) RstUserHandler() httprouter.Handle
RstUserHandler ...
func (*Server) SendMessageHandler ¶
func (s *Server) SendMessageHandler() httprouter.Handle
SendMessagesHandler ...
func (*Server) SettingsHandler ¶
func (s *Server) SettingsHandler() httprouter.Handle
SettingsHandler ...
func (*Server) SupportHandler ¶
func (s *Server) SupportHandler() httprouter.Handle
SupportHandler ...
func (*Server) SyndicationHandler ¶
func (s *Server) SyndicationHandler() httprouter.Handle
SyndicationHandler ...
func (*Server) TimelineHandler ¶
func (s *Server) TimelineHandler() httprouter.Handle
TimelineHandler ...
func (*Server) TransferFeedHandler ¶
func (s *Server) TransferFeedHandler() httprouter.Handle
TransferFeedHandler...
func (*Server) UnfollowHandler ¶
func (s *Server) UnfollowHandler() httprouter.Handle
UnfollowHandler ...
func (*Server) UploadMediaHandler ¶
func (s *Server) UploadMediaHandler() httprouter.Handle
UploadMediaHandler ...
func (*Server) UserConfigHandler ¶
func (s *Server) UserConfigHandler() httprouter.Handle
UserConfigHandler ...
func (*Server) ViewBlogHandler ¶
func (s *Server) ViewBlogHandler() httprouter.Handle
ViewBlogHandler ...
func (*Server) ViewMessageHandler ¶
func (s *Server) ViewMessageHandler() httprouter.Handle
ViewMessageHandler ...
func (*Server) WebMentionHandler ¶
func (s *Server) WebMentionHandler() httprouter.Handle
WebMentionHandler ...
func (*Server) WhoFollowsHandler ¶
func (s *Server) WhoFollowsHandler() httprouter.Handle
WhoFollowsHandler ...
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore ...
func NewSessionStore ¶
func NewSessionStore(store Store, sessionCacheTTL time.Duration) *SessionStore
func (*SessionStore) Count ¶
func (s *SessionStore) Count() int
func (*SessionStore) DelSession ¶
func (s *SessionStore) DelSession(sid string) error
func (*SessionStore) GetAllSessions ¶
func (s *SessionStore) GetAllSessions() ([]*session.Session, error)
func (*SessionStore) GetSession ¶
func (s *SessionStore) GetSession(sid string) (*session.Session, error)
func (*SessionStore) HasSession ¶
func (s *SessionStore) HasSession(sid string) bool
func (*SessionStore) SetSession ¶
func (s *SessionStore) SetSession(sid string, sess *session.Session) error
func (*SessionStore) SyncSession ¶
func (s *SessionStore) SyncSession(sess *session.Session) error
type Settings ¶
type Settings struct {
Name string `yaml:"pod_name"`
Logo string `yaml:"pod_logo"`
Description string `yaml:"pod_description"`
MaxTwtLength int `yaml:"max_twt_length"`
OpenProfiles bool `yaml:"open_profiles"`
OpenRegistrations bool `yaml:"open_registrations"`
}
Settings contains Pod Settings that can be customised via the Web UI
func LoadSettings ¶
LoadSettings loads pod settings from the given path
type Store ¶
type Store interface {
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) (*session.Session, error)
SetSession(sid string, sess *session.Session) error
HasSession(sid string) bool
DelSession(sid string) error
SyncSession(sess *session.Session) error
LenSessions() int64
GetAllSessions() ([]*session.Session, error)
GetUserTokens(user *User) ([]*Token, error)
SetToken(signature string, token *Token) error
DelToken(signature string) error
LenTokens() int64
}
type SyncStoreJob ¶
type SyncStoreJob struct {
// contains filtered or unexported fields
}
func (*SyncStoreJob) Run ¶
func (job *SyncStoreJob) Run()
type TTLCache ¶
func NewTTLCache ¶
type Task ¶
type Task interface {
fmt.Stringer
ID() string
State() TaskState
Result() TaskResult
Error() error
Run() error
}
Task is an interface that represents a single task to be executed by a worker. Any object can implement a `Task` if it implements the interface.
type TaskResult ¶
type TemplateManager ¶
func NewTemplateManager ¶
func NewTemplateManager(conf *Config, translator *Translator, blogs *BlogsCache, cache *Cache, archive Archiver) (*TemplateManager, error)
func (*TemplateManager) Add ¶
func (m *TemplateManager) Add(name string, template *template.Template)
func (*TemplateManager) LoadTemplates ¶
func (m *TemplateManager) LoadTemplates() error
type Token ¶
type Token struct {
Signature string
Value string
UserAgent string
CreatedAt time.Time
ExpiresAt time.Time
}
Token ...
type Translator ¶
func NewTranslator ¶
func NewTranslator() (*Translator, error)
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 ¶
func DetectFollowerFromUserAgent ¶
func DetectFollowerFromUserAgent(ua string) (*TwtxtUserAgent, error)
func (TwtxtUserAgent) IsPublicURL ¶
func (ua TwtxtUserAgent) IsPublicURL() bool
type UpdateFeedSourcesJob ¶
type UpdateFeedSourcesJob struct {
// contains filtered or unexported fields
}
func (*UpdateFeedSourcesJob) Run ¶
func (job *UpdateFeedSourcesJob) Run()
type UpdateFeedsJob ¶
type UpdateFeedsJob struct {
// contains filtered or unexported fields
}
func (*UpdateFeedsJob) Run ¶
func (job *UpdateFeedsJob) Run()
type User ¶
type User struct {
Username string
Password string
Tagline string
Email string // DEPRECATED: In favor of storing a Hashed Email
URL string
CreatedAt time.Time
Theme string `default:"auto"`
Lang string `default:""`
Recovery string `default:"auto"`
DisplayDatesInTimezone string `default:"UTC"`
IsFollowersPubliclyVisible bool `default:"true"`
IsFollowingPubliclyVisible bool `default:"true"`
IsBookmarksPubliclyVisible bool `default:"true"`
Feeds []string `default:"[]"`
Tokens []string `default:"[]"`
SMTPToken string `default:""`
POP3Token string `default:""`
Bookmarks map[string]string `default:"{}"`
Followers map[string]string `default:"{}"`
Following map[string]string `default:"{}"`
Muted map[string]string `default:"{}"`
// contains filtered or unexported fields
}
User ...
func (*User) AddFollower ¶
func (*User) Bookmarked ¶
func (*User) FollowAndValidate ¶
func (*User) FollowedBy ¶
type VideoOptions ¶
type VideoTask ¶
type VideoTask struct {
*BaseTask
// contains filtered or unexported fields
}
func NewVideoTask ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker attaches to a provided worker pool, and looks for tasks on its task channel
func NewWorker ¶
NewWorker creates a new worker using the given id and attaches to the provided worker pool. It also initializes the task/quit channels
Source Files
¶
- api.go
- archive.go
- audio_task.go
- base_task.go
- bitcask_store.go
- blog.go
- blog_handlers.go
- blogs_cache.go
- bookmark_handlers.go
- cache.go
- config.go
- context.go
- conversation_handler.go
- dispatcher.go
- email.go
- errors.go
- feedsources.go
- follow_handlers.go
- func_task.go
- handlers.go
- image_task.go
- init.go
- jobs.go
- manage_handlers.go
- media_handlers.go
- messages.go
- messages_cache.go
- messages_handler.go
- models.go
- mute_handlers.go
- options.go
- robots.go
- router.go
- server.go
- services.go
- session_store.go
- stats.go
- store.go
- support_handlers.go
- task.go
- templates.go
- tokencache.go
- translator.go
- ttlcache.go
- twt.go
- twtxt_handlers.go
- utils.go
- video_task.go
- whofollows_handler.go
- worker.go