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 <213943+nickvergessen@users.noreply.github.com>2022-10-18 11:12:37 +0300
committerGitHub <noreply@github.com>2022-10-18 11:12:37 +0300
commitdf1bcbc7f273cd21b92a120f4e31c816f4b202f5 (patch)
tree05b31d557da806cbbef9b27c940ef1faabac9d11
parentea68a9e46c9bc9667876516c3c6e29fecd0782c0 (diff)
parentce070786e7f6886d3523504a1614278258706a20 (diff)
Merge pull request #1325 from nextcloud/backport/1316/stable19stable19
[stable19] Send the subscription key to the Community push proxy
-rw-r--r--lib/Push.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Push.php b/lib/Push.php
index c3f6405..124e8dc 100644
--- a/lib/Push.php
+++ b/lib/Push.php
@@ -260,11 +260,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();