mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-10-15 05:49:55 +00:00
fix(pusher): Only strip notification_push_path as a URL suffix
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fixed push gateway URLs containing the configured notification path outside of their suffix. Contributed by @eleboucher.
|
||||
@@ -1392,15 +1392,9 @@
|
||||
#
|
||||
#emergency_password =
|
||||
|
||||
# Specifies the path where push notifications will be sent to a
|
||||
# push gateway.
|
||||
#
|
||||
# When a Matrix client registers for push notifications, it will specify
|
||||
# a push gateway url where notification events will be sent.
|
||||
# According to the current spec for Matrix Push Gateways, the path should
|
||||
# always be "/_matrix/push/v1/notify".
|
||||
# You should only change this if you have configured your own push gateway
|
||||
# that requires a different path.
|
||||
# Suffix stripped from the end of a pusher URL before appending
|
||||
# "/_matrix/push/v1/notify". Only change this if your pushers register
|
||||
# URLs ending in a different path.
|
||||
#
|
||||
# For more information on Push Gateways: https://spec.matrix.org/latest/push-gateway-api/
|
||||
#
|
||||
|
||||
@@ -1654,15 +1654,9 @@ pub struct Config {
|
||||
/// display: sensitive
|
||||
pub emergency_password: Option<String>,
|
||||
|
||||
/// Specifies the path where push notifications will be sent to a
|
||||
/// push gateway.
|
||||
///
|
||||
/// When a Matrix client registers for push notifications, it will specify
|
||||
/// a push gateway url where notification events will be sent.
|
||||
/// According to the current spec for Matrix Push Gateways, the path should
|
||||
/// always be "/_matrix/push/v1/notify".
|
||||
/// You should only change this if you have configured your own push gateway
|
||||
/// that requires a different path.
|
||||
/// Suffix stripped from the end of a pusher URL before appending
|
||||
/// "/_matrix/push/v1/notify". Only change this if your pushers register
|
||||
/// URLs ending in a different path.
|
||||
///
|
||||
/// For more information on Push Gateways: https://spec.matrix.org/latest/push-gateway-api/
|
||||
///
|
||||
|
||||
@@ -304,11 +304,13 @@ pub async fn send_request<T>(&self, dest: &str, request: T) -> Result<T::Incomin
|
||||
+ Debug
|
||||
+ Send,
|
||||
{
|
||||
let dest = dest.replace(self.services.globals.notification_push_path(), "");
|
||||
let dest = dest
|
||||
.strip_suffix(self.services.globals.notification_push_path())
|
||||
.unwrap_or(dest);
|
||||
trace!("Push gateway destination: {dest}");
|
||||
|
||||
let http_request = request
|
||||
.try_into_http_request::<BytesMut>(&dest, (), ())
|
||||
.try_into_http_request::<BytesMut>(dest, (), ())
|
||||
.map_err(|e| {
|
||||
err!(BadServerResponse(warn!(
|
||||
"Failed to find destination {dest} for push gateway: {e}"
|
||||
|
||||
Reference in New Issue
Block a user