]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/PushSubscription.php
New parameter to create a share block for display reasons
[friendica.git] / src / Worker / PushSubscription.php
index 48695bfcd0d52b589b7d58d80ca6c2bd9c2c4875..17b47f1cbd8388dc512e1846e6868e518890e1b4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -26,11 +26,11 @@ use Friendica\Content\Text\Plaintext;
 use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Factory\Api\Mastodon\Notification as NotificationFactory;
 use Friendica\Model\Contact;
 use Friendica\Model\Post;
 use Friendica\Model\Subscription as ModelSubscription;
 use Friendica\Model\User;
-use Friendica\Navigation\Notifications;
 use Friendica\Network\HTTPException\NotFoundException;
 use Minishlink\WebPush\WebPush;
 use Minishlink\WebPush\Subscription;
@@ -90,7 +90,7 @@ class PushSubscription
                }
 
                $message = DI::notificationFactory()->getMessageFromNotification($notification);
-               $title = $message['plain'] ?: '';
+               $title = $message['plain'] ?? '';
 
                $push = Subscription::create([
                        'contentEncoding' => 'aesgcm',
@@ -101,12 +101,11 @@ class PushSubscription
                        ],
                ]);
 
-               // @todo Only used for logging?
                $payload = [
                        'access_token'      => $application_token['access_token'],
                        'preferred_locale'  => $user['language'],
                        'notification_id'   => $nid,
-                       'notification_type' => \Friendica\Factory\Api\Mastodon\Notification::getType($notification),
+                       'notification_type' => NotificationFactory::getType($notification),
                        'icon'              => $actor['thumb'] ?? '',
                        'title'             => $title ?: $l10n->t('Notification from Friendica'),
                        'body'              => $body ?: $l10n->t('Empty Post'),
@@ -116,7 +115,7 @@ class PushSubscription
 
                $auth = [
                        'VAPID' => [
-                               'subject'    => DI::baseUrl()->getHostname(),
+                               'subject'    => DI::baseUrl()->getHost(),
                                'publicKey'  => ModelSubscription::getPublicVapidKey(),
                                'privateKey' => ModelSubscription::getPrivateVapidKey(),
                        ],