diff --git a/lib/api/routes/health.js b/lib/api/routes/health.js index 4fe5aa0..22953a8 100644 --- a/lib/api/routes/health.js +++ b/lib/api/routes/health.js @@ -5,6 +5,7 @@ import { requireOwner } from '../cap.js'; import { validate } from '../validate.js'; import { grouped, iconSlug } from '../../health/registry.js'; import * as services from '../../db/repos/monitored_services.js'; +import * as devices from '../../db/repos/lan_devices.js'; import * as statusRepo from '../../db/repos/service_status.js'; import { enqueue } from '../../jobs/queue.js'; @@ -29,7 +30,13 @@ router.get('/services', asyncWrap(async (_req, res) => { // GET /services/discovered — candidates from a LAN scan, awaiting review (owner). router.get('/services/discovered', requireOwner, asyncWrap(async (_req, res) => { - res.json((await services.listDiscovered()).map(s => ({ ...s, icon: iconSlug(s) }))); + // Cross-reference each candidate's host IP with the Network Devices band so the + // tile can show a known device name instead of a bare IP:port. + const byIp = Object.fromEntries( + (await devices.listKnown()).filter(d => d.ip).map(d => [d.ip, d.name])); + res.json((await services.listDiscovered()).map(s => ({ + ...s, icon: iconSlug(s), device: byIp[s.host] || null + }))); })); const checkCfg = z.object({ type: z.enum(['http', 'tcp']).optional(), path: z.string().max(200).optional() }); diff --git a/package-lock.json b/package-lock.json index fa7a5b2..d44326b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "void-server", - "version": "2.6.4", + "version": "2.6.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "void-server", - "version": "2.6.4", + "version": "2.6.5", "dependencies": { "@modelcontextprotocol/sdk": "^1.29.0", "@mozilla/readability": "^0.6.0", diff --git a/package.json b/package.json index 19a2c95..9ff0118 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "void-server", - "version": "2.6.4", + "version": "2.6.5", "type": "module", "private": true, "scripts": { diff --git a/public/views/health_band.js b/public/views/health_band.js index e7263a9..dc1afc3 100644 --- a/public/views/health_band.js +++ b/public/views/health_band.js @@ -61,8 +61,8 @@ async function discoveredSection() { el('div', { class: 'tiles' }, cand.map(c => el('div', { class: 'tile disc' }, el('div', { class: 'tile-main' }, - el('div', { class: 'tile-nm' }, c.name), - el('div', { class: 'tile-host' }, c.url)), + el('div', { class: 'tile-nm' }, c.device || c.name), + el('div', { class: 'tile-host' }, c.device ? `${c.name} · ${c.url}` : c.url)), el('button', { class: 'disc-add', title: 'Add to the band', onclick: () => promote(c.id) }, '+'))))); }