public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox] notify: fix #5274: also set 'X-Gotify-Key' header for authentication
@ 2024-04-03  8:08 Lukas Wagner
  2024-04-04 14:52 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2024-04-03  8:08 UTC (permalink / raw)
  To: pve-devel

Versions of Gotify < 2.2.0 only supported the 'X-Gotify-Key' header
for passing the API token. This comment sets this header in addition
to the regular 'Authorization' header in order to be compatible with
older Gotify servers.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 proxmox-notify/src/endpoints/gotify.rs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/proxmox-notify/src/endpoints/gotify.rs b/proxmox-notify/src/endpoints/gotify.rs
index 90ae959..20c83bf 100644
--- a/proxmox-notify/src/endpoints/gotify.rs
+++ b/proxmox-notify/src/endpoints/gotify.rs
@@ -124,10 +124,13 @@ impl Endpoint for GotifyEndpoint {
 
         let body = serde_json::to_vec(&body)
             .map_err(|err| Error::NotifyFailed(self.name().to_string(), err.into()))?;
-        let extra_headers = HashMap::from([(
-            "Authorization".into(),
-            format!("Bearer {}", self.private_config.token),
-        )]);
+        let extra_headers = HashMap::from([
+            (
+                "Authorization".into(),
+                format!("Bearer {}", self.private_config.token),
+            ),
+            ("X-Gotify-Key".into(), self.private_config.token.clone()),
+        ]);
 
         let proxy_config = context()
             .http_proxy_config()
-- 
2.39.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-04 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03  8:08 [pve-devel] [PATCH proxmox] notify: fix #5274: also set 'X-Gotify-Key' header for authentication Lukas Wagner
2024-04-04 14:52 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal