feat(mock): mesh.probe-device + manage_radio for the hot-swap modal demo
Some checks failed
Demo images / Build & push demo images (push) Failing after 2m53s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-07-22 17:35:55 -04:00
parent b705ed7715
commit d86043193b

View File

@ -2971,6 +2971,7 @@ app.post('/rpc/v1', (req, res) => {
region: mc.enabled ? mc.lora_region : null,
announce_block_headers: globalThis.__meshHeaders.announce_block_headers,
receive_block_headers: globalThis.__meshHeaders.receive_block_headers,
manage_radio: mc.manage_radio !== false,
},
})
}
@ -3088,7 +3089,32 @@ app.post('/rpc/v1', (req, res) => {
if (params && typeof params.device_kind === 'string') cfg.device_kind = params.device_kind === 'auto' ? null : params.device_kind
if (params && typeof params.channel_name === 'string') cfg.channel_name = params.channel_name
if (params && typeof params.advert_name === 'string') cfg.advert_name = params.advert_name
return res.json({ result: { configured: true, enabled: cfg.enabled, lora_region: cfg.lora_region, device_kind: cfg.device_kind, ...globalThis.__meshHeaders } })
// Hot-swap "keep as is" (2026-07-22): false = never write config to the radio.
if (params && typeof params.manage_radio === 'boolean') cfg.manage_radio = params.manage_radio
return res.json({ result: { configured: true, enabled: cfg.enabled, lora_region: cfg.lora_region, device_kind: cfg.device_kind, manage_radio: cfg.manage_radio !== false, ...globalThis.__meshHeaders } })
}
// Read-only firmware probe backing the hot-swap device modal's
// current-details card (2026-07-22). Real backend opens the serial
// port; the demo answers instantly with what's "flashed" on the
// Heltec that mesh.status advertises.
case 'mesh.probe-device': {
// 900ms delay lets the modal's "Reading what's on the radio…" spinner show.
setTimeout(() => res.json({
result: {
path: params?.path || '/dev/ttyUSB0',
kind: 'meshcore',
firmware_version: 'MeshCore v2.3.1',
node_id: 42,
advert_name: 'archy-228',
region: null,
modem_preset: null,
primary_channel: null,
secondary_channel: null,
max_contacts: 100,
},
}), 900)
return
}
case 'mesh.send-invoice': {