Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: persist jwt expires by cookie (#2509)
Athurg Gooth52fdf8bccd9e
diff --git a/api/v1/auth.go b/api/v1/auth.goindex ae15300b2..acedd169f 100644--- a/api/v1/auth.go+++ b/api/v1/auth.go@@ -106,8 +106,11 @@ func (s *APIV1Service) SignIn(c echo.Context) error {}var expireAt time.Time+ // Set cookie expiration to 100 years to make it persistent.+ cookieExp := time.Now().AddDate(100, 0, 0)if !signin.Remember {expireAt = time.Now().Add(auth.AccessTokenDuration)+ cookieExp = time.Now().Add(auth.CookieExpDuration)}accessToken, err := auth.GenerateAccessToken(user.Username, user.ID, expireAt, []byte(s.Secret))@@ -117,7 +120,6 @@ func (s *APIV1Service) SignIn(c echo.Context) error {if err := s.UpsertAccessTokenToStore(ctx, user, accessToken); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("failed to upsert access token, err: %s", err)).SetInternal(err)}- cookieExp := time.Now().Add(auth.CookieExpDuration)setTokenCookie(c, auth.AccessTokenCookieName, accessToken, cookieExp)userMessage := convertUserFromStore(user)return c.JSON(http.StatusOK, userMessage)