diff options
author | 2023-10-20 15:12:02 -0700 | |
---|---|---|
committer | 2023-10-20 16:07:18 -0700 | |
commit | 4cc99881d870495ef35dcbb44d351e4b3c01f401 (patch) | |
tree | 46c1408d9a8eba7fdf7633201902e18c6094e579 /internal/ui/session/session.go | |
parent | 95ee1c423b1157a967fb2024aa86bd395ead23f8 (diff) | |
download | v2-4cc99881d870495ef35dcbb44d351e4b3c01f401.tar.gz v2-4cc99881d870495ef35dcbb44d351e4b3c01f401.tar.zst v2-4cc99881d870495ef35dcbb44d351e4b3c01f401.zip |
Refactor Batch Builder and prevent accidental and excessive refreshes from the web ui
Diffstat (limited to 'internal/ui/session/session.go')
-rw-r--r-- | internal/ui/session/session.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/internal/ui/session/session.go b/internal/ui/session/session.go index 619c383a..c47a1828 100644 --- a/internal/ui/session/session.go +++ b/internal/ui/session/session.go @@ -4,6 +4,8 @@ package session // import "miniflux.app/v2/internal/ui/session" import ( + "time" + "miniflux.app/v2/internal/storage" ) @@ -13,6 +15,15 @@ type Session struct { sessionID string } +// New returns a new session handler. +func New(store *storage.Storage, sessionID string) *Session { + return &Session{store, sessionID} +} + +func (s *Session) SetLastForceRefresh() { + s.store.UpdateAppSessionField(s.sessionID, "last_force_refresh", time.Now().UTC().Unix()) +} + func (s *Session) SetOAuth2State(state string) { s.store.UpdateAppSessionField(s.sessionID, "oauth2_state", state) } @@ -61,8 +72,3 @@ func (s *Session) SetTheme(theme string) { func (s *Session) SetPocketRequestToken(requestToken string) { s.store.UpdateAppSessionField(s.sessionID, "pocket_request_token", requestToken) } - -// New returns a new session handler. -func New(store *storage.Storage, sessionID string) *Session { - return &Session{store, sessionID} -} |