added nr5g_dc on bandlocking

This commit is contained in:
Russel Yasol
2024-10-03 15:47:10 +08:00
parent 148fb5df1b
commit af8aee60ff
8 changed files with 669 additions and 443 deletions

View File

@@ -74,7 +74,9 @@
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -85,25 +87,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"

View File

@@ -73,9 +73,11 @@
</div> </div>
</div> </div>
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link has-text-weight-bold"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item has-text-weight-bold" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -86,25 +88,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"

View File

@@ -1,426 +1,638 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<head> <!-- Logo -->
<meta charset="UTF-8" /> <link rel="simpleadmin-logo" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<!-- Logo --> <link rel="stylesheet" href="css/bulma/bulma.scss" />
<link rel="simpleadmin-logo" href="favicon.ico" /> <link rel="stylesheet" href="css/bulma/css/bulma.min.css" />
<link rel="stylesheet" href="css/bulma/css/bulma.css" />
<link rel="stylesheet" href="css/custom.css" />
<link rel="stylesheet" href="css/bulma/bulma.scss" /> <!-- Font awesome icons -->
<link rel="stylesheet" href="css/bulma/css/bulma.min.css" /> <script
<link rel="stylesheet" href="css/bulma/css/bulma.css" /> src="https://kit.fontawesome.com/b0caedfab3.js"
<link rel="stylesheet" href="css/custom.css" /> crossorigin="anonymous"
></script>
<!-- Font awesome icons --> <script src="js/styles/toggle-theme.js"></script>
<script src="https://kit.fontawesome.com/b0caedfab3.js" crossorigin="anonymous"></script> <script src="/js/styles/nav-burger.js"></script>
<script src="/js/styles/modal-trigger.js"></script>
<script src="/js/utils/reboot.js"></script>
<script defer src="/js/auth/auth.js"></script>
<script src="js/styles/toggle-theme.js"></script> <script>
<script src="/js/styles/nav-burger.js"></script> (function () {
<script src="/js/styles/modal-trigger.js"></script> const savedTheme = localStorage.getItem("theme") || "theme-dark";
<script src="/js/utils/reboot.js"></script> document.documentElement.classList.add(savedTheme);
<script defer src="/js/auth/auth.js"></script> })();
</script>
<title>QuecManager</title>
</head>
<script> <body class="body-margin">
(function () { <nav class="navbar is-transparent">
const savedTheme = localStorage.getItem("theme") || "theme-dark"; <div class="navbar-brand">
document.documentElement.classList.add(savedTheme); <a class="navbar-item" href="/">
})(); <img src="/assets/logo.png" alt="Logo" />
</script> <span class="title">QuecManager</span>
<title>QuecManager</title> </a>
</head> <a
role="button"
<body class="body-margin"> class="navbar-burger"
<nav class="navbar is-transparent"> aria-label="menu"
<div class="navbar-brand"> aria-expanded="false"
<a class="navbar-item" href="/"> data-target="navMenu"
<img src="/assets/logo.png" alt="Logo" /> >
<span class="title">QuecManager</span> <span aria-hidden="true"></span>
</a> <span aria-hidden="true"></span>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navMenu"> <span aria-hidden="true"></span>
<span aria-hidden="true"></span> <span aria-hidden="true"></span>
<span aria-hidden="true"></span> </a>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navMenu" class="navbar-menu">
<div class="navbar-start ml-6">
<a class="navbar-item" href="/"> Home </a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link has-text-weight-bold"> Cellular </a>
<div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/bandlock.html"> Band Locking </a>
<a class="navbar-item" href="/cell-locking.html">Cell Locking</a>
<a class="navbar-item" href="/cell-scanner.html">Cell Scanner</a>
<a class="navbar-item" href="/cell-settings.html">Cell Settings</a>
<a class="navbar-item" href="/cell-sms.html"> Cell SMS </a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a>
<a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div>
</div>
<a class="navbar-item" href="/about.html"> About </a>
</div> </div>
<div class="navbar-end"> <div id="navMenu" class="navbar-menu">
<div class="navbar-item"> <div class="navbar-start ml-6">
<div class="buttons is-flex-direction-column-mobile"> <a class="navbar-item" href="/"> Home </a>
<p class="control is-expanded-mobile"> <div class="navbar-item has-dropdown is-hoverable">
<a href="#" class="button is-link is-outlined is-fullwidth-mobile"> <a class="navbar-link has-text-weight-bold"> Cellular </a>
<span class="icon"> <div class="navbar-dropdown is-boxed">
<i class="fas fa-arrows-rotate"></i> <a class="navbar-item" href="/bandlock.html"> Band Locking </a>
</span> <a class="navbar-item" href="/cell-locking.html">Cell Locking</a>
<span>Restart Connection</span> <a class="navbar-item" href="/cell-scanner.html">Cell Scanner</a>
<a class="navbar-item" href="/cell-settings.html"
>Cell Settings</a
>
<a class="navbar-item" href="/cell-sms.html"> Cell SMS </a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a> </a>
</p> <a class="navbar-item" href="#">Experimental Features</a>
<div class="is-flex is-mobile is-align-items-center"> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
<p class="control"> </div>
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal"> </div>
<span class="icon"> <a class="navbar-item" href="/about.html"> About </a>
<i class="fas fa-power-off"></i> </div>
</span>
</div> <div class="navbar-end">
</p> <div class="navbar-item">
<p class="control ml-2 is-mobile"> <div class="buttons is-flex-direction-column-mobile">
<a href="#" class="button is-warning is-outlined js-theme-toggle"> <div class="control is-expanded-mobile">
<div class="button is-link is-outlined is-fullwidth-mobile">
<span class="icon"> <span class="icon">
<i class="fas fa-sun"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
</a> <span>Restart Connection</span>
</p>
<p class="control ml-2 is-mobile">
<a href="#" class="button is-warning is-outlined js-theme-toggle" id="logoutButton">
<span class="icon">
<i class="fas fa-right-from-bracket"></i>
</span>
</a>
</p>
</div>
</div>
</div>
</div>
</div>
</nav>
<div class="column-margin">
<div class="fixed-grid has-2-cols has-1-cols-mobile">
<div class="grid is-gap-5">
<div class="cell is-col-span-2 is-col-span-1-mobile">
<div class="card">
<div class="card-header">
<div class="card-header-title">4G LTE Band Locking</div>
</div>
<div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="lte_bands">
<!-- LTE bands will be populated here -->
</div> </div>
</div> </div>
</div> <div class="is-flex is-mobile is-align-items-center">
<div class="card-footer"> <div class="control">
<div id="lockLte" class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"> <div
Lock LTE Bands class="button is-warning is-outlined reboot-modal"
</div> data-target="reboot-modal"
<div id="uncheckLte" >
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"> <span class="icon">
Uncheck All <i class="fas fa-power-off"></i>
</div> </span>
<div class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"> </div>
Reset
</div>
</div>
</div>
</div>
<div class="cell">
<div class="card">
<div class="card-header">
<div class="card-header-title">5G-NR NSA Band Locking</div>
</div>
<div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="nsa_bands">
<!-- NSA bands will be populated here -->
</div> </div>
</div> <p class="control ml-2 is-mobile">
</div> <a
<div class="card-footer"> href="#"
<div id="lockNsa" class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"> class="button is-warning is-outlined js-theme-toggle"
Lock NSA Bands >
</div> <span class="icon">
<div id="uncheckNsa" <i class="fas fa-sun"></i>
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"> </span>
Uncheck All </a>
</div> </p>
<div class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"> <p class="control ml-2 is-mobile">
Reset <a
</div> href="#"
</div> class="button is-warning is-outlined js-theme-toggle"
</div> id="logoutButton"
</div> >
<span class="icon">
<div class="cell"> <i class="fas fa-right-from-bracket"></i>
<div class="card"> </span>
<div class="card-header"> </a>
<div class="card-header-title">5G-NR SA Band Locking</div> </p>
</div>
<div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="sa_bands">
<!-- SA bands will be populated here -->
</div>
</div>
</div>
<div class="card-footer">
<div id="lockSa" class="button card-footer-item has-text-link has-text-weight-semibold has-text-white">
Lock SA Bands
</div>
<div id="uncheckSa" class="button card-footer-item has-text-link has-text-weight-semibold has-text-white">
Uncheck All
</div>
<div class="button card-footer-item has-text-link has-text-weight-semibold has-text-white">
Reset
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </nav>
</div>
<footer class="footer"> <div class="column-margin">
<div class="content">
<div class="fixed-grid has-2-cols has-1-cols-mobile"> <div class="fixed-grid has-2-cols has-1-cols-mobile">
<div class="grid"> <div class="grid is-gap-5">
<div class="cell"> <div class="cell">
<div class="icon-text"> <div class="card">
<span class="icon has-text-info"> <div class="card-header">
<i class="fas fa-info-circle"></i> <div class="card-header-title">4G LTE Band Locking</div>
</span> </div>
<span>Information</span> <div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="lte_bands">
<!-- LTE bands will be populated here -->
</div>
</div>
</div>
<div class="card-footer">
<div
id="lockLte"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Lock LTE Bands
</div>
<div
id="uncheckLte"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Uncheck All
</div>
<div
id="resetLte"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Reset
</div>
</div>
</div> </div>
<p class="block has-text-weight-semibold">
If problem persists after locking bands, please reboot the
modem.
</p>
</div> </div>
<div class="cell"> <div class="cell">
<div class="icon-text"> <div class="card">
<span class="icon has-text-info"> <div class="card-header">
<i class="fas fa-info-circle"></i> <div class="card-header-title">5G-NR SA Band Locking</div>
</span> </div>
<span>Current Active Bands</span> <div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="sa_bands">
<!-- SA bands will be populated here -->
</div>
</div>
</div>
<div class="card-footer">
<div
id="lockSa"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Lock SA Bands
</div>
<div
id="uncheckSa"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Uncheck All
</div>
<div
id="resetSa"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Reset
</div>
</div>
</div> </div>
</div>
<p class="block has-text-weight-semibold"> <div class="cell">
Band 1 / Band 3 / NR Band 41 <div class="card">
</p> <div class="card-header">
<div class="card-header-title">5G-NR NSA Band Locking</div>
</div>
<div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="nsa_bands">
<!-- NSA bands will be populated here -->
</div>
</div>
</div>
<div class="card-footer">
<div
id="lockNsa"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Lock NSA Bands
</div>
<div
id="uncheckNsa"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Uncheck All
</div>
<div
id="resetNsa"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Reset
</div>
</div>
</div>
</div>
<div class="cell">
<div class="card">
<div class="card-header">
<div class="card-header-title">5G-NR SA-DC Band Locking</div>
</div>
<div class="card-content">
<div class="fixed-grid has-5-cols has-3-cols-mobile">
<div class="grid" id="sanrdc_bands">
<!-- SA bands will be populated here -->
</div>
</div>
</div>
<div class="card-footer">
<div
id="lockSaDc"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Lock SA-DC Bands
</div>
<div
id="uncheckSaDc"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Uncheck All
</div>
<div
id="resetSaDc"
class="button card-footer-item has-text-link has-text-weight-semibold has-text-white"
>
Reset
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</footer>
<div id="reboot-modal" class="modal"> <footer class="footer">
<div class="modal-background"></div> <div class="content">
<div class="modal-card"> <div class="fixed-grid has-2-cols has-1-cols-mobile">
<section class="modal-card-body rounded-edge"> <div class="grid">
<p class="subtitle" id="modal-message"> <div class="cell">
Do you want to reboot the device? <div class="icon-text">
</p> <span class="icon has-text-info">
<div id="loading-content" style="display: none"> <i class="fas fa-info-circle"></i>
<div class="custom-loader"></div> </span>
<div class="countdown-text"> <span>Information</span>
Rebooting... <span id="countdown">40</span>s </div>
<p class="block has-text-weight-semibold">
If problem persists after locking bands, please reboot the
modem.
</p>
</div>
<div class="cell">
<div class="icon-text">
<span class="icon has-text-info">
<i class="fas fa-info-circle"></i>
</span>
<span>Current Active Bands</span>
</div>
<p class="block has-text-weight-semibold">
Band 1 / Band 3 / NR Band 41
</p>
</div>
</div> </div>
</div> </div>
<div class="buttons" id="modal-buttons"> </div>
<button class="button is-warning" id="rebootModem">Reboot</button> </footer>
<button class="button cancel" aria-label="close">Cancel</button> <div id="reboot-modal" class="modal">
</div> <div class="modal-background"></div>
</section> <div class="modal-card">
<section class="modal-card-body rounded-edge">
<p class="subtitle" id="modal-message">
Do you want to reboot the device?
</p>
<div id="loading-content" style="display: none">
<div class="custom-loader"></div>
<div class="countdown-text">
Rebooting... <span id="countdown">40</span>s
</div>
</div>
<div class="buttons" id="modal-buttons">
<button class="button is-warning" id="rebootModem">Reboot</button>
<button class="button cancel" aria-label="close">Cancel</button>
</div>
</section>
</div>
</div> </div>
</div> <script>
<script> // Function to fetch supported bands via AT command and populate the checkboxes
// Function to fetch supported bands via AT command and populate the checkboxes async function fetchSupportedBands() {
async function fetchSupportedBands() { try {
try { const response = await fetch("/cgi-bin/atinout_handler.sh", {
const response = await fetch('/cgi-bin/atinout_handler.sh', { method: "POST",
method: 'POST', body:
body: 'command=' + encodeURIComponent('AT+QNWPREFCFG="policy_band"') "command=" + encodeURIComponent('AT+QNWPREFCFG="policy_band"'),
}); });
const data = await response.json(); const data = await response.json();
const lteBandsMatch = data.output.match(/"lte_band",([0-9:]+)/); const lteBandsMatch = data.output.match(/"lte_band",([0-9:]+)/);
const nsaBandsMatch = data.output.match(/"nsa_nr5g_band",([0-9:]+)/); const nsaBandsMatch = data.output.match(/"nsa_nr5g_band",([0-9:]+)/);
const saBandsMatch = data.output.match(/"nrdc_nr5g_band",([0-9:]+)/);; const saBandsMatch = data.output.match(/"nr5g_band",([0-9:]+)/);
const saDcBandsMatch = data.output.match(
/"nrdc_nr5g_band",([0-9:]+)/
);
if (lteBandsMatch) populateBands(lteBandsMatch[1], "#lte_bands"); if (lteBandsMatch) populateBands(lteBandsMatch[1], "#lte_bands");
if (nsaBandsMatch) populateBands(nsaBandsMatch[1], "#nsa_bands"); if (saBandsMatch) populateBands(saBandsMatch[1], "#sa_bands");
if (saBandsMatch) populateBands(saBandsMatch[1], "#sa_bands"); if (nsaBandsMatch) populateBands(nsaBandsMatch[1], "#nsa_bands");
if (saDcBandsMatch) populateBands(saDcBandsMatch[1], "#sanrdc_bands");
fetchActiveBands(); fetchActiveBands();
} catch (error) { } catch (error) {
console.error('Error fetching supported bands:', error); console.error("Error fetching supported bands:", error);
}
} }
}
// Function to fetch currently active bands and mark the checkboxes accordingly // Function to fetch currently active bands and mark the checkboxes accordingly
async function fetchActiveBands() { async function fetchActiveBands() {
try { try {
const response = await fetch('/cgi-bin/atinout_handler.sh', { const response = await fetch("/cgi-bin/atinout_handler.sh", {
method: 'POST', method: "POST",
body: 'command=' + encodeURIComponent('AT+QNWPREFCFG="lte_band";+QNWPREFCFG="nsa_nr5g_band";+QNWPREFCFG="nrdc_nr5g_band"') body:
}); "command=" +
const data = await response.json(); encodeURIComponent(
'AT+QNWPREFCFG="lte_band";+QNWPREFCFG="nsa_nr5g_band";+QNWPREFCFG="nr5g_band";+QNWPREFCFG="nrdc_nr5g_band"'
),
});
const data = await response.json();
// Remove the first line of the output // Remove the first line of the output
data.output = data.output.split('\n').slice(1).join('\n'); data.output = data.output.split("\n").slice(1).join("\n");
// Extract active bands // Remove "OK" line
const activeLteBands = data.output.match(/"lte_band",([0-9:]+)/)[1].split(':'); data.output = data.output.replace("OK", "");
const activeNsaBands = data.output.match(/"nsa_nr5g_band",([0-9:]+)/)[1].split(':');
const activeSaBands = data.output.match(/"nr5g_band",([0-9:]+)/)[1].split(':');
// // Mark checkboxes as checked for active bands console.log(data.output);
markActiveBands(activeLteBands, '#lte_bands');
markActiveBands(activeNsaBands, '#nsa_bands'); // Extract active bands
markActiveBands(activeSaBands, '#sa_bands'); const activeLteBands = data.output
} catch (error) { .match(/"lte_band",([0-9:]+)/)[1]
console.error('Error fetching active bands:', error); .split(":");
const activeNsaBands = data.output
.match(/"nsa_nr5g_band",([0-9:]+)/)[1]
.split(":");
const activeSaBands = data.output
.match(/"nr5g_band",([0-9:]+)/)[1]
.split(":");
// get the the second to the last line of the output and use it for active sa-dc bands
const activeSaDcBandsLine = data.output
.split("\n")[6]
.match(/"nr5g_band",([0-9:]+)/)[1]
.split(":");
// // Mark checkboxes as checked for active bands
markActiveBands(activeLteBands, "#lte_bands");
markActiveBands(activeNsaBands, "#nsa_bands");
markActiveBands(activeSaBands, "#sa_bands");
markActiveBands(activeSaDcBandsLine, "#sanrdc_bands");
} catch (error) {
console.error("Error fetching active bands:", error);
}
} }
}
// Function to populate bands in the target element // Function to populate bands in the target element
function populateBands(bandsString, targetId) { function populateBands(bandsString, targetId) {
var bandsArray = bandsString.split(':'); var bandsArray = bandsString.split(":");
var html = ''; var html = "";
for (var i = 0; i < bandsArray.length; i++) { for (var i = 0; i < bandsArray.length; i++) {
html += `<div class="cell"> html += `<div class="cell">
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" value="${bandsArray[i]}" /> B${bandsArray[i]} <input type="checkbox" value="${bandsArray[i]}" /> B${bandsArray[i]}
</label> </label>
</div>`; </div>`;
}
document.querySelector(targetId).innerHTML = html;
}
// Function to mark checkboxes as checked based on active bands
function markActiveBands(activeBands, targetId) {
const checkboxes = document.querySelectorAll(`${targetId} input[type="checkbox"]`);
checkboxes.forEach((checkbox) => {
if (activeBands.includes(checkbox.value)) {
checkbox.setAttribute('checked', 'checked');
} }
});
}
// Function to uncheck all checkboxes in the target element document.querySelector(targetId).innerHTML = html;
function uncheckAll(targetId) {
const checkboxes = document.querySelectorAll(`${targetId} input[type="checkbox"]`);
checkboxes.forEach((checkbox) => {
checkbox.removeAttribute('checked');
checkbox.checked = false; // Also update the state programmatically
});
}
// Event listeners for "Uncheck All" buttons
document.getElementById('uncheckLte').addEventListener('click', function (event) {
event.preventDefault();
uncheckAll('#lte_bands');
});
document.getElementById('uncheckNsa').addEventListener('click', function (event) {
event.preventDefault();
uncheckAll('#nsa_bands');
});
document.getElementById('uncheckSa').addEventListener('click', function (event) {
event.preventDefault();
uncheckAll('#sa_bands');
});
// Locking the Bands
// Function to get checked bands and generate AT command
function getCheckedBandsCommand(targetId, commandType) {
const checkboxes = document.querySelectorAll(`${targetId} input[type="checkbox"]:checked`);
const checkedBands = Array.from(checkboxes).map(cb => cb.value).sort((a, b) => a - b);
if (checkedBands.length === 0) {
return null; // Return null if no bands are selected
} }
const bandString = checkedBands.join(':'); // Function to mark checkboxes as checked based on active bands
return `AT+QNWPREFCFG="${commandType}",${bandString}`; function markActiveBands(activeBands, targetId) {
} const checkboxes = document.querySelectorAll(
`${targetId} input[type="checkbox"]`
// Function to send AT command via atinout );
async function sendATCommand(command) { checkboxes.forEach((checkbox) => {
try { if (activeBands.includes(checkbox.value)) {
const response = await fetch('/cgi-bin/atinout_handler.sh', { checkbox.setAttribute("checked", "checked");
method: 'POST', }
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `command=${encodeURIComponent(command)}`
}); });
const data = await response.json();
return data;
// refetch active bands after successful command
fetchActiveBands();
} catch (error) {
console.error('Error sending AT command:', error);
throw error;
}
}
// Function to handle band locking for a specific type
async function lockBands(targetId, commandType) {
const command = getCheckedBandsCommand(targetId, commandType);
if (!command) {
alert('Please select at least one band to lock.');
return;
} }
try { // Function to uncheck all checkboxes in the target element
await sendATCommand(command); function uncheckAll(targetId) {
alert(`Successfully locked ${commandType.split('_')[0].toUpperCase()} bands`); const checkboxes = document.querySelectorAll(
} catch (error) { `${targetId} input[type="checkbox"]`
alert(`Failed to lock bands: ${error.message}`); );
checkboxes.forEach((checkbox) => {
checkbox.removeAttribute("checked");
checkbox.checked = false; // Also update the state programmatically
});
} }
}
// Event listeners for Lock buttons // Event listeners for "Uncheck All" buttons
document.getElementById('lockLte').addEventListener('click', () => document
lockBands('#lte_bands', 'lte_band') .getElementById("uncheckLte")
); .addEventListener("click", function (event) {
event.preventDefault();
uncheckAll("#lte_bands");
});
document.getElementById('lockNsa').addEventListener('click', () => document
lockBands('#nsa_bands', 'nsa_nr5g_band') .getElementById("uncheckNsa")
); .addEventListener("click", function (event) {
event.preventDefault();
uncheckAll("#nsa_bands");
});
document.getElementById('lockSa').addEventListener('click', () => document
lockBands('#sa_bands', 'nr5g_band') .getElementById("uncheckSa")
); .addEventListener("click", function (event) {
event.preventDefault();
uncheckAll("#sa_bands");
});
document
.getElementById("uncheckSaDc")
.addEventListener("click", function (event) {
event.preventDefault();
uncheckAll("#sanrdc_bands");
});
// Initial call to fetch supported bands on page load // Locking the Bands
window.onload = fetchSupportedBands; // Function to get checked bands and generate AT command
</script> function getCheckedBandsCommand(targetId, commandType) {
const checkboxes = document.querySelectorAll(
`${targetId} input[type="checkbox"]:checked`
);
const checkedBands = Array.from(checkboxes)
.map((cb) => cb.value)
.sort((a, b) => a - b);
</body> if (checkedBands.length === 0) {
return null; // Return null if no bands are selected
}
</html> const bandString = checkedBands.join(":");
return `AT+QNWPREFCFG="${commandType}",${bandString}`;
}
// Function to send AT command via atinout
async function sendATCommand(command) {
try {
const response = await fetch("/cgi-bin/atinout_handler.sh", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: `command=${encodeURIComponent(command)}`,
});
const data = await response.json();
return data;
// refetch active bands after successful command
fetchActiveBands();
} catch (error) {
console.error("Error sending AT command:", error);
throw error;
}
}
// Function to handle band locking for a specific type
async function lockBands(targetId, commandType) {
const command = getCheckedBandsCommand(targetId, commandType);
if (!command) {
alert("Please select at least one band to lock.");
return;
}
try {
await sendATCommand(command);
alert(
`Successfully locked ${commandType
.split("_")[0]
.toUpperCase()} bands`
);
} catch (error) {
alert(`Failed to lock bands: ${error.message}`);
}
}
// Event listeners for Lock buttons
document
.getElementById("lockLte")
.addEventListener("click", () => lockBands("#lte_bands", "lte_band"));
document
.getElementById("lockNsa")
.addEventListener("click", () =>
lockBands("#nsa_bands", "nsa_nr5g_band")
);
document
.getElementById("lockSa")
.addEventListener("click", () => lockBands("#sa_bands", "nr5g_band"));
document
.getElementById("lockSaDc")
.addEventListener("click", () =>
lockBands("#sanrdc_bands", "nrdc_nr5g_band")
);
// Event listeners for Reset buttons
// Function to reset and check all checkboxes for a given band type
function resetBands(targetId, bandType) {
const checkboxes = document.querySelectorAll(
`${targetId} input[type="checkbox"]`
);
let selectedBands = [];
// Check all checkboxes and gather their values
checkboxes.forEach((checkbox) => {
checkbox.setAttribute("checked", "checked");
checkbox.checked = true;
selectedBands.push(checkbox.value);
});
// Create and send the AT command with all bands
sendBandLockCommand(selectedBands, bandType);
}
// Function to send the AT command to lock the bands
async function sendBandLockCommand(bands, bandType) {
// Join the selected bands with ":" separator for the AT command
const bandString = bands.join(":");
const command = `AT+QNWPREFCFG="${bandType}",${bandString}`;
try {
const response = await fetch("/cgi-bin/atinout_handler.sh", {
method: "POST",
body: "command=" + encodeURIComponent(command),
});
const data = await response.json();
console.log(
`Band lock command for ${bandType} executed:`,
data.output
);
} catch (error) {
console.error(
`Error sending band lock command for ${bandType}:`,
error
);
}
}
// Event listeners for "Reset" buttons
document
.getElementById("resetLte")
.addEventListener("click", function (event) {
event.preventDefault();
resetBands("#lte_bands", "lte_band");
});
document
.getElementById("resetNsa")
.addEventListener("click", function (event) {
event.preventDefault();
resetBands("#nsa_bands", "nsa_nr5g_band");
});
document
.getElementById("resetSa")
.addEventListener("click", function (event) {
event.preventDefault();
resetBands("#sa_bands", "nr5g_band");
});
document
.getElementById("resetSaDc")
.addEventListener("click", function (event) {
event.preventDefault();
resetBands("#sanrdc_bands", "nrdc_nr5g_band");
});
// Initial call to fetch supported bands on page load
window.onload = fetchSupportedBands;
</script>
</body>
</html>

View File

@@ -74,7 +74,9 @@
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -85,25 +87,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"

View File

@@ -58,8 +58,8 @@
<div id="navMenu" class="navbar-menu"> <div id="navMenu" class="navbar-menu">
<div class="navbar-start ml-6"> <div class="navbar-start ml-6">
<a class="navbar-item has-text-weight-bold" href="/"> Home </a> <a class="navbar-item" href="/"> Home </a>
<div class="navbar-item"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link has-text-weight-bold"> Cellular </a> <a class="navbar-link has-text-weight-bold"> Cellular </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/bandlock.html"> Band Locking </a> <a class="navbar-item" href="/bandlock.html"> Band Locking </a>
@@ -74,7 +74,9 @@
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -85,25 +87,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"

View File

@@ -58,8 +58,8 @@
<div id="navMenu" class="navbar-menu"> <div id="navMenu" class="navbar-menu">
<div class="navbar-start ml-6"> <div class="navbar-start ml-6">
<a class="navbar-item has-text-weight-bold" href="/"> Home </a> <a class="navbar-item" href="/"> Home </a>
<div class="navbar-item"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link has-text-weight-bold"> Cellular </a> <a class="navbar-link has-text-weight-bold"> Cellular </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/bandlock.html"> Band Locking </a> <a class="navbar-item" href="/bandlock.html"> Band Locking </a>
@@ -74,7 +74,9 @@
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -85,25 +87,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"

View File

@@ -58,8 +58,8 @@
<div id="navMenu" class="navbar-menu"> <div id="navMenu" class="navbar-menu">
<div class="navbar-start ml-6"> <div class="navbar-start ml-6">
<a class="navbar-item has-text-weight-bold" href="/"> Home </a> <a class="navbar-item" href="/"> Home </a>
<div class="navbar-item"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link has-text-weight-bold"> Cellular </a> <a class="navbar-link has-text-weight-bold"> Cellular </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/bandlock.html"> Band Locking </a> <a class="navbar-item" href="/bandlock.html"> Band Locking </a>
@@ -74,7 +74,9 @@
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -85,25 +87,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"

View File

@@ -75,7 +75,9 @@
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> Advance </a> <a class="navbar-link"> Advance </a>
<div class="navbar-dropdown is-boxed"> <div class="navbar-dropdown is-boxed">
<a class="navbar-item" href="/advance-settings.html"> Advance Settings </a> <a class="navbar-item" href="/advance-settings.html">
Advance Settings
</a>
<a class="navbar-item" href="#">Experimental Features</a> <a class="navbar-item" href="#">Experimental Features</a>
<a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a> <a class="navbar-item" href="/cgi-bin/luci">OpenWRT Luci</a>
</div> </div>
@@ -86,25 +88,25 @@
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
<div class="buttons is-flex-direction-column-mobile"> <div class="buttons is-flex-direction-column-mobile">
<p class="control is-expanded-mobile"> <div class="control is-expanded-mobile">
<a <div class="button is-link is-outlined is-fullwidth-mobile">
href="#"
class="button is-link is-outlined is-fullwidth-mobile"
>
<span class="icon"> <span class="icon">
<i class="fas fa-arrows-rotate"></i> <i class="fas fa-arrows-rotate"></i>
</span> </span>
<span>Restart Connection</span> <span>Restart Connection</span>
</a> </div>
</p> </div>
<div class="is-flex is-mobile is-align-items-center"> <div class="is-flex is-mobile is-align-items-center">
<p class="control"> <div class="control">
<div href="#" class="button is-warning is-outlined reboot-modal" data-target="reboot-modal" > <div
class="button is-warning is-outlined reboot-modal"
data-target="reboot-modal"
>
<span class="icon"> <span class="icon">
<i class="fas fa-power-off"></i> <i class="fas fa-power-off"></i>
</span> </span>
</div> </div>
</p> </div>
<p class="control ml-2 is-mobile"> <p class="control ml-2 is-mobile">
<a <a
href="#" href="#"