Comment Webfinger controller properly

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-12-27 11:31:06 +01:00
parent caae6d0c0a
commit d5eac1df6c
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 10 additions and 4 deletions

View file

@ -4,10 +4,16 @@
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/web_finger/web_finger_controller.ex
defmodule MobilizonWeb.WebFingerController do
@moduledoc """
Handles Webfinger requests
"""
use MobilizonWeb, :controller
alias Mobilizon.Service.WebFinger
@doc """
Provides /.well-known/host-meta
"""
def host_meta(conn, _params) do
xml = WebFinger.host_meta()
@ -16,6 +22,9 @@ defmodule MobilizonWeb.WebFingerController do
|> send_resp(200, xml)
end
@doc """
Provides /.well-known/webfinger
"""
def webfinger(conn, %{"resource" => resource}) do
with {:ok, response} <- WebFinger.webfinger(resource, "JSON") do
json(conn, response)
@ -24,7 +33,5 @@ defmodule MobilizonWeb.WebFingerController do
end
end
def webfinger(conn, _) do
send_resp(conn, 400, "No query provided")
end
def webfinger(conn, _), do: send_resp(conn, 400, "No query provided")
end

View file

@ -4,7 +4,6 @@
# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/transmogrifier_test.exs
defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
use Mobilizon.DataCase
import Mobilizon.Factory