31b7c0c0c84a3642005e22a0c030fbf77dc87879
[anni] / lib / pleroma / web / twitter_api / views / util_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.TwitterAPI.UtilView do
6   use Pleroma.Web, :view
7   import Phoenix.HTML
8   import Phoenix.HTML.Form
9   import Phoenix.HTML.Link
10   alias Pleroma.Config
11   alias Pleroma.Web.Endpoint
12   alias Pleroma.Web.Gettext
13
14   def status_net_config(instance) do
15     """
16     <config>
17     <site>
18     <name>#{Keyword.get(instance, :name)}</name>
19     <site>#{Endpoint.url()}</site>
20     <textlimit>#{Keyword.get(instance, :limit)}</textlimit>
21     <closed>#{!Keyword.get(instance, :registrations_open)}</closed>
22     </site>
23     </config>
24     """
25   end
26
27   def render("frontend_configurations.json", _) do
28     Config.get(:frontend_configurations, %{})
29     |> Enum.into(%{})
30   end
31 end