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:
@@ -69,9 +69,20 @@ class Venue extends Model implements HasMedia
|
||||
'image/gif',
|
||||
'image/webp',
|
||||
])
|
||||
->useDisk('private')
|
||||
->useFallbackUrl(asset('img/einundzwanzig.png'));
|
||||
}
|
||||
|
||||
public function getSignedMediaUrl(string $collection = 'images', int $expireMinutes = 60): string
|
||||
{
|
||||
$media = $this->getFirstMedia($collection);
|
||||
if (! $media) {
|
||||
return asset('img/einundzwanzig.png');
|
||||
}
|
||||
|
||||
return url()->temporarySignedRoute('media.signed', now()->addMinutes($expireMinutes), ['media' => $media]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the options for generating the slug.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user