Added option to customize routes

This commit is contained in:
Julian Prieber 2022-06-09 16:45:05 +02:00
parent 93e2832614
commit 40f3dc0ec2
3 changed files with 63 additions and 9 deletions

View File

@ -10,25 +10,43 @@ use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Support\Facades\Route;
Route::get('/register', [RegisteredUserController::class, 'create'])
if(Config::get('meta.register_url') != '') {
$register = Config::get('meta.register_url');
} else {
$register = "/register";
}
if(Config::get('meta.login_url') != '') {
$login = Config::get('meta.login_url');
} else {
$login = "/login";
}
if(Config::get('meta.forgot_password_url') != '') {
$forgot_password = Config::get('meta.forgot_password_url');
} else {
$forgot_password = "/forgot-password";
}
Route::get($register, [RegisteredUserController::class, 'create'])
->middleware('guest')
->name('register');
Route::post('/register', [RegisteredUserController::class, 'store'])
Route::post($register, [RegisteredUserController::class, 'store'])
->middleware('guest');
Route::get('/login', [AuthenticatedSessionController::class, 'create'])
Route::get($login, [AuthenticatedSessionController::class, 'create'])
->middleware('guest')
->name('login');
Route::post('/login', [AuthenticatedSessionController::class, 'store'])
Route::post($login, [AuthenticatedSessionController::class, 'store'])
->middleware('guest');
Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])
Route::get( $forgot_password, [PasswordResetLinkController::class, 'create'])
->middleware('guest')
->name('password.request');
Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
Route::post( $forgot_password, [PasswordResetLinkController::class, 'store'])
->middleware('guest')
->name('password.email');

View File

@ -24,11 +24,19 @@ use App\Http\Controllers\UserController;
if(!file_exists(base_path("config/meta.php"))){copy(base_path('storage/templates/meta.php'), base_path('config/meta.php'));}
//Changes the homepage to a LittleLink Custom profile if set in the config
if(Config::get('meta.custom_home_url') != '') {
$custom_home_page_url = Config::get('meta.custom_home_url');
} else {
$custom_home_page_url = "/home";
}
if(env('HOME_URL') != '') {
Route::get('/', [UserController::class, 'littlelinkhome'])->name('littlelink');
Route::get('/home', [App\Http\Controllers\HomeController::class, 'home'])->name('home');
Route::get( $custom_home_page_url, [App\Http\Controllers\HomeController::class, 'home'])->name('home');
} else {
Route::get('/', [App\Http\Controllers\HomeController::class, 'home'])->name('home');
if(Config::get('meta.disable_home_page') == 'redirect') {
Route::get('/', function () {return redirect(Config::get('meta.redirect_home_page'));});
}elseif(Config::get('meta.disable_home_page') != 'true') {
Route::get('/', [App\Http\Controllers\HomeController::class, 'home'])->name('home');}
}
//Redirect if no page URL is set
@ -42,8 +50,9 @@ Route::get('/panel/diagnose', function () {
});
//Public route
$custom_prefix = Config::get('meta.custom_url_prefix');
Route::get('/going/{id?}/{link?}', [UserController::class, 'clickNumber'])->where('link', '.*')->name('clickNumber');
Route::get('/+{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/' . $custom_prefix . '{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/@{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/pages/{name}', [AdminController::class, 'pages'])->name('pages');
Route::get('/theme/@{littlelink}', [UserController::class, 'theme'])->name('theme');

View File

@ -84,6 +84,32 @@ return [
'analytics' => $analytics, // Set on top of page.
/*
|--------------------------------------------------------------------------
| Custom routes
|--------------------------------------------------------------------------
|
| You can change routes to improve security.
|
*/
'login_url' => '/login',
'register_url' => '/register',
'forgot_password_url' => '/forgot-password',
'custom_home_url' => '/home', // Only applies if you set a "HOME_URL" in the config.
// If 'true' the Home Page will be disabled entirely.
// You will still be able to login on the login page etc.
'disable_home_page' => 'false', // Either 'true', 'false' or 'redirect'.
'redirect_home_page' => 'https://littlelink-custom.com', // Only active if value above is set to 'redirect'.
// The URL prefix is the symbol that comes before a LittleLink URL.
// For example the '@' in 'example.com/@admin'.
// If empty no prefix is required. Use with caution.
'custom_url_prefix' => '+', // The '@' prefix will always work regardless of this setting.
/*
|--------------------------------------------------------------------------
| Footer links
@ -103,6 +129,7 @@ return [
'custom_link_home' => '', // Leave empty to use default value.
/*
|--------------------------------------------------------------------------
| Home Page settings