update copyright years to 2019
[akkoma] / lib / pleroma / web / mastodon_api / views / push_subscription_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.PushSubscriptionView do
6 use Pleroma.Web, :view
7
8 def render("push_subscription.json", %{subscription: subscription}) do
9 %{
10 id: to_string(subscription.id),
11 endpoint: subscription.endpoint,
12 alerts: Map.get(subscription.data, "alerts"),
13 server_key: server_key()
14 }
15 end
16
17 defp server_key do
18 Keyword.get(Application.get_env(:web_push_encryption, :vapid_details), :public_key)
19 end
20 end