ActivityPub: Use only string keys in views.

This commit is contained in:
Lain Iwakura 2017-12-11 18:20:41 +01:00
parent da005d3332
commit a89a613e4e
1 changed files with 30 additions and 30 deletions

View File

@ -8,43 +8,43 @@ def render("user.json", %{user: user}) do
public_key = :public_key.pem_entry_encode(:RSAPublicKey, public_key) public_key = :public_key.pem_entry_encode(:RSAPublicKey, public_key)
public_key = :public_key.pem_encode([public_key]) public_key = :public_key.pem_encode([public_key])
%{ %{
"@context": [ "@context" => [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1", "https://w3id.org/security/v1",
%{ %{
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers", "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
"sensitive": "as:sensitive", "sensitive" => "as:sensitive",
"Hashtag": "as:Hashtag", "Hashtag" => "as:Hashtag",
"ostatus": "http://ostatus.org#", "ostatus" => "http://ostatus.org#",
"atomUri": "ostatus:atomUri", "atomUri" => "ostatus:atomUri",
"inReplyToAtomUri": "ostatus:inReplyToAtomUri", "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
"conversation": "ostatus:conversation", "conversation" => "ostatus:conversation",
"toot": "http://joinmastodon.org/ns#", "toot" => "http://joinmastodon.org/ns#",
"Emoji": "toot:Emoji" "Emoji" => "toot:Emoji"
} }
], ],
"id": user.ap_id, "id" => user.ap_id,
"type": "Person", "type" => "Person",
"following": "#{user.ap_id}/following", "following" => "#{user.ap_id}/following",
"followers": "#{user.ap_id}/followers", "followers" => "#{user.ap_id}/followers",
"inbox": "#{user.ap_id}/inbox", "inbox" => "#{user.ap_id}/inbox",
"outbox": "#{user.ap_id}/outbox", "outbox" => "#{user.ap_id}/outbox",
"preferredUsername": user.nickname, "preferredUsername" => user.nickname,
"name": user.name, "name" => user.name,
"summary": user.bio, "summary" => user.bio,
"url": user.ap_id, "url" => user.ap_id,
"manuallyApprovesFollowers": false, "manuallyApprovesFollowers" => false,
"publicKey": %{ "publicKey" => %{
"id": "#{user.ap_id}#main-key", "id" => "#{user.ap_id}#main-key",
"owner": user.ap_id, "owner" => user.ap_id,
"publicKeyPem": public_key "publicKeyPem" => public_key
}, },
"endpoints": %{ "endpoints" => %{
"sharedInbox": "#{Pleroma.Web.Endpoint.url}/inbox" "sharedInbox" => "#{Pleroma.Web.Endpoint.url}/inbox"
}, },
"icon": %{ "icon" => %{
"type": "Image", "type" => "Image",
"url": User.avatar_url(user) "url" => User.avatar_url(user)
} }
} }
end end