Merge pull request #64 from dr-dolomite/feature-watchcat
Added Various Changes
This commit is contained in:
60
simpleadmin/script/create_watchcat.sh
Normal file
60
simpleadmin/script/create_watchcat.sh
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Function to create and run the Watchcat script
|
||||
create_and_run_watchcat_script() {
|
||||
local ip=$1
|
||||
local timeout=$2
|
||||
local failure_count=$3
|
||||
local script_path="/usrdata/simpleadmin/script/watchcat.sh"
|
||||
|
||||
# Create the script with the watchcat logic
|
||||
sudo cat << EOF > $script_path
|
||||
#!/bin/sh
|
||||
|
||||
failures=0
|
||||
|
||||
while :; do
|
||||
if ping -c 1 $ip > /dev/null 2>&1; then
|
||||
failures=0
|
||||
else
|
||||
failures=\$((failures + 1))
|
||||
if [ "\$failures" -ge "$failure_count" ]; then
|
||||
echo "Rebooting system due to \$failures consecutive ping failures."
|
||||
/sbin/reboot
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
sleep $timeout
|
||||
done
|
||||
EOF
|
||||
|
||||
# Make the watchcat script executable
|
||||
chmod +x $script_path
|
||||
|
||||
# Create a JSON to be fetched later
|
||||
echo "{\"enabled\": true, \"track_ip\": \"$ip\", \"ping_timeout\": $timeout, \"ping_failure_count\": $failure_count}" > /usrdata/simpleadmin/script/watchcat.json
|
||||
|
||||
# Check if the script was created successfully
|
||||
if [ -f "$script_path" ]; then
|
||||
# Make the script executable
|
||||
chmod +x "$script_path"
|
||||
|
||||
# Run the script in the background
|
||||
# nohup /bin/sh "$script_path" &
|
||||
/bin/sh "$script_path" &
|
||||
|
||||
echo "Watchcat script created and running."
|
||||
else
|
||||
echo "Failed to create the Watchcat script."
|
||||
echo "Please check the script path: $script_path"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if the script is called with the required parameters
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <IP> <timeout> <failure_count>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Call the function with the provided arguments
|
||||
create_and_run_watchcat_script "$1" "$2" "$3"
|
||||
32
simpleadmin/script/remove_watchcat.sh
Normal file
32
simpleadmin/script/remove_watchcat.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Function to remove the Watchcat script and JSON file
|
||||
remove_watchcat_script() {
|
||||
local script_path="/usrdata/simpleadmin/script/watchcat.sh"
|
||||
local json_path="/usrdata/simpleadmin/script/watchcat.json"
|
||||
|
||||
# Mount as read-write
|
||||
mount -o remount,rw /
|
||||
|
||||
# Remove the watchcat script if it exists
|
||||
if [ -f "$script_path" ]; then
|
||||
rm "$script_path"
|
||||
echo "Removed $script_path"
|
||||
else
|
||||
echo "$script_path does not exist"
|
||||
fi
|
||||
|
||||
# Remove the JSON file if it exists
|
||||
if [ -f "$json_path" ]; then
|
||||
rm "$json_path"
|
||||
echo "Removed $json_path"
|
||||
else
|
||||
echo "$json_path does not exist"
|
||||
fi
|
||||
|
||||
# Mount as read-only
|
||||
mount -o remount,ro /
|
||||
}
|
||||
|
||||
# Call the function to remove the scripts
|
||||
remove_watchcat_script
|
||||
@@ -4,15 +4,14 @@
|
||||
echo "Content-type: application/json"
|
||||
echo ""
|
||||
|
||||
# This script fetches the watchCat parameters from the /tmp/watchCatParams.json file and returns it as JSON
|
||||
# This script fetches the watchCat parameters from the /tmp/watchcat.json and returns it as JSON
|
||||
# Example content of /tmp/watchcat:
|
||||
# {"watchcat": {"enabled": true, "track_ip": "1.1.1.1", "ping_timeout": 30, "ping_failure_count": 10}}
|
||||
|
||||
# Check if the file exists
|
||||
if [ -f /tmp/watchCatParams.json ]; then
|
||||
# Read the file and return the content
|
||||
cat /tmp/watchCatParams.json
|
||||
if [ -f /tmp/watchcat.json ]; then
|
||||
cat /tmp/watchcat.json
|
||||
else
|
||||
# Return an empty JSON object
|
||||
# return an empty JSON object
|
||||
echo "{}"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -48,6 +48,9 @@ if [ -n "${setTTL}" ]; then
|
||||
ttlenabled=false
|
||||
ttlvalue=0
|
||||
fi
|
||||
|
||||
log_debug "Starting service to apply rules"
|
||||
/usrdata/simplefirewall/ttl-override start
|
||||
fi
|
||||
|
||||
echo "Content-type: text/text"
|
||||
|
||||
72
simpleadmin/www/cgi-bin/watchcat_maker
Normal file
72
simpleadmin/www/cgi-bin/watchcat_maker
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Decode URL-encoded strings
|
||||
function urldecode() {
|
||||
local data=${1//+/ }
|
||||
printf '%b' "${data//%/\\x}"
|
||||
}
|
||||
|
||||
# Parse QUERY_STRING
|
||||
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
|
||||
if [ "${QUERY_STRING}" ]; then
|
||||
export IFS="&"
|
||||
for cmd in ${QUERY_STRING}; do
|
||||
if [[ "$cmd" == *"="* ]]; then
|
||||
key=$(echo $cmd | awk -F '=' '{print $1}')
|
||||
value=$(echo $cmd | awk -F '=' '{print $2}')
|
||||
eval $key=$(urldecode $value)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Set default values
|
||||
WATCHCAT_ENABLED=${WATCHCAT_ENABLED:-"disable"}
|
||||
TRACK_IP=${TRACK_IP:-"1.1.1.1"}
|
||||
PING_TIMEOUT=${PING_TIMEOUT:-30}
|
||||
PING_FAILURE_COUNT=${PING_FAILURE_COUNT:-3}
|
||||
|
||||
# Validate input
|
||||
if ! [[ "$WATCHCAT_ENABLED" =~ ^(enable|disable)$ ]]; then
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
echo "Invalid value for WATCHCAT_ENABLED. Use 'enable' or 'disable'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$TRACK_IP" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
echo "Invalid IP address format for TRACK_IP."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$PING_TIMEOUT" =~ ^[0-9]+$ ]] || [ "$PING_TIMEOUT" -le 0 ]; then
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
echo "PING_TIMEOUT must be a positive integer."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$PING_FAILURE_COUNT" =~ ^[0-9]+$ ]] || [ "$PING_FAILURE_COUNT" -le 0 ]; then
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
echo "PING_FAILURE_COUNT must be a positive integer."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Implement the Watchcat logic
|
||||
if [ "$WATCHCAT_ENABLED" == "enable" ]; then
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
echo "Watchcat is enabled. Tracking IP: $TRACK_IP, Ping timeout: $PING_TIMEOUT seconds, Ping failure count: $PING_FAILURE_COUNT"
|
||||
# Call the create script here and use the needed parameters
|
||||
sudo /usrdata/simpleadmin/script/create_watchcat.sh "$TRACK_IP" "$PING_TIMEOUT" "$PING_FAILURE_COUNT"
|
||||
else
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
echo "Watchcat is disabled."
|
||||
# Call the remove script here
|
||||
sudo /usrdata/simpleadmin/script/remove_watchcat.sh
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -45,6 +45,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/network.html">Simple Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/scanner.html">Simple Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
</li>
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="network.html">Simple Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/scanner.html">Simple Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
</li>
|
||||
@@ -275,6 +278,10 @@
|
||||
<th scope="row">Assesment</th>
|
||||
<td x-text="signalAssessment"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Traffic Stats</th>
|
||||
<td x-text="downloadStat + ' DL / ' + uploadStat + ' UL'"></td>
|
||||
</tr>
|
||||
<tr x-show="csq != 'NR-SA Mode'">
|
||||
<th scope="row">CSQ</th>
|
||||
<td x-show="csq != '-'" x-text="csq"></td>
|
||||
@@ -292,14 +299,12 @@
|
||||
<th scope="row">TAC<sup>4G/5G</sup></th>
|
||||
<td x-text="tac"></td>
|
||||
</tr>
|
||||
<tr x-show="rssi != '-'">
|
||||
<!-- <tr x-show="rssi != '-'">
|
||||
<th scope="row">RSSI<sup>4G</sup></th>
|
||||
<td x-show="rssi != '-'" x-text="rssi"></td>
|
||||
<td x-show="rssi == '-'" class="fst-italic">None</td>
|
||||
</tr>
|
||||
<tr
|
||||
x-show="rsrqLTE != '-'"
|
||||
>
|
||||
</tr> -->
|
||||
<tr x-show="rsrqLTE != '-'">
|
||||
<th scope="row">SS_RSRQ<sup>4G</sup></th>
|
||||
<td
|
||||
class="gap-4 align-items-center"
|
||||
@@ -344,9 +349,7 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
x-show="rsrqNR != '-'"
|
||||
>
|
||||
<tr x-show="rsrqNR != '-'">
|
||||
<th scope="row">SS_RSRQ<sup>5G</sup></th>
|
||||
<td
|
||||
x-data="{ getProgressBarClass: function() {
|
||||
@@ -390,9 +393,7 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
x-show="rsrpLTE != '-'"
|
||||
>
|
||||
<tr x-show="rsrpLTE != '-'">
|
||||
<th scope="row">RSRP<sup>4G</sup></th>
|
||||
<td
|
||||
class="gap-4 align-items-center"
|
||||
@@ -439,9 +440,7 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
x-show="rsrpNR != '-'"
|
||||
>
|
||||
<tr x-show="rsrpNR != '-'">
|
||||
<th scope="row">SS_RSRP<sup>5G</sup></th>
|
||||
<td
|
||||
class="gap-4 align-items-center"
|
||||
@@ -488,9 +487,7 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
x-show="sinrLTE != '-'"
|
||||
>
|
||||
<tr x-show="sinrLTE != '-'">
|
||||
<th scope="row">SINR<sup>4G</sup></th>
|
||||
<td
|
||||
class="gap-4 align-items-center"
|
||||
@@ -537,9 +534,7 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
x-show="sinrNR != '-'"
|
||||
>
|
||||
<tr x-show="sinrNR != '-'">
|
||||
<th scope="row">SINR<sup>5G</sup></th>
|
||||
<td
|
||||
class="gap-4 align-items-center"
|
||||
@@ -635,7 +630,7 @@
|
||||
eNBID: "Unknown",
|
||||
tac: "Unknown",
|
||||
csq: "-",
|
||||
rssi: "-",
|
||||
// rssi: "-",
|
||||
rsrpLTE: "-",
|
||||
rsrpNR: "-",
|
||||
rsrpLTEPercentage: "0%",
|
||||
@@ -654,10 +649,16 @@
|
||||
lastUpdate: new Date().toLocaleString(),
|
||||
newRefreshRate: null,
|
||||
refreshRate: 3,
|
||||
nrDownload: "0",
|
||||
nrUpload: "0",
|
||||
nonNrDownload: "0",
|
||||
nonNrUpload: "0",
|
||||
downloadStat: "0",
|
||||
uploadStat: "0",
|
||||
|
||||
fetchAllInfo() {
|
||||
this.atcmd =
|
||||
'AT+QTEMP;+QUIMSLOT?;+QSPN;+CGCONTRDP=1;+QMAP="WWANIP";+QENG="servingcell";+QCAINFO;+QSIMSTAT?;+CSQ';
|
||||
'AT+QTEMP;+QUIMSLOT?;+QSPN;+CGCONTRDP=1;+QMAP="WWANIP";+QENG="servingcell";+QCAINFO;+QSIMSTAT?;+CSQ;+QGDNRCNT?;+QGDCNT?';
|
||||
|
||||
fetch(
|
||||
"/cgi-bin/get_atcommand?" +
|
||||
@@ -755,7 +756,7 @@
|
||||
.find((line) => line.includes('+QENG: "servingcell"'))
|
||||
.split(",")[2]
|
||||
.replace(/"/g, "");
|
||||
|
||||
|
||||
const duplex_mode = lines
|
||||
.find((line) => line.includes('+QENG: "servingcell"'))
|
||||
.split(",")[3]
|
||||
@@ -842,7 +843,10 @@
|
||||
}
|
||||
|
||||
// --- Bandwidth ---
|
||||
if (this.networkMode == "5G SA TDD" || this.networkMode == "5G SA FDD") {
|
||||
if (
|
||||
this.networkMode == "5G SA TDD" ||
|
||||
this.networkMode == "5G SA FDD"
|
||||
) {
|
||||
// find this example value from lines "+QENG: \"servingcell\"
|
||||
const bandwidth_line = lines.find((line) =>
|
||||
line.includes('+QENG: "servingcell"')
|
||||
@@ -906,7 +910,10 @@
|
||||
}
|
||||
|
||||
// --- E/ARFCN ---
|
||||
if (this.networkMode == "5G SA TDD" || this.networkMode == "5G SA FDD") {
|
||||
if (
|
||||
this.networkMode == "5G SA TDD" ||
|
||||
this.networkMode == "5G SA FDD"
|
||||
) {
|
||||
// find this value from lines "+QCAINFO: \"PCC\"
|
||||
const nr_pcc_arfcn = lines
|
||||
.find((line) => line.includes('+QCAINFO: "PCC"'))
|
||||
@@ -998,7 +1005,10 @@
|
||||
}
|
||||
|
||||
// --- PCI ---
|
||||
if (this.networkMode == "5G SA TDD" || this.networkMode == "5G SA FDD") {
|
||||
if (
|
||||
this.networkMode == "5G SA TDD" ||
|
||||
this.networkMode == "5G SA FDD"
|
||||
) {
|
||||
const nr_pcc_pci = lines
|
||||
.find((line) => line.includes('+QCAINFO: "PCC"'))
|
||||
.split(",")[4];
|
||||
@@ -1111,6 +1121,44 @@
|
||||
.split(",")[4]
|
||||
.replace(/"/g, "");
|
||||
|
||||
// Traffic Stats
|
||||
// for NR traffic stats: +QGDNRCNT: 3263753367,109876105
|
||||
this.nrDownload = lines
|
||||
.find((line) => line.includes("+QGDNRCNT:"))
|
||||
.split(",")[0]
|
||||
// remove the +QGDNRCNT: part
|
||||
.replace("+QGDNRCNT: ", "");
|
||||
|
||||
this.nrUpload = lines
|
||||
.find((line) => line.includes("+QGDNRCNT:"))
|
||||
.split(",")[1];
|
||||
|
||||
|
||||
// for non-NR traffic stats: +QGDCNT: 247357510,6864571506
|
||||
this.nonNrDownload = lines
|
||||
.find((line) => line.includes("+QGDCNT:"))
|
||||
.split(",")[1];
|
||||
|
||||
this.nonNrUpload = lines
|
||||
.find((line) => line.includes("+QGDCNT:"))
|
||||
.split(",")[0]
|
||||
// remove the +QGDCNT: part
|
||||
.replace("+QGDCNT: ", "");
|
||||
|
||||
|
||||
// Add the nrDownload and nonNrDownload together
|
||||
this.downloadStat = parseInt(this.nrDownload) + parseInt(this.nonNrDownload);
|
||||
|
||||
// Add the nrUpload and nonNrUpload together
|
||||
this.uploadStat = parseInt(this.nrUpload) + parseInt(this.nonNrUpload);
|
||||
|
||||
// Convert the downloadStat and uploadStat bytes to readable size
|
||||
this.downloadStat = this.bytesToSize(this.downloadStat);
|
||||
this.uploadStat = this.bytesToSize(this.uploadStat);
|
||||
|
||||
console.log(this.downloadStat);
|
||||
console.log(this.uploadStat);
|
||||
|
||||
// Signal Informations
|
||||
|
||||
const currentNetworkMode = this.networkMode;
|
||||
@@ -1133,8 +1181,11 @@
|
||||
|
||||
// Get the short Cell ID (Last 2 characters of the Cell ID)
|
||||
const shortCID = longCID.substring(longCID.length - 2);
|
||||
|
||||
if (currentNetworkMode == "5G SA TDD" || currentNetworkMode == "5G SA FDD") {
|
||||
|
||||
if (
|
||||
currentNetworkMode == "5G SA TDD" ||
|
||||
currentNetworkMode == "5G SA FDD"
|
||||
) {
|
||||
// TAC
|
||||
this.tac = lines
|
||||
.find((line) => line.includes('+QENG: "servingcell"'))
|
||||
@@ -1214,11 +1265,11 @@
|
||||
.split(",")[14]
|
||||
.replace(/"/g, "");
|
||||
|
||||
// RSSI
|
||||
this.rssi = lines
|
||||
.find((line) => line.includes('+QENG: "servingcell"'))
|
||||
.split(",")[15]
|
||||
.replace(/"/g, "");
|
||||
// // RSSI
|
||||
// this.rssi = lines
|
||||
// .find((line) => line.includes('+QENG: "servingcell"'))
|
||||
// .split(",")[15]
|
||||
// .replace(/"/g, "");
|
||||
|
||||
// SINR
|
||||
this.sinrLTE = lines
|
||||
@@ -1318,11 +1369,11 @@
|
||||
.split(",")[12]
|
||||
.replace(/"/g, "");
|
||||
|
||||
// RSSI LTE
|
||||
this.rssi = lines
|
||||
.find((line) => line.includes('+QENG: "LTE"'))
|
||||
.split(",")[13]
|
||||
.replace(/"/g, "");
|
||||
// // RSSI LTE
|
||||
// this.rssi = lines
|
||||
// .find((line) => line.includes('+QENG: "LTE"'))
|
||||
// .split(",")[13]
|
||||
// .replace(/"/g, "");
|
||||
|
||||
// SINR LTE
|
||||
this.sinrLTE = lines
|
||||
@@ -1408,6 +1459,13 @@
|
||||
});
|
||||
},
|
||||
|
||||
bytesToSize(bytes) {
|
||||
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
},
|
||||
|
||||
requestPing() {
|
||||
return fetch("/cgi-bin/get_ping")
|
||||
.then((response) => response.text())
|
||||
@@ -1759,4 +1817,4 @@
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!-- change to a much simpler tab title -->
|
||||
<title>Logging out...</title>
|
||||
|
||||
<link rel="stylesheet" href="css/bulma.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/admin.css" />
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- START NAV -->
|
||||
<nav class="navbar is-black" x-data="{ isOpen: false }">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item brand-text" href="/"> Logging Out... </a>
|
||||
<a
|
||||
role="button"
|
||||
class="navbar-burger burger"
|
||||
@click="isOpen = !isOpen"
|
||||
>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
id="navMenu"
|
||||
class="navbar-menu"
|
||||
:class="isOpen ? 'is-active' : ''"
|
||||
>
|
||||
<div class="navbar-start">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<!-- END NAV -->
|
||||
|
||||
<script>
|
||||
window.location=window.location.href.replace(/:\/\//, '://log:out@');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -53,6 +53,9 @@
|
||||
>Simple Network</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/scanner.html">Simple Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
</li>
|
||||
@@ -156,6 +159,28 @@
|
||||
x-bind:placeholder="apn === '-' ? 'Fetching...' : apn"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <div class="mb-4">
|
||||
<label for="disableCA" class="form-label"
|
||||
>Disable Carrier Aggregation</label
|
||||
>
|
||||
<select
|
||||
class="form-select"
|
||||
id="disableCA"
|
||||
x-model="disableCA"
|
||||
aria-label="disableCA"
|
||||
>
|
||||
<option
|
||||
selected
|
||||
x-text="disableCA === '-' ? 'Fetching...' : 'Current: ' + disableCA"
|
||||
></option>
|
||||
<option value="enableAll">Enable All</option>
|
||||
<option value="LTE">Disable LTE</option>
|
||||
<option value="NR5G">Disable NR5G</option>
|
||||
<option value="both">Disable Both</option>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="mb-4 input-group grid gap-3">
|
||||
<label for="SIM1" class="form-label"> Change SIM</label>
|
||||
<div class="form-check form-check-inline">
|
||||
@@ -378,6 +403,10 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
Cell Locking only works for the primary cell and is not
|
||||
persistent across reboots.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -697,7 +726,7 @@
|
||||
|
||||
// If atcmd has QUIMSLOT, do a reboot instead
|
||||
if (atcmd.includes("QUIMSLOT")) {
|
||||
atcmd = atcmd +"+CFUN=1,1";
|
||||
atcmd = atcmd + "+CFUN=1,1";
|
||||
this.sendATcommand(atcmd);
|
||||
this.countdown = 45;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/alpinejs.min.js" defer></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
@@ -51,11 +53,14 @@
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link active"
|
||||
href="/settings.html"
|
||||
href="/scanner.html"
|
||||
aria-current="page"
|
||||
>Simple Settings</a
|
||||
>Simple Scan</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/sms.html">SMS</a>
|
||||
</li>
|
||||
@@ -76,6 +81,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="row mt-3 mb-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">Live Signal</div>
|
||||
<div class="card-body">
|
||||
<div class="row mt-2 mb-2">
|
||||
<p>Signal Graph</p>
|
||||
<div>
|
||||
<canvas id="myChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3 mb-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
@@ -128,7 +150,7 @@
|
||||
class="btn btn-primary me-md-2"
|
||||
type="button"
|
||||
x-on:click="startCellScan()"
|
||||
:disabled='isLoading === true || cellScanMode === "Unspecified" || cellScanMode === "Select Scan Mode"'
|
||||
:disabled="isLoading === true || cellScanMode === 'Unspecified' || cellScanMode === 'Select Scan Mode'"
|
||||
x-text="isCellScanning ? 'Scanning... Please wait.' : 'Start Cell Scan'"
|
||||
></button>
|
||||
<button
|
||||
@@ -2311,6 +2333,61 @@
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const ctx = document.getElementById("myChart");
|
||||
|
||||
new Chart(ctx, {
|
||||
type: "line",
|
||||
data: {
|
||||
labels: [
|
||||
"0m",
|
||||
"1m",
|
||||
"2m",
|
||||
"3m",
|
||||
"4m",
|
||||
"5m",
|
||||
"6m",
|
||||
"7m",
|
||||
"8m",
|
||||
"9m",
|
||||
"10m",
|
||||
"11m",
|
||||
"12m",
|
||||
"13m",
|
||||
"14m",
|
||||
"15m",
|
||||
|
||||
],
|
||||
datasets: [
|
||||
{
|
||||
label: "LTE",
|
||||
data: [0, 10, 5, 2, 20, 30, 45, 50, 60, 70, 80],
|
||||
borderColor: "rgb(255, 99, 132)",
|
||||
backgroundColor: "rgba(255, 99, 132, 0.5)",
|
||||
borderWidth: 1,
|
||||
},
|
||||
{
|
||||
label: "NR5G",
|
||||
data: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50],
|
||||
borderColor: "rgb(54, 162, 235)",
|
||||
backgroundColor: "rgba(54, 162, 235, 0.5)",
|
||||
borderWidth: 1,
|
||||
},
|
||||
],
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: "top",
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: "Chart.js Line Chart",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/network.html">Simple Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/scanner.html">Simple Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link active"
|
||||
@@ -314,22 +317,12 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<!-- <div class="card-text">
|
||||
<div class="d-flex flex-row gap-4 w-full">
|
||||
<!-- -->
|
||||
<!-- <a
|
||||
class="btn btn-warning"
|
||||
type="button"
|
||||
href="/scanner.html"
|
||||
role="button"
|
||||
>
|
||||
Go to Cell Scanner
|
||||
</a> -->
|
||||
<p><a class="link-info link-opacity-50-hover link-offset-2" href="/scanner.html">Go to Cell Scanner</a></p>
|
||||
<!-- <p><a class="link-info link-opacity-50-hover link-offset-2" href="/watchcat.html">Go to WatchCat</a></p> -->
|
||||
<!-- </a> -->
|
||||
<p><a class="link-info link-opacity-50-hover link-offset-2" href="/watchcat.html">Go to WatchCat</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/network.html">Simple Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/scanner.html">Simple Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/settings.html">Simple Settings</a>
|
||||
</li>
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Simple Admin</title>
|
||||
<!-- <link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
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" />
|
||||
@@ -17,14 +11,14 @@
|
||||
<!-- Logo -->
|
||||
<link rel="simpleadmin-logo" href="favicon.ico" />
|
||||
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<!-- Import BootStrap Javascript -->
|
||||
<script src="js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/alpinejs.min.js" defer></script>
|
||||
|
||||
<style>
|
||||
.form-switch .form-check-input {
|
||||
width: 3em;
|
||||
height: 1.5em;
|
||||
width: 2.4em;
|
||||
height: 1.2em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -55,6 +49,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/network.html">Simple Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/scanner.html">Simple Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link active"
|
||||
@@ -104,7 +101,8 @@
|
||||
role="switch"
|
||||
id="watchCatSwitch"
|
||||
x-model="watchCatStatus"
|
||||
disabled
|
||||
:disabled="!isFormComplete"
|
||||
x-on:change="setWatchCatSettings"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,7 +145,7 @@
|
||||
aria-label="Ping Timeout"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Enter Ping Timeout in Seconds."
|
||||
x-model="cooldown"
|
||||
x-model="pingTimeout"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -158,113 +156,7 @@
|
||||
aria-label="Sizing example input"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Enter Ping Failure Amount."
|
||||
x-model="failures"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3 mb-5 align-content-center mx-4">
|
||||
<div class="col">
|
||||
<div class="mt-3">
|
||||
<label>Sim Auto Switch</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="mt-2">
|
||||
<div class="form-check form-switch form-switch-lg">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="simAutoSwitch"
|
||||
x-model="simAutoSwitchStatus"
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3 mb-3 align-items-center mx-4">
|
||||
<div class="col">
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Select Preferred SIM </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> SIM 1 APN </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> SIM 2 APN </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Failover Interval </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Scheduled SIM Hot Swap</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
<div class="mt-3 mb-3">
|
||||
<select
|
||||
class="form-select"
|
||||
aria-label="Select Sim"
|
||||
x-model="preferredSim"
|
||||
>
|
||||
<option selected>Select SIM</option>
|
||||
<option value="1">SIM 1</option>
|
||||
<option value="2">SIM 2</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
aria-label="SIM 1 APN"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Input APN for SIM 1. (Optional)"
|
||||
x-model="sim1APN"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
aria-label="SIM 2 APN"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Input APN for SIM 2. (Optional)"
|
||||
x-model="sim2APN"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3 d-flex align-items-center">
|
||||
<select
|
||||
class="form-select"
|
||||
aria-label="Failover Interval"
|
||||
>
|
||||
<option selected>Failover Interval</option>
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="15">15</option>
|
||||
<option value="20">20</option>
|
||||
</select>
|
||||
<label class="mx-3">Minutes</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3">
|
||||
<input
|
||||
type="time"
|
||||
class="form-control"
|
||||
aria-label="Scheduled SIM Hot Swap"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
x-model="scheduledSIMHotSwap"
|
||||
x-model="pingFailureCount"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -272,89 +164,109 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<!-- Setting a low ping timeout and ping failure count may cause
|
||||
intermittent disconnections due to high sensitivity. <br />
|
||||
Select appropriate values for both based on your needs.<br /> -->
|
||||
Still under development. Coming soon...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3 mb-3">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">Simple Watchcat Logs</div>
|
||||
<div class="card-body">
|
||||
<div class="card-text">
|
||||
<div class="form-floating">
|
||||
<textarea
|
||||
class="form-control"
|
||||
placeholder="Leave a comment here"
|
||||
id="floatingTextarea2"
|
||||
style="height: 100px"
|
||||
x-text="response"
|
||||
readonly
|
||||
></textarea>
|
||||
<label for="floatingTextarea2">Logs</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
No log is provided when successfully enabling the watchcat.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
<script>
|
||||
function simpleWatchCat() {
|
||||
return {
|
||||
watchCatStatus: "",
|
||||
watchCatStatus: false, // Initialize as false (not enabled)
|
||||
trackIP: "",
|
||||
cooldown: "",
|
||||
failures: "",
|
||||
pingTimeout: "",
|
||||
pingFailureCount: "",
|
||||
response: "",
|
||||
formCompleted: false,
|
||||
|
||||
simAutoSwitchStatus: "",
|
||||
scheduledSIMHotSwap: "",
|
||||
sim1APN: "",
|
||||
sim2APN: "",
|
||||
preferredSim: "",
|
||||
simFormCompleted: false,
|
||||
|
||||
modifyWatchCatScript() {
|
||||
// If one of the params is empty then use their corresponding default values
|
||||
if (this.IpDNS === "") {
|
||||
this.IpDNS = "1.1.1.1";
|
||||
} else if (this.cooldown === "") {
|
||||
this.cooldown = "30";
|
||||
} else if (this.failures === "") {
|
||||
this.failures = "5";
|
||||
} else if (this.action === "") {
|
||||
this.action = "Reboot";
|
||||
}
|
||||
|
||||
setWatchCatSettings() {
|
||||
fetch(
|
||||
"/cgi-bin/get_atcommand?" +
|
||||
"/cgi-bin/watchcat_maker?" +
|
||||
new URLSearchParams({
|
||||
status: this.status,
|
||||
IpDNS: this.IpDNS,
|
||||
cooldown: this.cooldown,
|
||||
failures: this.failures,
|
||||
action: this.action,
|
||||
WATCHCAT_ENABLED: this.watchCatStatus ? "enable" : "disable",
|
||||
TRACK_IP: this.trackIP,
|
||||
PING_TIMEOUT: this.pingTimeout,
|
||||
PING_FAILURE_COUNT: this.pingFailureCount,
|
||||
})
|
||||
)
|
||||
.then((response) => {
|
||||
return res.text();
|
||||
})
|
||||
.then((response) => response.text()) // Convert response to text
|
||||
.then((data) => {
|
||||
this.response = data;
|
||||
this.response = data; // Store the response data
|
||||
console.log(data); // Log the response for debugging
|
||||
})
|
||||
.then(() => {
|
||||
this.fetchWatchCatSettings();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error); // Handle any errors
|
||||
this.response = "An error occurred.";
|
||||
});
|
||||
},
|
||||
|
||||
formCompletedChecker() {
|
||||
this.formCompleted =
|
||||
this.watchCatStatus !== "" &&
|
||||
// Computed property to check if the form is complete
|
||||
get isFormComplete() {
|
||||
return (
|
||||
this.trackIP !== "" &&
|
||||
this.cooldown !== "" &&
|
||||
this.failures !== "";
|
||||
this.pingTimeout !== "" &&
|
||||
this.pingFailureCount !== ""
|
||||
);
|
||||
},
|
||||
|
||||
simFormCompletedChecker() {
|
||||
if (
|
||||
this.simAutoSwitchStatus !== "" &&
|
||||
this.scheduledSIMHotSwap !== "" &&
|
||||
this.preferredSim !== ""
|
||||
) {
|
||||
this.simFormCompleted = true;
|
||||
} else {
|
||||
this.simFormCompleted = false;
|
||||
}
|
||||
// Fetch the current watchcat settings
|
||||
fetchWatchCatSettings() {
|
||||
fetch("/cgi-bin/get_watchcat_status")
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
return response.json(); // Parse response as JSON
|
||||
})
|
||||
.then((data) => {
|
||||
console.log(data); // Log the parsed data for debugging
|
||||
|
||||
// Check if the JSON is not empty
|
||||
if (data) {
|
||||
this.watchCatStatus = data.enabled === true;
|
||||
this.trackIP = data.track_ip;
|
||||
this.pingTimeout = data.ping_timeout;
|
||||
this.pingFailureCount = data.ping_failure_count;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error); // Handle any errors
|
||||
this.response = "An error occurred.";
|
||||
});
|
||||
},
|
||||
|
||||
init() {
|
||||
this.$watch("watchCatStatus", this.formCompletedChecker.bind(this));
|
||||
this.$watch("trackIP", this.formCompletedChecker.bind(this));
|
||||
this.$watch("cooldown", this.formCompletedChecker.bind(this));
|
||||
this.$watch("failures", this.formCompletedChecker.bind(this));
|
||||
this.fetchWatchCatSettings();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
351
simpleadmin/www/watchcat_backup.html
Normal file
351
simpleadmin/www/watchcat_backup.html
Normal file
@@ -0,0 +1,351 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="light">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Simple Admin</title>
|
||||
<!-- <link
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
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" />
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<style>
|
||||
.form-switch .form-check-input {
|
||||
width: 2.4em;
|
||||
height: 1.2em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="container my-4" x-data="simpleWatchCat()">
|
||||
<nav class="navbar navbar-expand-lg mt-2">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/"
|
||||
><span class="mb-0 h4">Simple Admin</span></a
|
||||
>
|
||||
<button
|
||||
class="navbar-toggler"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarText"
|
||||
aria-controls="navbarText"
|
||||
aria-expanded="false"
|
||||
aria-label="Toggle navigation"
|
||||
>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarText">
|
||||
<ul class="navbar-nav me-auto mb-2 ml-4 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<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
|
||||
>
|
||||
</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
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-text">
|
||||
<button class="btn btn-link text-reset" id="darkModeToggle">
|
||||
Dark Mode
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="row mt-3 mb-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">Simple Watchcat</div>
|
||||
<div class="card-body">
|
||||
<div class="card-text">
|
||||
<div class="row mt-3 mb-5 align-content-center mx-4">
|
||||
<div class="col">
|
||||
<div class="mt-3">
|
||||
<label> Enable Watchcat </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="mt-2">
|
||||
<div class="form-check form-switch form-switch-lg">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="watchCatSwitch"
|
||||
x-model="watchCatStatus"
|
||||
:disabled="!isFormComplete"
|
||||
x:onchange="setWatchCatSettings"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3 mb-3 align-items-center mx-4">
|
||||
<div class="col">
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Track IP </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Ping Request Timeout </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Ping Failure Amount </label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
<div class="mt-3 mb-4">
|
||||
<select
|
||||
class="form-select"
|
||||
aria-label="Select Site to Ping"
|
||||
x-model="trackIP"
|
||||
>
|
||||
<option selected>Select IP</option>
|
||||
<option value="1.1.1.1">1.1.1.1</option>
|
||||
<option value="8.8.8.8">8.8.8.8</option>
|
||||
<option value="9.9.9.9">9.9.9.9</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
aria-label="Ping Timeout"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Enter Ping Timeout in Seconds."
|
||||
x-model="pingTimeout"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
aria-label="Sizing example input"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Enter Ping Failure Amount."
|
||||
x-model="pingFailureCount"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="row mt-3 mb-5 align-content-center mx-4">
|
||||
<div class="col">
|
||||
<div class="mt-3">
|
||||
<label>Sim Auto Switch</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="mt-2">
|
||||
<div class="form-check form-switch form-switch-lg">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="simAutoSwitch"
|
||||
x-model="simAutoSwitchStatus"
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="row mt-3 mb-3 align-items-center mx-4">
|
||||
<div class="col">
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Select Preferred SIM </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> SIM 1 APN </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> SIM 2 APN </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Failover Interval </label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-4">
|
||||
<label> Scheduled SIM Hot Swap</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-5">
|
||||
<div class="mt-3 mb-3">
|
||||
<select
|
||||
class="form-select"
|
||||
aria-label="Select Sim"
|
||||
x-model="preferredSim"
|
||||
>
|
||||
<option selected>Select SIM</option>
|
||||
<option value="1">SIM 1</option>
|
||||
<option value="2">SIM 2</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
aria-label="SIM 1 APN"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Input APN for SIM 1. (Optional)"
|
||||
x-model="sim1APN"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control"
|
||||
aria-label="SIM 2 APN"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
placeholder="Input APN for SIM 2. (Optional)"
|
||||
x-model="sim2APN"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3 d-flex align-items-center">
|
||||
<select
|
||||
class="form-select"
|
||||
aria-label="Failover Interval"
|
||||
>
|
||||
<option selected>Failover Interval</option>
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="15">15</option>
|
||||
<option value="20">20</option>
|
||||
</select>
|
||||
<label class="mx-3">Minutes</label>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 mb-3">
|
||||
<input
|
||||
type="time"
|
||||
class="form-control"
|
||||
aria-label="Scheduled SIM Hot Swap"
|
||||
aria-describedby="inputGroup-sizing-default"
|
||||
x-model="scheduledSIMHotSwap"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<!-- Setting a low ping timeout and ping failure count may cause
|
||||
intermittent disconnections due to high sensitivity. <br />
|
||||
Select appropriate values for both based on your needs.<br /> -->
|
||||
Still under development. Coming soon...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3 mb-3">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">Simple Watchcat Logs</div>
|
||||
<div class="card-body">
|
||||
<div class="card-text">
|
||||
<div class="form-floating">
|
||||
<textarea
|
||||
class="form-control"
|
||||
placeholder="Leave a comment here"
|
||||
id="floatingTextarea2"
|
||||
style="height: 100px"
|
||||
x-text="response"
|
||||
readonly
|
||||
></textarea>
|
||||
<label for="floatingTextarea2">Logs Here</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="js/dark-mode.js"></script>
|
||||
<script>
|
||||
function simpleWatchCat() {
|
||||
return {
|
||||
watchCatStatus: false,
|
||||
trackIP: "",
|
||||
pingTimeout: "",
|
||||
pingFailureCount: "",
|
||||
response: "",
|
||||
|
||||
setWatchCatSettings() {
|
||||
fetch(
|
||||
"/cgi-bin/watchcat_maker?" +
|
||||
new URLSearchParams({
|
||||
WATCHCAT_ENABLED: this.watchCatStatus,
|
||||
TRACK_IP: this.trackIP,
|
||||
PING_TIMEOUT: this.pingTimeout,
|
||||
PING_FAILURE_COUNT: this.pingFailureCount,
|
||||
})
|
||||
)
|
||||
.then((response) => response.text()) // Convert response to text
|
||||
.then((data) => {
|
||||
this.response = data; // Store the response data
|
||||
console.log(data); // Log the response for debugging
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error); // Handle any errors
|
||||
this.response = "An error occurred.";
|
||||
});
|
||||
},
|
||||
|
||||
// Computed property to check if the form is complete
|
||||
get isFormComplete() {
|
||||
return (
|
||||
this.trackIP !== "" &&
|
||||
this.pingTimeout !== "" &&
|
||||
this.pingFailureCount !== ""
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -143,6 +143,8 @@ echo -e "\e[1;31m2) Installing simpleadmin from the $GITTREE branch\e[0m"
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/script
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/script/ttl_script.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/script/remove_watchcat.sh
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/script/create_watchcat.sh
|
||||
sleep 1
|
||||
cd $SIMPLE_ADMIN_DIR/console
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/console/.profile
|
||||
@@ -160,7 +162,6 @@ echo -e "\e[1;31m2) Installing simpleadmin from the $GITTREE branch\e[0m"
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/network.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/settings.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/sms.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/logout.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/scanner.html
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/watchcat.html
|
||||
sleep 1
|
||||
@@ -186,6 +187,7 @@ echo -e "\e[1;31m2) Installing simpleadmin from the $GITTREE branch\e[0m"
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/cgi-bin/get_uptime
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/cgi-bin/get_watchcat_status
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/cgi-bin/set_watchcat
|
||||
wget https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/simpleadmin/www/cgi-bin/watchcat_maker
|
||||
sleep 1
|
||||
cd /
|
||||
chmod +x $SIMPLE_ADMIN_DIR/www/cgi-bin/*
|
||||
|
||||
Reference in New Issue
Block a user