add general Update* in fetch.go
TODO: implement backend protocol functions
This commit is contained in:
+34
-4
@@ -42,13 +42,43 @@ func NewPage(remoteURL *url.URL, title string) (*core.Page, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateFeed will check an existing core.Feed for updates
|
// UpdateFeed will check an existing core.Feed for updates
|
||||||
func UpdateFeed(feed *core.Feed) error {
|
func UpdateFeed(f *core.Feed) error {
|
||||||
// TODO
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePage will check an existing core.Page for updages
|
// UpdatePage will check an existing core.Page for updages
|
||||||
func UpdatePage(page *core.Page) error {
|
func UpdatePage(p *core.Page) error {
|
||||||
// TODO
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user