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:31 +0300
committerGitHub <noreply@github.com>2022-10-18 11:12:31 +0300
commit0eeedb4c7e44ecd87230540478a31abcbce9c9fd (patch)
treed5d74cb2b964b947fc02a5fb40a4a71ee7454c8a
parenta27e079193d1c33e7348593fc2b631a422227f84 (diff)
parent4afcd2306a750dd68ddcbd14ab2d00a2db489e26 (diff)
Merge pull request #1324 from nextcloud/backport/1316/stable20stable20
[stable20] 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 b5d44dc..dc6e168 100644
--- a/lib/Push.php
+++ b/lib/Push.php
@@ -281,11 +281,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();