Skip to content

Commit

Permalink
Merge pull request #1320 from nextcloud/backport/1316/stable24
Browse files Browse the repository at this point in the history
[stable24] Send the subscription key to the Community push proxy
  • Loading branch information
nickvergessen authored Oct 17, 2022
2 parents f83e3fa + 54bf005 commit d26d429
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,20 @@ protected function sendNotificationsToProxies(): void {
$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);
Expand Down

0 comments on commit d26d429

Please sign in to comment.