diff options
author | Joas Schilling <coding@schilljs.com> | 2022-10-06 17:38:30 +0300 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2022-10-12 17:27:13 +0300 |
commit | 3d59bc8635e800c7a4ac8b8ad7d12c02af583f90 (patch) | |
tree | 59d5bd3fc84a55eec78b3867fc3c54fd09dccfbd | |
parent | 4a43b6c5947814dc3e9aba7fdad8faf2df667ad8 (diff) |
Send the subscription key to the Community push proxybackport/1316/stable23
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 b4770c6..a6ef570 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -307,11 +307,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); |