3c6791658c
- Created server/utils/logCapture.js to intercept and buffer server output, stripping ANSI escape codes. - Created server/middleware/logStreamAuth.js enforcing subnet IP filtering (LOG_ALLOW_SUBNETS), Emby session cookie, Basic Auth fallback, and X-Webhook-Secret header bypass. - Created server/routes/debug.js with SSE streams /api/debug/server-logs, /api/debug/client-logs and batched POST /api/debug/client-logs. Exposes public configuration status at /api/debug/status. - Integrated log capture and mounted debug routes in server/app.js and server/index.js. - Implemented client/src/utils/clientLogCapture.js in the frontend SPA to hook console log/warn/error and flush batched console events. - Documented all endpoints in OpenAPI server/openapi.yaml, ARCHITECTURE.md, and README.md. - Wrote route integration tests and frontend console capture tests, with full validation in swagger-coverage.
69 lines
2.1 KiB
JavaScript
69 lines
2.1 KiB
JavaScript
// 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();
|
|
});
|