mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-28 07:43:18 +00:00
🔒 Implement signed media URLs and migrate media storage to private disk
- ✅ Introduce `getSignedMediaUrl` in models for temporary signed URLs - 🗂️ Migrate media collections to private disk for added security - 🔧 Add `media:move-to-private` command to streamline migration - ⚙️ Update views and components to use signed media URLs - ✏️ Adjust route `media.signed` for signed file access handling
This commit is contained in:
@@ -73,9 +73,20 @@ class ProjectProposal extends Model implements HasMedia
|
||||
'image/gif',
|
||||
'image/webp',
|
||||
])
|
||||
->useDisk('private')
|
||||
->useFallbackUrl(asset('einundzwanzig-alpha.jpg'));
|
||||
}
|
||||
|
||||
public function getSignedMediaUrl(string $collection = 'main', int $expireMinutes = 60): string
|
||||
{
|
||||
$media = $this->getFirstMedia($collection);
|
||||
if (! $media) {
|
||||
return asset('einundzwanzig-alpha.jpg');
|
||||
}
|
||||
|
||||
return url()->temporarySignedRoute('media.signed', now()->addMinutes($expireMinutes), ['media' => $media]);
|
||||
}
|
||||
|
||||
public function einundzwanzigPleb(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EinundzwanzigPleb::class);
|
||||
|
||||
Reference in New Issue
Block a user