Merging 2.2.6 release candidate

This commit is contained in:
Russel Yasol
2025-08-07 10:17:34 +08:00
parent 384c055278
commit 619502a100
200 changed files with 1774 additions and 472 deletions

View File

@@ -1,9 +1,35 @@
#!/bin/sh
# Ping Latency Script with Enable/Disable Configuration
# Author: dr-dolomite
# Date: 2025-08-04
# Set the content type to JSON
echo "Content-Type: application/json"
echo ""
# Configuration
CONFIG_DIR="/etc/quecmanager/settings"
CONFIG_FILE="$CONFIG_DIR/ping_settings.conf"
# Check if ping is enabled (default: enabled if no config exists)
is_ping_enabled() {
# If config file exists, read the setting
if [ -f "$CONFIG_FILE" ]; then
ping_enabled=$(grep "^PING_ENABLED=" "$CONFIG_FILE" | cut -d'=' -f2)
if [ "$ping_enabled" = "false" ] || [ "$ping_enabled" = "0" ] || [ "$ping_enabled" = "off" ]; then
return 1 # Disabled
fi
fi
return 0 # Enabled (default)
}
# Check if ping is enabled before proceeding
if ! is_ping_enabled; then
echo '{"connection": "DISABLED", "latency": 0}'
exit 0
fi
# Ping 8.8.8.8 with 5 packets and capture the full output
ping_result=$(ping -c 5 8.8.8.8)