Skip to content

Commit

Permalink
Move 'installation:complete' to web instead of per route (#1467)
Browse files Browse the repository at this point in the history
* Move 'installation:complete' to web instead of per route
* Add complete to api too
  • Loading branch information
ildyria authored Sep 5, 2022
1 parent 1c8eedb commit b31d345
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
'installation:complete',
'accept_content_type:html',
\Illuminate\Cookie\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
Expand Down Expand Up @@ -60,6 +61,7 @@ class Kernel extends HttpKernel
],

'api' => [
'installation:complete',
'accept_content_type:json',
'content_type:json',
\Illuminate\Cookie\Middleware\EncryptCookies::class,
Expand All @@ -72,6 +74,7 @@ class Kernel extends HttpKernel
],

'api-admin' => [
'installation:complete',
'accept_content_type:json',
'content_type:json',
\Illuminate\Cookie\Middleware\EncryptCookies::class,
Expand Down
14 changes: 7 additions & 7 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

Route::feeds();

Route::get('/', [IndexController::class, 'show'])->name('home')->middleware(['installation:complete', 'migration:complete']);
Route::get('/gallery', [IndexController::class, 'gallery'])->name('gallery')->middleware(['installation:complete', 'migration:complete']);
Route::get('/', [IndexController::class, 'show'])->name('home')->middleware(['migration:complete']);
Route::get('/gallery', [IndexController::class, 'gallery'])->name('gallery')->middleware(['migration:complete']);
Route::match(['get', 'post'], '/migrate', [Administration\UpdateController::class, 'migrate'])
->name('migrate')
->middleware(['installation:complete', 'migration:incomplete']);
->name('migrate')
->middleware(['migration:incomplete']);

/*
* TODO see to add better redirection functionality later.
Expand All @@ -38,10 +38,10 @@
*
* Other ideas, redirection by album name, photo title...
*/
Route::get('/r/{albumID}/{photoID}', [RedirectController::class, 'photo'])->middleware(['installation:complete', 'migration:complete']);
Route::get('/r/{albumID}', [RedirectController::class, 'album'])->middleware(['installation:complete', 'migration:complete']);
Route::get('/r/{albumID}/{photoID}', [RedirectController::class, 'photo'])->middleware(['migration:complete']);
Route::get('/r/{albumID}', [RedirectController::class, 'album'])->middleware(['migration:complete']);

Route::get('/view', [ViewController::class, 'view'])->name('view')->middleware(['redirect-legacy-id']);
Route::get('/demo', [DemoController::class, 'js']);
Route::get('/frame', [FrameController::class, 'init'])->name('frame')->middleware(['installation:complete', 'migration:complete']);
Route::get('/frame', [FrameController::class, 'init'])->name('frame')->middleware(['migration:complete']);

0 comments on commit b31d345

Please sign in to comment.