forked from Shinonome/dots-hyprland
fix:wifinetwork keep asking for pass
This commit is contained in:
@@ -143,28 +143,32 @@ const CurrentNetwork = () => {
|
|||||||
onAccept: (self) => {
|
onAccept: (self) => {
|
||||||
authLock = false;
|
authLock = false;
|
||||||
networkAuth.revealChild = false;
|
networkAuth.revealChild = false;
|
||||||
execAsync(['nmcli', 'connection', 'delete', connectAttempt])
|
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text])
|
||||||
.catch(print)
|
.catch(print);
|
||||||
.then(() => execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text])
|
|
||||||
.catch(print));
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
setup: (self) => self.hook(Network, (self) => {
|
setup: (self) => self.hook(Network, (self) => {
|
||||||
if (Network.wifi.state == 'failed' || Network.wifi.state == 'need_auth') {
|
execAsync(['nmcli', '-g', 'NAME', 'connection', 'show'])
|
||||||
authLock = true;
|
.then((savedConnections) => {
|
||||||
connectAttempt = Network.wifi.ssid;
|
const savedSSIDs = savedConnections.split('\n');
|
||||||
self.revealChild = true;
|
if (Network.wifi.state == 'failed' ||
|
||||||
if (timeoutId) {
|
(Network.wifi.state == 'need_auth' && !savedSSIDs.includes(Network.wifi.ssid))) {
|
||||||
clearTimeout(timeoutId);
|
authLock = true;
|
||||||
|
connectAttempt = Network.wifi.ssid;
|
||||||
|
self.revealChild = true;
|
||||||
|
if (timeoutId) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
}
|
||||||
|
timeoutId = setTimeout(() => {
|
||||||
|
authLock = false;
|
||||||
|
self.revealChild = false;
|
||||||
|
Network.wifi.state = 'activated';
|
||||||
|
}, 20000); // 20 seconds timeout
|
||||||
|
}
|
||||||
}
|
}
|
||||||
timeoutId = setTimeout(() => {
|
).catch(print);
|
||||||
authLock = false;
|
|
||||||
self.revealChild = false;
|
|
||||||
Network.wifi.state = 'activated';
|
|
||||||
}, 20000); // 20 seconds timeout
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const actualContent = Box({
|
const actualContent = Box({
|
||||||
|
|||||||
Reference in New Issue
Block a user