diff --git a/fetch/fetch.go b/fetch/fetch.go index 5c6809a..1f16143 100644 --- a/fetch/fetch.go +++ b/fetch/fetch.go @@ -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 { - // TODO +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 { - // TODO +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 }