postland/lib/postland_web/controllers/webfinger_json.ex
2024-10-16 10:30:23 -05:00

30 lines
791 B
Elixir

defmodule PostlandWeb.WebfingerJSON do
use Phoenix.VerifiedRoutes, endpoint: PostlandWeb.Endpoint, router: PostlandWeb.Router
alias Postland.Accounts
def render("webfinger.json", _assigns) do
user = Accounts.solo_user()
%{
subject: "acct:#{user.username}@#{PostlandWeb.Endpoint.host()}",
links: [
%{
"rel" => "self",
"type" => "application/activity+json",
"href" => url(~p"/actor")
},
%{
"rel" => "http://webfinger.net/rel/profile-page",
"type" => "text/html",
"href" => url(~p"/about")
},
%{
"rel" => "http://webfinger.net/rel/avatar",
"type" => "image/png",
"href" => url(~p"/images/avatar.png")
}
]
}
end
end