Modules: - Chain: daemon RPC client (DaemonRpc singleton, cached queries) - Explorer: block browser, tx viewer, alias directory, search, stats API - Names: .lthn TLD registrar portal (availability check, lookup, directory) - Trade: scaffold (DEX frontend + API) - Pool: scaffold (mining pool dashboard) Replaces 5 Node.js containers (5.9GB) with one FrankenPHP app. Built on CorePHP framework pattern from host.uk.com. Co-Authored-By: Charon <charon@lethean.io>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import axios from 'axios';
|
|
window.axios = axios;
|
|
|
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
|
|
|
/**
|
|
* Laravel Echo - Real-time event broadcasting
|
|
*
|
|
* Uses Laravel Reverb for WebSocket connections.
|
|
* Enable by setting BROADCAST_CONNECTION=reverb in .env
|
|
*/
|
|
import Echo from 'laravel-echo';
|
|
import Pusher from 'pusher-js';
|
|
|
|
window.Pusher = Pusher;
|
|
|
|
// Only initialise Echo if Reverb is configured.
|
|
// In production builds, derive host/port from the page URL so a single
|
|
// Docker image works on any domain (lthn.ai, lthn.sh, etc.).
|
|
if (import.meta.env.VITE_REVERB_APP_KEY) {
|
|
const isSecure = window.location.protocol === 'https:';
|
|
const isDev = import.meta.env.DEV;
|
|
|
|
window.Echo = new Echo({
|
|
broadcaster: 'reverb',
|
|
key: import.meta.env.VITE_REVERB_APP_KEY,
|
|
wsHost: isDev ? (import.meta.env.VITE_REVERB_HOST || 'localhost') : window.location.hostname,
|
|
wsPort: isDev ? (import.meta.env.VITE_REVERB_PORT || 8080) : (isSecure ? 443 : 80),
|
|
wssPort: isDev ? (import.meta.env.VITE_REVERB_PORT || 8080) : 443,
|
|
forceTLS: isSecure,
|
|
enabledTransports: ['ws', 'wss'],
|
|
});
|
|
}
|