forked from potsda.mn/mobilizon
Format
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
559c889f1b
commit
7e137d1a1c
|
@ -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
|
||||||
|
|
|
@ -12,10 +12,11 @@ defmodule MobilizonWeb.ActivityPubController do
|
||||||
def actor(conn, %{"name" => name}) do
|
def actor(conn, %{"name" => name}) do
|
||||||
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
|
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
|
||||||
case get_req_header(conn, "accept") do
|
case get_req_header(conn, "accept") do
|
||||||
["application/activity+json"] ->
|
["application/activity+json"] ->
|
||||||
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")
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -8,7 +8,7 @@ defmodule MobilizonWeb.PageController do
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_content_type("text/html")
|
|> put_resp_content_type("text/html")
|
||||||
|> send_file(200, "priv/static/index.html")
|
|> send_file(200, "priv/static/index.html")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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))
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue