diff --git a/server/handlers.go b/server/handlers.go index dd7991a..bf83540 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -27,6 +27,7 @@ var routes []Route = []Route{ p("/api/folders", FolderListHandler), p("/api/folders/:id", FolderHandler), p("/api/feeds", FeedListHandler), + p("/api/feeds/refresh", FeedRefreshHandler), p("/api/feeds/:id", FeedHandler), p("/api/feeds/find", FeedHandler), p("/api/items", ItemListHandler), @@ -136,6 +137,15 @@ type UpdateFeed struct { FolderID *int64 `json:"folder_id,omitempty"` } +func FeedRefreshHandler(rw http.ResponseWriter, req *http.Request) { + if req.Method == "POST" { + handler(req).fetchAllFeeds() + rw.WriteHeader(http.StatusOK) + } else { + rw.WriteHeader(http.StatusMethodNotAllowed) + } +} + func FeedListHandler(rw http.ResponseWriter, req *http.Request) { if req.Method == "GET" { list := db(req).ListFeeds() diff --git a/template/index.html b/template/index.html index 2f561e1..e9aa28b 100644 --- a/template/index.html +++ b/template/index.html @@ -28,6 +28,11 @@ Manage Feeds + + {% inline "rotate-cw.svg" %} + Refresh Feeds + + Sort by {% inline "check.svg" %} diff --git a/template/static/images/rotate-cw.svg b/template/static/images/rotate-cw.svg new file mode 100644 index 0000000..83dca35 --- /dev/null +++ b/template/static/images/rotate-cw.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/template/static/javascripts/api.js b/template/static/javascripts/api.js index 56add93..2698d5f 100644 --- a/template/static/javascripts/api.js +++ b/template/static/javascripts/api.js @@ -37,6 +37,9 @@ list_items: function(id) { return api('get', '/api/feeds/' + id + '/items').then(json) }, + refresh: function() { + return api('post', '/api/feeds/refresh') + }, }, folders: { list: function() { diff --git a/template/static/javascripts/app.js b/template/static/javascripts/app.js index 21b4614..0c24810 100644 --- a/template/static/javascripts/app.js +++ b/template/static/javascripts/app.js @@ -497,6 +497,9 @@ var vm = new Vue({ incrFont: function(x) { console.log(x, this.settings.size) this.settings.size = +(this.settings.size + (0.1 * x)).toFixed(1) - } + }, + fetchAllFeeds: function() { + api.feeds.refresh() + }, } })