More robust validation the vapid config is set
This commit is contained in:
parent
9d67827619
commit
07cb89823f
@ -20,16 +20,10 @@ defmodule Pleroma.Web.Push do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def vapid_config do
|
def vapid_config do
|
||||||
Application.get_env(:web_push_encryption, :vapid_details, [])
|
Application.get_env(:web_push_encryption, :vapid_details, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def enabled do
|
def enabled, do: match?([subject: _, public_key: _, private_key: _], vapid_config())
|
||||||
case vapid_config() do
|
|
||||||
[] -> false
|
|
||||||
list when is_list(list) -> true
|
|
||||||
_ -> false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def send(notification) do
|
def send(notification) do
|
||||||
WebPusherWorker.enqueue("web_push", %{"notification_id" => notification.id})
|
WebPusherWorker.enqueue("web_push", %{"notification_id" => notification.id})
|
||||||
|
Loading…
Reference in New Issue
Block a user