diff --git a/extensions/pusher/bootstrap.php b/extensions/pusher/bootstrap.php index 9b493fe29..22598daff 100644 --- a/extensions/pusher/bootstrap.php +++ b/extensions/pusher/bootstrap.php @@ -10,6 +10,7 @@ */ use Flarum\Extend; +use Flarum\Pusher\Api\Controller\AuthController; use Flarum\Pusher\Listener; use Illuminate\Contracts\Events\Dispatcher; @@ -21,6 +22,8 @@ return [ (new Extend\Assets('admin')) ->asset(__DIR__.'/js/admin/dist/extension.js') ->bootstrapper('flarum/pusher/main'), + (new Extend\Routes('api')) + ->post('/pusher/auth', 'pusher.auth', AuthController::class), function (Dispatcher $events) { $events->subscribe(Listener\AddPusherApi::class); $events->subscribe(Listener\PushNewPosts::class); diff --git a/extensions/pusher/src/Listener/AddPusherApi.php b/extensions/pusher/src/Listener/AddPusherApi.php index 93a2307b4..27a8d014d 100755 --- a/extensions/pusher/src/Listener/AddPusherApi.php +++ b/extensions/pusher/src/Listener/AddPusherApi.php @@ -13,8 +13,6 @@ namespace Flarum\Pusher\Listener; use Flarum\Api\Event\Serializing; use Flarum\Api\Serializer\ForumSerializer; -use Flarum\Event\ConfigureApiRoutes; -use Flarum\Pusher\Api\Controller\AuthController; use Flarum\Settings\SettingsRepositoryInterface; use Illuminate\Contracts\Events\Dispatcher; @@ -39,7 +37,6 @@ class AddPusherApi public function subscribe(Dispatcher $events) { $events->listen(Serializing::class, [$this, 'addAttributes']); - $events->listen(ConfigureApiRoutes::class, [$this, 'addRoutes']); } /** @@ -52,12 +49,4 @@ class AddPusherApi $event->attributes['pusherCluster'] = $this->settings->get('flarum-pusher.app_cluster'); } } - - /** - * @param ConfigureApiRoutes $event - */ - public function addRoutes(ConfigureApiRoutes $event) - { - $event->post('/pusher/auth', 'pusher.auth', AuthController::class); - } }