feat: FileController para servir archivos privados con autenticación
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,17 +27,17 @@
|
||||
@endif
|
||||
@if($msg->attachment)
|
||||
@if($msg->attachment_type === 'image')
|
||||
<img src="{{ Storage::disk('uploads')->url($msg->attachment) }}" class="img-fluid rounded mt-1">
|
||||
<img src="{{ route('files.serve', ['path' => $msg->attachment]) }}" class="img-fluid rounded mt-1">
|
||||
@elseif($msg->attachment_type === 'audio')
|
||||
<audio controls class="mt-1" style="max-width:250px">
|
||||
<source src="{{ Storage::disk('uploads')->url($msg->attachment) }}">
|
||||
<source src="{{ route('files.serve', ['path' => $msg->attachment]) }}">
|
||||
</audio>
|
||||
@elseif($msg->attachment_type === 'video')
|
||||
<video controls class="mt-1 rounded" style="max-width:250px">
|
||||
<source src="{{ Storage::disk('uploads')->url($msg->attachment) }}">
|
||||
<source src="{{ route('files.serve', ['path' => $msg->attachment]) }}">
|
||||
</video>
|
||||
@else
|
||||
<a href="{{ Storage::disk('uploads')->url($msg->attachment) }}" target="_blank" class="btn btn-sm btn-light mt-1">
|
||||
<a href="{{ route('files.serve', ['path' => $msg->attachment]) }}" target="_blank" class="btn btn-sm btn-light mt-1">
|
||||
<i class="fas fa-file"></i> Ver archivo
|
||||
</a>
|
||||
@endif
|
||||
@@ -86,7 +86,7 @@
|
||||
<script>
|
||||
const receiverId = {{ $user->id }};
|
||||
const authId = {{ auth()->id() }};
|
||||
const storageBase = '{{ rtrim(Storage::disk('uploads')->url(''), '/') }}';
|
||||
const storageBase = '{{ url('/files') }}';
|
||||
const chatMessages = document.getElementById('chat-messages');
|
||||
|
||||
// scroll al fondo
|
||||
|
||||
Reference in New Issue
Block a user