diff options
Diffstat (limited to '')
-rw-r--r-- | views/actor.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/views/actor.go b/views/actor.go index 48aaa0b..bc89f95 100644 --- a/views/actor.go +++ b/views/actor.go @@ -7,7 +7,7 @@ import ( "github.com/go-fed/activity/streams" ) -func RenderActor(name, domain, pem string) (map[string]interface{}, error) { +func RenderActor(name, domain, pem, mediaType string) (map[string]interface{}, error) { inbox, err := urls.UrlInbox(name, domain) if err != nil { return nil, err @@ -34,6 +34,11 @@ func RenderActor(name, domain, pem string) (map[string]interface{}, error) { return nil, err } + actorAvatarUrl, err := urls.UrlActorAvatar(name, domain) + if err != nil { + return nil, err + } + followingUrl, err := urls.UrlFollowing(name, domain) if err != nil { return nil, err @@ -51,6 +56,18 @@ func RenderActor(name, domain, pem string) (map[string]interface{}, error) { p.SetActivityStreamsInbox(inboxProp) p.SetActivityStreamsOutbox(outboxProp) + image := streams.NewActivityStreamsImage() + mediaTypeProp := streams.NewActivityStreamsMediaTypeProperty() + mediaTypeProp.Set(mediaType) + image.SetActivityStreamsMediaType(mediaTypeProp) + urlProp := streams.NewActivityStreamsUrlProperty() + urlProp.AppendIRI(actorAvatarUrl) + image.SetActivityStreamsUrl(urlProp) + + iconProp := streams.NewActivityStreamsIconProperty() + iconProp.AppendActivityStreamsImage(image) + p.SetActivityStreamsIcon(iconProp) + nameProp := streams.NewActivityStreamsNameProperty() nameProp.AppendXMLSchemaString(name) p.SetActivityStreamsName(nameProp) @@ -59,7 +76,7 @@ func RenderActor(name, domain, pem string) (map[string]interface{}, error) { usernameProp.SetXMLSchemaString(name) p.SetActivityStreamsPreferredUsername(usernameProp) - urlProp := streams.NewActivityStreamsUrlProperty() + urlProp = streams.NewActivityStreamsUrlProperty() urlProp.AppendIRI(actorUrl) p.SetActivityStreamsUrl(urlProp) |