diff --git a/simpleadmin/script/sms.sh b/simpleadmin/script/sms.sh new file mode 100644 index 0000000..6a2af92 --- /dev/null +++ b/simpleadmin/script/sms.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# Check if the required parameters are provided +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Assign the provided parameters to variables +phone_number="$1" +message="$2" + +# Send the AT command to set the message format to text mode +echo -ne "AT+CMGF=1\r" > microcom -s /dev/ttyOUT2 +sleep 1 +echo -ne "AT+CNMI=2,1\r" > microcom /dev/ttyOUT2 +sleep 1 +echo -ne 'AT+CMGS="09938931024"\r' > microcom /dev/ttyOUT2 +sleep 1 + +# Send the message +echo -ne "$message" > microcom /dev/ttyOUT2 +echo -ne "\032" > microcom /dev/ttyOUT2 + +# Wait for the response +sleep 1 + +# Capture and output the response +runcmd=$(microcom /dev/ttyOUT2) +# echo "Content-type: text/plain" +echo "$runcmd" \ No newline at end of file diff --git a/simpleadmin/www/cgi-bin/get_ttl_status.old b/simpleadmin/www/cgi-bin/get_ttl_status.old deleted file mode 100644 index 03d366b..0000000 --- a/simpleadmin/www/cgi-bin/get_ttl_status.old +++ /dev/null @@ -1,20 +0,0 @@ -#!/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 </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 < Simple Admin Version - SimpleAdminRev-Alpha-0.3 + SimpleAdminRev-Alpha-0.5 @@ -149,7 +149,7 @@ + + + None + @@ -319,7 +333,7 @@ } }" >
+ + + None + @@ -359,7 +380,7 @@ }" >
+ + + None + @@ -399,7 +427,7 @@ }" >
+ + + None + @@ -439,7 +474,7 @@ }" >
+ + + None + @@ -479,7 +521,7 @@ }" >
+ + + None + @@ -563,7 +612,7 @@ internetConnection: "Disconnected", lastUpdate: new Date().toLocaleString(), newRefreshRate: null, - refreshRate: 5, + refreshRate: 3, intervalId: null, fetchNetworkInfo() { this.atcmd = @@ -627,9 +676,7 @@ if (networkMode1 === '"NR5G-SA"') { this.network_mode = networkMode1; this.network_mode = this.network_mode.replace(/"/g, ""); - } - - else { + } else { let networkMode2, networkMode3; if ( @@ -786,7 +833,10 @@ this.signalPercentage ); } else { - if (this.network_mode.match(/LTE/) != null && this.network_mode.match(/NR5G-NSA/) == null) { + if ( + this.network_mode.match(/LTE/) != null && + this.network_mode.match(/NR5G-NSA/) == null + ) { let lte_bw_ul = lines[27].split(",")[10].replace(/"/g, ""); let lte_bw_dl = lines[27].split(",")[11].replace(/"/g, ""); @@ -795,9 +845,11 @@ // Calculate the LTE bandwidth this.bandwidth = - "UL " + this.calculate_lte_bw(lte_bw_ul) + + "UL " + + this.calculate_lte_bw(lte_bw_ul) + " MHz / " + - "DL " + this.calculate_lte_bw(lte_bw_dl) + + "DL " + + this.calculate_lte_bw(lte_bw_dl) + " MHz"; // Get the Cell ID @@ -878,7 +930,8 @@ this.bandwidth = this.calculate_lte_bw(lte_bw_ul) + " MHz, " + - "NR " + this.calculate_lte_bw(lte_bw_dl) + + "NR " + + this.calculate_lte_bw(lte_bw_dl) + " MHz"; // Get the RSSI @@ -1042,7 +1095,7 @@ let RSRQ_max = -8; // If rsrq is null, return 0% - if (isNaN(rsrq)) { + if (isNaN(rsrq) || rsrq < -20) { return 0; } @@ -1060,7 +1113,7 @@ let RSRP_max = -60; // If rsrp is null, return 0% - if (isNaN(rsrp)) { + if (isNaN(rsrp) || rsrp < -140) { return 0; } @@ -1074,11 +1127,11 @@ }, calculateSINRPercentage(sinr) { - let SINR_min = 0; + let SINR_min = -10; // Changed from 0 let SINR_max = 35; // If sinr is null, return 0% - if (isNaN(sinr)) { + if (isNaN(sinr) || sinr < -10) { return 0; } @@ -1173,7 +1226,7 @@ // 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 + : 3; // Change 5 to your desired default value this.fetchNetworkInfo(); // sleep for 2 seconds diff --git a/simpleadmin/www/settings.html b/simpleadmin/www/settings.html index 37f7fff..5b62cb0 100644 --- a/simpleadmin/www/settings.html +++ b/simpleadmin/www/settings.html @@ -6,9 +6,9 @@ Simple Admin - + - + @@ -104,7 +104,7 @@ placeholder="ATI" aria-describedby="atCommandInput" x-model="atcmd" - @keydown.enter = "sendATCommand()" + @keydown.enter="sendATCommand()" />
Seperate multiple commands with comma (,). @@ -557,21 +557,24 @@ case "LTE": this.atcmd = "AT+QSCAN=1,1"; this.scanStart = true; - this.atCommandResponse = "Scanning all available LTE networks... This might take a while." + this.atCommandResponse = + "Scanning all available LTE networks... This might take a while."; this.sendATCommand(); this.scanStart = false; break; case "NR5G": this.atcmd = "AT+QSCAN=2,1"; this.scanStart = true; - this.atCommandResponse = "Scanning all available NR5G-SA networks... This might take a while." + this.atCommandResponse = + "Scanning all available NR5G-SA networks... This might take a while."; this.sendATCommand(); this.scanStart = false; break; case "ALL": this.atcmd = "AT+QSCAN=3,1"; this.scanStart = true; - this.atCommandResponse = "Scanning all available networks... This might take a while." + this.atCommandResponse = + "Scanning all available networks... This might take a while."; this.sendATCommand(); this.scanStart = false; break; @@ -646,15 +649,16 @@ setTTL() { this.isLoading = true; // Set loading state while updating TTL - + const ttlval = this.newTTL; fetch( - "/cgi-bin/set_ttl?" + - new URLSearchParams({ - ttlvalue: this.newTTL, - }) + "/cgi-bin/set_ttl?" + new URLSearchParams({ ttlvalue: ttlval }) ) - .then((res) => res.json()) + .then((res) => res.text()) // Use res.text() instead of res.json() .then((data) => { + // Manually handle the response data + console.log("Response from server:", data); + // You can try to parse the JSON manually or handle the response as needed + // Once TTL is updated, fetch the updated TTL data this.fetchTTL(); this.isLoading = false; // Set loading state back to false @@ -664,7 +668,6 @@ this.isLoading = false; // Ensure loading state is properly handled in case of error }); }, - init() { this.fetchTTL(); this.fetchCurrentSettings(); diff --git a/simpleupdates/scripts/update_simpleadmin.sh b/simpleupdates/scripts/update_simpleadmin.sh index 9fd95d6..6d7fefd 100644 --- a/simpleupdates/scripts/update_simpleadmin.sh +++ b/simpleupdates/scripts/update_simpleadmin.sh @@ -166,6 +166,7 @@ echo -e "\e[1;31m2) Installing simpleadmin from the $GITTREE branch\e[0m" sleep 1 cd / chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/* + chmod +x $SIMPLE_ADMIN_DIR/script/* cp -rf $SIMPLE_ADMIN_DIR/systemd/* /lib/systemd/system sleep 1 systemctl daemon-reload