67e86294e6c8739962da35ce8e45388d4ddedbf2
[akkoma] / lib / pleroma / web / mastodon_api / views / push_subscription_view.ex
1 defmodule Pleroma.Web.MastodonAPI.PushSubscriptionView do
2 use Pleroma.Web, :view
3
4 def render("push_subscription.json", %{subscription: subscription}) do
5 %{
6 id: to_string(subscription.id),
7 endpoint: subscription.endpoint,
8 alerts: Map.get(subscription.data, "alerts"),
9 server_key: server_key()
10 }
11 end
12
13 defp server_key do
14 Keyword.get(Application.get_env(:web_push_encryption, :vapid_details), :public_key)
15 end
16 end