forked from tangled.org/core
this repo has no description

simplify time in few places

Changed files
+2 -4
appview
+1 -1
appview/auth/auth.go
···
clientSession.Values[appview.SessionPds] = pdsEndpoint
clientSession.Values[appview.SessionAccessJwt] = atSessionish.GetAccessJwt()
clientSession.Values[appview.SessionRefreshJwt] = atSessionish.GetRefreshJwt()
-
clientSession.Values[appview.SessionExpiry] = time.Now().Add(time.Hour).Format(appview.TimeLayout)
+
clientSession.Values[appview.SessionExpiry] = time.Now().Add(time.Hour).Format(time.RFC3339)
clientSession.Values[appview.SessionAuthenticated] = true
return clientSession.Save(r, w)
}
-1
appview/consts.go
···
SessionRefreshJwt = "refreshJwt"
SessionExpiry = "expiry"
SessionAuthenticated = "authenticated"
-
TimeLayout = "2006-01-02 15:04:05.999999999 -0700 MST"
SqliteDbPath = "appview.db"
)
+1 -1
appview/state/middleware.go
···
// refresh if nearing expiry
// TODO: dedup with /login
expiryStr := session.Values[appview.SessionExpiry].(string)
-
expiry, err := time.Parse(appview.TimeLayout, expiryStr)
+
expiry, err := time.Parse(time.RFC3339, expiryStr)
if err != nil {
log.Println("invalid expiry time", err)
return
-1
appview/state/state.go
···
lexutil "github.com/bluesky-social/indigo/lex/util"
"github.com/gliderlabs/ssh"
"github.com/go-chi/chi/v5"
-
"github.com/google/uuid"
tangled "github.com/sotangled/tangled/api/tangled"
"github.com/sotangled/tangled/appview"
"github.com/sotangled/tangled/appview/auth"