diff --git a/public/index.html b/public/index.html index e670b0a1..9128b578 100644 --- a/public/index.html +++ b/public/index.html @@ -80,7 +80,7 @@ - + diff --git a/public/nodes.js b/public/nodes.js index cd92025a..37be8fc7 100644 --- a/public/nodes.js +++ b/public/nodes.js @@ -108,6 +108,7 @@
${escapeHtml(n.name || '(unnamed)')}
${n.role} ${statusLabel}
${n.public_key}
+
@@ -182,6 +183,22 @@ }).catch(() => {}); }); + // QR code for full-screen view + const qrFullEl = document.getElementById('nodeFullQrCode'); + if (qrFullEl && typeof qrcode === 'function') { + try { + const typeMap = { companion: 1, repeater: 2, room: 3, sensor: 4 }; + const contactType = typeMap[(n.role || '').toLowerCase()] || 2; + const meshcoreUrl = `meshcore://contact/add?name=${encodeURIComponent(n.name || 'Unknown')}&public_key=${n.public_key}&type=${contactType}`; + const qr = qrcode(0, 'M'); + qr.addData(meshcoreUrl); + qr.make(); + qrFullEl.innerHTML = `
Scan with MeshCore app to add contact
` + qr.createSvgTag(3, 0); + const svg = qrFullEl.querySelector('svg'); + if (svg) { svg.style.display = 'block'; svg.style.margin = '0 auto'; } + } catch {} + } + } catch (e) { body.innerHTML = `
Failed to load node: ${e.message}
`; }