isolate signature in images
Some checks failed
docker / Docker (push) Has been cancelled
test / Test (push) Has been cancelled

This commit is contained in:
Failure 2024-08-08 23:17:06 -07:00
parent 17d4d46d09
commit 4f4f7ac6e2

View file

@ -83,7 +83,8 @@ func subThumbnail(url string) string {
Height: 400, Height: 400,
} }
path := imagorpath.Generate(params, imagorpath.NewHMACSigner(sha256.New, 0, key)) path := imagorpath.Generate(params, imagorpath.NewHMACSigner(sha256.New, 0, key))
return path signature := path[:strings.IndexByte(path, '/')]
return signature
} }
// Process implements imagor.Processor interface // Process implements imagor.Processor interface
@ -156,7 +157,8 @@ func (p *Processor) Process(ctx context.Context, in *imagor.Blob, params imagorp
case "og:image": case "og:image":
fallthrough fallthrough
case "twitter:image:src": case "twitter:image:src":
meta.Image = subThumbnail(val) meta.ImageSignature = subThumbnail(val)
meta.Image = val
break break
case "og:title": case "og:title":
@ -190,6 +192,7 @@ type Metadata struct {
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
Image string `json:"image"` Image string `json:"image"`
ImageSignature string `json:"image_signature"`
Hostname string `json:"hostname"` Hostname string `json:"hostname"`
SpecialHandler string `json:"special_handler"` SpecialHandler string `json:"special_handler"`
SpecialData map[string]string `json:"special_data"` SpecialData map[string]string `json:"special_data"`