Documentation
¶
Overview ¶
Package feeds keeps the RSS and Atom feeds the owner chose for the dashboard's footer (CasaOS#180) and their latest headlines. A box whose owner never saved the settings shows the distribution's own releases (DefaultFeed); turned off, or with no feed, it fetches nothing. Reading the headlines never waits on the network: it answers what is cached and, when that is older than refreshEvery, starts a refresh in the background. Feeds are fetched by the box, never toward an address of the box itself or of its networks (guard.go).
Index ¶
Constants ¶
const ConfigFile = "/var/lib/casaos/feeds.json"
ConfigFile holds the switch and the feeds (root, 0600: a private feed's URL can carry its token).
const DefaultFeed = "https://github.com/ReCasaOS/CasaOS-Install/releases.atom"
DefaultFeed is what a box whose owner never saved the settings shows: the distribution's releases.
Variables ¶
var Default = New("/")
Default is the box's own.
var ErrInvalid = errors.New("invalid feeds settings")
ErrInvalid is a PUT body that is not one: too many feeds, or one that is not an http(s) URL. Nothing is written.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
Root string
Now func() time.Time
Client *http.Client
// contains filtered or unexported fields
}
Hub is the feeds of one box.
type Item ¶
type Item struct {
Title string `json:"title"`
Link string `json:"link"`
Source string `json:"source"`
}
Item is one headline: its title as plain text, an http(s) link, and the feed it came from.
type Status ¶
type Status struct {
Enabled bool `json:"enabled"`
Feeds []string `json:"feeds"`
Items []Item `json:"items"`
// why the last read of a feed failed, by feed; absent for a feed read fine or not read yet
Errors map[string]string `json:"errors,omitempty"`
}
Status is what GET and PUT /v1/sys/feeds answer: the settings and the cached headlines of the feeds set now, in their order.