Files
iro2-back-lecture/routes/web.php
kosipov e639968a46 Adapt deployment for Dokploy
Replace the Gitea Actions SSH deploy with a Docker image
(serversideup/php fpm-nginx) and docker-compose setup. Store the
SQLite database inside the persistent storage volume, trust the
reverse proxy, and move admin credentials into config so they work
with cached configuration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 15:39:41 +03:00

46 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use App\Http\Controllers\PokerController;
use App\Http\Controllers\FileLinkController;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::middleware('file.upload.basic')->group(function () {
Route::get('/files', [FileLinkController::class, 'index'])->name('files.index');
Route::post('/files', [FileLinkController::class, 'uploadWeb'])->name('files.upload');
});
Route::get('/files/download/{path}', [FileLinkController::class, 'download'])
->where('path', '.*')
->middleware('signed')
->name('files.download');
// Публичные маршруты
Route::get('/s/{token}', [PokerController::class, 'showForm'])->name('vote.form');
Route::post('/s/{token}', [PokerController::class, 'submitVote']);
Route::get('/thanks', [PokerController::class, 'thanks'])->name('vote.thanks');
// Админка с базовой аутентификацией
Route::prefix('admin')->group(function () {
Route::match(['get', 'post'], '/login', function () {
if (isset($_SERVER['PHP_AUTH_USER'])) {
if ($_SERVER['PHP_AUTH_USER'] === config('admin.user') &&
$_SERVER['PHP_AUTH_PW'] === config('admin.password')) {
session(['admin_logged_in' => true]);
return redirect('/admin/sessions');
}
}
header('WWW-Authenticate: Basic realm="Admin Login"');
abort(401);
});
Route::middleware([\App\Http\Middleware\EnsureAdminAuthenticated::class])->group(function () {
Route::get('/sessions/create', [PokerController::class, 'createEstimationRoundForm'])->name('admin.session.create');
Route::post('/sessions', [PokerController::class, 'createEstimationRound'])->name('admin.sessions.store');
Route::get('/sessions', [PokerController::class, 'listEstimationRounds'])->name('admin.sessions');
Route::get('/sessions/{id}', [PokerController::class, 'showEstimationRound']);
});
});