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)
|> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}")
|> 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")
|> validate_required([:preferred_username, :keys, :suspended, :url, :type])
end

View File

@ -12,10 +12,11 @@ defmodule MobilizonWeb.ActivityPubController do
def actor(conn, %{"name" => name}) do
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
case get_req_header(conn, "accept") do
["application/activity+json"] ->
["application/activity+json"] ->
conn
|> put_resp_header("content-type", "application/activity+json")
|> json(ActorView.render("actor.json", %{actor: actor}))
_ ->
conn
|> put_resp_content_type("text/html")

View File

@ -41,7 +41,9 @@ defmodule MobilizonWeb.GroupController do
nil ->
conn
|> 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 ->
require Logger

View File

@ -8,7 +8,7 @@ defmodule MobilizonWeb.PageController do
def index(conn, _params) do
conn
|> put_resp_content_type("text/html")
|> send_file(200, "priv/static/index.html")
|> put_resp_content_type("text/html")
|> send_file(200, "priv/static/index.html")
end
end

View File

@ -261,7 +261,10 @@ defmodule Mobilizon.Service.ActivityPub do
host = URI.parse(inbox).host
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(inspect(signature))

View File

@ -10,7 +10,11 @@ defmodule MobilizonWeb.NodeinfoControllerTest do
"links" => [
%{
"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"
}
]