()
| 18560 | function displayWifiNetworks(data, options = {}) { |
| 18561 | const networksList = document.getElementById('wifi-networks-list'); |
| 18562 | if (!networksList) return; |
| 18563 | |
| 18564 | let networks = []; |
| 18565 | let knownNetworks = []; |
| 18566 | const activeInterface = options.forceInterface || getActiveWifiInterface(); |
| 18567 | const responseInterface = data.interface || null; |
| 18568 | const cacheKeyInterface = responseInterface || activeInterface || null; |
| 18569 | |
| 18570 | if (cacheKeyInterface) { |
| 18571 | cacheWifiNetworkResult(cacheKeyInterface, data); |
| 18572 | } else { |
| 18573 | cacheWifiNetworkResult(null, data); |
| 18574 | } |
| 18575 | |
| 18576 | if (!options.skipInterfaceCheck && responseInterface && activeInterface && responseInterface !== activeInterface) { |
| 18577 | console.info(`Ignoring Wi-Fi scan results for ${responseInterface} because ${activeInterface} is selected`); |
| 18578 | const cachedActive = getCachedWifiNetworkResult(activeInterface); |
| 18579 | if (cachedActive && cachedActive !== data) { |
| 18580 | displayWifiNetworks(cachedActive, { forceInterface: activeInterface, skipInterfaceCheck: true }); |
| 18581 | return; |
| 18582 | } |
| 18583 | networksList.innerHTML = ` |
| 18584 | <div class="text-center text-gray-400 py-8"> |
| 18585 | <p>Scan results for <span class="font-semibold text-gray-100">${escapeHtml(responseInterface)}</span> are ready.</p> |
| 18586 | <p class="text-sm mt-2">Switch to that interface or run a new scan for <span class="font-semibold text-gray-100">${escapeHtml(activeInterface)}</span>.</p> |
| 18587 | </div> |
| 18588 | `; |
| 18589 | return; |
| 18590 | } |
| 18591 | |
| 18592 | const interfaceName = options.forceInterface || responseInterface || activeInterface; |
| 18593 | const warningMarkup = data.warning ? ` |
| 18594 | <div class="text-xs text-yellow-300 bg-yellow-900/40 border border-yellow-800 rounded px-3 py-2 mb-3"> |
| 18595 | ${escapeHtml(data.warning)} |
| 18596 | </div> |
| 18597 | ` : ''; |
| 18598 | const sectionHeader = interfaceName ? ` |
| 18599 | <div class="text-xs text-gray-400 mb-3"> |
| 18600 | Showing results for interface <span class="font-semibold text-gray-100">${escapeHtml(interfaceName)}</span> |
| 18601 | </div> |
no test coverage detected