diff options
author | Joas Schilling <coding@schilljs.com> | 2022-10-06 17:38:30 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-10-06 17:38:30 +0300 |
commit | 49fb541f2729994c0871b62b47143cfd0a4d8201 (patch) | |
tree | 3f161957d61e40084d371cdd3dd61dc4add7c35f | |
parent | 21b0ae2be952445aa35d3150c5a0b8bfbc1f10c9 (diff) |
Send the subscription key to the Community push proxy
Signed-off-by: Joas Schilling <coding@schilljs.com>
-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); |