add general Update* in fetch.go
TODO: implement backend protocol functions
This commit is contained in:
+32
-2
@@ -42,13 +42,43 @@ func NewPage(remoteURL *url.URL, title string) (*core.Page, error) {
|
||||
}
|
||||
|
||||
// UpdateFeed will check an existing core.Feed for updates
|
||||
func UpdateFeed(feed *core.Feed) error {
|
||||
func UpdateFeed(f *core.Feed) error {
|
||||
switch f.FeedLink.Scheme {
|
||||
case "gemini":
|
||||
// return updateGeminiFeed(f)
|
||||
// TODO
|
||||
fallthrough
|
||||
case "http", "https":
|
||||
// return updateHTTPFeed(f)
|
||||
// TODO
|
||||
fallthrough
|
||||
case "gopher", "gophers":
|
||||
// return updateGopherFeed(f)
|
||||
// TODO
|
||||
fallthrough
|
||||
default:
|
||||
return fmt.Errorf("Unsupported protocol '%s'", f.FeedLink.Scheme)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdatePage will check an existing core.Page for updages
|
||||
func UpdatePage(page *core.Page) error {
|
||||
func UpdatePage(p *core.Page) error {
|
||||
switch p.Link.Scheme {
|
||||
case "gemini":
|
||||
// return updateGeminiPage(p)
|
||||
// TODO
|
||||
fallthrough
|
||||
case "http", "https":
|
||||
// return updateHTTPPage(p)
|
||||
// TODO
|
||||
fallthrough
|
||||
case "gopher", "gophers":
|
||||
// return updateGopherPage(p)
|
||||
// TODO
|
||||
fallthrough
|
||||
default:
|
||||
return fmt.Errorf("Unsupported protocol '%s'", p.Link.Scheme)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user