Fix opengraph icons

This commit is contained in:
2021-11-10 19:30:49 +01:00
parent 04fb4e5b27
commit e99a00e369
6 changed files with 17 additions and 24 deletions

View File

@@ -59,12 +59,14 @@ func (wc *WebController) metadataFromFile(f pixelapi.FileInfo) (og ogData) {
og.addLink("image_src", wc.websiteAddress+"/api/file/"+f.ID+"/thumbnail")
} else if strings.HasPrefix(f.MimeType, "audio") {
og.addProp("og:type", "music.song")
og.addProp("og:image", wc.websiteAddress+"/api/file/"+f.ID+"/thumbnail")
og.addProp("og:audio", wc.websiteAddress+"/api/file/"+f.ID)
og.addProp("og:audio:secure_url", wc.websiteAddress+"/api/file/"+f.ID)
og.addProp("og:audio:type", f.MimeType)
og.addLink("image_src", wc.websiteAddress+"/api/file/"+f.ID+"/thumbnail")
} else {
og.addProp("og:type", "website")
og.addProp("og:image", wc.websiteAddress+"/api/file/"+f.ID+"/thumbnail")
og.addLink("image_src", wc.websiteAddress+"/api/file/"+f.ID+"/thumbnail")
}
return og

View File

@@ -114,15 +114,6 @@ type hsl struct {
Lightness float64
}
func (h hsl) cssString() string {
return fmt.Sprintf(
"hsl(%d, %.3f%%, %.3f%%)",
h.Hue,
h.Saturation*100,
h.Lightness*100,
)
}
func (orig hsl) RGB() string {
var r, g, b, q, p float64
var h, s, l = float64(orig.Hue) / 360, orig.Saturation, orig.Lightness