PWA-Benachrichtigungen mit VAPID und Testnachricht ergänzen
This commit is contained in:
parent
7e589b58cd
commit
920b8e895a
13 changed files with 1207 additions and 2 deletions
|
|
@ -6,6 +6,8 @@ namespace App\Controllers;
|
|||
|
||||
use App\Core\Auth;
|
||||
use App\Core\Image;
|
||||
use App\Core\WebPush;
|
||||
use App\Models\PushSubscription;
|
||||
use App\Models\User;
|
||||
|
||||
class UserController
|
||||
|
|
@ -81,7 +83,13 @@ class UserController
|
|||
redirect('/member');
|
||||
}
|
||||
|
||||
view('users.edit', ['user' => $user]);
|
||||
$pushAvailable = PushSubscription::isAvailable() && WebPush::isConfigured();
|
||||
|
||||
view('users.edit', [
|
||||
'user' => $user,
|
||||
'pushPublicKey' => $pushAvailable ? WebPush::publicKey() : null,
|
||||
'pushEnabled' => $pushAvailable && PushSubscription::hasSubscription((int) $user->id),
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(string $id): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue