diff options
author | Joas Schilling <coding@schilljs.com> | 2022-10-06 17:38:30 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-10-17 13:47:27 +0300 |
commit | 67b79ce9b14382e5571756b48ddb8b9e9b284d45 (patch) | |
tree | ad5780f89e2279184a11a7a716cc5877535d661d | |
parent | dffdc2abca306b262dec556f0ecf9552067a0acb (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 203d0eb..780d26e 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -293,11 +293,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); } catch (ClientException $e) { // Server responded with 4xx (400 Bad Request mostlikely) $response = $e->getResponse(); |