change image library and refactor thumbnails service
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user