From bfc2662efb669b57c6f2c653d4fb1aa2696fb3b2 Mon Sep 17 00:00:00 2001 From: idevakk <219866223+idevakk@users.noreply.github.com> Date: Thu, 5 Mar 2026 15:34:39 +0530 Subject: [PATCH] chore: update .env.example with Reverb TLS configuration --- .env.example | 6 ++++-- config/reverb.php | 6 +++++- resources/js/app.js | 24 ++++++++++++++-------- resources/views/livewire/mailbox.blade.php | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index cac7686..98d34ec 100644 --- a/.env.example +++ b/.env.example @@ -73,9 +73,11 @@ EMAIL_BODY_TTL_SECONDS=259200 REVERB_APP_ID=imail-local REVERB_APP_KEY=imail-local-key REVERB_APP_SECRET=imail-local-secret -REVERB_HOST=localhost +REVERB_HOST=imail.app REVERB_PORT=8080 -REVERB_SCHEME=http +REVERB_SCHEME=https +REVERB_TLS_CERT="D:/laragon/etc/ssl/laragon.crt" +REVERB_TLS_KEY="D:/laragon/etc/ssl/laragon.key" VITE_REVERB_APP_KEY="${REVERB_APP_KEY}" VITE_REVERB_HOST="${REVERB_HOST}" diff --git a/config/reverb.php b/config/reverb.php index 9909415..c627f00 100644 --- a/config/reverb.php +++ b/config/reverb.php @@ -34,7 +34,11 @@ return [ 'path' => env('REVERB_SERVER_PATH', ''), 'hostname' => env('REVERB_HOST'), 'options' => [ - 'tls' => [], + 'tls' => env('REVERB_TLS_CERT') ? [ + 'local_cert' => env('REVERB_TLS_CERT'), + 'local_pk' => env('REVERB_TLS_KEY'), + 'verify_peer' => false, + ] : [], ], 'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000), 'scaling' => [ diff --git a/resources/js/app.js b/resources/js/app.js index 9349afa..21eade0 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -3,12 +3,18 @@ import Echo from 'laravel-echo'; import Pusher from 'pusher-js'; window.Pusher = Pusher; -window.Echo = new Echo({ - broadcaster: 'reverb', - key: import.meta.env.VITE_REVERB_APP_KEY, - wsHost: import.meta.env.VITE_REVERB_HOST, - wsPort: import.meta.env.VITE_REVERB_PORT ?? 80, - wssPort: import.meta.env.VITE_REVERB_PORT ?? 443, - forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https', - enabledTransports: ['ws', 'wss'], -}); +window.startReverb = function () { + if (window.Echo) return window.Echo; + + window.Echo = new Echo({ + broadcaster: 'reverb', + key: import.meta.env.VITE_REVERB_APP_KEY, + wsHost: import.meta.env.VITE_REVERB_HOST, + wsPort: import.meta.env.VITE_REVERB_PORT ?? 80, + wssPort: import.meta.env.VITE_REVERB_PORT ?? 443, + forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https', + enabledTransports: ['ws', 'wss'], + }); + + return window.Echo; +}; diff --git a/resources/views/livewire/mailbox.blade.php b/resources/views/livewire/mailbox.blade.php index f5bb069..a541ba2 100644 --- a/resources/views/livewire/mailbox.blade.php +++ b/resources/views/livewire/mailbox.blade.php @@ -20,7 +20,7 @@ }); } }" - x-init="$watch('selectedId', value => { if(value && window.innerWidth < 1024) mobileView = 'detail' }); $watch('mobileView', value => { if(value === 'list' && window.innerWidth < 1024) selectedId = null })" + x-init="window.startReverb(); $watch('selectedId', value => { if(value && window.innerWidth < 1024) mobileView = 'detail' }); $watch('mobileView', value => { if(value === 'list' && window.innerWidth < 1024) selectedId = null })" @resize.window="if (window.innerWidth >= 1280) sidebarOpen = true">