This commit is contained in:
Mekan1206
2026-08-15 19:45:56 +05:00
parent cdbad87958
commit 3a415edb6e
3 changed files with 27 additions and 7 deletions

View File

@@ -18,9 +18,21 @@ class SupportChatController extends Controller
{
public function index(): View
{
if (app()->bound('debugbar')) {
app('debugbar')->disable();
}
$key = config('broadcasting.connections.reverb.key');
return view('nova.chat', [
'chatCss' => $this->panelAsset('css/chat.css'),
'chatScripts' => array_values(array_filter([
$key ? $this->panelAsset('js/pusher.min.js') : null,
$key ? $this->panelAsset('js/echo.iife.js') : null,
$this->panelAsset('js/chat.js'),
])),
'pusher' => [
'key' => config('broadcasting.connections.reverb.key'),
'key' => $key,
'host' => config('broadcasting.connections.reverb.options.host'),
'port' => (int) config('broadcasting.connections.reverb.options.port', 8080),
'scheme' => config('broadcasting.connections.reverb.options.scheme', 'http'),
@@ -89,4 +101,13 @@ class SupportChatController extends Controller
return $support;
}
private function panelAsset(string $relative): string
{
$path = public_path('assets/panel/'.$relative);
abort_unless(is_readable($path), 500, "Missing chat asset [{$relative}].");
return (string) file_get_contents($path);
}
}

View File

@@ -18,6 +18,7 @@ return [
'except' => [
'telescope*',
'horizon*',
'panel/chat*',
],
/*

View File

@@ -6,7 +6,7 @@
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="robots" content="noindex">
<title>{{ __('Chat') }} — {{ config('nova.name', config('app.name')) }}</title>
<link rel="stylesheet" href="{{ asset('assets/panel/css/chat.css') }}">
<style>{!! $chatCss !!}</style>
</head>
<body>
<div class="mm-chat" id="mm-chat">
@@ -54,10 +54,8 @@
},
};
</script>
@if (! empty($pusher['key']))
<script src="{{ asset('assets/panel/js/pusher.min.js') }}"></script>
<script src="{{ asset('assets/panel/js/echo.iife.js') }}"></script>
@endif
<script src="{{ asset('assets/panel/js/chat.js') }}"></script>
@foreach ($chatScripts as $script)
<script>{!! $script !!}</script>
@endforeach
</body>
</html>