Add avatar URL to Webfinger when available
This commit is contained in:
@@ -33,6 +33,10 @@ class WebfingerController < WellKnownController
|
||||
links: []
|
||||
}
|
||||
|
||||
if @user.avatar.attached?
|
||||
jrd[:links] += avatar_link
|
||||
end
|
||||
|
||||
if Setting.mastodon_enabled && @user.service_enabled?(:mastodon)
|
||||
# https://docs.joinmastodon.org/spec/webfinger/
|
||||
jrd[:aliases] += mastodon_aliases
|
||||
@@ -47,6 +51,16 @@ class WebfingerController < WellKnownController
|
||||
jrd
|
||||
end
|
||||
|
||||
def avatar_link
|
||||
[
|
||||
{
|
||||
rel: "http://webfinger.net/rel/avatar",
|
||||
type: @user.avatar.content_type,
|
||||
href: helpers.image_url_for(@user.avatar)
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
def mastodon_aliases
|
||||
[
|
||||
"#{Setting.mastodon_public_url}/@#{@user.cn}",
|
||||
|
||||
Reference in New Issue
Block a user