refactor: typed proxy key

This commit is contained in:
2026-05-26 22:40:09 +02:00
parent b8521d2219
commit 65a7b0f50d
2 changed files with 7 additions and 5 deletions

View File

@@ -35,6 +35,8 @@ type playbackService struct {
auditSvc domain.AuditService
}
type ProxyTokenKey string
type proxyTokenPayload struct {
TargetURL string `json:"u"`
Referer string `json:"r,omitempty"`
@@ -42,7 +44,7 @@ type proxyTokenPayload struct {
ExpiresAt int64 `json:"exp"`
}
func NewPlaybackService(repo domain.PlaybackRepository, providers []domain.Provider, jikan *jikan.Client, episodes domain.EpisodeService, auditSvc domain.AuditService, proxyTokenKey string) domain.PlaybackService {
func NewPlaybackService(repo domain.PlaybackRepository, providers []domain.Provider, jikan *jikan.Client, episodes domain.EpisodeService, auditSvc domain.AuditService, proxyTokenKey ProxyTokenKey) domain.PlaybackService {
return &playbackService{
repo: repo,
providers: providers,
@@ -50,7 +52,7 @@ func NewPlaybackService(repo domain.PlaybackRepository, providers []domain.Provi
episodes: episodes,
auditSvc: auditSvc,
httpClient: &http.Client{Timeout: 10 * time.Second},
proxyTokenKey: proxyTokenKey,
proxyTokenKey: string(proxyTokenKey),
}
}