Documentation ¶
Index ¶
- Constants
- Variables
- func AccountBlocks(by, b *Account) bool
- func AccountFollows(a, by *Account) bool
- func AccountIgnores(by, b *Account) bool
- func AccountIsBlocked(by, a *Account) bool
- func AccountIsFollowed(a, by *Account) bool
- func AccountIsIgnored(by, a *Account) bool
- func AccountIsRejected(by, a *Account) bool
- func AccountIsReported(by, a *Account) bool
- func AccountListingModelMw(next http.Handler) http.Handler
- func AccountLocalLink(a *Account) string
- func AccountPermaLink(a *Account) string
- func ActivityPubService(c appConfig) (*repository, error)
- func ActorsFiltersMw(next http.Handler) http.Handler
- func AddModelMw(next http.Handler) http.Handler
- func AllFilters(next http.Handler) http.Handler
- func Authors(d *deps)
- func BlockAccountModelMw(next http.Handler) http.Handler
- func BlockContentModelMw(next http.Handler) http.Handler
- func BlueMondayPolicy() *bluemonday.Policy
- func BuildID(r Renderable) (vocab.ID, bool)
- func BuildIDFromItem(i Item) (vocab.ID, bool)
- func ConnectFedBOX(h *handler, c appConfig) error
- func Contains[T Renderable](sl []T, it T) bool
- func ContentModelMw(next http.Handler) http.Handler
- func ContextContentModel(ctx context.Context) *contentModel
- func ContextDependentLoads(ctx context.Context) *deps
- func ContextListingModel(ctx context.Context) *listingModel
- func ContextModerationModel(ctx context.Context) *moderationModel
- func ContextRegisterModel(ctx context.Context) *registerModel
- func ContextRepository(ctx context.Context) *repository
- func CurrentTab(r *http.Request) func(h headerEl) bool
- func DefaultFilters(next http.Handler) http.Handler
- func Deps(depsSetFn ...func(*deps)) func(next http.Handler) http.Handler
- func DomainFiltersMw(next http.Handler) http.Handler
- func EditContentModelMw(next http.Handler) http.Handler
- func FederatedFiltersMw(id vocab.IRI) func(next http.Handler) http.Handler
- func FollowFilterMw(next http.Handler) http.Handler
- func FollowedFiltersMw(next http.Handler) http.Handler
- func Follows(d *deps)
- func FromActor(a *Account, p *vocab.Actor) error
- func FromArticle(i *Item, a *vocab.Object) error
- func FromMention(t *Tag, a *vocab.Mention) error
- func FromObject(a *Account, o *vocab.Object) error
- func FromObjectWithBinaryData(i *Item, a *vocab.Object) error
- func FromTag(t *Tag, a *vocab.Object) error
- func GetID(a Renderable) vocab.ID
- func GetInviteLink(v *view) func(invitee *Account) template.HTMLAttr
- func Hacker(votes int64, date time.Duration) float64
- func HostIsLocal(s string) bool
- func InOutbox(a *Account, it ...vocab.Item) bool
- func ItemIsReported(by *Account, i *Item) bool
- func ItemLocalLink(i *Item) string
- func ItemPermaLink(i *Item) string
- func ListingModelMw(next http.Handler) http.Handler
- func LoadFromSearches(ctx context.Context, repo *repository, loads RemoteLoads, fn searchFn) error
- func LoadInvitedMw(next http.Handler) http.Handler
- func LoadMw(next http.Handler) http.Handler
- func LoadSingleItemMw(next http.Handler) http.Handler
- func LoadSingleObjectMw(next http.Handler) http.Handler
- func Markdown(data string) template.HTML
- func MessageFiltersMw(next http.Handler) http.Handler
- func MessageUserContentModelMw(next http.Handler) http.Handler
- func ModerationFiltersMw(next http.Handler) http.Handler
- func ModerationListingFiltersMw(next http.Handler) http.Handler
- func Moderations(d *deps)
- func NewClient(o ...OptionFn) (*fedbox, error)
- func NodeInfoConfig() nodeinfo.Config
- func OperatorSearches(next http.Handler) http.Handler
- func OutOfOrderMw(v *view) func(next http.Handler) http.Handler
- func PermaLink(r Renderable) string
- func Reddit(ups, downs int64, date time.Duration) float64
- func Replies(d *deps)
- func ReportAccountModelMw(next http.Handler) http.Handler
- func ReportContentModelMw(next http.Handler) http.Handler
- func SearchInCollectionsMw(getActorsFn func(r *http.Request) vocab.ItemCollection, collections ...LoadFn) func(next http.Handler) http.Handler
- func SelfFiltersMw(id vocab.IRI) func(next http.Handler) http.Handler
- func ShowAccountHandle(a *Account) string
- func SignByAppMw(next http.Handler) http.Handler
- func SingleItemModelMw(next http.Handler) http.Handler
- func SortByDate(next http.Handler) http.Handler
- func SortByRecentActivity(next http.Handler) http.Handler
- func SortByScore(next http.Handler) http.Handler
- func TagFiltersMw(next http.Handler) http.Handler
- func ToTitle(s string) string
- func Values(f interface{}) client.FilterFn
- func ViewInit(c appConfig, l log.Logger) (*view, error)
- func Votes(d *deps)
- func WarmupCaches(r *repository, self vocab.Item) error
- func Wilson(ups, downs int64) float64
- type Account
- func (a *Account) AP() vocab.Item
- func (a *Account) Children() *RenderableList
- func (a Account) Date() time.Time
- func (a *Account) Deleted() bool
- func (a *Account) FromActivityPub(it vocab.Item) error
- func (a Account) GetLink() string
- func (a *Account) HasIcon() bool
- func (a *Account) HasMetadata() bool
- func (a *Account) HasPublicKey() bool
- func (a *Account) ID() Hash
- func (a *Account) IsApplication() bool
- func (a *Account) IsFederated() bool
- func (a *Account) IsGroup() bool
- func (a *Account) IsLocal() bool
- func (a *Account) IsLogged() bool
- func (a *Account) IsModerator() bool
- func (a *Account) IsOperator() bool
- func (a *Account) IsService() bool
- func (a *Account) IsValid() bool
- func (a *Account) Private() bool
- func (a Account) Type() RenderType
- func (a Account) VotedOn(i Item) *Vote
- func (a Account) Votes() VoteCollection
- type AccountCollection
- type AccountMetadata
- type AccountPtrCollection
- type ActivityMetadata
- type Application
- type Cacheable
- type CollectionFilterFn
- type CollectionFn
- type CollectionLoadFn
- type CompStr
- type CompStrs
- func AccountsIRIFilter(accounts ...Account) CompStrs
- func ActivityTypesFilter(t ...vocab.ActivityVocabularyType) CompStrs
- func IRIsFilter(iris ...vocab.IRI) CompStrs
- func IRIsLikeFilter(iris ...vocab.IRI) CompStrs
- func ItemIRIFilter(items ...Item) CompStrs
- func ModerationSubmittedByHashFilter(items ...ModerationOp) CompStrs
- type Converter
- type CtxLogFn
- type CtxtKey
- type Cursor
- type Deletable
- type Desc
- type ErrorHandler
- type ErrorHandlerFn
- type FedInstance
- type Filters
- type FlagBits
- type FollowRequest
- func (f *FollowRequest) AP() vocab.Item
- func (f *FollowRequest) Children() *RenderableList
- func (f FollowRequest) Date() time.Time
- func (f *FollowRequest) Deleted() bool
- func (f *FollowRequest) FromActivityPub(it vocab.Item) error
- func (f *FollowRequest) ID() Hash
- func (f *FollowRequest) IsValid() bool
- func (f *FollowRequest) Private() bool
- func (f *FollowRequest) Type() RenderType
- type FollowRequests
- type Handler
- type HasContent
- type Hash
- type Hashes
- type Identifiable
- type ImageMetadata
- type Item
- func (i *Item) AP() vocab.Item
- func (i *Item) Children() *RenderableList
- func (i Item) Content() map[string][]byte
- func (i Item) Date() time.Time
- func (i *Item) Delete()
- func (i *Item) Deleted() bool
- func (i *Item) FromActivityPub(it vocab.Item) error
- func (i *Item) HasMetadata() bool
- func (i *Item) ID() Hash
- func (i Item) IsFederated() bool
- func (i Item) IsLink() bool
- func (i Item) IsLocal() bool
- func (i Item) IsSelf() bool
- func (i *Item) IsTop() bool
- func (i *Item) IsValid() bool
- func (i *Item) MakePrivate()
- func (i *Item) MakePublic()
- func (i Item) Mentions() TagCollection
- func (i *Item) Private() bool
- func (i *Item) Public() bool
- func (i Item) Score() int
- func (i Item) Tags() TagCollection
- func (i *Item) Type() RenderType
- func (i *Item) UnDelete()
- type ItemCollection
- type ItemMetadata
- type ItemPtrCollection
- type Links
- type LoadFn
- type LogFn
- type Model
- type Moderatable
- type ModerationGroup
- func (m *ModerationGroup) AP() vocab.Item
- func (m *ModerationGroup) Children() *RenderableList
- func (m ModerationGroup) Date() time.Time
- func (m *ModerationGroup) Deleted() bool
- func (m *ModerationGroup) FromActivityPub(it vocab.Item) error
- func (m *ModerationGroup) ID() Hash
- func (m ModerationGroup) IsBlock() bool
- func (m ModerationGroup) IsDelete() bool
- func (m ModerationGroup) IsIgnore() bool
- func (m ModerationGroup) IsReport() bool
- func (m ModerationGroup) IsUpdate() bool
- func (m *ModerationGroup) IsValid() bool
- func (m *ModerationGroup) Private() bool
- func (m *ModerationGroup) Type() RenderType
- type ModerationMetadata
- type ModerationOp
- func (m *ModerationOp) AP() vocab.Item
- func (m *ModerationOp) Children() *RenderableList
- func (m ModerationOp) Content() map[string][]byte
- func (m ModerationOp) Date() time.Time
- func (m *ModerationOp) Deleted() bool
- func (m *ModerationOp) FromActivityPub(it vocab.Item) error
- func (m ModerationOp) ID() Hash
- func (m ModerationOp) IsBlock() bool
- func (m ModerationOp) IsDelete() bool
- func (m ModerationOp) IsIgnore() bool
- func (m ModerationOp) IsReport() bool
- func (m ModerationOp) IsUpdate() bool
- func (m *ModerationOp) IsValid() bool
- func (m ModerationOp) Mentions() TagCollection
- func (m *ModerationOp) Private() bool
- func (m ModerationOp) Tags() TagCollection
- func (m ModerationOp) Type() RenderType
- type ModerationRequests
- type NodeInfoResolver
- type OAuth
- type OptionFn
- type Paginator
- type RemoteLoad
- type RemoteLoads
- type RenderType
- type Renderable
- type RenderableList
- type SSHKey
- type ScoreType
- type Stats
- type StopLoad
- type StopSearchErr
- type Tag
- type TagCollection
- type Vote
- func (v *Vote) AP() vocab.Item
- func (v *Vote) Children() *RenderableList
- func (v Vote) Date() time.Time
- func (v *Vote) FromActivityPub(it vocab.Item) error
- func (v Vote) HasMetadata() bool
- func (v *Vote) ID() Hash
- func (v Vote) IsNay() bool
- func (v *Vote) IsValid() bool
- func (v Vote) IsYay() bool
- func (v *Vote) Type() RenderType
- type VoteCollection
- type VoteMetadata
- type WebInfo
Constants ¶
const ( // Deleted label Deleted = "deleted" // Anonymous label Anonymous = "anonymous" // System label System = "system" )
const ( FlagsDeleted = FlagBits(1 << iota) FlagsOperator FlagsModerator FlagsApplication FlagsGroup FlagsService FlagsPrivate FlagsNone = FlagBits(0) )
const ( MimeTypeURL = "application/url" MimeTypeHTML = "text/html" MimeTypeMarkdown = "text/markdown" MimeTypeText = "text/plain" MimeTypeSVG = "image/svg+xml" MimeTypeCss = "text/css" )
const ( DiasporaProfile = vocab.IRI("https://nodeinfo.diaspora.software/ns/schema") Mastodon = "mastodon" )
const ( Success flashType = "success" Info flashType = "info" Warning flashType = "warning" Error flashType = "error" )
const ( TagMention = "mention" TagTag = "tag" )
const ( ScoreMultiplier = 1 ScoreMaxK = 10000.0 ScoreMaxM = 10000000.0 ScoreMaxB = 10000000000.0 )
const ( ScoreItem = ScoreType(iota) ScoreAccount )
const Delete = "rm"
const Edit = "edit"
const (
MaxContentItems = 35
)
const Nay = "nay"
const Report = "bad"
const SessionUserKey = "__current_acct"
const Yay = "yay"
Variables ¶
var ( // DeletedAccount is a default static value for a deleted account DeletedAccount = Account{Handle: Anonymous, Hash: AnonymousHash, Metadata: new(AccountMetadata), Pub: &vocab.Tombstone{}} // AnonymousAccount is a default static value for the anonymous account AnonymousAccount = Account{Handle: Anonymous, Hash: AnonymousHash, Metadata: new(AccountMetadata)} // SystemAccount is a default static value for the system account SystemAccount = Account{Handle: System, Hash: SystemHash, Metadata: new(AccountMetadata)} // DeletedItem is a default static value for a deleted item DeletedItem = Item{Title: Deleted, Hash: AnonymousHash, Metadata: new(ItemMetadata), Pub: &vocab.Tombstone{}} )
var ( CreateActivitiesFilter = ActivityTypesFilter(vocab.CreateType) AppreciationActivitiesFilter = ActivityTypesFilter(vocab.LikeType, vocab.DislikeType) )
var ( AnonymousHash = Hash{} SystemHash = Hash{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} )
AnonymousHash is the sha hash for the anonymous account
var ContentManagementActivitiesFilter = ActivityTypesFilter(ValidContentManagementTypes...)
var CreateFollowActivitiesFilter = CompStrs{ CompStr{Str: string(vocab.CreateType)}, CompStr{Str: string(vocab.FollowType)}, }
var HNGravity = 1.5
represents how fast elapsed hours affect the order of an item
var LocalHTMLPolicy = BlueMondayPolicy()
var MdPolicy = mark.New( mark.HTML(true), mark.Tables(true), mark.Linkify(false), mark.Breaks(false), mark.Typographer(false), mark.XHTMLOutput(false), )
var ModerationActivitiesFilter = ActivityTypesFilter(ValidModerationActivityTypes...)
var StatisticalConfidence = 1.94
represents the statistical confidence var StatisticalConfidence = 1.0 => ~69%, 1.96 => ~95% (default)
var ValidActorTypes = vocab.ActivityVocabularyTypes{ vocab.PersonType, vocab.ServiceType, vocab.GroupType, vocab.ApplicationType, vocab.OrganizationType, }
var ValidAppreciationTypes = vocab.ActivityVocabularyTypes{ vocab.LikeType, vocab.DislikeType, }
var ValidContentManagementTypes = vocab.ActivityVocabularyTypes{ vocab.UpdateType, vocab.CreateType, vocab.DeleteType, }
var ValidContentTypes = vocab.ActivityVocabularyTypes{ vocab.ArticleType, vocab.NoteType, vocab.LinkType, vocab.PageType, vocab.DocumentType, vocab.VideoType, vocab.AudioType, }
var ValidModerationActivityTypes = vocab.ActivityVocabularyTypes{vocab.BlockType, vocab.IgnoreType, vocab.FlagType}
Functions ¶
func AccountBlocks ¶
func AccountFollows ¶
func AccountIgnores ¶
func AccountIsBlocked ¶
func AccountIsFollowed ¶
func AccountIsIgnored ¶
func AccountIsRejected ¶
func AccountIsReported ¶
func AccountLocalLink ¶
func ActivityPubService ¶
func ActivityPubService(c appConfig) (*repository, error)
func BlueMondayPolicy ¶
func BlueMondayPolicy() *bluemonday.Policy
func ConnectFedBOX ¶
func ConnectFedBOX(h *handler, c appConfig) error
func Contains ¶
func Contains[T Renderable](sl []T, it T) bool
func ContextContentModel ¶
func ContextDependentLoads ¶
func ContextListingModel ¶
func ContextModerationModel ¶
func ContextRegisterModel ¶
func ContextRepository ¶
func CurrentTab ¶
func FederatedFiltersMw ¶
func GetID ¶
func GetID(a Renderable) vocab.ID
func GetInviteLink ¶
func Hacker ¶
hackernews' hot sort https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm-works-1d9b0cf2c08d
func HostIsLocal ¶
func ItemIsReported ¶
func LoadFromSearches ¶
func LoadFromSearches(ctx context.Context, repo *repository, loads RemoteLoads, fn searchFn) error
func Moderations ¶
func Moderations(d *deps)
func NodeInfoConfig ¶
func NodeInfoConfig() nodeinfo.Config
func Reddit ¶
reddit's hot sort http://amix.dk/blog/post/19588
func SearchInCollectionsMw ¶
func WarmupCaches ¶
func Wilson ¶
wilson score interval sort http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
Types ¶
type Account ¶
type Account struct { Hash Hash `json:"hash,omitempty"` Handle string `json:"handle,omitempty"` CreatedAt time.Time `json:"-"` CreatedBy *Account `json:"-"` UpdatedAt time.Time `json:"-"` Flags FlagBits `json:"flags,omitempty"` Metadata *AccountMetadata `json:"metadata,omitempty"` Pub vocab.Item `json:"-"` Followers AccountCollection `json:"-"` Following AccountCollection `json:"-"` Blocked AccountCollection `json:"-"` Ignored AccountCollection `json:"-"` Level uint8 `json:"-"` Parent Renderable `json:"-"` // contains filtered or unexported fields }
func AuthorizeOAuthClient ¶
func ContextAccount ¶
func (*Account) Children ¶
func (a *Account) Children() *RenderableList
func (*Account) HasPublicKey ¶
HasPublicKey returns if current account had a public ssh key generated
func (*Account) IsValid ¶
IsValid returns if the current account has a handle or a hash with length greater than 0
func (Account) Type ¶
func (a Account) Type() RenderType
func (Account) Votes ¶
func (a Account) Votes() VoteCollection
type AccountCollection ¶
type AccountCollection []Account
func ContextAuthors ¶
func ContextAuthors(ctx context.Context) AccountCollection
func (AccountCollection) Contains ¶
func (a AccountCollection) Contains(b Account) bool
func (AccountCollection) Split ¶
func (a AccountCollection) Split(pieceCount int) []AccountCollection
type AccountMetadata ¶
type AccountMetadata struct { Password []byte `json:"pw,omitempty"` Key *SSHKey `json:"key,omitempty"` Blurb string `json:"blurb,omitempty"` Icon ImageMetadata `json:"icon,omitempty"` Name string `json:"name,omitempty"` ID string `json:"id,omitempty"` URL string `json:"url,omitempty"` Tags TagCollection `json:"tags,omitempty"` InboxIRI string `json:"inbox,omitempty"` OutboxIRI string `json:"outbox,omitempty"` LikedIRI string `json:"liked,omitempty"` FollowersIRI string `json:"followers,omitempty"` FollowingIRI string `json:"following,omitempty"` OAuth OAuth `json:"-"` AuthorizationEndPoint string `json:"authorizationEndPoint,omitempty"` TokenEndPoint string `json:"tokenEndPoint,omitempty"` OutboxUpdated time.Time `json:"outboxUpdated,omitempty"` Outbox vocab.ItemCollection `json:"-"` }
func (*AccountMetadata) InvalidateOutbox ¶
func (m *AccountMetadata) InvalidateOutbox()
type AccountPtrCollection ¶
type AccountPtrCollection []*Account
type ActivityMetadata ¶
ActivityMetadata
type Application ¶
type Application struct { Version string BaseURL url.URL Conf *config.Configuration ModTags TagCollection Logger log.Logger Mux *chi.Mux // contains filtered or unexported fields }
Application is the global state of our application
var Instance *Application
Instance is the default instance of our application
func New ¶
func New(c *config.Configuration, l log.Logger, host string, port int, ver string) (*Application, error)
New instantiates a new Application
func (*Application) Front ¶
func (a *Application) Front() error
func (Application) Hash ¶
func (a Application) Hash() string
func (Application) NodeInfo ¶
func (a Application) NodeInfo() WebInfo
func (*Application) Reload ¶
func (a *Application) Reload() error
func (*Application) Routes ¶
func (a *Application) Routes()
type CollectionFilterFn ¶
type CollectionFn ¶
type CollectionLoadFn ¶
type CollectionLoadFn func(vocab.CollectionInterface) error
type CompStr ¶
type CompStr = qstring.ComparativeString
func DifferentThanString ¶
func EqualsString ¶
func LikeString ¶
type CompStrs ¶
type CompStrs []CompStr
func AccountsIRIFilter ¶
func ActivityTypesFilter ¶
func ActivityTypesFilter(t ...vocab.ActivityVocabularyType) CompStrs
func IRIsFilter ¶
func IRIsLikeFilter ¶
func ItemIRIFilter ¶
func ModerationSubmittedByHashFilter ¶
func ModerationSubmittedByHashFilter(items ...ModerationOp) CompStrs
type CtxtKey ¶
type CtxtKey string
var ( ServicesCtxtKey CtxtKey = "__di" LoggedAccountCtxtKey CtxtKey = "__acct" RepositoryCtxtKey CtxtKey = "__repository" FilterCtxtKey CtxtKey = "__filter" LoadsCtxtKey CtxtKey = "__loads" ModelCtxtKey CtxtKey = "__model" AuthorCtxtKey CtxtKey = "__author" CursorCtxtKey CtxtKey = "__cursor" ContentCtxtKey CtxtKey = "__content" DependenciesCtxtKey CtxtKey = "__deps" )
type Desc ¶
type Desc struct { Description string `json:"description"` Email string `json:"email"` Stats Stats `json:"stats"` Thumbnail string `json:"thumbnail,omitempty"` Title string `json:"title"` Lang []string `json:"languages"` URI string `json:"uri"` Urls []string `json:"urls,omitempty"` Version string `json:"version"` }
Desc holds data for keeping compatibility with Mastodon instances
type ErrorHandler ¶
type ErrorHandler func(http.ResponseWriter, *http.Request, ...error)
type ErrorHandlerFn ¶
type ErrorHandlerFn func(eh ErrorHandler) Handler
type FedInstance ¶
type Filters ¶
type Filters struct { Name CompStrs `qstring:"name,omitempty"` Cont CompStrs `qstring:"content,omitempty"` MedTypes CompStrs `qstring:"mediaType,omitempty"` URL CompStrs `qstring:"url,omitempty"` IRI CompStrs `qstring:"iri,omitempty"` Generator CompStrs `qstring:"generator,omitempty"` Type CompStrs `qstring:"type,omitempty"` AttrTo CompStrs `qstring:"attributedTo,omitempty"` InReplTo CompStrs `qstring:"inReplyTo,omitempty"` OP CompStrs `qstring:"context,omitempty"` Recipients CompStrs `qstring:"recipients,omitempty"` Next vocab.IRI `qstring:"after,omitempty"` Prev vocab.IRI `qstring:"before,omitempty"` MaxItems int `qstring:"maxItems,omitempty"` Object *Filters `qstring:"object,omitempty"` Tag *Filters `qstring:"tag,omitempty"` Actor *Filters `qstring:"actor,omitempty"` }
func ContextActivityFilters ¶
ContextActivityFilters loads the filters we use for generating storage queries from the HTTP request
func FilterAccountByHandle ¶
func FiltersFromRequest ¶
FiltersFromRequest loads the filters we use for generating storage queries from the HTTP request
type FollowRequest ¶
type FollowRequest struct { Hash Hash `json:"hash"` SubmittedAt time.Time `json:"-"` SubmittedBy *Account `json:"by,omitempty"` Object *Account `json:"-"` Metadata *ActivityMetadata `json:"-"` Flags FlagBits `json:"flags,omitempty"` // contains filtered or unexported fields }
FollowRequest
func ContextFollowRequest ¶
func ContextFollowRequest(ctx context.Context) *FollowRequest
func FollowRequestFromContext ¶
func FollowRequestFromContext(ctx context.Context, hash string) (FollowRequest, error)
func (*FollowRequest) AP ¶
func (f *FollowRequest) AP() vocab.Item
AP returns the underlying actvitypub item
func (*FollowRequest) Children ¶
func (f *FollowRequest) Children() *RenderableList
func (*FollowRequest) FromActivityPub ¶
func (f *FollowRequest) FromActivityPub(it vocab.Item) error
FromActivityPub
func (*FollowRequest) ID ¶
func (f *FollowRequest) ID() Hash
func (*FollowRequest) IsValid ¶
func (f *FollowRequest) IsValid() bool
IsValid returns if the current follow request has a hash with length greater than 0
type HasContent ¶
type HasContent interface { Content() map[string][]byte Tags() TagCollection Mentions() TagCollection }
type Hash ¶
Hash is a local type for string, it should hold a [32]byte array actually
func HashFromIRI ¶
func HashFromItem ¶
func HashFromString ¶
type Identifiable ¶
type Identifiable interface {
Id() int64
}
type ImageMetadata ¶
type Item ¶
type Item struct { Hash Hash `json:"hash"` Title string `json:"-"` MimeType string `json:"-"` Data string `json:"-"` Votes VoteCollection `json:"-"` SubmittedAt time.Time `json:"-"` SubmittedBy *Account `json:"by,omitempty"` UpdatedAt time.Time `json:"-"` UpdatedBy *Account `json:"-"` Flags FlagBits `json:"-"` Metadata *ItemMetadata `json:"-"` Pub vocab.Item `json:"-"` Parent Renderable `json:"-"` OP Renderable `json:"-"` Level uint8 `json:"-"` // contains filtered or unexported fields }
Item
func ContextItem ¶
func ItemFromContext ¶
func (*Item) Children ¶
func (i *Item) Children() *RenderableList
func (*Item) MakePrivate ¶
func (i *Item) MakePrivate()
func (*Item) MakePublic ¶
func (i *Item) MakePublic()
func (Item) Mentions ¶
func (i Item) Mentions() TagCollection
Mentions returns the mentions associated with the current Item
func (Item) Tags ¶
func (i Item) Tags() TagCollection
Tags returns the tags associated with the current Item
func (*Item) Type ¶
func (i *Item) Type() RenderType
type ItemCollection ¶
type ItemCollection []Item
func (ItemCollection) Contains ¶
func (i ItemCollection) Contains(cc Item) bool
func (ItemCollection) First ¶
func (i ItemCollection) First() (*Item, error)
func (ItemCollection) Split ¶
func (i ItemCollection) Split(pieceCount int) []ItemCollection
type ItemMetadata ¶
type ItemMetadata struct { To AccountCollection `json:"to,omitempty"` CC AccountCollection `json:"to,omitempty"` Tags TagCollection `json:"tags,omitempty"` Mentions TagCollection `json:"mentions,omitempty"` ID string `json:"id,omitempty"` URL string `json:"url,omitempty"` RepliesURI string `json:"replies,omitempty"` LikesURI string `json:"likes,omitempty"` AuthorURI string `json:"author,omitempty"` Icon ImageMetadata `json:"icon,omitempty"` }
type ItemPtrCollection ¶
type ItemPtrCollection []*Item
func (ItemPtrCollection) Contains ¶
func (h ItemPtrCollection) Contains(it Item) bool
func (ItemPtrCollection) Sorted ¶
func (h ItemPtrCollection) Sorted() ItemPtrCollection
type Model ¶
func ContextModel ¶
type Moderatable ¶
type ModerationGroup ¶
type ModerationGroup struct { Hash Hash `json:"hash"` Icon template.HTML `json:"-"` SubmittedAt time.Time `json:"-"` Object Renderable `json:"-"` Requests []*ModerationOp `json:"-"` Followup []*ModerationOp `json:"-"` }
func (*ModerationGroup) AP ¶
func (m *ModerationGroup) AP() vocab.Item
AP returns the underlying actvitypub item
func (*ModerationGroup) Children ¶
func (m *ModerationGroup) Children() *RenderableList
func (*ModerationGroup) FromActivityPub ¶
func (m *ModerationGroup) FromActivityPub(it vocab.Item) error
func (*ModerationGroup) ID ¶
func (m *ModerationGroup) ID() Hash
func (ModerationGroup) IsBlock ¶
func (m ModerationGroup) IsBlock() bool
IsBlock returns true if current moderation request is a block
func (ModerationGroup) IsDelete ¶
func (m ModerationGroup) IsDelete() bool
IsDelete returns true if current moderation request is a delete
func (ModerationGroup) IsIgnore ¶
func (m ModerationGroup) IsIgnore() bool
IsIgnore returns true if current moderation request is a ignore
func (ModerationGroup) IsReport ¶
func (m ModerationGroup) IsReport() bool
IsReport returns true if current moderation request is a report
func (ModerationGroup) IsUpdate ¶
func (m ModerationGroup) IsUpdate() bool
IsUpdate returns true if current moderation request is an update
func (*ModerationGroup) IsValid ¶
func (m *ModerationGroup) IsValid() bool
IsValid returns if the current follow request group has a hash with length greater than 0
type ModerationMetadata ¶
type ModerationMetadata struct { ID string `json:"-"` InReplyTo vocab.IRIs `json:"-"` Tags TagCollection `json:"tags,omitempty"` Mentions TagCollection `json:"mentions,omitempty"` }
type ModerationOp ¶
type ModerationOp struct { Hash Hash `json:"hash"` Icon template.HTML `json:"-"` SubmittedAt time.Time `json:"-"` Data string `json:"-"` MimeType string `json:"-"` SubmittedBy *Account `json:"by,omitempty"` Object Renderable `json:"-"` Metadata *ModerationMetadata `json:"-"` Pub vocab.Item `json:"-"` Flags FlagBits `json:"flags,omitempty"` }
func (*ModerationOp) AP ¶
func (m *ModerationOp) AP() vocab.Item
AP returns the underlying actvitypub item
func (*ModerationOp) Children ¶
func (m *ModerationOp) Children() *RenderableList
func (ModerationOp) Content ¶
func (m ModerationOp) Content() map[string][]byte
Content returns the reason for it
func (*ModerationOp) FromActivityPub ¶
func (m *ModerationOp) FromActivityPub(it vocab.Item) error
func (ModerationOp) ID ¶
func (m ModerationOp) ID() Hash
func (ModerationOp) IsBlock ¶
func (m ModerationOp) IsBlock() bool
IsBlock returns true if current moderation request is a block
func (ModerationOp) IsDelete ¶
func (m ModerationOp) IsDelete() bool
IsBlock returns true if current moderation request is a delete
func (ModerationOp) IsIgnore ¶
func (m ModerationOp) IsIgnore() bool
IsIgnore returns true if current moderation request is a ignore
func (ModerationOp) IsReport ¶
func (m ModerationOp) IsReport() bool
IsReport returns true if current moderation request is a report
func (ModerationOp) IsUpdate ¶
func (m ModerationOp) IsUpdate() bool
IsUpdate returns true if current moderation request is an update
func (*ModerationOp) IsValid ¶
func (m *ModerationOp) IsValid() bool
IsValid returns if the current follow request has a hash with length greater than 0
func (ModerationOp) Mentions ¶
func (m ModerationOp) Mentions() TagCollection
Mentions returns the mentions associated with the current ModerationOp
func (ModerationOp) Tags ¶
func (m ModerationOp) Tags() TagCollection
Tags returns the tags associated with the current ModerationOp
type ModerationRequests ¶
type ModerationRequests []ModerationOp
ModerationRequests
func (ModerationRequests) Contains ¶
func (m ModerationRequests) Contains(mop ModerationOp) bool
type NodeInfoResolver ¶
type NodeInfoResolver struct {
// contains filtered or unexported fields
}
func NodeInfoResolverNew ¶
func NodeInfoResolverNew(r *repository) NodeInfoResolver
func (NodeInfoResolver) IsOpenRegistration ¶
func (n NodeInfoResolver) IsOpenRegistration() (bool, error)
func (NodeInfoResolver) Usage ¶
func (n NodeInfoResolver) Usage() (nodeinfo.Usage, error)
type OptionFn ¶
type OptionFn func(*fedbox) error
func SkipTLSCheck ¶
func WithHTTPTransport ¶
func WithHTTPTransport(t http.RoundTripper) OptionFn
func WithLogger ¶
type RemoteLoad ¶
type RemoteLoad struct {
// contains filtered or unexported fields
}
type RemoteLoads ¶
type RemoteLoads map[vocab.IRI][]RemoteLoad
func ContextLoads ¶
func ContextLoads(ctx context.Context) RemoteLoads
ContextLoads loads the searches we use for generating storage queries from the HTTP request
type RenderType ¶
type RenderType int
const ( UnknownType RenderType = -1 CommentType RenderType = iota FollowType AppreciationType ActorType ModerationType )
type Renderable ¶
type Renderable interface { ID() Hash AP() vocab.Item IsValid() bool Type() RenderType Date() time.Time Children() *RenderableList }
func ByDate ¶
func ByDate(r RenderableList) []Renderable
func ByRecentActivity ¶
func ByRecentActivity(r RenderableList) []Renderable
func ByScore ¶
func ByScore(r RenderableList) []Renderable
func GetRenderableByType ¶
func GetRenderableByType(typ vocab.ActivityVocabularyType) Renderable
func LoadFromActivityPubItem ¶
func LoadFromActivityPubItem(it vocab.Item) (Renderable, error)
type RenderableList ¶
type RenderableList []Renderable
func (*RenderableList) Append ¶
func (r *RenderableList) Append(others ...Renderable)
func (RenderableList) Contains ¶
func (r RenderableList) Contains(ren Renderable) bool
func (RenderableList) Follows ¶
func (r RenderableList) Follows() FollowRequests
func (RenderableList) Items ¶
func (r RenderableList) Items() ItemCollection
func (*RenderableList) Merge ¶
func (r *RenderableList) Merge(other RenderableList)
func (*RenderableList) Valid ¶
func (r *RenderableList) Valid() bool
type Stats ¶
type Stats struct { DomainCount int `json:"domain_count"` UserCount uint `json:"user_count"` StatusCount uint `json:"status_count"` }
Stats holds data for keeping compatibility with Mastodon instances
type StopSearchErr ¶
type StopSearchErr string
func (StopSearchErr) Error ¶
func (s StopSearchErr) Error() string
type Tag ¶
type Tag struct { Hash Hash `json:"hash"` Type string `json:"-"` Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` SubmittedAt time.Time `json:"-"` SubmittedBy *Account `json:"-"` UpdatedAt time.Time `json:"-"` UpdatedBy *Account `json:"-"` Metadata *ItemMetadata `json:"-"` Pub vocab.Item `json:"-"` }
type TagCollection ¶
type TagCollection []Tag
func LoadModeratorTags ¶
func LoadModeratorTags(repo *repository) (TagCollection, error)
func SaveModeratorTags ¶
func SaveModeratorTags(repo *repository) (TagCollection, error)
func (TagCollection) Contains ¶
func (c TagCollection) Contains(t Tag) bool
func (*TagCollection) FromActivityPub ¶
func (c *TagCollection) FromActivityPub(tag vocab.Item) error
type Vote ¶
type Vote struct { SubmittedBy *Account `json:"-"` SubmittedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` Weight int `json:"weight"` Item *Item `json:"on"` Flags FlagBits `json:"-"` Metadata *VoteMetadata `json:"-"` Pub *vocab.Activity `json:"-"` }
func (*Vote) Children ¶
func (v *Vote) Children() *RenderableList
type VoteCollection ¶
type VoteCollection []Vote
func (VoteCollection) Contains ¶
func (v VoteCollection) Contains(vot Vote) bool
func (VoteCollection) First ¶
func (v VoteCollection) First() (*Vote, error)
type VoteMetadata ¶
type WebInfo ¶
type WebInfo struct { Title string `json:"title"` Email string `json:"email"` Summary string `json:"summary"` Description string `json:"description"` Thumbnail string `json:"thumbnail,omitempty"` Languages []string `json:"languages"` URI string `json:"uri"` Urls []string `json:"urls,omitempty"` Version string `json:"version"` }