push: make vapid_config fallback to empty array

2024-09-24T03:53:27.770757+00:00 NightmareMoon pleroma: path=/notice/AmJcSqyeyij4W70K36 [error] Preloading for /notice/AmJcSqyeyij4W70K36 failed.
    ** (FunctionClauseError) no function clause matching in Keyword.get/3
        (elixir 1.15.8) lib/keyword.ex:388: Keyword.get(nil, :public_key, nil)
        (pleroma 2.7.0-3067-g9b76dbd4-dev-lanodan2) lib/pleroma/web/mastodon_api/views/instance_view.ex:262: Pleroma.Web.MastodonAPI.InstanceView.pleroma_configuration/1
        (pleroma 2.7.0-3067-g9b76dbd4-dev-lanodan2) lib/pleroma/web/mastodon_api/views/instance_view.ex:45: Pleroma.Web.MastodonAPI.InstanceView.render/2
        (pleroma 2.7.0-3067-g9b76dbd4-dev-lanodan2) lib/pleroma/web/preload/providers/instance.ex:28: Pleroma.Web.Preload.Providers.Instance.build_info_tag/1
        (pleroma 2.7.0-3067-g9b76dbd4-dev-lanodan2) lib/pleroma/web/preload/providers/instance.ex:21: Pleroma.Web.Preload.Providers.Instance.generate_terms/1
        (pleroma 2.7.0-3067-g9b76dbd4-dev-lanodan2) lib/pleroma/web/preload.ex:13: anonymous fn/3 in Pleroma.Web.Preload.build_tags/2
This commit is contained in:
Haelwenn (lanodan) Monnier 2024-09-24 05:54:25 +02:00
parent 196f108823
commit 7dd3a4d86d
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

@ -0,0 +1 @@
Make vapid_config return empty array, fixing preloading for instances without push notifications configured

View file

@ -20,7 +20,7 @@ def init do
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())