Skip to content

Commit

Permalink
Send the subscription key to the Community push proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot-nextcloud[bot] committed Oct 12, 2022
1 parent 3034102 commit 54bf005
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 54bf005

Please sign in to comment.