Documentation
¶
Overview ¶
Package files redirects to stored files by resource kind and ID, applying per-kind access rules (player photos respect the safeguarding rule).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheControl ¶
CacheControl returns the Cache-Control for a file redirect of the given kind (shared by the API handler and /download). Player photos must not be cached publicly: if a player moves to a youth team, or an under-18's photo must stop being shown, a year-long public cache would keep serving the old redirect to browsers and CDNs regardless.
func LegacyKind ¶
LegacyKind maps the old /download?s=<code> codes to kinds.
Types ¶
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers serves /files.
func NewHandlers ¶
func (*Handlers) RegisterDownload ¶
RegisterDownload keeps /download?s=<code>&id=<n> working for old links, including ones inside saved articles; it redirects like GET /api/v1/files.
type PhotoKeyer ¶
PhotoKeyer resolves player photos by public UUID, enforcing the safeguarding rule (satisfied by *player.Service).
type Resolver ¶
Resolver returns the storage key for a resource ID ("" when it has no file). The ID is a positive integer, or a UUID for the kinds in uuidKinds.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service resolves files to public URLs.
type Sources ¶
type Sources struct {
Affiliation interface {
GetAffiliation(ctx context.Context, a affiliation.Affiliation) (affiliation.Affiliation, error)
}
Document interface {
GetDocument(ctx context.Context, d document.Document) (document.Document, error)
}
Image interface {
GetImage(ctx context.Context, i image.Image) (image.Image, error)
}
News interface {
GetNewsArticle(ctx context.Context, n news.News) (news.News, error)
}
Programme interface {
GetProgramme(ctx context.Context, p programme.Programme) (programme.Programme, error)
}
Sponsor interface {
GetSponsor(ctx context.Context, s sponsor.Sponsor) (sponsor.Sponsor, error)
}
Team interface {
GetTeam(ctx context.Context, t team.Team) (team.Team, error)
}
User interface {
GetUserByUUID(ctx context.Context, id string) (user.User, error)
}
WhatsOn interface {
GetWhatsOnArticle(ctx context.Context, w whatson.WhatsOn) (whatson.WhatsOn, error)
}
Players PhotoKeyer
}
Sources are the lookups behind each kind (satisfied by the domain stores).