added various fixes for simple network

This commit is contained in:
Russel Yasol
2024-07-14 10:26:54 +08:00
parent 08889533f4
commit 157f0d61c3
3 changed files with 87 additions and 22 deletions

View File

@@ -16,7 +16,7 @@ function parseCurrentSettings(rawdata) {
try {
this.apn = lines
.find((line) => line.includes("+CGCONTRDP: 1,0"))
.find((line) => line.includes("+CGCONTRDP: 1"))
.split(",")[2]
.replace(/\"/g, "");
} catch (error) {
@@ -49,10 +49,22 @@ function parseCurrentSettings(rawdata) {
.replace(/\"/g, "");
try {
this.bands = lines
.find((line) => line.includes("+QCAINFO:"))
const PCCbands = lines
.find((line) => line.includes('+QCAINFO: "PCC"'))
.split(",")[3]
.replace(/\"/g, "");
// Loop over all QCAINFO: "SCC" lines and get the bands
try {
const SCCbands = lines
.filter((line) => line.includes('+QCAINFO: "SCC"'))
.map((line) => line.split(",")[3].replace(/\"/g, ""))
.join(", ");
this.bands = `${PCCbands}, ${SCCbands}`;
} catch (error) {
this.bands = PCCbands;
}
} catch (error) {
this.bands = "Failed fetching bands";
}

View File

@@ -15,7 +15,7 @@ function populateCheckboxes(lte_band, nsa_nr5g_band, nr5g_band, locked_lte_bands
checkboxesForm.innerHTML = ""; // Clear existing checkboxes
var bandsArray;
if (bands !== null) {
if (bands !== null && bands !== "0") {
bandsArray = bands.split(":");
bandsArray.forEach(function(band, index) {
if (index % 5 === 0) {
@@ -68,7 +68,11 @@ function populateCheckboxes(lte_band, nsa_nr5g_band, nr5g_band, locked_lte_bands
currentRow.appendChild(checkboxDiv);
});
} else {
// Do nothing
// Create a text saying that no bands are available
var noBandsText = document.createElement("p");
noBandsText.className = "text-center";
noBandsText.innerText = "No supported bands available";
checkboxesForm.appendChild(noBandsText);
}
var currentRow;