aboutsummaryrefslogtreecommitdiff
path: root/internal/http/request/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/http/request/context.go')
-rw-r--r--internal/http/request/context.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/http/request/context.go b/internal/http/request/context.go
index 7fb50685..9a0acbf4 100644
--- a/internal/http/request/context.go
+++ b/internal/http/request/context.go
@@ -3,7 +3,10 @@
package request // import "miniflux.app/v2/internal/http/request"
-import "net/http"
+import (
+ "net/http"
+ "strconv"
+)
// ContextKey represents a context key.
type ContextKey int
@@ -24,6 +27,7 @@ const (
FlashMessageContextKey
FlashErrorMessageContextKey
PocketRequestTokenContextKey
+ LastForceRefreshContextKey
ClientIPContextKey
GoogleReaderToken
)
@@ -114,6 +118,16 @@ func PocketRequestToken(r *http.Request) string {
return getContextStringValue(r, PocketRequestTokenContextKey)
}
+// LastForceRefresh returns the last force refresh timestamp.
+func LastForceRefresh(r *http.Request) int64 {
+ jsonStringValue := getContextStringValue(r, LastForceRefreshContextKey)
+ timestamp, err := strconv.ParseInt(jsonStringValue, 10, 64)
+ if err != nil {
+ return 0
+ }
+ return timestamp
+}
+
// ClientIP returns the client IP address stored in the context.
func ClientIP(r *http.Request) string {
return getContextStringValue(r, ClientIPContextKey)