logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: 3af9692352a54f6f85d5c9b7eeba00bca605db69
parent 254b31bf1caee1f3ad1407e477ea7c304c8c8f3b
Author: Moon Man <shitposterclub@gmail.com>
Date:   Thu, 20 Mar 2025 15:25:00 +0000

return json if no accept is specified

Diffstat:

Mlib/pleroma/web/web_finger/web_finger_controller.ex12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/pleroma/web/web_finger/web_finger_controller.ex b/lib/pleroma/web/web_finger/web_finger_controller.ex @@ -41,5 +41,17 @@ defmodule Pleroma.Web.WebFinger.WebFingerController do end end + # Default to JSON when no format is specified or format is not recognized + def webfinger(%{assigns: %{format: _format}} = conn, %{"resource" => resource}) do + with {:ok, response} <- WebFinger.webfinger(resource, "JSON") do + json(conn, response) + else + _e -> + conn + |> put_status(404) + |> json("Couldn't find user") + end + end + def webfinger(conn, _params), do: send_resp(conn, 400, "Bad Request") end