akkoma/lib/pleroma/web/twitter_api/controllers/util_controller.ex

58 lines
1.3 KiB
Elixir
Raw Normal View History

2017-06-20 14:55:57 +00:00
defmodule Pleroma.Web.TwitterAPI.UtilController do
use Pleroma.Web, :controller
alias Pleroma.Web
def help_test(conn, _params) do
json(conn, "ok")
end
def config(conn, _params) do
2017-08-24 12:07:05 +00:00
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
2017-06-20 14:55:57 +00:00
end
2017-08-24 12:15:16 +00:00
# TODO: Move this
def masto_instance(conn, _params) do
response = %{
uri: Web.base_url,
title: Web.base_url,
description: "A Pleroma instance, an alternative fediverse server",
version: "dev"
}
json(conn, response)
end
2017-06-20 14:55:57 +00:00
end