Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const connect=(networkDetails, callback)=>{
// Connect to a network
wifi.connect(networkDetails, (err) => {
if (err) {
console.log('WARNING in Wifi.js - connect(): connection fails', err.message)
callback(err, false)
return
}
console.log('INFO in Wifi.js - connect() : connected successfully')
get_status((err, status)=>{
if (err) {
callback(err, false)
} else {
save_config(networkDetails, callback.bind(null,false, status))
}
})
})
}
again = false;
return;
}
const pass = document.querySelector("message-box input");
await wifi.connect({
ssid: hs.ssid,
password: pass.value
}).catch(err => {
//console.error(err);
again = true;
elem.click();
});
listConnectedNetworks().then(listNetworks);
again = false;
} else {
await wifi.connect({
ssid: hs.ssid
}).catch(console.error);
listConnectedNetworks().then(listNetworks);
}
};
elem.className = "rounded-0 flex-shrink-0 border-top border-bottom-0 border-left-0 border-right-0 d-flex align-items-center text-left py-2 mb-0 btn px-3 " + (Shell.ui.darkMode ? "btn-dark border-secondary" : "btn-white");
message.append(message.lead, message.pass);
let button = await Shell.showMessageBox({
title: "Passphrase required",
icon: "wifi-strength-lock-outline",
message: message,
cancelId: 0,
buttons: ["Cancel", "<i class="mdi mdi-fingerprint mdi-18px lh-18 d-inline-flex align-text-top"></i> Connect"],
defaultId: 1,
iconBG: "var(--orange)"
});
if (button === "Cancel") {
again = false;
return;
}
const pass = document.querySelector("message-box input");
await wifi.connect({
ssid: hs.ssid,
password: pass.value
}).catch(err => {
//console.error(err);
again = true;
elem.click();
});
listConnectedNetworks().then(listNetworks);
again = false;
} else {
await wifi.connect({
ssid: hs.ssid
}).catch(console.error);
listConnectedNetworks().then(listNetworks);
}
};