Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/dht_proxy_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading