diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-10-12 22:59:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 22:59:08 +0300 |
commit | be17f1994578d45d59988d26a214865bd78b81fa (patch) | |
tree | 5a5e247e4b6e6985dee45bbf9acdc111da6716b7 | |
parent | 2f417fe7eaf83597fb660857737a2aea41f41dc3 (diff) | |
parent | 582402fb4f2c184a7fc155c698a372c8b2b64841 (diff) |
Merge pull request #1318 from nextcloud/backport/1316/stable25
[stable25] Send the subscription key to the Community push proxy
-rw-r--r-- | lib/Push.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Push.php b/lib/Push.php index 3fd323f..94f7648 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -379,11 +379,20 @@ class Push { $client = $this->clientService->newClient(); foreach ($pushNotifications as $proxyServer => $notifications) { try { - $response = $client->post($proxyServer . '/notifications', [ + $requestData = [ 'body' => [ 'notifications' => $notifications, ], - ]); + ]; + + if ($proxyServer === 'https://push-notifications.nextcloud.com') { + $subscriptionKey = $this->config->getAppValue('support', 'subscription_key'); + if ($subscriptionKey) { + $requestData['headers']['X-Nextcloud-Subscription-Key'] = $subscriptionKey; + } + } + + $response = $client->post($proxyServer . '/notifications', $requestData); $status = $response->getStatusCode(); $body = $response->getBody(); $bodyData = json_decode($body, true); |