Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/changelog.d/vapid_keyword_fallback.fix b/changelog.d/vapid_keyword_fallback.fix
new file mode 100644
index 000000000..aa48f8938
--- /dev/null
+++ b/changelog.d/vapid_keyword_fallback.fix
@@ -0,0 +1 @@
+Make vapid_config return empty array, fixing preloading for instances without push notifications configured
\ No newline at end of file
diff --git a/lib/pleroma/web/push.ex b/lib/pleroma/web/push.ex
index 6d777142e..77f77f88e 100644
--- a/lib/pleroma/web/push.ex
+++ b/lib/pleroma/web/push.ex
@@ -1,34 +1,34 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Push do
alias Pleroma.Workers.WebPusherWorker
require Logger
def init do
unless enabled() do
Logger.warning("""
VAPID key pair is not found. If you wish to enabled web push, please run
mix web_push.gen.keypair
and add the resulting output to your configuration file.
""")
end
end
def vapid_config do
- Application.get_env(:web_push_encryption, :vapid_details, nil)
+ Application.get_env(:web_push_encryption, :vapid_details, [])
end
def enabled, do: match?([subject: _, public_key: _, private_key: _], vapid_config())
@spec send(Pleroma.Notification.t()) ::
{:ok, Oban.Job.t()} | {:error, Oban.Job.changeset() | term()}
def send(notification) do
WebPusherWorker.new(%{"op" => "web_push", "notification_id" => notification.id})
|> Oban.insert()
end
end

File Metadata

Mime Type
text/x-diff
Expires
Sat, Oct 31, 11:24 PM (14 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1801901
Default Alt Text
(1 KB)

Event Timeline