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
|
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) {
|
func consumeactivity(user *WhatAbout, j junk.Junk, origin string) {
|
||||||
xonk := xonkxonk(user, j, origin)
|
xonk := xonkxonk(user, j, origin)
|
||||||
if xonk != nil {
|
if xonk != nil {
|
||||||
|
@ -486,6 +505,8 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
obj, _ = item.GetMap("object")
|
obj, _ = item.GetMap("object")
|
||||||
xid, _ = item.GetString("object")
|
xid, _ = item.GetString("object")
|
||||||
what = "eradicate"
|
what = "eradicate"
|
||||||
|
case "Video":
|
||||||
|
fallthrough
|
||||||
case "Question":
|
case "Question":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "Note":
|
case "Note":
|
||||||
|
@ -508,12 +529,14 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
who, _ := item.GetString("actor")
|
who, _ := item.GetString("actor")
|
||||||
if obj != nil {
|
if obj != nil {
|
||||||
if who == "" {
|
if who == "" {
|
||||||
who, _ = obj.GetString("attributedTo")
|
who = extractattrto(obj)
|
||||||
}
|
}
|
||||||
oonker, _ = obj.GetString("attributedTo")
|
oonker = extractattrto(obj)
|
||||||
ot, _ := obj.GetString("type")
|
ot, _ := obj.GetString("type")
|
||||||
url, _ = obj.GetString("url")
|
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)
|
audience = newphone(audience, obj)
|
||||||
xid, _ = obj.GetString("id")
|
xid, _ = obj.GetString("id")
|
||||||
precis, _ = obj.GetString("summary")
|
precis, _ = obj.GetString("summary")
|
||||||
|
@ -553,9 +576,6 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
|
||||||
what = "tonk"
|
what = "tonk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ot == "Tombstone" {
|
|
||||||
xid, _ = obj.GetString("id")
|
|
||||||
}
|
|
||||||
atts, _ := obj.GetArray("attachment")
|
atts, _ := obj.GetArray("attachment")
|
||||||
for i, atti := range atts {
|
for i, atti := range atts {
|
||||||
att, ok := atti.(junk.Junk)
|
att, ok := atti.(junk.Junk)
|
||||||
|
|
|
@ -2,6 +2,8 @@ changelog
|
||||||
|
|
||||||
-- next
|
-- next
|
||||||
|
|
||||||
|
+ Minimal support for Video activity and PeerTube compat.
|
||||||
|
|
||||||
+ Support for some user selectable styling. Currently, skinny column mode.
|
+ Support for some user selectable styling. Currently, skinny column mode.
|
||||||
|
|
||||||
+ webp image transcoding.
|
+ webp image transcoding.
|
||||||
|
|
Loading…
Reference in New Issue