Refusing to start hotspot if Wifi device is in use.

This commit is contained in:
Roland 2024-07-31 12:41:53 -06:00
parent a068273beb
commit e72d461461
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 90 additions and 18 deletions

View file

@ -623,17 +623,23 @@ export const useFilesProgressInterval = () => {
export const useHotspot = () => {
const [on, setOn] = useState(null);
const [inUse, setInUse] = useState(false);
const {status} = useContext(StatusContext);
// Hotspot is unsupported on Docker.
const {dockerized} = status;
const {dockerized, hotspot_ssid} = status;
useEffect(() => {
if (status && status['hotspot_status']) {
const {hotspot_status} = status;
if (hotspot_status === 'connected') {
setOn(true);
setInUse(false);
} else if (hotspot_status === 'in_use') {
setInUse(true);
setOn(false);
} else if (hotspot_status === 'disconnected' || hotspot_status === 'unavailable') {
setOn(false);
setInUse(false);
} else {
setOn(null);
}
@ -645,7 +651,7 @@ export const useHotspot = () => {
await setHotspot(on);
}
return {on, setOn, setHotspot: localSetHotspot, dockerized};
return {on, inUse, hotspotSsid: hotspot_ssid, setOn, setHotspot: localSetHotspot, dockerized};
}
export const useDownloads = () => {