* Collect and validate auth parameters based on auth type * Returns auth params object or null if validation fails
(authType)
| 19845 | const icon = document.getElementById('primary-connection-icon'); |
| 19846 | |
| 19847 | if (!label) return; |
| 19848 | |
| 19849 | // Determine connection type key to avoid redundant DOM updates |
| 19850 | let connKey; |
| 19851 | if (data.ethernet_connected) { |
| 19852 | connKey = `lan:${data.ethernet_interface || ''}:${data.ethernet_ip || ''}`; |
| 19853 | } else if (data.wifi_connected) { |
| 19854 | connKey = `wifi:${data.current_ssid || ''}:${data.ap_mode_active ? 1 : 0}:${data.ap_ssid || ''}`; |
| 19855 | } else if (data.pan_connected) { |
| 19856 | connKey = 'pan'; |
| 19857 | } else if (data.bluetooth_active) { |
| 19858 | connKey = 'bt'; |
| 19859 | } else { |
| 19860 | connKey = 'none'; |
| 19861 | } |
| 19862 | if (connKey === _lastPrimaryConnectionKey) return; |
| 19863 | _lastPrimaryConnectionKey = connKey; |
| 19864 | |
| 19865 | const lanIcon = '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2"></path></svg>'; |
| 19866 | const wifiIcon = '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"></path></svg>'; |
| 19867 | |
| 19868 | if (data.ethernet_connected) { |
| 19869 | label.textContent = 'LAN'; |
| 19870 | name.textContent = data.ethernet_interface || 'Ethernet'; |
| 19871 | if (ip) ip.textContent = data.ethernet_ip || ''; |
| 19872 | if (status) status.className = 'w-3 h-3 bg-green-500 rounded-full pulse-glow'; |
| 19873 | if (icon) { icon.innerHTML = lanIcon; icon.className = 'text-green-400'; } |
| 19874 | } else if (data.wifi_connected) { |
| 19875 | const ssid = data.current_ssid || 'Connected'; |
| 19876 | label.textContent = data.ap_mode_active ? 'AP Mode' : 'WiFi'; |
| 19877 | name.textContent = data.ap_mode_active ? `AP: ${data.ap_ssid || 'Ragnar'}` : ssid; |
| 19878 | if (ip) ip.textContent = ''; |
| 19879 | if (status) status.className = 'w-3 h-3 bg-green-500 rounded-full pulse-glow'; |
| 19880 | if (icon) { icon.innerHTML = wifiIcon; icon.className = 'text-green-400'; } |
| 19881 | } else if (data.pan_connected) { |
| 19882 | label.textContent = 'USB/PAN'; |
| 19883 | name.textContent = 'Connected via USB'; |
| 19884 | if (ip) ip.textContent = ''; |
| 19885 | if (status) status.className = 'w-3 h-3 bg-green-500 rounded-full pulse-glow'; |
| 19886 | if (icon) icon.className = 'text-yellow-400'; |
| 19887 | } else if (data.bluetooth_active) { |
| 19888 | label.textContent = 'Bluetooth'; |
| 19889 | name.textContent = 'Bluetooth active'; |
| 19890 | if (ip) ip.textContent = ''; |
| 19891 | if (status) status.className = 'w-3 h-3 bg-blue-500 rounded-full pulse-glow'; |
| 19892 | if (icon) icon.className = 'text-blue-400'; |
| 19893 | } else { |
| 19894 | label.textContent = 'Disconnected'; |
| 19895 | name.textContent = 'No active connection'; |
| 19896 | if (ip) ip.textContent = ''; |
| 19897 | if (status) status.className = 'w-3 h-3 bg-gray-600 rounded-full'; |
| 19898 | if (icon) icon.className = 'text-gray-500'; |
| 19899 | } |
| 19900 | } |
| 19901 | |
| 19902 | // ============================================================================ |
| 19903 | // CONSOLE |
| 19904 | // ============================================================================ |
no test coverage detected