fix:wifinetwork keep asking for pass

This commit is contained in:
Satoxyan
2025-03-20 09:37:21 +07:00
parent ad63420198
commit 968534c99a
@@ -143,16 +143,18 @@ 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'])
.then((savedConnections) => {
const savedSSIDs = savedConnections.split('\n');
if (Network.wifi.state == 'failed' ||
(Network.wifi.state == 'need_auth' && !savedSSIDs.includes(Network.wifi.ssid))) {
authLock = true; authLock = true;
connectAttempt = Network.wifi.ssid; connectAttempt = Network.wifi.ssid;
self.revealChild = true; self.revealChild = true;
@@ -165,6 +167,8 @@ const CurrentNetwork = () => {
Network.wifi.state = 'activated'; Network.wifi.state = 'activated';
}, 20000); // 20 seconds timeout }, 20000); // 20 seconds timeout
} }
}
).catch(print);
}), }),
}); });
const actualContent = Box({ const actualContent = Box({