show warning if VAPID is not set
This commit is contained in:
parent
8b4397c704
commit
bac58b1524
|
@ -18,11 +18,11 @@ def start_link() do
|
||||||
def init(:ok) do
|
def init(:ok) do
|
||||||
case Application.get_env(:web_push_encryption, :vapid_details) do
|
case Application.get_env(:web_push_encryption, :vapid_details) do
|
||||||
nil ->
|
nil ->
|
||||||
Logger.error(
|
Logger.warn(
|
||||||
"VAPID key pair is not found. Please, add VAPID configuration to config. Run `mix web_push.gen.keypair` mix task to create a key pair"
|
"VAPID key pair is not found. Please, add VAPID configuration to config. Run `mix web_push.gen.keypair` mix task to create a key pair"
|
||||||
)
|
)
|
||||||
|
|
||||||
{:error, %{}}
|
:ignore
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
{:ok, %{}}
|
{:ok, %{}}
|
||||||
|
@ -30,8 +30,10 @@ def init(:ok) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def send(notification) do
|
def send(notification) do
|
||||||
|
if Application.get_env(:web_push_encryption, :vapid_details) do
|
||||||
GenServer.cast(Pleroma.Web.Push, {:send, notification})
|
GenServer.cast(Pleroma.Web.Push, {:send, notification})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def handle_cast(
|
def handle_cast(
|
||||||
{:send, %{activity: %{data: %{"type" => type}}, user_id: user_id} = notification},
|
{:send, %{activity: %{data: %{"type" => type}}, user_id: user_id} = notification},
|
||||||
|
|
Loading…
Reference in New Issue