Optimize router config to use only GET or GET/POST to keep the route configuration cleaner (and avoid misrepresenting that the URLs can respond to PUT/DELETE/etc)
This commit is contained in:
parent
197c1f6b3c
commit
39620ae482
|
@ -7,75 +7,75 @@
|
|||
|
||||
$app->group('/admin', function() {
|
||||
|
||||
$this->any('', 'admin:index:index')
|
||||
$this->get('', 'admin:index:index')
|
||||
->setName('admin:index:index');
|
||||
|
||||
$this->any('/sync/{type}', 'admin:index:sync')
|
||||
$this->get('/sync/{type}', 'admin:index:sync')
|
||||
->setName('admin:index:sync');
|
||||
|
||||
$this->group('/api', function() {
|
||||
|
||||
$this->any('', 'admin:api:index')
|
||||
$this->get('', 'admin:api:index')
|
||||
->setName('admin:api:index');
|
||||
|
||||
$this->any('/edit[/{id}]', 'admin:api:edit')
|
||||
$this->map(['GET', 'POST'], '/edit[/{id}]', 'admin:api:edit')
|
||||
->setName('admin:api:edit');
|
||||
|
||||
$this->any('/delete/{id}', 'admin:api:delete')
|
||||
$this->get('/delete/{id}', 'admin:api:delete')
|
||||
->setName('admin:api:delete');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/permissions', function() {
|
||||
|
||||
$this->any('', 'admin:permissions:index')
|
||||
$this->get('', 'admin:permissions:index')
|
||||
->setName('admin:permissions:index');
|
||||
|
||||
$this->any('/role/edit[/{id}]', 'admin:permissions:editrole')
|
||||
$this->map(['GET', 'POST'], '/role/edit[/{id}]', 'admin:permissions:editrole')
|
||||
->setName('admin:permissions:editrole');
|
||||
|
||||
$this->any('/role/delete/{id}', 'admin:permissions:deleterole')
|
||||
$this->get('/role/delete/{id}', 'admin:permissions:deleterole')
|
||||
->setName('admin:permissions:deleterole');
|
||||
|
||||
$this->any('/role/members/{id}', 'admin:permissions:rolemembers')
|
||||
$this->get('/role/members/{id}', 'admin:permissions:rolemembers')
|
||||
->setName('admin:permissions:rolemembers');
|
||||
|
||||
$this->any('/action/edit[/{id}]', 'admin:permissions:editaction')
|
||||
$this->map(['GET', 'POST'], '/action/edit[/{id}]', 'admin:permissions:editaction')
|
||||
->setName('admin:permissions:editaction');
|
||||
|
||||
$this->any('/action/delete/{id}', 'admin:permissions:deleteaction')
|
||||
$this->get('/action/delete/{id}', 'admin:permissions:deleteaction')
|
||||
->setName('admin:permissions:deleteaction');
|
||||
|
||||
});
|
||||
|
||||
$this->any('/settings', 'admin:settings:index')
|
||||
$this->map(['GET', 'POST'], '/settings', 'admin:settings:index')
|
||||
->setName('admin:settings:index');
|
||||
|
||||
$this->group('/stations', function() {
|
||||
|
||||
$this->any('', 'admin:stations:index')
|
||||
$this->get('', 'admin:stations:index')
|
||||
->setName('admin:stations:index');
|
||||
|
||||
$this->any('/edit[/{id}]', 'admin:stations:edit')
|
||||
$this->map(['GET', 'POST'], '/edit[/{id}]', 'admin:stations:edit')
|
||||
->setName('admin:stations:edit');
|
||||
|
||||
$this->any('/delete/{id}', 'admin:stations:delete')
|
||||
$this->get('/delete/{id}', 'admin:stations:delete')
|
||||
->setName('admin:stations:delete');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/users', function() {
|
||||
|
||||
$this->any('', 'admin:users:index')
|
||||
$this->get('', 'admin:users:index')
|
||||
->setName('admin:users:index');
|
||||
|
||||
$this->any('/edit[/{id}]', 'admin:users:edit')
|
||||
$this->map(['GET', 'POST'], '/edit[/{id}]', 'admin:users:edit')
|
||||
->setName('admin:users:edit');
|
||||
|
||||
$this->any('/delete/{id}', 'admin:users:delete')
|
||||
$this->get('/delete/{id}', 'admin:users:delete')
|
||||
->setName('admin:users:delete');
|
||||
|
||||
$this->any('/login-as/{id}', 'admin:users:impersonate')
|
||||
$this->get('/login-as/{id}', 'admin:users:impersonate')
|
||||
->setName('admin:users:impersonate');
|
||||
|
||||
});
|
||||
|
|
|
@ -7,45 +7,45 @@
|
|||
|
||||
$app->group('/api', function() {
|
||||
|
||||
$this->any('', 'api:index:index')
|
||||
$this->map(['GET', 'POST'], '', 'api:index:index')
|
||||
->setName('api:index:index');
|
||||
|
||||
$this->any('/status', 'api:index:status')
|
||||
$this->map(['GET', 'POST'], '/status', 'api:index:status')
|
||||
->setName('api:index:status');
|
||||
|
||||
$this->any('/time', 'api:index:time')
|
||||
$this->map(['GET', 'POST'], '/time', 'api:index:time')
|
||||
->setName('api:index:time');
|
||||
|
||||
$this->group('/internal', function() {
|
||||
|
||||
$this->any('/streamauth/{id}', 'api:internal:streamauth')
|
||||
$this->map(['GET', 'POST'], '/streamauth/{id}', 'api:internal:streamauth')
|
||||
->setName('api:internal:streamauth');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/nowplaying[/{id}]', function() {
|
||||
|
||||
$this->any('', 'api:nowplaying:index')
|
||||
$this->map(['GET', 'POST'], '', 'api:nowplaying:index')
|
||||
->setName('api:nowplaying:index');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/requests/{station}', function() {
|
||||
|
||||
$this->any('/list', 'api:requests:list')
|
||||
$this->map(['GET', 'POST'], '/list', 'api:requests:list')
|
||||
->setName('api:requests:list');
|
||||
|
||||
$this->any('/submit/{song_id}', 'api:requests:submit')
|
||||
$this->map(['GET', 'POST'], '/submit/{song_id}', 'api:requests:submit')
|
||||
->setName('api:requests:submit');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/stations', function() {
|
||||
|
||||
$this->any('', 'api:stations:list')
|
||||
$this->map(['GET', 'POST'], '', 'api:stations:list')
|
||||
->setName('api:stations:list');
|
||||
|
||||
$this->any('/{id}', 'api:stations:index')
|
||||
$this->map(['GET', 'POST'], '/{id}', 'api:stations:index')
|
||||
->setName('api:stations:index');
|
||||
|
||||
});
|
||||
|
|
|
@ -5,42 +5,42 @@
|
|||
* i.e. frontend:index:index -> \Modules\Frontend\Controllers\IndexController::indexAction
|
||||
*/
|
||||
|
||||
$app->any('/', 'frontend:index:index')
|
||||
$app->get('/', 'frontend:index:index')
|
||||
->setName('home');
|
||||
|
||||
$app->any('/account', 'frontend:account:index')
|
||||
$app->get('/account', 'frontend:account:index')
|
||||
->setName('account:index');
|
||||
|
||||
$app->any('/login', 'frontend:account:login')
|
||||
$app->get('/login', 'frontend:account:login')
|
||||
->setName('account:login');
|
||||
|
||||
$app->any('/logout', 'frontend:account:logout')
|
||||
$app->get('/logout', 'frontend:account:logout')
|
||||
->setName('account:logout');
|
||||
|
||||
$app->any('/profile', 'frontend:profile:index')
|
||||
$app->get('/profile', 'frontend:profile:index')
|
||||
->setName('profile:index');
|
||||
|
||||
$app->any('/profile/edit', 'frontend:profile:edit')
|
||||
$app->map(['GET', 'POST'], '/profile/edit', 'frontend:profile:edit')
|
||||
->setName('profile:edit');
|
||||
|
||||
$app->any('/profile/timezone', 'frontend:profile:timezone')
|
||||
$app->map(['GET', 'POST'], '/profile/timezone', 'frontend:profile:timezone')
|
||||
->setName('profile:timezone');
|
||||
|
||||
$app->group('/setup', function() {
|
||||
|
||||
$this->any('', 'frontend:setup:index')
|
||||
$this->map(['GET', 'POST'], '', 'frontend:setup:index')
|
||||
->setName('setup:index');
|
||||
|
||||
$this->any('/complete', 'frontend:setup:complete')
|
||||
$this->map(['GET', 'POST'], '/complete', 'frontend:setup:complete')
|
||||
->setName('setup:complete');
|
||||
|
||||
$this->any('/register', 'frontend:setup:register')
|
||||
$this->map(['GET', 'POST'], '/register', 'frontend:setup:register')
|
||||
->setName('setup:register');
|
||||
|
||||
$this->any('/station', 'frontend:setup:station')
|
||||
$this->map(['GET', 'POST'], '/station', 'frontend:setup:station')
|
||||
->setName('setup:station');
|
||||
|
||||
$this->any('/settings', 'frontend:setup:settings')
|
||||
$this->map(['GET', 'POST'], '/settings', 'frontend:setup:settings')
|
||||
->setName('setup:settings');
|
||||
|
||||
});
|
|
@ -7,111 +7,111 @@
|
|||
|
||||
$app->group('/station/{station}', function() {
|
||||
|
||||
$this->any('', 'stations:index:index')
|
||||
$this->get('', 'stations:index:index')
|
||||
->setName('stations:index:index');
|
||||
|
||||
$this->group('/automation', function() {
|
||||
|
||||
$this->any('', 'stations:automation:index')
|
||||
$this->map(['GET', 'POST'], '', 'stations:automation:index')
|
||||
->setName('stations:automation:index');
|
||||
|
||||
$this->any('/run', 'stations:automation:run')
|
||||
$this->get('/run', 'stations:automation:run')
|
||||
->setName('stations:automation:run');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/files', function() {
|
||||
|
||||
$this->any('', 'stations:files:index')
|
||||
$this->get('', 'stations:files:index')
|
||||
->setName('stations:files:index');
|
||||
|
||||
$this->any('/edit/{id}', 'stations:files:edit')
|
||||
$this->map(['GET', 'POST'], '/edit/{id}', 'stations:files:edit')
|
||||
->setName('stations:files:edit');
|
||||
|
||||
$this->any('/list', 'stations:files:list')
|
||||
$this->map(['GET', 'POST'], '/list', 'stations:files:list')
|
||||
->setName('stations:files:list');
|
||||
|
||||
$this->any('/batch', 'stations:files:batch')
|
||||
$this->map(['GET', 'POST'], '/batch', 'stations:files:batch')
|
||||
->setName('stations:files:batch');
|
||||
|
||||
$this->any('/mkdir', 'stations:files:mkdir')
|
||||
$this->map(['GET', 'POST'], '/mkdir', 'stations:files:mkdir')
|
||||
->setName('stations:files:mkdir');
|
||||
|
||||
$this->any('/upload', 'stations:files:upload')
|
||||
$this->map(['GET', 'POST'], '/upload', 'stations:files:upload')
|
||||
->setName('stations:files:upload');
|
||||
|
||||
$this->any('/download', 'stations:files:download')
|
||||
$this->map(['GET', 'POST'], '/download', 'stations:files:download')
|
||||
->setName('stations:files:download');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/playlists', function() {
|
||||
|
||||
$this->any('', 'stations:playlists:index')
|
||||
$this->get('', 'stations:playlists:index')
|
||||
->setName('stations:playlists:index');
|
||||
|
||||
$this->any('/edit[/{id}]', 'stations:playlists:edit')
|
||||
$this->map(['GET', 'POST'], '/edit[/{id}]', 'stations:playlists:edit')
|
||||
->setName('stations:playlists:edit');
|
||||
|
||||
$this->any('/delete/{id}', 'stations:playlists:delete')
|
||||
$this->get('/delete/{id}', 'stations:playlists:delete')
|
||||
->setName('stations:playlists:delete');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/profile', function() {
|
||||
|
||||
$this->any('', 'stations:profile:index')
|
||||
$this->get('', 'stations:profile:index')
|
||||
->setName('stations:profile:index');
|
||||
|
||||
$this->any('/edit', 'stations:profile:edit')
|
||||
$this->map(['GET', 'POST'], '/edit', 'stations:profile:edit')
|
||||
->setName('stations:profile:edit');
|
||||
|
||||
$this->any('/backend[/{do}]', 'stations:profile:backend')
|
||||
$this->map(['GET', 'POST'], '/backend[/{do}]', 'stations:profile:backend')
|
||||
->setName('stations:profile:backend');
|
||||
|
||||
$this->any('/frontend[/{do}]', 'stations:profile:frontend')
|
||||
$this->map(['GET', 'POST'], '/frontend[/{do}]', 'stations:profile:frontend')
|
||||
->setName('stations:profile:frontend');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/reports', function() {
|
||||
|
||||
$this->any('/timeline[/format/{format}]', 'stations:index:timeline')
|
||||
$this->get('/timeline[/format/{format}]', 'stations:index:timeline')
|
||||
->setName('stations:index:timeline');
|
||||
|
||||
$this->any('/performance[/format/{format}]', 'stations:reports:performance')
|
||||
$this->get('/performance[/format/{format}]', 'stations:reports:performance')
|
||||
->setName('stations:reports:performance');
|
||||
|
||||
$this->any('/duplicates', 'stations:reports:duplicates')
|
||||
$this->get('/duplicates', 'stations:reports:duplicates')
|
||||
->setName('stations:reports:duplicates');
|
||||
|
||||
$this->any('/duplicates/delete/{media_id}', 'stations:reports:deletedupe')
|
||||
$this->get('/duplicates/delete/{media_id}', 'stations:reports:deletedupe')
|
||||
->setName('stations:reports:deletedupe');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/streamers', function() {
|
||||
|
||||
$this->any('', 'stations:streamers:index')
|
||||
$this->get('', 'stations:streamers:index')
|
||||
->setName('stations:streamers:index');
|
||||
|
||||
$this->any('/edit[/{id}]', 'stations:streamers:edit')
|
||||
$this->map(['GET', 'POST'], '/edit[/{id}]', 'stations:streamers:edit')
|
||||
->setName('stations:streamers:edit');
|
||||
|
||||
$this->any('/delete/{id}', 'stations:streamers:delete')
|
||||
$this->get('/delete/{id}', 'stations:streamers:delete')
|
||||
->setName('stations:streamers:delete');
|
||||
|
||||
});
|
||||
|
||||
$this->group('/util', function() {
|
||||
|
||||
$this->any('/playlist[/{format}]', 'stations:util:playlist')
|
||||
$this->get('/playlist[/{format}]', 'stations:util:playlist')
|
||||
->setName('stations:util:playlist');
|
||||
|
||||
$this->any('/write', 'stations:util:write')
|
||||
$this->get('/write', 'stations:util:write')
|
||||
->setName('stations:util:write');
|
||||
|
||||
$this->any('/restart', 'stations:util:restart')
|
||||
$this->get('/restart', 'stations:util:restart')
|
||||
->setName('stations:util:restart');
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue