diff --git a/app/engine.js b/app/engine.js index 6387710..1991875 100644 --- a/app/engine.js +++ b/app/engine.js @@ -3602,6 +3602,26 @@ function renderShare() { const list = state.local.addresses || []; const box = $('addrList'); box.textContent = ''; + /* + * WHICH INTERFACE THE QR USES IS A QUESTION ONLY A LAN SETUP HAS. + * + * These rows let the operator pick the address the code points at. Once a + * public address is configured the code points at the domain whatever they + * pick, so the list is a row of numbers that do nothing — and the one + * marked IN USE is not the address anyone is being given. Hide it. + */ + const addrBox = $('addrList'); + addrBox.hidden = !!publicBaseConfigured(); + if (addrBox.hidden) { + /* Still draw the code itself — it is the only thing left in this panel. */ + const only = shareBase(); + $('qr').src = only + ? 'http://127.0.0.1:' + state.local.port + '/qr.svg?url=' + encodeURIComponent(only + '/') + : ''; + renderQrWarning(); + renderOperatorUrl(); + return; + } /* Mark the row the QR is actually using, not the row that was saved — when a lease moves those are two different things and the saved one is gone. */ @@ -3643,8 +3663,22 @@ $('copyAddr').addEventListener('click', () => { .catch((err) => log('could not copy: ' + err.message, 'err')); }); -$('openPoster').addEventListener('click', () => { - window.open('http://127.0.0.1:' + state.local.port + '/poster', '_blank'); +/* + * The QR itself, saved as a file, because the poster people actually print + * is made in their own design tool. The built-in poster page is still there + * at /poster for anyone who wants it; it is just not what this button does. + */ +$('saveQr').addEventListener('click', () => { + const base = shareBase(); + if (!base) { log('no address to encode yet', 'err'); return; } + const a = document.createElement('a'); + a.href = 'http://127.0.0.1:' + state.local.port + '/qr.svg?url=' + + encodeURIComponent(base + '/'); + a.download = 'church-translate-qr.svg'; + document.body.appendChild(a); + a.click(); + a.remove(); + log('saved the QR for ' + base + '/', 'ok'); }); $('openOperator').addEventListener('click', () => { window.open('http://127.0.0.1:' + state.local.port + '/operator', '_blank'); diff --git a/app/index.html b/app/index.html index 50625c0..1c44221 100644 --- a/app/index.html +++ b/app/index.html @@ -433,7 +433,7 @@