From 8b95399387cd2a63110ecf2adbc305ef416989b0 Mon Sep 17 00:00:00 2001 From: girlbossceo Date: Sat, 28 Oct 2023 22:31:11 -0400 Subject: [PATCH] add support for modifying the default notification pusher path this is not officially in spec yet, but who cares? matrix team certainly doesn't care. Signed-off-by: girlbossceo --- src/config/mod.rs | 11 +++++++++++ src/service/pusher/mod.rs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 00283ae1..915169b2 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -92,6 +92,9 @@ pub struct Config { pub emergency_password: Option, + #[serde(default = "default_notification_push_path")] + pub notification_push_path: String, + #[serde(default = "false_fn")] pub allow_local_presence: bool, #[serde(default = "false_fn")] @@ -187,6 +190,10 @@ impl fmt::Display for Config { "Allow device name federation", &self.allow_device_name_federation.to_string(), ), + ( + "Notification push path", + &self.notification_push_path.to_string(), + ), ("Allow room creation", &self.allow_room_creation.to_string()), ( "Allow public room directory over federation", @@ -317,6 +324,10 @@ fn default_log() -> String { "warn,state_res=warn,_=off,sled=off".to_owned() } +fn default_notification_push_path() -> String { + "/_matrix/push/v1/notify".to_owned() +} + fn default_turn_ttl() -> u64 { 60 * 60 * 24 } diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index 315c5ef0..249ee460 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -52,7 +52,7 @@ impl Service { where T: Debug, { - let destination = destination.replace("/_matrix/push/v1/notify", ""); + let destination = destination.replace(services().globals.notification_push_path(), ""); let http_request = request .try_into_http_request::(