// Plain ES modules, no bundler. import { startShell } from './shell.js'; import { get } from './api.js'; let offline = 0; startShell({ name: 'network monitor', categories: ['Network', 'DNS', 'Hub'], views: [ { id: 'health', name: 'Network health', path: '/', category: 'Network', icon: '◎', description: 'Mesh and internet health as the probes see it: now, over time, and every outage.', load: () => import('./views/health.js') }, { id: 'probes', name: 'Probes', path: '/probes', category: 'Network', icon: 'P', description: 'Add, place and remove the machines that test the network.', load: () => import('./views/probes.js'), badge: () => offline }, { id: 'clients', name: 'Clients', path: '/clients', category: 'DNS', icon: '▣', description: 'Every device seen on the network, with your names, categories and flags.', load: () => import('./views/clients.js') }, { id: 'queries', name: 'Query log', path: '/queries', category: 'DNS', icon: 'Q?', description: 'Sift through DNS requests from AdGuard Home.', load: () => import('./views/queries.js') }, { id: 'domains', name: 'Domains', path: '/domains', category: 'DNS', icon: '.com', description: 'Most requested domains, and who asks for each one.', load: () => import('./views/domains.js') }, { id: 'blocked', name: 'Blocked domains', path: '/blocked', category: 'DNS', icon: '⊘', description: 'What AdGuard Home blocked, how often, and for whom.', load: () => import('./views/blocked.js') }, { id: 'settings', name: 'Settings', path: '/settings', category: 'Hub', icon: '⚙', description: 'What the hub tests, its thresholds and its AdGuard connection.', load: () => import('./views/settings.js') }, ], }); // Offline probes show as a count on the Probes nav item. async function pollProbes() { try { const { probes } = await get('/api/probes'); offline = probes.filter((p) => !p.online).length; window.dispatchEvent(new Event('app:badges')); } catch {} } pollProbes(); setInterval(pollProbes, 60000);