Skip to content

Commit

Permalink
Add support for alsoKnownAs
Browse files Browse the repository at this point in the history
  • Loading branch information
jlelse committed Nov 20, 2024
1 parent a1e4c4e commit 1fc817c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions activityStreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ func (a *goBlog) toApPerson(blog string) *goBlogPerson {
}
apBlog.AttributionDomains = attributionDomains

var alsoKnownAs ap.ItemCollection
for _, aka := range a.cfg.ActivityPub.AlsoKnownAs {
alsoKnownAs = append(alsoKnownAs, ap.IRI(aka))
}
apBlog.AlsoKnownAs = alsoKnownAs

return apBlog
}

Expand Down Expand Up @@ -232,6 +238,9 @@ func (a goBlogPerson) MarshalJSON() ([]byte, error) {
}

// Custom
if len(a.AlsoKnownAs) > 0 {
notEmpty = ap.JSONWriteItemCollectionProp(&b, "alsoKnownAs", a.AlsoKnownAs, false)
}
if len(a.AttributionDomains) > 0 {
notEmpty = ap.JSONWriteItemCollectionProp(&b, "attributionDomains", a.AttributionDomains, false)
}
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ type configActivityPub struct {
Enabled bool `mapstructure:"enabled"`
TagsTaxonomies []string `mapstructure:"tagsTaxonomies"`
AttributionDomains []string `mapstructure:"attributionDomains"`
AlsoKnownAs []string `mapstructure:"alsoKnownAs"`
}

type configNotifications struct {
Expand Down
2 changes: 2 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ activityPub:
- tags
attributionDomains: # Domains allowed to use fediverse:creator for your ActivityPub actors in published articles
- example.com # Add your blog at least
alsoKnownAs: # Alias identities, add your old Fediverse user if you want to migrate followers to GoBlog
- https://example.com/users/example

# Webmention
webmention:
Expand Down

0 comments on commit 1fc817c

Please sign in to comment.