From 87bb2842ce07df480cc044b1d06add17f13d9c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyrille=20B=C3=A9raud?= Date: Wed, 20 May 2026 18:55:12 -0400 Subject: [PATCH] proxy: include priority field in push notification JSON payload The HTTP Urgency header set on WebPush requests is not exposed to UnifiedPush Android clients by the connector library. Include a "priority" field ("high" or "normal") directly in the JSON body so that clients can determine whether a push notification requires immediate wake-up processing or can be deferred until the next natural activity. This complements the daemon-side priority assignment (Gerrit #34059) and allows UnifiedPush (F-Droid) builds to benefit from the same battery savings as FCM builds. Change-Id: Id316ff89e64e59d1b224f5b4e14da6b36dc62c95 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/dht_proxy_server.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index 19c3369d..465eb1c6 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -1191,7 +1191,13 @@ DhtProxyServer::handlePushListen(const InfoHash& infoHash, minPriority, values.size()); - sendPushNotification(pushToken, std::move(json), type, !expired and minPriority == 0, topic); + // Include priority in the JSON payload so that UnifiedPush clients + // (which don't have access to the HTTP Urgency header) can determine + // whether a push requires immediate processing or can be deferred. + bool highPriority = !expired and minPriority == 0; + json["priority"] = highPriority ? "high" : "normal"; + + sendPushNotification(pushToken, std::move(json), type, highPriority, topic); return true; }