From dba012840c5656acfd6dfbc4afa6f8a8232ad15f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 28 Sep 2024 03:51:39 -0600 Subject: [PATCH] Add PushGatewayRefresh command --- app/Console/Commands/PushGatewayRefresh.php | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/Console/Commands/PushGatewayRefresh.php diff --git a/app/Console/Commands/PushGatewayRefresh.php b/app/Console/Commands/PushGatewayRefresh.php new file mode 100644 index 000000000..3a15154e6 --- /dev/null +++ b/app/Console/Commands/PushGatewayRefresh.php @@ -0,0 +1,66 @@ +info('Checking Push Notification support...'); + $this->line(' '); + + $currentState = NotificationAppGatewayService::enabled(); + + if($currentState) { + $this->info('Push Notification support is active!'); + return; + } else { + $this->error('Push notification support is NOT active'); + + $action = select( + label: 'Do you want to force re-check?', + options: ['Yes', 'No'], + required: true + ); + + if($action === 'Yes') { + $recheck = NotificationAppGatewayService::forceSupportRecheck(); + if($recheck) { + $this->info('Success! Push Notifications are now active!'); + return; + } else { + $this->error('Error, please ensure you have a valid API key.'); + $this->line(' '); + $this->line('For more info, visit https://docs.pixelfed.org/running-pixelfed/push-notifications.html'); + $this->line(' '); + return; + } + return; + } else { + exit; + } + return; + } + } +}