From 5d8f5f635bab5b313738c70bb77a78b75bd7e8e9 Mon Sep 17 00:00:00 2001 From: Joao Mario Lago Date: Thu, 29 Feb 2024 11:59:37 -0300 Subject: [PATCH] frontend: Beacon: Add double check for is Wifi * Add a double check when detecting if its connected using WiFi to avoid cases where its pointing using WiFi connection but is actually using Cable --- .../src/components/beacon/BeaconTrayMenu.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/frontend/src/components/beacon/BeaconTrayMenu.vue b/core/frontend/src/components/beacon/BeaconTrayMenu.vue index c2645eff98..008a9edd52 100644 --- a/core/frontend/src/components/beacon/BeaconTrayMenu.vue +++ b/core/frontend/src/components/beacon/BeaconTrayMenu.vue @@ -73,10 +73,19 @@ export default Vue.extend({ return beacon.available_domains.filter((entry) => entry.interface_type === InterfaceType.WIRED) }, wireless_interface_domains(): Domain[] { - return beacon.available_domains.filter((entry) => entry.interface_type !== InterfaceType.WIRED) + return beacon.available_domains.filter( + (entry) => entry.interface_type === InterfaceType.WIFI || entry.interface_type === InterfaceType.HOTSPOT, + ) }, is_connected_to_wifi(): boolean { - return this.wireless_interface_domains.some((domain) => domain.ip === beacon.nginx_ip_address) + const is_on_wifi = this.wireless_interface_domains.some((domain) => domain.ip === beacon.nginx_ip_address) + const is_on_wired = this.wired_interface_domains.some((domain) => domain.ip === beacon.nginx_ip_address) + + if (is_on_wifi && is_on_wired) { + console.debug('Unexpected behavior. There are both Wired and Wireless interfaces sharing the same IP address.') + } + + return is_on_wifi && !is_on_wired }, }, mounted() {