Cleanup middleware and routes
This commit is contained in:
@@ -24,15 +24,13 @@ class ApiRoutes
|
||||
* Define the api routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'namespace' => 'Api',
|
||||
'prefix' => 'api/v1',
|
||||
'middleware' => ['api'],
|
||||
], function ($router) {
|
||||
$router->group(['middleware' => ['auth.api.optional']], function ($router) {
|
||||
$router->group(['namespace' => 'Api', 'prefix' => 'api/v1', 'middleware' => ['api']], function ($router) {
|
||||
$router->group(['middleware' => ['auth.api']], function ($router) {
|
||||
$router->get('ping', 'GeneralController@ping');
|
||||
|
||||
$router->get('components', 'ComponentController@getComponents');
|
||||
@@ -48,7 +46,7 @@ class ApiRoutes
|
||||
$router->get('metrics/{metric}/points', 'MetricController@getMetricPoints');
|
||||
});
|
||||
|
||||
$router->group(['middleware' => ['auth.api.required']], function ($router) {
|
||||
$router->group(['middleware' => ['auth.api:true']], function ($router) {
|
||||
$router->get('subscribers', 'SubscriberController@getSubscribers');
|
||||
|
||||
$router->post('components', 'ComponentController@postComponents');
|
||||
|
||||
@@ -24,15 +24,12 @@ class AuthRoutes
|
||||
* Define the auth routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'as' => 'auth.',
|
||||
'middleware' => ['web', 'app.hasSetting'],
|
||||
'prefix' => 'auth',
|
||||
'setting' => 'app_name',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'auth.', 'middleware' => ['web', 'ready'], 'prefix' => 'auth'], function ($router) {
|
||||
$router->get('login', [
|
||||
'middleware' => 'guest',
|
||||
'as' => 'login',
|
||||
@@ -44,7 +41,6 @@ class AuthRoutes
|
||||
'uses' => 'AuthController@postLogin',
|
||||
]);
|
||||
|
||||
// Two factor authorization
|
||||
$router->get('2fa', [
|
||||
'as' => 'two-factor',
|
||||
'uses' => 'AuthController@showTwoFactorAuth',
|
||||
|
||||
@@ -24,26 +24,18 @@ class DashboardRoutes
|
||||
* Define the dashboard routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'middleware' => ['web', 'auth'],
|
||||
'prefix' => 'dashboard',
|
||||
'namespace' => 'Dashboard',
|
||||
'as' => 'dashboard.',
|
||||
], function ($router) {
|
||||
// Dashboard
|
||||
$router->group(['middleware' => ['web', 'auth'], 'prefix' => 'dashboard', 'namespace' => 'Dashboard', 'as' => 'dashboard.'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'DashboardController@showDashboard',
|
||||
]);
|
||||
|
||||
// Components
|
||||
$router->group([
|
||||
'as' => 'components.',
|
||||
'prefix' => 'components',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'components.', 'prefix' => 'components'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'ComponentController@showComponents',
|
||||
@@ -76,11 +68,7 @@ class DashboardRoutes
|
||||
$router->post('{component}/edit', 'ComponentController@updateComponentAction');
|
||||
});
|
||||
|
||||
// Incidents
|
||||
$router->group([
|
||||
'as' => 'incidents.',
|
||||
'prefix' => 'incidents',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'incidents.', 'prefix' => 'incidents'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'IncidentController@showIncidents',
|
||||
@@ -101,11 +89,7 @@ class DashboardRoutes
|
||||
$router->post('{incident}/edit', 'IncidentController@editIncidentAction');
|
||||
});
|
||||
|
||||
// Scheduled Maintenance
|
||||
$router->group([
|
||||
'as' => 'schedule.',
|
||||
'prefix' => 'schedule',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'schedule.', 'prefix' => 'schedule'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'ScheduleController@showIndex',
|
||||
@@ -126,11 +110,7 @@ class DashboardRoutes
|
||||
]);
|
||||
});
|
||||
|
||||
// Incident Templates
|
||||
$router->group([
|
||||
'as' => 'templates.',
|
||||
'prefix' => 'templates',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'templates.', 'prefix' => 'templates'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'IncidentController@showTemplates',
|
||||
@@ -148,11 +128,7 @@ class DashboardRoutes
|
||||
$router->delete('{incident_template}/delete', 'IncidentController@deleteTemplateAction');
|
||||
});
|
||||
|
||||
// Subscribers
|
||||
$router->group([
|
||||
'as' => 'subscribers.',
|
||||
'prefix' => 'subscribers',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'subscribers.', 'prefix' => 'subscribers'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'SubscriberController@showSubscribers',
|
||||
@@ -165,11 +141,7 @@ class DashboardRoutes
|
||||
$router->delete('{subscriber}/delete', 'SubscriberController@deleteSubscriberAction');
|
||||
});
|
||||
|
||||
// Metrics
|
||||
$router->group([
|
||||
'as' => 'metrics.',
|
||||
'prefix' => 'metrics',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'metrics.', 'prefix' => 'metrics'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'MetricController@showMetrics',
|
||||
@@ -187,11 +159,7 @@ class DashboardRoutes
|
||||
$router->post('{metric}/edit', 'MetricController@editMetricAction');
|
||||
});
|
||||
|
||||
// Team Members
|
||||
$router->group([
|
||||
'as' => 'team.',
|
||||
'prefix' => 'team',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'team.', 'prefix' => 'team'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'index',
|
||||
'uses' => 'TeamController@showTeamView',
|
||||
@@ -214,11 +182,7 @@ class DashboardRoutes
|
||||
});
|
||||
});
|
||||
|
||||
// Settings
|
||||
$router->group([
|
||||
'as' => 'settings.',
|
||||
'prefix' => 'settings',
|
||||
], function ($router) {
|
||||
$router->group(['as' => 'settings.', 'prefix' => 'settings'], function ($router) {
|
||||
$router->get('setup', [
|
||||
'as' => 'setup',
|
||||
'uses' => 'SettingsController@showSetupView',
|
||||
@@ -246,7 +210,6 @@ class DashboardRoutes
|
||||
$router->post('/', 'SettingsController@postSettings');
|
||||
});
|
||||
|
||||
// User Settings
|
||||
$router->group(['prefix' => 'user'], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'user',
|
||||
@@ -256,10 +219,6 @@ class DashboardRoutes
|
||||
$router->get('{user}/api/regen', 'UserController@regenerateApiKey');
|
||||
});
|
||||
|
||||
/*
|
||||
* Internal API.
|
||||
* This should only be used for making requests within the dashboard.
|
||||
*/
|
||||
$router->group(['prefix' => 'api'], function ($router) {
|
||||
$router->get('incidents/templates', 'ApiController@getIncidentTemplate');
|
||||
$router->post('components/groups/order', 'ApiController@postUpdateComponentGroupOrder');
|
||||
|
||||
@@ -24,13 +24,12 @@ class FeedRoutes
|
||||
* Define the status page routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'middleware' => ['web', 'app.hasSetting'],
|
||||
'setting' => 'app_name',
|
||||
], function ($router) {
|
||||
$router->group(['middleware' => ['web', 'ready']], function ($router) {
|
||||
$router->get('/atom/{component_group?}', [
|
||||
'as' => 'feed.atom',
|
||||
'uses' => 'FeedController@atomAction',
|
||||
|
||||
@@ -23,11 +23,13 @@ class SetupRoutes
|
||||
/**
|
||||
* Define the setup routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router#*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group(['middleware' => ['web', 'app.isSetup']], function ($router) {
|
||||
$router->group(['middleware' => ['web', 'setup']], function ($router) {
|
||||
$router->controller('setup', 'SetupController');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,14 +24,12 @@ class SignupRoutes
|
||||
* Define the signup routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'middleware' => ['web', 'app.hasSetting', 'guest'],
|
||||
'setting' => 'app_name',
|
||||
'as' => 'signup.',
|
||||
], function ($router) {
|
||||
$router->group(['middleware' => ['web', 'ready', 'guest'], 'as' => 'signup.'], function ($router) {
|
||||
$router->get('signup/invite/{code}', [
|
||||
'as' => 'invite',
|
||||
'uses' => 'SignupController@getSignup',
|
||||
|
||||
@@ -24,13 +24,12 @@ class StatusPageRoutes
|
||||
* Define the status page routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'middleware' => ['web', 'app.hasSetting', 'localize'],
|
||||
'setting' => 'app_name',
|
||||
], function ($router) {
|
||||
$router->group(['middleware' => ['web', 'ready', 'localize']], function ($router) {
|
||||
$router->get('/', [
|
||||
'as' => 'status-page',
|
||||
'uses' => 'StatusPageController@showIndex',
|
||||
|
||||
@@ -24,15 +24,13 @@ class SubscribeRoutes
|
||||
* Define the subscribe routes.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Routing\Registrar $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Registrar $router)
|
||||
{
|
||||
$router->group([
|
||||
'middleware' => ['web', 'app.hasSetting', 'localize'],
|
||||
'setting' => 'app_name',
|
||||
'as' => 'subscribe.',
|
||||
], function ($router) {
|
||||
$router->group(['middleware' => 'app.subscribers'], function ($router) {
|
||||
$router->group(['middleware' => ['web', 'ready', 'localize'], 'as' => 'subscribe.'], function ($router) {
|
||||
$router->group(['middleware' => ['subscribers']], function ($router) {
|
||||
$router->get('subscribe', [
|
||||
'as' => 'subscribe',
|
||||
'uses' => 'SubscribeController@showSubscribe',
|
||||
|
||||
Reference in New Issue
Block a user