Merge QuecManager beta into QuecManager
Sync beta and normal QuecManager versions
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Path: /www/cgi-bin/quecmanager
|
||||
|
||||
# Set content type to JSON
|
||||
echo "Content-Type: application/json"
|
||||
echo ""
|
||||
|
||||
# Fetch public IP using multiple fallback methods
|
||||
PUBLIC_IP=$(
|
||||
curl -s https://api.ipify.org 2>/dev/null || \
|
||||
wget -qO- https://api.ipify.org 2>/dev/null || \
|
||||
uclient-fetch -qO- https://api.ipify.org 2>/dev/null
|
||||
)
|
||||
|
||||
# Handle errors
|
||||
if [ -z "$PUBLIC_IP" ]; then
|
||||
echo '{"error": "Failed to fetch public IP"}'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Return JSON response
|
||||
echo "{\"public_ip\": \"$PUBLIC_IP\"}"
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
export HOME=/tmp/home
|
||||
|
||||
# Create named pipe for speedtest output if it doesn't exist
|
||||
[ ! -p /tmp/realtime_spd.json ] && mkfifo /tmp/realtime_spd.json
|
||||
|
||||
# Run speedtest in background
|
||||
/usr/bin/speedtest --accept-license -f json -p yes --progress-update-interval=100 > /tmp/realtime_spd.json
|
||||
|
||||
# Remove named pipe
|
||||
rm /tmp/realtime_spd.json
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Content-Type: text/event-stream"
|
||||
echo "Cache-Control: no-cache"
|
||||
echo "Connection: keep-alive"
|
||||
echo ""
|
||||
|
||||
# Use cat to read from the FIFO
|
||||
cat /tmp/realtime_spd.json | while read line; do
|
||||
echo "data: $line"
|
||||
echo
|
||||
sleep 0.1
|
||||
done
|
||||
Reference in New Issue
Block a user