forked from Shinonome/dots-hyprland
translate comments to english
This commit is contained in:
@@ -41,23 +41,20 @@ const WifiNetwork = (accessPoint) => {
|
|||||||
connectAttempt = accessPoint.ssid;
|
connectAttempt = accessPoint.ssid;
|
||||||
networkAuthSSID.label = `Connecting to: ${connectAttempt}`;
|
networkAuthSSID.label = `Connecting to: ${connectAttempt}`;
|
||||||
|
|
||||||
// Cek apakah SSID sudah tersimpan
|
// Check if the SSID is stored
|
||||||
execAsync(['nmcli', '-g', 'NAME', 'connection', 'show'])
|
execAsync(['nmcli', '-g', 'NAME', 'connection', 'show'])
|
||||||
.then((savedConnections) => {
|
.then((savedConnections) => {
|
||||||
const savedSSIDs = savedConnections.split('\n');
|
const savedSSIDs = savedConnections.split('\n');
|
||||||
|
|
||||||
if (!savedSSIDs.includes(connectAttempt)) {
|
if (!savedSSIDs.includes(connectAttempt)) { // SSID not saved: show password input
|
||||||
// Jika SSID belum tersimpan, tampilkan input password
|
|
||||||
if (networkAuth) {
|
if (networkAuth) {
|
||||||
networkAuth.revealChild = true;
|
networkAuth.revealChild = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else { // If SSID is saved, hide password input
|
||||||
// Jika SSID sudah tersimpan, sembunyikan input password
|
|
||||||
if (networkAuth) {
|
if (networkAuth) {
|
||||||
networkAuth.revealChild = false;
|
networkAuth.revealChild = false;
|
||||||
}
|
}
|
||||||
|
// Connect
|
||||||
// Langsung konek tanpa input password
|
|
||||||
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt])
|
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt])
|
||||||
.catch(print);
|
.catch(print);
|
||||||
}
|
}
|
||||||
@@ -234,20 +231,20 @@ const CurrentNetwork = () => {
|
|||||||
visibility: false,
|
visibility: false,
|
||||||
onAccept: (self) => {
|
onAccept: (self) => {
|
||||||
authLock = false;
|
authLock = false;
|
||||||
// Hapus koneksi SSID sebelum mencoba menyambung ulang
|
// Delete SSID connection before attempting to reconnect
|
||||||
execAsync(['nmcli', 'connection', 'delete', connectAttempt])
|
execAsync(['nmcli', 'connection', 'delete', connectAttempt])
|
||||||
.catch(() => {}); // Abaikan error jika SSID tidak ditemukan
|
.catch(() => {}); // Ignore error if SSID not found
|
||||||
|
|
||||||
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text])
|
execAsync(['nmcli', 'device', 'wifi', 'connect', connectAttempt, 'password', self.text])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
connectAttempt = ''; // Reset SSID setelah koneksi berhasil
|
connectAttempt = ''; // Reset SSID after successful connection
|
||||||
networkAuth.revealChild = false; // Sembunyikan input jika berhasil
|
networkAuth.revealChild = false; // Hide input if successful
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// Jika koneksi gagal, tampilkan kembali input password
|
// Connection failed, show password input again
|
||||||
networkAuth.revealChild = true;
|
networkAuth.revealChild = true;
|
||||||
networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`;
|
networkAuthSSID.label = `Authentication failed. Retry for: ${connectAttempt}`;
|
||||||
self.text = ''; // Kosongkan input untuk coba lagi
|
self.text = ''; // Empty input for retry
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user