mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-28 07:43:18 +00:00
- 🗂️ Change default filesystem disk from `local` to `private` in configuration - 📤 Use `Storage::disk` for media download and response functionality - ⚙️ Refactor download and file response logic for improved security and consistency
60 lines
2.4 KiB
PHP
60 lines
2.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\Facades\Session;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
|
|
|
Route::redirect('/', '/association/profile');
|
|
|
|
Route::get('dl/{media}', function (Media $media, Request $request) {
|
|
return Storage::disk($media->disk)->download(
|
|
$media->getPathRelativeToRoot(),
|
|
$media->file_name
|
|
);
|
|
})
|
|
->name('dl')
|
|
->middleware('signed');
|
|
|
|
Route::get('media/{media}', function (Media $media, Request $request) {
|
|
return Storage::disk($media->disk)->response(
|
|
$media->getPathRelativeToRoot(),
|
|
$media->file_name,
|
|
[
|
|
'Content-Type' => $media->mime_type,
|
|
'Cache-Control' => 'private, max-age=3600',
|
|
]
|
|
);
|
|
})
|
|
->name('media.signed')
|
|
->middleware('signed');
|
|
|
|
Route::post('logout', function () {
|
|
\App\Support\NostrAuth::logout();
|
|
Session::flush();
|
|
|
|
return redirect('/');
|
|
})->name('logout');
|
|
|
|
// Association Routes
|
|
Route::livewire('/association/profile', 'association.profile')->name('association.profile');
|
|
Route::livewire('/association/benefits', 'association.benefits')->name('association.benefits');
|
|
|
|
Route::livewire('/association/election', 'association.election.index')->name('association.elections');
|
|
Route::livewire('/association/election/{election:year}', 'association.election.show')->name('association.election');
|
|
Route::livewire('/association/election/admin/{election:year}', 'association.election.admin')->name('association.election.admin');
|
|
|
|
Route::livewire('/association/members/admin', 'association.members.admin')->name('association.members.admin');
|
|
|
|
Route::livewire('/association/news', 'association.news')->name('association.news');
|
|
|
|
Route::livewire('/association/project-support', 'association.project-support.index')->name('association.projectSupport');
|
|
Route::livewire('/association/project-support/create', 'association.project-support.form.create')->name('association.projectSupport.create');
|
|
Route::livewire('/association/project-support/{projectProposal:slug}', 'association.project-support.show')->name('association.projectSupport.item');
|
|
Route::livewire('/association/project-support/edit/{projectProposal:slug}', 'association.project-support.form.edit')->name('association.projectSupport.edit');
|
|
|
|
// Other pages
|
|
Route::livewire('/changelog', 'changelog')->name('changelog');
|
|
Route::livewire('/welcome', 'welcome')->name('welcome');
|