1976d4dcb00a0ce92ce041e95f375e8f733c8714
[akkoma] / lib / pleroma / web / mastodon_api / views / app_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.AppView do
6 use Pleroma.Web, :view
7
8 alias Pleroma.Web.OAuth.App
9
10 def render("show.json", %{app: %App{website: webiste, client_name: name}}) do
11 result = %{
12 name: name,
13 website: webiste
14 }
15
16 vapid_key = Pleroma.Web.Push.vapid_config() |> Keyword.get(:public_key)
17
18 result =
19 if vapid_key do
20 Map.put(result, "vapid_key", vapid_key)
21 else
22 result
23 end
24
25 result
26 end
27 end