feat(session): add session list API

- Move token-related functions from auth.go to new session.go
- Add session tracking with expiration and cleanup
- Implement session list API endpoint
- Update login/logout handlers to use session system
- Add hourly cleanup of expired tokens and sessions
This commit is contained in:
2026-03-05 18:24:19 +08:00
parent efdaefa6f5
commit e400cc1869
6 changed files with 155 additions and 9 deletions
+9
View File
@@ -87,6 +87,15 @@ func main() {
}
}()
go func() {
ticker := time.NewTicker(1 * time.Hour)
defer ticker.Stop()
for range ticker.C {
CleanupExpiredTokens()
CleanupExpiredSessions()
}
}()
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit