aboutsummaryrefslogtreecommitdiffhomepage
path: root/fever
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-09-03 14:26:40 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-09-03 14:26:40 -0700
commiteee1f3190355224eef63a4dcdef8c36eb3ca3738 (patch)
tree009b7ca67b96d9be473d8ddf2c8c95f22a6749d1 /fever
parent88e81d4d800ff6433518522954197d75203a25c2 (diff)
Refactor HTTP context handling
Diffstat (limited to 'fever')
-rw-r--r--fever/fever.go28
1 files changed, 9 insertions, 19 deletions
diff --git a/fever/fever.go b/fever/fever.go
index 2f17fd2..e1090b7 100644
--- a/fever/fever.go
+++ b/fever/fever.go
@@ -11,7 +11,6 @@ import (
"time"
"miniflux.app/config"
- "miniflux.app/http/context"
"miniflux.app/http/request"
"miniflux.app/http/response/json"
"miniflux.app/integration"
@@ -180,8 +179,7 @@ is_spark equal to 1.
*/
func (c *Controller) handleGroups(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Fetching groups for userID=%d", userID)
categories, err := c.store.Categories(userID)
@@ -231,8 +229,7 @@ should be limited to feeds with an is_spark equal to 0.
For the “Sparks” super group the items should be limited to feeds with an is_spark equal to 1.
*/
func (c *Controller) handleFeeds(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Fetching feeds for userID=%d", userID)
feeds, err := c.store.Feeds(userID)
@@ -285,8 +282,7 @@ A PHP/HTML example:
echo '<img src="data:'.$favicon['data'].'">';
*/
func (c *Controller) handleFavicons(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Fetching favicons for userID=%d", userID)
icons, err := c.store.Icons(userID)
@@ -341,8 +337,7 @@ Three optional arguments control determine the items included in the response.
func (c *Controller) handleItems(w http.ResponseWriter, r *http.Request) {
var result itemsResponse
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Fetching items for userID=%d", userID)
builder := c.store.NewEntryQueryBuilder(userID)
@@ -425,8 +420,7 @@ A request with the unread_item_ids argument will return one additional member:
unread_item_ids (string/comma-separated list of positive integers)
*/
func (c *Controller) handleUnreadItems(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Fetching unread items for userID=%d", userID)
builder := c.store.NewEntryQueryBuilder(userID)
@@ -457,8 +451,7 @@ with the remote Fever installation.
saved_item_ids (string/comma-separated list of positive integers)
*/
func (c *Controller) handleSavedItems(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Fetching saved items for userID=%d", userID)
builder := c.store.NewEntryQueryBuilder(userID)
@@ -486,8 +479,7 @@ func (c *Controller) handleSavedItems(w http.ResponseWriter, r *http.Request) {
id=? where ? is replaced with the id of the item to modify
*/
func (c *Controller) handleWriteItems(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Receiving mark=item call for userID=%d", userID)
entryID := request.FormInt64Value(r, "id")
@@ -544,8 +536,7 @@ func (c *Controller) handleWriteItems(w http.ResponseWriter, r *http.Request) {
before=? where ? is replaced with the Unix timestamp of the the local client’s most recent items API request
*/
func (c *Controller) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Receiving mark=feed call for userID=%d", userID)
feedID := request.FormInt64Value(r, "id")
@@ -585,8 +576,7 @@ func (c *Controller) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
before=? where ? is replaced with the Unix timestamp of the the local client’s most recent items API request
*/
func (c *Controller) handleWriteGroups(w http.ResponseWriter, r *http.Request) {
- ctx := context.New(r)
- userID := ctx.UserID()
+ userID := request.UserID(r)
logger.Debug("[Fever] Receiving mark=group call for userID=%d", userID)
groupID := request.FormInt64Value(r, "id")