fix: realtime connection popup could be disabled

This commit is contained in:
Andras Bacsai
2023-12-11 12:03:32 +01:00
parent 5e03979f9c
commit e022492770
4 changed files with 92 additions and 27 deletions

View File

@@ -8,34 +8,10 @@
</div>
@endpersist
<livewire:sponsorship />
@auth
<livewire:realtime-connection />
@endauth
<main class="pb-10 main max-w-screen-2xl">
{{ $slot }}
</main>
<script data-navigate-once>
@auth
if ("{{ auth()->user()->id }}" == 0) {
let checkPusherInterval = null;
let checkNumber = 0;
let errorMessage =
"Coolify could not connect to the new realtime service introduced in beta.154.<br>Please check the related <a href='https://coolify.io/docs/cloudflare-tunnels' target='_blank'>documentation</a> or get help on <a href='https://coollabs.io/discord' target='_blank'>Discord</a>.";
checkPusherInterval = setInterval(() => {
if (window.Echo) {
if (window.Echo.connector.pusher.connection.state !== 'connected') {
checkNumber++;
if (checkNumber > 2) {
clearInterval(checkPusherInterval);
window.Livewire.dispatch('error', errorMessage);
}
} else {
console.log('Coolify is now connected to the new realtime service introduced in beta.154.');
clearInterval(checkPusherInterval);
}
} else {
clearInterval(checkPusherInterval);
window.Livewire.dispatch('error', errorMessage);
}
}, 2000);
}
@endauth
</script>
@endsection