change image library and refactor thumbnails service

This commit is contained in:
David Christofas
2020-11-26 16:36:51 +01:00
parent c5a75291f9
commit c46a5598d4
18 changed files with 355 additions and 321 deletions
@@ -16,15 +16,16 @@ type Source interface {
Get(ctx context.Context, path string) (image.Image, error)
}
// WithAuthorization puts the authorization in the context.
func WithAuthorization(parent context.Context, authorization string) context.Context {
// ContextSetAuthorization puts the authorization in the context.
func ContextSetAuthorization(parent context.Context, authorization string) context.Context {
return context.WithValue(parent, auth, authorization)
}
func authorization(ctx context.Context) string {
// ContextGetAuthorization gets the authorization from the context.
func ContextGetAuthorization(ctx context.Context) (string, bool) {
val := ctx.Value(auth)
if val == nil {
return ""
return "", false
}
return val.(string)
return val.(string), true
}