Format
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
6c6f93038e
commit
4bd2dd8a0e
@ -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
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user