can be changed in runtime

This commit is contained in:
Alexander Strizhakov 2020-01-25 10:39:10 +03:00
parent 6252e82f85
commit de4102b247
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
1 changed files with 4 additions and 6 deletions

View File

@ -7,10 +7,6 @@ defmodule Pleroma.Web.MastodonAPI.AppView do
alias Pleroma.Web.OAuth.App alias Pleroma.Web.OAuth.App
@vapid_key :web_push_encryption
|> Application.get_env(:vapid_details, [])
|> Keyword.get(:public_key)
def render("show.json", %{app: %App{} = app}) do def render("show.json", %{app: %App{} = app}) do
%{ %{
id: app.id |> to_string, id: app.id |> to_string,
@ -32,8 +28,10 @@ def render("short.json", %{app: %App{website: webiste, client_name: name}}) do
end end
defp with_vapid_key(data) do defp with_vapid_key(data) do
if @vapid_key do vapid_key = Application.get_env(:web_push_encryption, :vapid_details, [])[:public_key]
Map.put(data, "vapid_key", @vapid_key)
if vapid_key do
Map.put(data, "vapid_key", vapid_key)
else else
data data
end end