aggregator

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotModified = errors.New("not modified")

Functions

func GetFoldersMap added in v0.3.0

func GetFoldersMap(db *server.DB) (map[string]*common.Folder, error)

Types

type Account added in v0.4.0

type Account struct {
	ID          ID     `json:"id"`
	Username    string `json:"username"`
	Acct        string `json:"acct"`
	DisplayName string `json:"display_name"`
	URL         string `json:"url"`
	Avatar      string `json:"avatar"`
}

type Attachment added in v0.4.0

type Attachment struct {
	ID   ID             `json:"id"`
	Type string         `json:"type"`
	URL  string         `json:"url"`
	Meta AttachmentMeta `json:"meta"`
}

type AttachmentMeta added in v0.4.0

type AttachmentMeta struct {
	Original AttachmentSize `json:"original"`
	Small    AttachmentSize `json:"small"`
}

type AttachmentSize added in v0.4.0

type AttachmentSize struct {
	Width  int64   `json:"width"`
	Height int64   `json:"height"`
	Size   string  `json:"size"`
	Aspect float64 `json:"aspect"`
}

type Feed

type Feed struct {
	*gofeed.Feed

	ETag         string
	LastModified string
}

type ID added in v0.4.0

type ID string

type MastodonPoller

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

func NewMastodonPoller

func NewMastodonPoller(cfg *common.Config, db *server.DB, newCh chan common.AggregatorItem) (*MastodonPoller, error)

func (*MastodonPoller) APICall added in v0.4.0

func (m *MastodonPoller) APICall(ctx context.Context, method, path string, params map[string]string) ([]byte, error)

func (*MastodonPoller) Authorize added in v0.4.0

func (m *MastodonPoller) Authorize(ctx context.Context, username, password string) error

func (*MastodonPoller) GetAccount added in v0.4.0

func (m *MastodonPoller) GetAccount(ctx context.Context) (*Account, error)

func (*MastodonPoller) GetFollowedTags added in v0.4.0

func (m *MastodonPoller) GetFollowedTags(ctx context.Context) (map[string]Tag, error)

func (*MastodonPoller) GetTimelineHome added in v0.4.0

func (m *MastodonPoller) GetTimelineHome(ctx context.Context, pagination *Pagination) ([]*Status, error)

func (*MastodonPoller) GrabTimeline

func (m *MastodonPoller) GrabTimeline()

func (*MastodonPoller) HandleHTTP

func (m *MastodonPoller) HandleHTTP(c *gin.Context)

type Pagination added in v0.4.0

type Pagination struct {
	SinceID string
	Limit   int64
}

type PollerData

type PollerData struct {
	ID          int    `json:"id,omitempty"`
	Type        string `json:"type"`
	Kind        string `json:"kind"`
	Skey        string `json:"skey"`
	LastSeenStr string `json:"last_seen_str"`
	LastSeenInt int64  `json:"last_seen_int"`
}

func GetRunData

func GetRunData(db *server.DB, skey string) *PollerData

func (*PollerData) GetID

func (p *PollerData) GetID() int

func (*PollerData) SetID

func (p *PollerData) SetID(id int)

type RssItem

type RssItem struct {
	*gofeed.Item `binding:"required"`
	FeedTitle    string         `json:"feed_title"`
	FeedUrl      string         `json:"feed_url"`
	Skey         string         `json:"skey"`
	Folder       *common.Folder `json:"folder,omitempty"`
}

func (RssItem) ToDoc

func (ri RssItem) ToDoc() (*common.Doc, error)

type RssPoller

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

func NewRssPoller

func NewRssPoller(cfg *common.Config,
	db *server.DB,
	newCh chan common.AggregatorItem,
	newSubCh chan *common.Sub) *RssPoller

func (*RssPoller) GetFromURL

func (r *RssPoller) GetFromURL(sub *common.Sub) (*Feed, error)

Calls the feed url with conditional headers. See https://github.com/mmcdole/gofeed/issues/111#issuecomment-450956821

func (*RssPoller) GrabFeed

func (r *RssPoller) GrabFeed(sub *common.Sub, folder *common.Folder) error

func (*RssPoller) GrabFeeds

func (r *RssPoller) GrabFeeds()

func (*RssPoller) HandleHTTP

func (r *RssPoller) HandleHTTP(c *gin.Context)

func (*RssPoller) HandleNewSubs

func (r *RssPoller) HandleNewSubs()

func (*RssPoller) Run

func (r *RssPoller) Run()

type Status

type Status struct {
	ID               ID           `json:"id"`
	URI              string       `json:"uri"`
	URL              string       `json:"url"`
	Account          Account      `json:"account"`
	Reblog           *Status      `json:"reblog"`
	Content          string       `json:"content"`
	CreatedAt        time.Time    `json:"created_at"`
	Reblogged        interface{}  `json:"reblogged"`
	Muted            interface{}  `json:"muted"`
	MediaAttachments []Attachment `json:"media_attachments"`
	Tags             []Tag        `json:"tags"`
	Card             *common.Card `json:"card"`
	Filtered         []interface{}
}

type Tag added in v0.4.0

type Tag struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Toot added in v0.4.0

type Toot struct {
	*Status     `binding:"required"`
	User        *Account
	FollowedTag *Tag
}

func (*Toot) ToDoc added in v0.4.0

func (s *Toot) ToDoc() (*common.Doc, error)

Jump to

Keyboard shortcuts

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