feat(littleblue): discovered services show matching network-device name
Cross-references each candidate host IP with lan_devices (known) so a tile shows e.g. 'H Tower' instead of '192.168.1.15:32400'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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() });
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "void-server",
|
||||
"version": "2.6.4",
|
||||
"version": "2.6.5",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -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) }, '+')))));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user