some fixes and changes necessary to support peertube links
This commit is contained in:
parent
227a6a38c4
commit
ff73147e28
32
activity.go
32
activity.go
|
@ -419,6 +419,25 @@ func newphone(a []string, obj junk.Junk) []string {
|
|||
return a
|
||||
}
|
||||
|
||||
func extractattrto(obj junk.Junk) string {
|
||||
who, _ := obj.GetString("attributedTo")
|
||||
if who != "" {
|
||||
return who
|
||||
}
|
||||
arr, _ := obj.GetArray("attributedTo")
|
||||
for _, a := range arr {
|
||||
o, ok := a.(junk.Junk)
|
||||
if ok {
|
||||
t, _ := o.GetString("type")
|
||||
id, _ := o.GetString("id")
|
||||
if t == "Person" || t == "" {
|
||||
return id
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func consumeactivity(user *WhatAbout, j junk.Junk, origin string) {
|
||||
xonk := xonkxonk(user, j, origin)
|
||||
if xonk != nil {
|
||||
|
@ -486,6 +505,8 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
|||
obj, _ = item.GetMap("object")
|
||||
xid, _ = item.GetString("object")
|
||||
what = "eradicate"
|
||||
case "Video":
|
||||
fallthrough
|
||||
case "Question":
|
||||
fallthrough
|
||||
case "Note":
|
||||
|
@ -508,12 +529,14 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
|||
who, _ := item.GetString("actor")
|
||||
if obj != nil {
|
||||
if who == "" {
|
||||
who, _ = obj.GetString("attributedTo")
|
||||
who = extractattrto(obj)
|
||||
}
|
||||
oonker, _ = obj.GetString("attributedTo")
|
||||
oonker = extractattrto(obj)
|
||||
ot, _ := obj.GetString("type")
|
||||
url, _ = obj.GetString("url")
|
||||
if ot == "Note" || ot == "Article" || ot == "Page" || ot == "Question" {
|
||||
if ot == "Tombstone" {
|
||||
xid, _ = obj.GetString("id")
|
||||
} else {
|
||||
audience = newphone(audience, obj)
|
||||
xid, _ = obj.GetString("id")
|
||||
precis, _ = obj.GetString("summary")
|
||||
|
@ -553,9 +576,6 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
|||
what = "tonk"
|
||||
}
|
||||
}
|
||||
if ot == "Tombstone" {
|
||||
xid, _ = obj.GetString("id")
|
||||
}
|
||||
atts, _ := obj.GetArray("attachment")
|
||||
for i, atti := range atts {
|
||||
att, ok := atti.(junk.Junk)
|
||||
|
|
|
@ -2,6 +2,8 @@ changelog
|
|||
|
||||
-- next
|
||||
|
||||
+ Minimal support for Video activity and PeerTube compat.
|
||||
|
||||
+ Support for some user selectable styling. Currently, skinny column mode.
|
||||
|
||||
+ webp image transcoding.
|
||||
|
|
Loading…
Reference in New Issue