Move page logic

This commit is contained in:
Kroese 2023-05-09 01:18:15 +02:00 committed by GitHub
parent 12760b038d
commit c82592a460

View File

@ -228,24 +228,8 @@ if [[ "${DHCP}" == [Yy1]* ]]; then
{ pkill -f server.sh || true; } 2>/dev/null { pkill -f server.sh || true; } 2>/dev/null
SH_SCRIPT="/run/ipinfo.sh" /run/server.sh 80 /run/ip.sh &
/run/server.sh 5000 /run/ip.sh &
{ echo "#!/bin/bash"
echo "INFO=\$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=10 2>/dev/null)"
echo "rest=\${INFO#*http_port}; rest=\${rest#*:}; rest=\${rest%%,*}; PORT=\${rest%%\\\"*}"
echo "rest=\${INFO#*eth0}; rest=\${rest#*ip}; rest=\${rest#*:}; rest=\${rest#*\\\"}; IP=\${rest%%\\\"*}"
echo "BODY=\"The location of DSM is <a href=\"http://\${IP}:\${PORT}\">http://\${IP}:\${PORT}</a><script>\\"
echo "setTimeout(function(){ window.location.assign('http://\${IP}:\${PORT}'); }, 3000);</script>\""
echo "HTML=\"<!DOCTYPE html><HTML><HEAD><TITLE>VirtualDSM</TITLE><STYLE>body { color: white; background-color: #125bdb; font-family: Verdana,\\"
echo "Arial,sans-serif; } a, a:hover, a:active, a:visited { color: white; }</STYLE></HEAD><BODY><BR><BR><H1><CENTER>\$BODY</CENTER></H1></BODY></HTML>\""
echo "LENGTH=\"\${#HTML}\"; RESPONSE=\"HTTP/1.1 200 OK\\nContent-Length: \${LENGTH}\\nConnection: close\\n\\n\$HTML\""
echo "echo -e \"\$RESPONSE\""
} > "$SH_SCRIPT"
chmod +x "$SH_SCRIPT"
/run/server.sh 80 "$SH_SCRIPT" &
/run/server.sh 5000 "$SH_SCRIPT" &
else else