You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
use App\Http\Controllers\Api\ApplicationFileController;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
/** 选手端附件预览:签名临时 URL避免仅依赖 public/storage → storage/app/public 的软链(未 link 时 /storage/... 404 */
Route::get('/participant/application-files/{file}', [ApplicationFileController::class, 'downloadSigned'])
->middleware('signed')
->whereNumber('file')
->name('participant.application-file.download');
/** cxxfds-web 生产构建产出目录public/admin */
Route::redirect('/admin', '/admin/', 301);
Route::get('/admin/{path?}', function (?string $path = null) {
if ($path !== null && $path !== '') {
$candidate = public_path('admin/'.$path);
if (File::isFile($candidate)) {
return response()->file($candidate);
}
}
$index = public_path('admin/index.html');
if (! File::exists($index)) {
abort(503, 'Admin frontend not built. Run npm run build in cxxfds-web.');
}
return response()->file($index, ['Content-Type' => 'text/html; charset=UTF-8']);
})->where('path', '.*')->name('admin.spa');