aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-08-24 14:07:05 +0200
committerRoger Braun <roger@rogerbraun.net>2017-08-24 14:07:05 +0200
commit8a97bebc5349dc4b388567ce8c7335a51c2427f3 (patch)
tree1a1b2891a9a6972dff985866176b49a07653212e /lib
parent7ccdebe1800d4790f42172704c61bdc0e3d08d5e (diff)
downloadpleroma-8a97bebc5349dc4b388567ce8c7335a51c2427f3.tar.gz
More meta info fixes.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/router.ex11
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex41
2 files changed, 44 insertions, 8 deletions
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 = """
+ <config>
+ <site>
+ <name>#{Web.base_url}</name>
+ <site>#{Web.base_url}</site>
+ <textlimit>5000</textlimit>
+ </site>
+ </config>
+ """
+ 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 = "<version>Pleroma Dev</version>"
+ conn
+ |> put_resp_content_type("application/xml")
+ |> send_resp(200, response)
+ _ -> json(conn, "Pleroma Dev")
+ end
end
end