// Copyright (c) 2026 Gordon Bolton. MIT License. // Bootstrap - wire all event handlers on DOMContentLoaded import { checkAuthenticationAndInit, handleLogin, handleLogoutClick } from './ui/auth.js'; import { initDownloadClientFilter } from './ui/filters.js'; import { initRequestFilters } from './ui/requestFilters.js'; import { initHistoryControls } from './ui/history.js'; import { toggleStatusPanel } from './ui/statusPanel.js'; import { initWebhooks } from './ui/webhooks.js'; import { initThemeSwitcher } from './ui/theme.js'; import { initTabs, goHome } from './ui/tabs.js'; import { handleShowAllToggle } from './sse.js'; import { loadAppVersion } from './api.js'; import { initClientLogCapture } from './utils/clientLogCapture.js'; document.addEventListener('DOMContentLoaded', () => { // Initialize client console log capturing early initClientLogCapture(); // Login form const loginForm = document.getElementById('login-form'); if (loginForm) { loginForm.addEventListener('submit', handleLogin); } // Logout button const logoutBtn = document.getElementById('logout-btn'); if (logoutBtn) { logoutBtn.addEventListener('click', handleLogoutClick); } // Show all toggle const showAllToggle = document.getElementById('show-all-toggle'); if (showAllToggle) { showAllToggle.addEventListener('change', (e) => handleShowAllToggle(e.target.checked)); } // Status panel toggle const statusToggle = document.getElementById('status-btn'); if (statusToggle) { statusToggle.addEventListener('click', toggleStatusPanel); } // Home button const homeBtn = document.getElementById('home-btn'); if (homeBtn) { homeBtn.addEventListener('click', goHome); } // Initialize UI components initThemeSwitcher(); initTabs(); initDownloadClientFilter(); initRequestFilters(); initHistoryControls(); initWebhooks(); // Load app version loadAppVersion().then(version => { const versionEl = document.getElementById('app-version'); if (versionEl && version) { versionEl.textContent = 'v' + version; } }); // Check authentication and initialize checkAuthenticationAndInit(); });