Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Send the subscription key to the Community push proxy
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot-nextcloud[bot] committed Oct 12, 2022
commit 582402fb4f2c184a7fc155c698a372c8b2b64841
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