From: Roger Braun Date: Thu, 24 Aug 2017 12:07:05 +0000 (+0200) Subject: More meta info fixes. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=8a97bebc5349dc4b388567ce8c7335a51c2427f3;p=akkoma More meta info fixes. --- diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index f88b71915..585642c33 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -23,12 +23,21 @@ defmodule Pleroma.Web.Router do plug :accepts, ["xml", "xrd+xml"] end + pipeline :config do + plug :accepts, ["json", "xml"] + end + scope "/api", Pleroma.Web do - pipe_through :api + pipe_through :config get "/help/test", TwitterAPI.UtilController, :help_test post "/help/test", TwitterAPI.UtilController, :help_test get "/statusnet/config", TwitterAPI.UtilController, :config + get "/statusnet/version", TwitterAPI.UtilController, :version + end + + scope "/api", Pleroma.Web do + pipe_through :api get "/statuses/public_timeline", TwitterAPI.Controller, :public_timeline get "/statuses/public_and_external_timeline", TwitterAPI.Controller, :public_and_external_timeline diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 2bcae74ce..41881e742 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -7,12 +7,39 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do end def config(conn, _params) do - json(conn, %{ - site: %{ - name: Web.base_url, - server: Web.base_url, - textlimit: 5000 - } - }) + case get_format(conn) do + "xml" -> + response = """ + + + #{Web.base_url} + #{Web.base_url} + 5000 + + + """ + conn + |> put_resp_content_type("application/xml") + |> send_resp(200, response) + _ -> + json(conn, %{ + site: %{ + name: Web.base_url, + server: Web.base_url, + textlimit: 5000 + } + }) + end + end + + def version(conn, _params) do + case get_format(conn) do + "xml" -> + response = "Pleroma Dev" + conn + |> put_resp_content_type("application/xml") + |> send_resp(200, response) + _ -> json(conn, "Pleroma Dev") + end end end