Deprecate Pleroma.Web.base_url/0
[akkoma] / lib / pleroma / web / twitter_api / views / util_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 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.Form
8 alias Pleroma.Config
9 alias Pleroma.Web.Endpoint
10
11 def status_net_config(instance) do
12 """
13 <config>
14 <site>
15 <name>#{Keyword.get(instance, :name)}</name>
16 <site>#{Endpoint.url()}</site>
17 <textlimit>#{Keyword.get(instance, :limit)}</textlimit>
18 <closed>#{!Keyword.get(instance, :registrations_open)}</closed>
19 </site>
20 </config>
21 """
22 end
23
24 def render("frontend_configurations.json", _) do
25 Config.get(:frontend_configurations, %{})
26 |> Enum.into(%{})
27 end
28 end