hostname & https

This commit is contained in:
fred 2022-12-07 00:14:22 +01:00
parent 19acebbda3
commit 131917a891
1 changed files with 9 additions and 3 deletions

View File

@ -108,7 +108,13 @@ else
#####################################################################
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ $isLAN ]] && HNAME="http://g1billet.localhost" || HNAME="http://$(hostname)"
if [[ $isLAN ]]; then
HNAME="http://g1billet.localhost"
RNAME="$HNAME:33102"
else
HNAME="http://$(hostname)"
RNAME="https://$(hostname)/33102"
fi
HTTPWELLCOME='HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
@ -120,13 +126,13 @@ Content-Type: text/html; charset=UTF-8
<!DOCTYPE html><html>
<head>
<title>[G1BILLET] HTTP MICRO SERVICE - 33101 - 33102 -</title>
<meta http-equiv="refresh" content="30; url='$HNAME':33102" />
<meta http-equiv="refresh" content="30; url='$RNAME'" />
<style>
#countdown { display: flex; justify-content: center; align-items: center; color: #0e2c4c; font-size: 20px; width: 60px; height: 60px; background-color: #e7d9fc; border-radius: 50%;}
</style>
</head>
<body>
<center><h1><a href="'$HNAME':33102">(♥‿‿♥)</a>.</h1></center>
<center><h1><a href="'$RNAME'">(♥‿‿♥)</a>.</h1></center>
<center><div id="countdown"></div></center>
<script>
var timeLeft = 30;