2017-04-01 21:01:10 -04:00
|
|
|
<?php
|
2018-06-20 23:05:35 -07:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2022-12-01 11:49:54 -07:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Http\Controllers\Base\ExtensionFileController;
|
|
|
|
|
use Pterodactyl\Http\Controllers\Base\IndexController;
|
|
|
|
|
use Pterodactyl\Http\Controllers\Base\LocaleController;
|
2020-12-06 13:56:14 -08:00
|
|
|
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Services\Extensions\ExtensionSettingFiles;
|
2020-12-06 13:56:14 -08:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
Route::get('/', [IndexController::class, 'index'])->name('index')->fallback();
|
|
|
|
|
Route::get('/account', [IndexController::class, 'index'])
|
2020-12-06 13:56:14 -08:00
|
|
|
->withoutMiddleware(RequireTwoFactorAuthentication::class)
|
|
|
|
|
->name('account');
|
2017-05-05 16:27:36 -04:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
Route::get('/locales/locale.json', LocaleController::class)
|
2022-05-14 15:51:05 -04:00
|
|
|
->withoutMiddleware(['auth', RequireTwoFactorAuthentication::class])
|
2019-11-16 12:46:19 -08:00
|
|
|
->where('namespace', '.*');
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
// Files uploaded through extension `file` settings. Public and stateless: no
|
|
|
|
|
// session, no cookies, so the immutable cache headers are safe behind a proxy.
|
|
|
|
|
Route::get('/'.ExtensionSettingFiles::ROUTE_PREFIX.'/{extension}/{file}', ExtensionFileController::class)
|
|
|
|
|
->withoutMiddleware(['web', 'auth.session', RequireTwoFactorAuthentication::class])
|
|
|
|
|
->where('extension', '[a-z][a-z0-9-]{0,47}')
|
|
|
|
|
->where('file', '[a-f0-9]{40}\.[a-z0-9]{2,5}')
|
|
|
|
|
->name('extensions.files');
|
|
|
|
|
|
|
|
|
|
// The SPA catch-all is a fallback so that routes registered after it - an extension's
|
|
|
|
|
// /extensions/<id> and claimed root path routes - are matched first.
|
|
|
|
|
Route::get('/{react}', [IndexController::class, 'index'])
|
|
|
|
|
->where('react', '^(?!(\/)?(api|auth|daemon)).+')
|
|
|
|
|
->fallback();
|