1/*global qrcode*/ 2/* 3 * wpstream-qr.js 4 * 5 * Local, in-browser QR-code generation for the Larix "scan to configure" flow. 6 * 7 * Previously the Larix QR was built by sending the full RTMP URL + secret stream 8 * key to a third-party image service (qrcode.tec-it.com) as a query parameter, 9 * disclosing the key to that provider and its logs (SEC-05 / TASK-06). This module 10 * generates the QR entirely on the client from the bundled `qrcode-generator` 11 * library, so no credential ever leaves the page. 12 * 13 * Single public entry point, used by both start_streaming.js call sites: 14 * wpstreamRenderQr( imgElement, text ) 15 */ 16 17/** 18 * Render `text` as a QR code into an <img> element, using a locally bundled 19 * generator. Produces a `data:image/gif` URI and assigns it to the image's src; 20 * nothing is requested from the network. 21 * 22 * @param {HTMLImageElement|jQuery} imgElement The target <img> (raw node or jQuery-wrapped). 23 * @param {string} text The payload to encode (e.g. the Larix deep-link). 24 * @returns {boolean} true if a QR was rendered, false if inputs/library were unusable. 25 */ 26function wpstreamRenderQr( imgElement, text ) { 27 // Normalise a jQuery-wrapped element down to the underlying DOM node. 28 var img = ( imgElement && imgElement.jquery ) ? imgElement.get( 0 ) : imgElement; 29 30 // Fail closed on missing target, empty payload, or an unloaded library â 31 // never fall back to a remote generator. 32 if ( ! img || typeof text !== 'string' || text === '' || typeof qrcode !== 'function' ) { 33 return false; 34 } 35 36 // Build the QR: typeNumber 0 auto-selects the smallest size that fits the data, 37 // error-correction level 'M' matches the density the old service produced. 38 var qr = qrcode( 0, 'M' ); 39 qr.addData( text ); 40 qr.make(); 41 42 // cellSize 4px, 8px quiet-zone margin â a compact, scannable image for the modal. 43 img.src = qr.createDataURL( 4, 8 ); 44 return true; 45} 46 47// Expose on window so it is reachable from start_streaming.js (no module system here). 48window.wpstreamRenderQr = wpstreamRenderQr;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.