diff --git a/lib/Push.php b/lib/Push.php index 468d5a8d..ad9c2a3d 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -422,6 +422,13 @@ protected function sendNotificationsToProxies(): void { return; } + $subscriptionAwareServer = rtrim($this->config->getAppValue(Application::APP_ID, 'subscription_aware_server', 'https://push-notifications.nextcloud.com'), '/'); + if ($subscriptionAwareServer === 'https://push-notifications.nextcloud.com') { + $subscriptionKey = $this->config->getAppValue('support', 'subscription_key'); + } else { + $subscriptionKey = $this->config->getSystemValueString('instanceid'); + } + $client = $this->clientService->newClient(); foreach ($pushNotifications as $proxyServer => $notifications) { try { @@ -431,11 +438,8 @@ protected function sendNotificationsToProxies(): void { ], ]; - if ($proxyServer === 'https://push-notifications.nextcloud.com') { - $subscriptionKey = $this->config->getAppValue('support', 'subscription_key'); - if ($subscriptionKey) { - $requestData['headers']['X-Nextcloud-Subscription-Key'] = $subscriptionKey; - } + if ($subscriptionKey !== '' && $proxyServer === $subscriptionAwareServer) { + $requestData['headers']['X-Nextcloud-Subscription-Key'] = $subscriptionKey; } $response = $client->post($proxyServer . '/notifications', $requestData);