Files

34 lines
1.5 KiB
PHP
Raw Permalink Normal View History

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;
use Pterodactyl\Http\Middleware\RequireTwoFactorAuthentication;
2026-10-05 18:10:18 -04:00
use Pterodactyl\Services\Extensions\ExtensionSettingFiles;
2026-10-05 18:10:18 -04:00
Route::get('/', [IndexController::class, 'index'])->name('index')->fallback();
Route::get('/account', [IndexController::class, 'index'])
->withoutMiddleware(RequireTwoFactorAuthentication::class)
->name('account');
2026-10-05 18:10:18 -04:00
Route::get('/locales/locale.json', LocaleController::class)
->withoutMiddleware(['auth', RequireTwoFactorAuthentication::class])
->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();