Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-10-11 17:47:02 +02:00
parent 559c889f1b
commit 7e137d1a1c
6 changed files with 20 additions and 7 deletions

View File

@ -96,7 +96,10 @@ defmodule Mobilizon.Actors.Actor do
|> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index) |> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
|> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}") |> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}")
|> put_change(:inbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/inbox") |> put_change(:inbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/inbox")
|> put_change(:outbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox") |> put_change(
:outbox_url,
"#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox"
)
|> put_change(:shared_inbox_url, "#{MobilizonWeb.Endpoint.url()}/inbox") |> put_change(:shared_inbox_url, "#{MobilizonWeb.Endpoint.url()}/inbox")
|> validate_required([:preferred_username, :keys, :suspended, :url, :type]) |> validate_required([:preferred_username, :keys, :suspended, :url, :type])
end end

View File

@ -16,6 +16,7 @@ defmodule MobilizonWeb.ActivityPubController do
conn conn
|> put_resp_header("content-type", "application/activity+json") |> put_resp_header("content-type", "application/activity+json")
|> json(ActorView.render("actor.json", %{actor: actor})) |> json(ActorView.render("actor.json", %{actor: actor}))
_ -> _ ->
conn conn
|> put_resp_content_type("text/html") |> put_resp_content_type("text/html")

View File

@ -41,7 +41,9 @@ defmodule MobilizonWeb.GroupController do
nil -> nil ->
conn conn
|> put_status(:not_found) |> put_status(:not_found)
|> render(MobilizonWeb.ErrorView, "not_found.json", details: "group or actor doesn't exist") |> render(MobilizonWeb.ErrorView, "not_found.json",
details: "group or actor doesn't exist"
)
err -> err ->
require Logger require Logger

View File

@ -261,7 +261,10 @@ defmodule Mobilizon.Service.ActivityPub do
host = URI.parse(inbox).host host = URI.parse(inbox).host
signature = signature =
Mobilizon.Service.HTTPSignatures.sign(actor, %{host: host, "content-length": byte_size(json)}) Mobilizon.Service.HTTPSignatures.sign(actor, %{
host: host,
"content-length": byte_size(json)
})
Logger.debug("signature") Logger.debug("signature")
Logger.debug(inspect(signature)) Logger.debug(inspect(signature))

View File

@ -10,7 +10,11 @@ defmodule MobilizonWeb.NodeinfoControllerTest do
"links" => [ "links" => [
%{ %{
"href" => "href" =>
MobilizonWeb.Router.Helpers.nodeinfo_url(MobilizonWeb.Endpoint, :nodeinfo, "2.0"), MobilizonWeb.Router.Helpers.nodeinfo_url(
MobilizonWeb.Endpoint,
:nodeinfo,
"2.0"
),
"rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0" "rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0"
} }
] ]