akkoma/lib/pleroma/web/mastodon_api/views/app_view.ex

28 lines
623 B
Elixir
Raw Normal View History

# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AppView do
use Pleroma.Web, :view
alias Pleroma.Web.OAuth.App
def render("show.json", %{app: %App{website: webiste, client_name: name}}) do
result = %{
name: name,
website: webiste
}
vapid_key = Pleroma.Web.Push.vapid_config() |> Keyword.get(:public_key)
result =
if vapid_key do
Map.put(result, "vapid_key", vapid_key)
else
result
end
result
end
end