Merge pull request #2 from dr-dolomite/development-socat
Syncing Confirmed Changes from Development to Main
This commit is contained in:
@@ -16,8 +16,8 @@ fi
|
||||
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
|
||||
if [ -n "${MYATCMD}" ]; then
|
||||
x=$(urldecode "$atcmd")
|
||||
# Initialize wait time to 1 second
|
||||
wait_time=1000
|
||||
# Initialize wait time to 200 ms
|
||||
wait_time=200
|
||||
while true; do
|
||||
runcmd=$(echo -en "$x\r\n" | microcom -t $wait_time /dev/ttyOUT2)
|
||||
# Check if "OK" or "ERROR" is present in the response
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check iptables for ttlvalue
|
||||
ttlvalue=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}' | head -n1)
|
||||
ttlvalue=$(iptables -t mangle -vnL | awk '/TTL/ {print $13; exit}')
|
||||
ttlenabled=true;
|
||||
|
||||
# Set Variables
|
||||
@@ -17,4 +17,4 @@ cat <<EOT
|
||||
"isEnabled": $ttlenabled,
|
||||
"ttl": $ttlvalue
|
||||
}
|
||||
EOT
|
||||
EOT
|
||||
20
simpleadmin/www/cgi-bin/get_ttl_status.old
Normal file
20
simpleadmin/www/cgi-bin/get_ttl_status.old
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check iptables for ttlvalue
|
||||
ttlvalue=$(iptables -t mangle -vnL | awk '/TTL/ {print $13; exit}')
|
||||
ttlenabled=true;
|
||||
|
||||
# Set Variables
|
||||
if [ -z "${ttlvalue}" ]; then
|
||||
ttlvalue=0
|
||||
ttlenabled=false
|
||||
fi
|
||||
|
||||
echo "Content-type: text/json"
|
||||
echo ""
|
||||
cat <<EOT
|
||||
{
|
||||
"isEnabled": $ttlenabled,
|
||||
"ttl": $ttlvalue
|
||||
}
|
||||
EOT
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin
|
||||
|
||||
# Get query
|
||||
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
|
||||
|
||||
@@ -22,28 +22,28 @@ setTTL=$(printf '%b\n' "${ttlvalue//%/\\x}")
|
||||
|
||||
if [ -n "${setTTL}" ]; then
|
||||
# Stop Service To Remove Rules
|
||||
/opt/bin/sudo /usrdata/simplefirewall/ttl-override stop
|
||||
/usrdata/simplefirewall/ttl-override stop
|
||||
|
||||
# Check iptables is still set
|
||||
ttlcheck=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}')
|
||||
ttlcheck=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
|
||||
|
||||
# If TTL is still set manually remove values
|
||||
if [ ! -z "${ttlcheck}" ]; then
|
||||
/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set ${ttlcheck} &>/dev/null || true
|
||||
/opt/bin/sudo /usr/sbin/ip6tables -w 5 -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set ${ttlcheck} &>/dev/null || true
|
||||
if [ !-z "${ttlcheck}" ]; then
|
||||
iptables -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set ${ttlcheck} &>/dev/null || true
|
||||
ip6tables -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set ${ttlcheck} &>/dev/null || true
|
||||
fi
|
||||
|
||||
# Echo TTL to file
|
||||
echo $setTTL > /usrdata/simplefirewall/ttlvalue
|
||||
|
||||
# Set Start Service
|
||||
/opt/bin/sudo /usrdata/simplefirewall/ttl-override start
|
||||
/usrdata/simplefirewall/ttl-override start
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check iptables for ttlvalue
|
||||
ttlvalue=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}')
|
||||
ttlvalue=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
|
||||
ttlenabled=true;
|
||||
|
||||
# Set Variables
|
||||
@@ -58,5 +58,4 @@ cat <<EOT
|
||||
{
|
||||
"isEnabled": $ttlenabled,
|
||||
"ttl": $ttlvalue
|
||||
}
|
||||
EOT
|
||||
}
|
||||
61
simpleadmin/www/cgi-bin/set_ttl.old
Normal file
61
simpleadmin/www/cgi-bin/set_ttl.old
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get query
|
||||
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
|
||||
|
||||
if [ "${QUERY_STRING}" ]; then
|
||||
|
||||
export IFS="&"
|
||||
for cmd in ${QUERY_STRING}; do
|
||||
|
||||
if [ "$(echo $cmd | grep '=')" ]; then
|
||||
key=$(echo $cmd | awk -F '=' '{print $1}')
|
||||
value=$(echo $cmd | awk -F '=' '{print $2}')
|
||||
eval $key=$value
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
setTTL=$(printf '%b\n' "${ttlvalue//%/\\x}")
|
||||
|
||||
if [ -n "${setTTL}" ]; then
|
||||
# Stop Service To Remove Rules
|
||||
/usrdata/simplefirewall/ttl-override stop
|
||||
|
||||
# Check iptables is still set
|
||||
ttlcheck=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
|
||||
|
||||
# If TTL is still set manually remove values
|
||||
if [ !-z "${ttlcheck}" ]; then
|
||||
iptables -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set ${ttlcheck} &>/dev/null || true
|
||||
ip6tables -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set ${ttlcheck} &>/dev/null || true
|
||||
fi
|
||||
|
||||
# Echo TTL to file
|
||||
echo $setTTL > /usrdata/simplefirewall/ttlvalue
|
||||
|
||||
# Set Start Service
|
||||
/usrdata/simplefirewall/ttl-override start
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check iptables for ttlvalue
|
||||
ttlvalue=$(iptables -t mangle -vnL | grep TTL | awk '{print $13}')
|
||||
ttlenabled=true;
|
||||
|
||||
# Set Variables
|
||||
if [ -z "${ttlvalue}" ]; then
|
||||
ttlvalue=0
|
||||
ttlenabled=false
|
||||
fi
|
||||
|
||||
echo "Content-type: text/json"
|
||||
echo ""
|
||||
cat <<EOT
|
||||
{
|
||||
"isEnabled": $ttlenabled,
|
||||
"ttl": $ttlvalue
|
||||
}
|
||||
@@ -11,12 +11,12 @@
|
||||
crossorigin="anonymous"
|
||||
/> -->
|
||||
<!-- Import all the bootstrap css files from css folder -->
|
||||
<link rel="stylesheet" href="/css/styles.css" />
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/js/alpinejs.min.js" defer></script>
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/alpinejs.min.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
@@ -52,18 +52,19 @@
|
||||
<a class="nav-link" href="/sms.html">SMS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/console">Console</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/deviceinfo.html" aria-current="page" >Device Information</a>
|
||||
<a
|
||||
class="nav-link active"
|
||||
href="/deviceinfo.html"
|
||||
aria-current="page"
|
||||
>Device Information</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">Dark Mode</button>
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">
|
||||
Dark Mode
|
||||
</button>
|
||||
</span>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link" href="logout.html">Log Out</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -208,7 +209,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/js/dark-mode.js"></script>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
<script>
|
||||
function fetchDeviceInfo() {
|
||||
return {
|
||||
|
||||
BIN
simpleadmin/www/favicon.ico
Normal file
BIN
simpleadmin/www/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -14,9 +14,12 @@
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
|
||||
<!-- Logo -->
|
||||
<link rel="simpleadmin-logo" href="favicon.ico">
|
||||
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/js/alpinejs.min.js" defer></script>
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/alpinejs.min.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
@@ -40,7 +43,9 @@
|
||||
<div class="collapse navbar-collapse" id="navbarText">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="/">Home</a>
|
||||
<a class="nav-link active" aria-current="page" href="/"
|
||||
>Home</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="network.html">Simple Network</a>
|
||||
@@ -52,18 +57,16 @@
|
||||
<a class="nav-link" href="/sms.html">SMS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/console">Console</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/deviceinfo.html">Device Information</a>
|
||||
</li>
|
||||
<a class="nav-link" href="/deviceinfo.html"
|
||||
>Device Information</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">Dark Mode</button>
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">
|
||||
Dark Mode
|
||||
</button>
|
||||
</span>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link" href="logout.html">Log Out</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -272,7 +275,6 @@
|
||||
}
|
||||
} }"
|
||||
>
|
||||
|
||||
<div
|
||||
x-show="rsrqLTE != '-'"
|
||||
class="progress w-100"
|
||||
@@ -287,7 +289,9 @@
|
||||
:class="getProgressBarClass()"
|
||||
:style="'width: ' + rsrqLTEPercentage + '%'"
|
||||
>
|
||||
<span x-text="rsrqLTE + ' / ' + rsrqLTEPercentage + '%'"></span>
|
||||
<span
|
||||
x-text="rsrqLTE + ' / ' + rsrqLTEPercentage + '%'"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -322,7 +326,9 @@
|
||||
:class="getProgressBarClass()"
|
||||
:style="'width: ' + rsrqNRPercentage + '%'"
|
||||
>
|
||||
<span x-text="rsrqNR + ' / ' + rsrqNRPercentage + '%'"></span>
|
||||
<span
|
||||
x-text="rsrqNR + ' / ' + rsrqNRPercentage + '%'"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -360,7 +366,9 @@
|
||||
:class="getProgressBarClass()"
|
||||
:style="'width: ' + rsrpLTEPercentage + '%'"
|
||||
>
|
||||
<span x-text="rsrpLTE + ' / ' + rsrpLTEPercentage + '%'"></span>
|
||||
<span
|
||||
x-text="rsrpLTE + ' / ' + rsrpLTEPercentage + '%'"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -398,7 +406,9 @@
|
||||
:class="getProgressBarClass()"
|
||||
:style="'width: ' + rsrpNRPercentage + '%'"
|
||||
>
|
||||
<span x-text="rsrpNR + ' / ' + rsrpNRPercentage + '%'"></span>
|
||||
<span
|
||||
x-text="rsrpNR + ' / ' + rsrpNRPercentage + '%'"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -436,7 +446,9 @@
|
||||
:class="getProgressBarClass()"
|
||||
:style="'width: ' + sinrLTEPercentage +'%'"
|
||||
>
|
||||
<span x-text="sinrLTE + ' / ' + sinrLTEPercentage +'%'"></span>
|
||||
<span
|
||||
x-text="sinrLTE + ' / ' + sinrLTEPercentage +'%'"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -474,7 +486,9 @@
|
||||
:class="getProgressBarClass()"
|
||||
:style="'width: ' + sinrNRPercentage +'%'"
|
||||
>
|
||||
<span x-text="sinrNR + ' / ' + sinrNRPercentage +'%'"></span>
|
||||
<span
|
||||
x-text="sinrNR + ' / ' + sinrNRPercentage +'%'"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -503,7 +517,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/js/dark-mode.js"></script>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
<script>
|
||||
function getStaticNetworkInfo() {
|
||||
return {
|
||||
@@ -543,7 +557,7 @@
|
||||
internetConnection: "Disconnected",
|
||||
lastUpdate: new Date().toLocaleString(),
|
||||
newRefreshRate: null,
|
||||
refreshRate: 3,
|
||||
refreshRate: 5,
|
||||
intervalId: null,
|
||||
fetchNetworkInfo() {
|
||||
this.atcmd =
|
||||
@@ -607,19 +621,42 @@
|
||||
if (networkMode1 === '"NR5G-SA"') {
|
||||
this.network_mode = networkMode1;
|
||||
this.network_mode = this.network_mode.replace(/"/g, "");
|
||||
} else {
|
||||
}
|
||||
|
||||
else {
|
||||
let networkMode2, networkMode3;
|
||||
|
||||
networkMode2 = lines[28].split(":")[1].replace(/"/g, "");
|
||||
networkMode2 = networkMode2.split(",")[0];
|
||||
|
||||
if (
|
||||
lines[29] !== undefined &&
|
||||
lines[29] !== "OK" &&
|
||||
lines[29] !== ""
|
||||
lines[27] !== undefined &&
|
||||
lines[27] !== "OK" &&
|
||||
lines[27] !== "" &&
|
||||
lines[27] !== "/r"
|
||||
) {
|
||||
networkMode3 = lines[29].split(":")[1].replace(/"/g, "");
|
||||
networkMode3 = networkMode3.split(",")[0];
|
||||
// Check if lines[27] doesnt have TDD or FDD
|
||||
if (
|
||||
lines[27].match(/FDD/) != null ||
|
||||
lines[27].match(/TDD/) != null
|
||||
) {
|
||||
networkMode2 = lines[27].split(",")[2].replace(/"/g, "");
|
||||
networkMode2 = networkMode2.split(",")[0].trim();
|
||||
}
|
||||
|
||||
if (networkMode2 !== "LTE") {
|
||||
networkMode2 = lines[28].split(":")[1].replace(/"/g, "");
|
||||
networkMode2 = networkMode2.split(",")[0];
|
||||
|
||||
if (
|
||||
lines[29] !== undefined &&
|
||||
lines[29] !== "OK" &&
|
||||
lines[29] !== ""
|
||||
) {
|
||||
networkMode3 = lines[29]
|
||||
.split(":")[1]
|
||||
.split(",")[0]
|
||||
.replace(/"/g, "");
|
||||
networkMode3 = networkMode3.split(",")[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if networkMode3 is not empty
|
||||
@@ -743,86 +780,167 @@
|
||||
this.signalPercentage
|
||||
);
|
||||
} else {
|
||||
let lte_bw_ul = lines[28].split(",")[8].replace(/"/g, "");
|
||||
let lte_bw_dl = lines[28].split(",")[9].replace(/"/g, "");
|
||||
if (this.network_mode.match(/LTE/) != null) {
|
||||
let lte_bw_ul = lines[27].split(",")[10].replace(/"/g, "");
|
||||
let lte_bw_dl = lines[27].split(",")[11].replace(/"/g, "");
|
||||
|
||||
lte_bw_dl = parseInt(lte_bw_dl);
|
||||
lte_bw_ul = parseInt(lte_bw_ul);
|
||||
lte_bw_dl = parseInt(lte_bw_dl);
|
||||
lte_bw_ul = parseInt(lte_bw_ul);
|
||||
|
||||
// Calculate the LTE bandwidth
|
||||
this.bandwidth =
|
||||
this.calculate_lte_bw(lte_bw_ul) +
|
||||
" MHz / " +
|
||||
this.calculate_lte_bw(lte_bw_dl) +
|
||||
" MHz";
|
||||
// Calculate the LTE bandwidth
|
||||
this.bandwidth =
|
||||
this.calculate_lte_bw(lte_bw_ul) +
|
||||
" MHz / " +
|
||||
this.calculate_lte_bw(lte_bw_dl) +
|
||||
" MHz";
|
||||
|
||||
// Get the RSSI
|
||||
this.rssi = lines[28].split(",")[13].replace(/"/g, "");
|
||||
// Get the Cell ID
|
||||
const longCID = lines[27].split(",")[6].replace(/"/g, "");
|
||||
|
||||
// Get the Cell ID
|
||||
const longCID = lines[28].split(",")[4].replace(/"/g, "");
|
||||
// Get the eNBID. Its just Cell ID minus the last 2 characters
|
||||
this.eNBID = longCID.substring(0, longCID.length - 2);
|
||||
|
||||
// Get the eNBID. Its just Cell ID minus the last 2 characters
|
||||
this.eNBID = longCID.substring(0, longCID.length - 2);
|
||||
// Get the short Cell ID (Last 2 characters of the Cell ID)
|
||||
const shortCID = longCID.substring(longCID.length - 2);
|
||||
|
||||
// Get the short Cell ID (Last 2 characters of the Cell ID)
|
||||
const shortCID = longCID.substring(longCID.length - 2);
|
||||
// Get the TAC
|
||||
this.tac = lines[27].split(",")[12].replace(/"/g, "");
|
||||
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
|
||||
|
||||
// Get the TAC
|
||||
this.tac = lines[28].split(",")[10].replace(/"/g, "");
|
||||
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
|
||||
this.cellID =
|
||||
"Short " +
|
||||
shortCID +
|
||||
"(" +
|
||||
parseInt(shortCID, 16) +
|
||||
")" +
|
||||
", " +
|
||||
"Long " +
|
||||
longCID +
|
||||
"(" +
|
||||
parseInt(longCID, 16) +
|
||||
")";
|
||||
|
||||
this.cellID =
|
||||
"Short " +
|
||||
shortCID +
|
||||
"(" +
|
||||
parseInt(shortCID, 16) +
|
||||
")" +
|
||||
", " +
|
||||
"Long " +
|
||||
longCID +
|
||||
"(" +
|
||||
parseInt(longCID, 16) +
|
||||
")";
|
||||
// Parse the PCIs
|
||||
this.pcc_pci = lines[27].split(",")[7].replace(/"/g, "");
|
||||
|
||||
// Parse the PCIs
|
||||
this.pcc_pci = lines[28].split(",")[5].replace(/"/g, "");
|
||||
// Get the RSRQ
|
||||
this.rsrqLTE = lines[27].split(",")[14].replace(/"/g, "");
|
||||
let rsrq = parseInt(this.rsrqLTE);
|
||||
|
||||
// Get the RSRQ
|
||||
this.rsrqLTE = lines[28].split(",")[12].replace(/"/g, "");
|
||||
let rsrq = parseInt(this.rsrqLTE);
|
||||
// Calculate the RSRQ percentage
|
||||
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
|
||||
|
||||
// Calculate the RSRQ percentage
|
||||
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
|
||||
// Get the RSRP
|
||||
this.rsrpLTE = lines[27].split(",")[13].replace(/"/g, "");
|
||||
|
||||
// Get the RSRP
|
||||
this.rsrpLTE = lines[28].split(",")[11].replace(/"/g, "");
|
||||
// Calculate the RSRP percentage
|
||||
this.rsrpLTEPercentage = this.calculateRSRPPercentage(
|
||||
parseInt(this.rsrpLTE)
|
||||
);
|
||||
|
||||
// Calculate the RSRP percentage
|
||||
this.rsrpLTEPercentage = this.calculateRSRPPercentage(
|
||||
parseInt(this.rsrpLTE)
|
||||
);
|
||||
// Get the RSSI
|
||||
this.rssi = lines[27].split(",")[15].replace(/"/g, "");
|
||||
|
||||
// Get the SINR
|
||||
this.sinrLTE = lines[28].split(",")[14].replace(/"/g, "");
|
||||
// Get the SINR
|
||||
this.sinrLTE = lines[27].split(",")[16].replace(/"/g, "");
|
||||
|
||||
// Calculate the SINR percentage
|
||||
this.sinrLTEPercentage = this.calculateSINRPercentage(
|
||||
parseInt(this.sinrLTE)
|
||||
);
|
||||
// Calculate the SINR percentage
|
||||
this.sinrLTEPercentage = this.calculateSINRPercentage(
|
||||
parseInt(this.sinrLTE)
|
||||
);
|
||||
|
||||
// Calculate Signal Percentage
|
||||
this.signalPercentage = this.calculateSignalPercentage(
|
||||
parseInt(this.rsrpLTEPercentage),
|
||||
parseInt(this.sinrLTEPercentage)
|
||||
);
|
||||
// Calculate Signal Percentage
|
||||
this.signalPercentage = this.calculateSignalPercentage(
|
||||
parseInt(this.rsrpLTEPercentage),
|
||||
parseInt(this.sinrLTEPercentage)
|
||||
);
|
||||
|
||||
// Get the Signal Assessment
|
||||
this.signalAssessment = this.signalQuality(
|
||||
this.signalPercentage
|
||||
);
|
||||
// Get the Signal Assessment
|
||||
this.signalAssessment = this.signalQuality(
|
||||
this.signalPercentage
|
||||
);
|
||||
}
|
||||
|
||||
if (this.network_mode.match(/NR5G-NSA/) != null) {
|
||||
let lte_bw_ul = lines[28].split(",")[8].replace(/"/g, "");
|
||||
let lte_bw_dl = lines[28].split(",")[9].replace(/"/g, "");
|
||||
|
||||
lte_bw_dl = parseInt(lte_bw_dl);
|
||||
lte_bw_ul = parseInt(lte_bw_ul);
|
||||
|
||||
// Calculate the LTE bandwidth
|
||||
this.bandwidth =
|
||||
this.calculate_lte_bw(lte_bw_ul) +
|
||||
" MHz / " +
|
||||
this.calculate_lte_bw(lte_bw_dl) +
|
||||
" MHz";
|
||||
|
||||
// Get the RSSI
|
||||
this.rssi = lines[28].split(",")[13].replace(/"/g, "");
|
||||
|
||||
// Get the Cell ID
|
||||
const longCID = lines[28].split(",")[4].replace(/"/g, "");
|
||||
|
||||
// Get the eNBID. Its just Cell ID minus the last 2 characters
|
||||
this.eNBID = longCID.substring(0, longCID.length - 2);
|
||||
|
||||
// Get the short Cell ID (Last 2 characters of the Cell ID)
|
||||
const shortCID = longCID.substring(longCID.length - 2);
|
||||
|
||||
// Get the TAC
|
||||
this.tac = lines[28].split(",")[10].replace(/"/g, "");
|
||||
this.tac = this.tac + " (" + parseInt(this.tac, 16) + ")";
|
||||
|
||||
this.cellID =
|
||||
"Short " +
|
||||
shortCID +
|
||||
"(" +
|
||||
parseInt(shortCID, 16) +
|
||||
")" +
|
||||
", " +
|
||||
"Long " +
|
||||
longCID +
|
||||
"(" +
|
||||
parseInt(longCID, 16) +
|
||||
")";
|
||||
|
||||
// Parse the PCIs
|
||||
this.pcc_pci = lines[28].split(",")[5].replace(/"/g, "");
|
||||
|
||||
// Get the RSRQ
|
||||
this.rsrqLTE = lines[28].split(",")[12].replace(/"/g, "");
|
||||
rsrq = parseInt(this.rsrqLTE);
|
||||
|
||||
// Calculate the RSRQ percentage
|
||||
this.rsrqLTEPercentage = this.calculateRSRQPercentage(rsrq);
|
||||
|
||||
// Get the RSRP
|
||||
this.rsrpLTE = lines[28].split(",")[11].replace(/"/g, "");
|
||||
|
||||
// Calculate the RSRP percentage
|
||||
this.rsrpLTEPercentage = this.calculateRSRPPercentage(
|
||||
parseInt(this.rsrpLTE)
|
||||
);
|
||||
|
||||
// Get the SINR
|
||||
this.sinrLTE = lines[28].split(",")[14].replace(/"/g, "");
|
||||
|
||||
// Calculate the SINR percentage
|
||||
this.sinrLTEPercentage = this.calculateSINRPercentage(
|
||||
parseInt(this.sinrLTE)
|
||||
);
|
||||
|
||||
// Calculate Signal Percentage
|
||||
this.signalPercentage = this.calculateSignalPercentage(
|
||||
parseInt(this.rsrpLTEPercentage),
|
||||
parseInt(this.sinrLTEPercentage)
|
||||
);
|
||||
|
||||
// Get the Signal Assessment
|
||||
this.signalAssessment = this.signalQuality(
|
||||
this.signalPercentage
|
||||
);
|
||||
|
||||
let nr_bw = lines[29].split(",")[9].replace(/"/g, "");
|
||||
|
||||
nr_bw = parseInt(nr_bw);
|
||||
@@ -871,6 +989,9 @@
|
||||
this.signalPercentage =
|
||||
(this.signalPercentage + nrSignalPercentage) / 2;
|
||||
|
||||
// Round the signalPercentage value
|
||||
this.signalPercentage = Math.round(this.signalPercentage);
|
||||
|
||||
// Get the Signal Assessment
|
||||
this.signalAssessment = this.signalQuality(
|
||||
this.signalPercentage
|
||||
@@ -998,8 +1119,9 @@
|
||||
const rawdata = data;
|
||||
|
||||
const lines = rawdata.split("\n");
|
||||
console.log("CSQ: ", lines);
|
||||
|
||||
this.csq = lines[0].split(":")[1].split(",")[0].trim();
|
||||
this.csq = lines[1].split(":")[1].split(",")[0].trim();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1031,11 +1153,22 @@
|
||||
this.refreshRate = this.newRefreshRate;
|
||||
console.log("Refresh Rate Updated to " + this.refreshRate);
|
||||
|
||||
// Store the refresh rate in local storage or session storage
|
||||
localStorage.setItem("refreshRate", this.refreshRate);
|
||||
|
||||
// Initialize with the new refresh rate
|
||||
this.init();
|
||||
},
|
||||
|
||||
init() {
|
||||
// Retrieve the refresh rate from local storage or session storage
|
||||
const storedRefreshRate = localStorage.getItem("refreshRate");
|
||||
|
||||
// If a refresh rate is stored, use it; otherwise, use a default value
|
||||
this.refreshRate = storedRefreshRate
|
||||
? parseInt(storedRefreshRate)
|
||||
: 5; // Change 5 to your desired default value
|
||||
|
||||
this.fetchNetworkInfo();
|
||||
// sleep for 2 seconds
|
||||
setTimeout(() => {
|
||||
@@ -1044,7 +1177,8 @@
|
||||
|
||||
this.requestPing()
|
||||
.then((data) => {
|
||||
const response = data.trim(); // Trim any leading/trailing spaces
|
||||
const response = data.trim();
|
||||
// Trim any leading/trailing spaces
|
||||
if (response === "OK") {
|
||||
this.internetConnection = "Connected";
|
||||
} else {
|
||||
@@ -1069,7 +1203,8 @@
|
||||
|
||||
this.requestPing()
|
||||
.then((data) => {
|
||||
const response = data.trim(); // Trim any leading/trailing spaces
|
||||
const response = data.trim();
|
||||
// Trim any leading/trailing spaces
|
||||
if (response === "OK") {
|
||||
this.internetConnection = "Connected";
|
||||
} else {
|
||||
@@ -1082,7 +1217,6 @@
|
||||
});
|
||||
|
||||
this.lastUpdate = new Date().toLocaleString();
|
||||
|
||||
console.log("Refreshed");
|
||||
}, this.refreshRate * 1000);
|
||||
},
|
||||
|
||||
@@ -15,14 +15,16 @@ function parseCurrentSettings(rawdata) {
|
||||
|
||||
let bands = [];
|
||||
|
||||
// Append the values if there is separated by comma
|
||||
// Append the values if there is separated by comma with a space.
|
||||
// i.e. LTE BAND 3, LTE BAND 1
|
||||
for (let i = 13; i < 17; i++) {
|
||||
if (lines[i].split(",").length > 1) {
|
||||
bands.push(lines[i].split(",")[3].replace(/\"/g, ""));
|
||||
bands.push(lines[i].split(",")[3].replace(/\"/g, " "));
|
||||
}
|
||||
}
|
||||
|
||||
this.bands = bands;
|
||||
|
||||
|
||||
if (this.cellLock4GStatus == 1 && this.cellLock5GStatus == 1) {
|
||||
this.cellLockStatus = "Locked to 4G and 5G";
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<!-- change to a much simpler tab title -->
|
||||
<title>Simple Admin</title>
|
||||
|
||||
<link rel="stylesheet" href="/css/bulma.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
||||
<link rel="stylesheet" href="css/bulma.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/admin.css" />
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
</head>
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<!-- Import all the bootstrap css files from css folder -->
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
|
||||
<!-- Logo -->
|
||||
<link rel="simpleadmin-logo" href="favicon.ico">
|
||||
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
@@ -43,7 +46,12 @@
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="network.html" aria-current="page">Simple Network</a>
|
||||
<a
|
||||
class="nav-link active"
|
||||
href="network.html"
|
||||
aria-current="page"
|
||||
>Simple Network</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
@@ -52,18 +60,16 @@
|
||||
<a class="nav-link" href="/sms.html">SMS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/console">Console</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="deviceinfo.html">Device Information</a>
|
||||
<a class="nav-link" href="deviceinfo.html"
|
||||
>Device Information</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">Dark Mode</button>
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">
|
||||
Dark Mode
|
||||
</button>
|
||||
</span>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link" href="logout.html">Log Out</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -552,7 +558,7 @@
|
||||
updatedLockedBands: null,
|
||||
sim: "-",
|
||||
newSim: null,
|
||||
cellLockStatus: null,
|
||||
cellLockStatus: "Unknown",
|
||||
bands: "Fetching Bands...",
|
||||
init() {
|
||||
// Function to populate checkboxes
|
||||
@@ -787,11 +793,10 @@
|
||||
}
|
||||
|
||||
// Construct the AT command using the valid pairs
|
||||
let atcmd = `+QNWLOCK="common/4g",${cellNum},${validPairs
|
||||
let atcmd = `AT+QNWLOCK="common/4g",${cellNum},${validPairs
|
||||
.map((pair) => `${pair.earfcn},${pair.pci}`)
|
||||
.join(",")}`;
|
||||
atcmd = "AT+CFUN=0;" + atcmd + ";+CFUN=1";
|
||||
|
||||
|
||||
// Mock data
|
||||
this.showModal = true;
|
||||
|
||||
@@ -824,8 +829,7 @@
|
||||
}
|
||||
|
||||
// Construct the AT command using the valid pairs
|
||||
let atcmd = `+QNWLOCK="common/5g",${earfcn},${pci},${scs},${band}`;
|
||||
atcmd = "AT+CFUN=0;" + atcmd + ";+CFUN=1";
|
||||
let atcmd = `AT+QNWLOCK="common/5g",${earfcn},${pci},${scs},${band}`;
|
||||
|
||||
// Mock data
|
||||
this.showModal = true;
|
||||
@@ -844,7 +848,7 @@
|
||||
},
|
||||
cellLockDisableLTE() {
|
||||
// Send the atcmd command to reset the locked bands
|
||||
const atcmd = 'AT+CFUN=0;+QNWLOCK="common/4g,0;+CFUN=1"';
|
||||
const atcmd = 'AT+QNWLOCK="common/4g,0"';
|
||||
this.showModal = true;
|
||||
|
||||
this.sendATcommand(atcmd);
|
||||
@@ -860,7 +864,7 @@
|
||||
},
|
||||
cellLockDisableNR() {
|
||||
// Send the atcmd command to reset the locked bands
|
||||
const atcmd = 'AT+CFUN=0;+QNWLOCK="common/5g,0;+CFUN=1"';
|
||||
const atcmd = 'AT+QNWLOCK="common/5g,0"';
|
||||
|
||||
this.showModal = true;
|
||||
|
||||
@@ -925,6 +929,6 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="/js/dark-mode.js"></script>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,12 +4,15 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Simple Admin</title>
|
||||
<link rel="stylesheet" href="/css/styles.css" />
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
|
||||
<!-- Logo -->
|
||||
<link rel="simpleadmin-logo" href="favicon.ico">
|
||||
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/js/alpinejs.min.js" defer></script>
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/alpinejs.min.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
@@ -39,14 +42,16 @@
|
||||
<a class="nav-link" href="/network.html">Simple Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/settings.html" aria-current="page">Simple Settings</a>
|
||||
<a
|
||||
class="nav-link active"
|
||||
href="/settings.html"
|
||||
aria-current="page"
|
||||
>Simple Settings</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/sms.html">SMS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/console">Console</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/deviceinfo.html"
|
||||
>Device Information</a
|
||||
@@ -54,11 +59,10 @@
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">Dark Mode</button>
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">
|
||||
Dark Mode
|
||||
</button>
|
||||
</span>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link" href="logout.html">Log Out</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -396,7 +400,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/js/dark-mode.js"></script>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
<script>
|
||||
function simpleSettings() {
|
||||
return {
|
||||
|
||||
@@ -11,13 +11,16 @@
|
||||
crossorigin="anonymous"
|
||||
/> -->
|
||||
<!-- Import all the bootstrap css files from css folder -->
|
||||
<link rel="stylesheet" href="/css/styles.css" />
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
|
||||
<!-- Logo -->
|
||||
<link rel="simpleadmin-logo" href="favicon.ico">
|
||||
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/js/alpinejs.min.js" defer></script>
|
||||
<script src="/js/auth.js"></script>
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/alpinejs.min.js" defer></script>
|
||||
<script src="js/auth.js"></script>
|
||||
</head>
|
||||
<body onload="isAuthenticated()">
|
||||
<main>
|
||||
@@ -50,11 +53,13 @@
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/sms.html" aria-current="page">SMS</a>
|
||||
<a
|
||||
class="nav-link active"
|
||||
href="/sms.html"
|
||||
aria-current="page"
|
||||
>SMS</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/console">Console</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/deviceinfo.html"
|
||||
>Device Information</a
|
||||
@@ -62,11 +67,10 @@
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">Dark Mode</button>
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">
|
||||
Dark Mode
|
||||
</button>
|
||||
</span>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link" href="logout.html">Log Out</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -175,7 +179,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/js/dark-mode.js"></script>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
<script>
|
||||
function fetchSMS() {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user