photoprism/internal/hub/session.go
Michael Mayer 53232b53c0 Frontend: Add upgrade page and update about page
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-11-27 18:00:55 +01:00

23 lines
466 B
Go

package hub
import "time"
// Session represents backend api session data.
type Session struct {
MapKey string
Customer string `json:",omitempty"`
ExpiresAt string
}
// Expired tests if the api session is expired.
func (p *Session) Expired() bool {
if p.ExpiresAt == "" {
return true
} else if date, err := time.Parse("2006-01-02T15:04:05", p.ExpiresAt); err != nil {
return true
} else if date.Before(time.Now()) {
return true
}
return false
}