diff options
| author | nytpu <alex@nytpu.com> | 2021-03-17 08:42:06 -0600 |
|---|---|---|
| committer | nytpu <alex@nytpu.com> | 2021-03-17 08:48:16 -0600 |
| commit | 09c1c4caabe206fb825575b04f9de932da2aa785 (patch) | |
| tree | 8555bb9d0b6aeb937c76ebdc2876d740c835a522 /fetch | |
| parent | 1389fc8d6ee89decc49a510557ab43cbd64c5b1d (diff) | |
add general Update* in fetch.go
TODO: implement backend protocol functions
Diffstat (limited to 'fetch')
| -rw-r--r-- | fetch/fetch.go | 38 |
1 files changed, 34 insertions, 4 deletions
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 } |
