some fixups to grab "image" property as seen on lemmy
This commit is contained in:
parent
314e0bb805
commit
3b036f4975
10
activity.go
10
activity.go
|
@ -689,7 +689,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
case "Audio":
|
case "Audio":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "Image":
|
case "Image":
|
||||||
preferorig = true
|
if what == "Image" {
|
||||||
|
preferorig = true
|
||||||
|
}
|
||||||
fallthrough
|
fallthrough
|
||||||
case "Video":
|
case "Video":
|
||||||
fallthrough
|
fallthrough
|
||||||
|
@ -837,6 +839,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
procatt := func(att junk.Junk) {
|
procatt := func(att junk.Junk) {
|
||||||
at, _ := att.GetString("type")
|
at, _ := att.GetString("type")
|
||||||
mt, _ := att.GetString("mediaType")
|
mt, _ := att.GetString("mediaType")
|
||||||
|
if mt == "" {
|
||||||
|
mt = "image"
|
||||||
|
}
|
||||||
u, ok := att.GetString("url")
|
u, ok := att.GetString("url")
|
||||||
if !ok {
|
if !ok {
|
||||||
u, ok = att.GetString("href")
|
u, ok = att.GetString("href")
|
||||||
|
@ -890,6 +895,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
}
|
}
|
||||||
numatts++
|
numatts++
|
||||||
}
|
}
|
||||||
|
if img, ok := obj.GetMap("image"); ok {
|
||||||
|
procatt(img)
|
||||||
|
}
|
||||||
if preferorig {
|
if preferorig {
|
||||||
atts, _ := obj.GetArray("url")
|
atts, _ := obj.GetArray("url")
|
||||||
for _, atti := range atts {
|
for _, atti := range atts {
|
||||||
|
|
Loading…
Reference in New Issue