Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-06 17:38:30 +0300
committerJoas Schilling <coding@schilljs.com>2022-10-17 13:47:27 +0300
commit67b79ce9b14382e5571756b48ddb8b9e9b284d45 (patch)
treead5780f89e2279184a11a7a716cc5877535d661d
parentdffdc2abca306b262dec556f0ecf9552067a0acb (diff)
Send the subscription key to the Community push proxy
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/Push.php13
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();