Files
web_server/backend/handlers/store.go
Adam French 264df132df
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled
Add Steam integration showing online status and recent games
Fetches player summary and recently played games from Steam API with
5-minute server-side caching. Displays in the home sidebar with online
indicator and game artwork.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 01:59:34 +00:00

49 lines
1.0 KiB
Go

package handlers
import (
"time"
"adam-french.co.uk/backend/services"
"github.com/anthropics/anthropic-sdk-go"
"github.com/zmb3/spotify/v2"
spotifyauth "github.com/zmb3/spotify/v2/auth"
"gorm.io/gorm"
)
type Store struct {
DB *gorm.DB
SpotifyAuth *spotifyauth.Authenticator
SpotifyClient *spotify.Client
ClaudeClient *anthropic.Client
Auth *services.Auth
Notes *services.Notes
RecentSongs *[]spotify.RecentlyPlayedItem
RecentSongsFetchedAt time.Time
GiteaHost string
GiteaPort string
GiteaFeed *services.GiteaFeedResponse
GiteaFeedFetchedAt time.Time
SteamAPIKey string
SteamID string
SteamRecentGames []services.SteamRecentGame
SteamOnline bool
SteamFetchedAt time.Time
}
func (s *Store) GiteaFeedFresh() bool {
if s.GiteaFeed == nil {
return false
}
return time.Since(s.GiteaFeedFetchedAt) < time.Minute
}
func (s *Store) SteamFresh() bool {
if s.SteamRecentGames == nil {
return false
}
return time.Since(s.SteamFetchedAt) < 5*time.Minute
}