From 15731018dbd7b62d39927204edb8ec5fbb1ffb7b Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Wed, 12 Nov 2025 18:25:35 -0500 Subject: [PATCH] Modify UnifiedPush post request to be AND_3 compliant --- src/dht_proxy_server.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index 659407e2a..0a04e000a 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -1142,7 +1142,18 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso request->set_header_field(restinio::http_field_t::host, type == PushType::UnifiedPush ? tokenUrl.host.c_str() : pushServer_.c_str()); request->set_header_field(restinio::http_field_t::user_agent, "RESTinio client"); request->set_header_field(restinio::http_field_t::accept, "*/*"); - request->set_header_field(restinio::http_field_t::content_type, "application/json"); + if (type == PushType::UnifiedPush) { + // Unified Push with AND_3 expects encrypted WebPush requests. We can make + // our request look like a real WebPush request by adding Content-Encoding + // and TTL headers to our request and just sending the plain json data. + // This should work since the content of push message is already e2ee. + // See https://codeberg.org/UnifiedPush/wishlist/issues/22 + request->set_header_field(restinio::http_field_t::content_encoding, "aes128gcm"); + request->set_header_field(restinio::http_field_t::ttl, "86400"); + request->set_header_field(restinio::http_field_t::urgency, highPriority ? "high" : "normal"); + } else { + request->set_header_field(restinio::http_field_t::content_type, "application/json"); + } if (type == PushType::UnifiedPush) { Json::Value notification(Json::objectValue);