diff options
Diffstat (limited to 'backend/notes/app.bsky.actor.go')
| -rw-r--r-- | backend/notes/app.bsky.actor.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/backend/notes/app.bsky.actor.go b/backend/notes/app.bsky.actor.go index dc5d536..797a8e8 100644 --- a/backend/notes/app.bsky.actor.go +++ b/backend/notes/app.bsky.actor.go @@ -17,6 +17,12 @@ type AppBskyActorProfileRecord struct { } `json:"ref"` } `json:"banner,omitempty"` Pronouns string `json:"pronouns"` + Labels *struct { + Type string `json:"$type"` + Values []struct { + Val string `json:"val"` + } `json:"values"` + } `json:"labels,omitempty"` } func AuthorFromAppBskyActorProfileRecord(record AppBskyActorProfileRecord, did, handle string) (*Author, error) { @@ -28,12 +34,23 @@ func AuthorFromAppBskyActorProfileRecord(record AppBskyActorProfileRecord, did, bannerURL = fmt.Sprintf("https://cdn.bsky.app/img/banner/plain/%s/%s@jpeg", did, record.Banner.Ref.Link) } + // check for !no-unauthenticated label + noUnauth := false + if record.Labels != nil && record.Labels.Type == "com.atproto.label.defs#selfLabels" { + for _, label := range record.Labels.Values { + if label.Val == "!no-unauthenticated" { + noUnauth = true + } + } + } + author := &Author{ Handle: handle, DisplayName: record.DisplayName, AvatarURL: avatarURL, BannerURL: bannerURL, Pronouns: record.Pronouns, + NoUnauth: noUnauth, } return author, nil |
