Reworked maintenance mode

https://github.com/LinkStackOrg/LinkStack/issues/590
This commit is contained in:
Julian Prieber 2023-10-10 16:20:04 +02:00
parent a59e98e1cc
commit 8942b33f09
2 changed files with 7 additions and 2 deletions

View File

@ -20,7 +20,10 @@ class CheckBlockedUser
if (Auth::check() && Auth::user()->block === "yes") { if (Auth::check() && Auth::user()->block === "yes") {
return redirect()->route('blocked'); return redirect()->route('blocked');
} }
if (env('MAINTENANCE_MODE') == 'true' && (Auth::check() && Auth::user()->role != 'admin')) {
return redirect(url(''));
}
return $next($request); return $next($request);
} }
} }

View File

@ -86,7 +86,7 @@ Route::get('/panel/diagnose', function () {
//Public route //Public route
$custom_prefix = config('advanced-config.custom_url_prefix'); $custom_prefix = config('advanced-config.custom_url_prefix');
Route::get('/going/{id?}', [UserController::class, 'clickNumber'])->where('link', '.*')->name('clickNumber'); Route::get('/going/{id?}', [UserController::class, 'clickNumber'])->where('link', '.*')->name('clickNumber');
if($custom_prefix != ""){Route::get('/' . $custom_prefix . '{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');}} if($custom_prefix != ""){Route::get('/' . $custom_prefix . '{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');}
Route::get('/@{littlelink}', [UserController::class, 'littlelink'])->name('littlelink'); Route::get('/@{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/pages/'.strtolower(footer('Terms')), [AdminController::class, 'pagesTerms'])->name('pagesTerms'); Route::get('/pages/'.strtolower(footer('Terms')), [AdminController::class, 'pagesTerms'])->name('pagesTerms');
Route::get('/pages/'.strtolower(footer('Privacy')), [AdminController::class, 'pagesPrivacy'])->name('pagesPrivacy'); Route::get('/pages/'.strtolower(footer('Privacy')), [AdminController::class, 'pagesPrivacy'])->name('pagesPrivacy');
@ -97,6 +97,8 @@ Route::get('/u/{id?}', [UserController::class, 'userRedirect'])->name('userRedir
Route::get('/demo-page', [App\Http\Controllers\HomeController::class, 'demo'])->name('demo'); Route::get('/demo-page', [App\Http\Controllers\HomeController::class, 'demo'])->name('demo');
}
Route::middleware(['auth', 'blocked', 'impersonate'])->group(function () { Route::middleware(['auth', 'blocked', 'impersonate'])->group(function () {
//User route //User route
Route::group([ Route::group([