2018-09-21 12:04:05 +00:00
|
|
|
<?php
|
2018-09-24 14:07:34 +00:00
|
|
|
use App\Middleware;
|
|
|
|
use App\Console\Command;
|
2018-09-22 11:52:43 +00:00
|
|
|
|
2018-11-12 16:59:15 +00:00
|
|
|
return function (\Azura\EventDispatcher $dispatcher)
|
2018-09-21 18:04:42 +00:00
|
|
|
{
|
2018-09-22 11:52:43 +00:00
|
|
|
// Build default routes and middleware
|
2018-11-12 16:59:15 +00:00
|
|
|
$dispatcher->addListener(Azura\Event\BuildRoutes::NAME, function(Azura\Event\BuildRoutes $event) {
|
2018-09-22 11:52:43 +00:00
|
|
|
$app = $event->getApp();
|
|
|
|
|
|
|
|
// Get the current user entity object and assign it into the request if it exists.
|
2018-09-24 14:07:34 +00:00
|
|
|
$app->add(Middleware\GetCurrentUser::class);
|
2018-09-22 11:52:43 +00:00
|
|
|
|
|
|
|
// Check HTTPS setting and enforce Content Security Policy accordingly.
|
2018-09-24 14:07:34 +00:00
|
|
|
$app->add(Middleware\EnforceSecurity::class);
|
2018-09-22 11:52:43 +00:00
|
|
|
|
2018-11-12 16:59:15 +00:00
|
|
|
}, 2);
|
2018-09-21 12:04:05 +00:00
|
|
|
|
2019-02-24 05:28:01 +00:00
|
|
|
// Build default menus
|
|
|
|
$dispatcher->addListener(App\Event\BuildAdminMenu::NAME, function(\App\Event\BuildAdminMenu $e) {
|
|
|
|
$callable = require(__DIR__.'/menus/admin.php');
|
|
|
|
$callable($e);
|
|
|
|
});
|
|
|
|
|
|
|
|
$dispatcher->addListener(App\Event\BuildStationMenu::NAME, function(\App\Event\BuildStationMenu $e) {
|
|
|
|
$callable = require(__DIR__.'/menus/station.php');
|
|
|
|
$callable($e);
|
|
|
|
});
|
|
|
|
|
2018-09-24 14:07:34 +00:00
|
|
|
// Build CLI commands
|
2018-11-12 16:59:15 +00:00
|
|
|
$dispatcher->addListener(Azura\Event\BuildConsoleCommands::NAME, function(Azura\Event\BuildConsoleCommands $event) {
|
2018-09-24 14:07:34 +00:00
|
|
|
$event->getConsole()->addCommands([
|
|
|
|
// Liquidsoap Internal CLI Commands
|
2019-02-25 06:43:00 +00:00
|
|
|
new Command\Internal\NextSong,
|
|
|
|
new Command\Internal\DjAuth,
|
|
|
|
new Command\Internal\DjOn,
|
|
|
|
new Command\Internal\DjOff,
|
|
|
|
new Command\Internal\Feedback,
|
2018-09-24 14:07:34 +00:00
|
|
|
|
|
|
|
// Locales
|
|
|
|
new Command\LocaleGenerate,
|
|
|
|
new Command\LocaleImport,
|
|
|
|
|
|
|
|
// Setup
|
|
|
|
new Command\MigrateConfig,
|
|
|
|
new Command\SetupInflux,
|
|
|
|
new Command\SetupFixtures,
|
|
|
|
new Command\Setup,
|
|
|
|
|
|
|
|
// Maintenance
|
|
|
|
new Command\RestartRadio,
|
|
|
|
new Command\Sync,
|
2018-12-30 10:18:48 +00:00
|
|
|
new Command\ProcessMessageQueue,
|
2018-09-24 14:07:34 +00:00
|
|
|
new Command\ReprocessMedia,
|
|
|
|
|
|
|
|
new Command\GenerateApiDocs,
|
|
|
|
new Command\UptimeWait,
|
|
|
|
|
|
|
|
// User-side tools
|
|
|
|
new Command\ResetPassword,
|
2019-02-18 00:52:01 +00:00
|
|
|
new Command\SetAdministrator,
|
2018-09-24 14:07:34 +00:00
|
|
|
new Command\ListSettings,
|
|
|
|
new Command\SetSetting,
|
|
|
|
]);
|
|
|
|
}, 0);
|
|
|
|
|
2018-09-22 11:52:43 +00:00
|
|
|
// Other event subscribers from across the application.
|
2018-09-21 18:04:42 +00:00
|
|
|
$dispatcher->addServiceSubscriber([
|
2018-09-22 11:52:43 +00:00
|
|
|
\App\Radio\AutoDJ::class,
|
|
|
|
\App\Radio\Backend\Liquidsoap::class,
|
|
|
|
\App\Sync\Task\NowPlaying::class,
|
2018-09-21 18:04:42 +00:00
|
|
|
\App\Webhook\Dispatcher::class,
|
2018-09-28 13:03:03 +00:00
|
|
|
\App\Controller\Api\NowplayingController::class,
|
2018-11-15 13:41:52 +00:00
|
|
|
\App\Notification\Manager::class,
|
2018-09-21 18:04:42 +00:00
|
|
|
]);
|
2018-09-21 12:04:05 +00:00
|
|
|
|
|
|
|
};
|