From f939dcac88c3b972f8bdf0099e71b17baed88846 Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Thu, 25 May 2023 20:12:37 +0200 Subject: [PATCH] Fixed errors with empty custom URL prefix https://github.com/LinkStackOrg/LinkStack/issues/451 --- routes/web.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/routes/web.php b/routes/web.php index b6bb350..32b9dc2 100755 --- a/routes/web.php +++ b/routes/web.php @@ -85,8 +85,7 @@ Route::get('/panel/diagnose', function () { //Public route $custom_prefix = config('advanced-config.custom_url_prefix'); Route::get('/going/{id?}', [UserController::class, 'clickNumber'])->where('link', '.*')->name('clickNumber'); -if (!str_contains(url()->full(), '@') and !in_array(url()->full(), [url('login'), url('register'), url('update'), url('update?error='), url('update?success='), url('update?finishing='), url('update?updating='), url('update?backups='), url('update?backup='), url('update?updating-windows='), url('update?preparing='), url('updating'), url('backup')])) { -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('/pages/'.strtolower(env('TITLE_FOOTER_TERMS')), [AdminController::class, 'pagesTerms'])->name('pagesTerms'); Route::get('/pages/'.strtolower(env('TITLE_FOOTER_PRIVACY')), [AdminController::class, 'pagesPrivacy'])->name('pagesPrivacy'); @@ -224,6 +223,11 @@ Route::group([ }); // ENd Admin authenticated routes }); + + if(config('advanced-config.custom_url_prefix') == ""){ + Route::get('/{littlelink}', [UserController::class, 'littlelink'])->name('littlelink'); + } + // Displays Maintenance Mode page if(env('MAINTENANCE_MODE') == 'true' or file_exists(base_path("storage/MAINTENANCE"))){ Route::get('/{any}', function () { @@ -231,6 +235,5 @@ Route::get('/{any}', function () { })->where('any', '.*'); } -} require __DIR__.'/auth.php';