From 3b036f49753e13e7902d4481961b98687ad3748b Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sat, 10 Jun 2023 23:19:31 -0400 Subject: [PATCH] some fixups to grab "image" property as seen on lemmy --- activity.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/activity.go b/activity.go index 5fe11de..99b61c1 100644 --- a/activity.go +++ b/activity.go @@ -689,7 +689,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { case "Audio": fallthrough case "Image": - preferorig = true + if what == "Image" { + preferorig = true + } fallthrough case "Video": fallthrough @@ -837,6 +839,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { procatt := func(att junk.Junk) { at, _ := att.GetString("type") mt, _ := att.GetString("mediaType") + if mt == "" { + mt = "image" + } u, ok := att.GetString("url") if !ok { u, ok = att.GetString("href") @@ -890,6 +895,9 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk { } numatts++ } + if img, ok := obj.GetMap("image"); ok { + procatt(img) + } if preferorig { atts, _ := obj.GetArray("url") for _, atti := range atts {