Skip to content

Commit

Permalink
frontend: Beacon: Add double check for is Wifi
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
JoaoMario109 authored and patrickelectric committed Mar 4, 2024
1 parent 974b95d commit 5d8f5f6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/frontend/src/components/beacon/BeaconTrayMenu.vue
Expand Up @@ -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() {
Expand Down

0 comments on commit 5d8f5f6

Please sign in to comment.