This commit is contained in:
parent
7718f6ad7f
commit
0db95ea686
33
12345.sh
33
12345.sh
|
@ -13,6 +13,7 @@ MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
ME="${0##*/}"
|
||||||
|
|
||||||
|
. "${MY_PATH}/tools/myhash.sh"
|
||||||
. "${MY_PATH}/tools/myhost.sh"
|
. "${MY_PATH}/tools/myhost.sh"
|
||||||
. "${MY_PATH}/tools/template.sh"
|
. "${MY_PATH}/tools/template.sh"
|
||||||
|
|
||||||
|
@ -36,7 +37,6 @@ Access-Control-Allow-Credentials: true
|
||||||
Access-Control-Allow-Methods: GET
|
Access-Control-Allow-Methods: GET
|
||||||
Server: Astroport.ONE
|
Server: Astroport.ONE
|
||||||
Content-Type: text/html; charset=UTF-8
|
Content-Type: text/html; charset=UTF-8
|
||||||
|
|
||||||
"
|
"
|
||||||
echo "_________________________________________________________ $(date)"
|
echo "_________________________________________________________ $(date)"
|
||||||
echo "LAUNCHING Astroport API Server - TUBE : $LIBRA - "
|
echo "LAUNCHING Astroport API Server - TUBE : $LIBRA - "
|
||||||
|
@ -99,14 +99,8 @@ while true; do
|
||||||
############### ############### ############### ############### templates/index.http
|
############### ############### ############### ############### templates/index.http
|
||||||
# REPLACE myHOST in http response template (fixing next API meeting point)
|
# REPLACE myHOST in http response template (fixing next API meeting point)
|
||||||
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||||
[[ $isLAN ]] \
|
template_register >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||||
&& template_register_localhost >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http \
|
sed -i "s~:http://127.0.0.1:12345~http://${myHOST}:${PORT}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
||||||
|| template_register >> ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
|
||||||
|
|
||||||
sed -i "s~:12345~:${PORT}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
|
||||||
sed -i "s~_SESSIONLNK_~${myIPFS}/ipns/${SESSIONNS}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
|
||||||
sed -i "s~127.0.0.1:12345~${myHOST}:${PORT}~g" ~/.zen/tmp/coucou/${MOATS}.myHOST.http
|
|
||||||
############### ############### ############### ###############
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
## SERVE LANDING REDIRECT PAGE ~/.zen/tmp/coucou/${MOATS}.myHOST.http on PORT 1234 (LOOP BLOCKING POINT)
|
## SERVE LANDING REDIRECT PAGE ~/.zen/tmp/coucou/${MOATS}.myHOST.http on PORT 1234 (LOOP BLOCKING POINT)
|
||||||
|
@ -117,8 +111,7 @@ while true; do
|
||||||
HOSTP=$(echo "$REQ" | grep '^Host:' | cut -d ' ' -f2 | cut -d '?' -f2)
|
HOSTP=$(echo "$REQ" | grep '^Host:' | cut -d ' ' -f2 | cut -d '?' -f2)
|
||||||
HOST=$(echo "$HOSTP" | cut -d ':' -f 1)
|
HOST=$(echo "$HOSTP" | cut -d ':' -f 1)
|
||||||
|
|
||||||
## TODO APPLY GENERAL isLAN or zen !isLAN CALACULA>TONS
|
############### ############### ############### ###############
|
||||||
[[ ! $isLAN || $USER == "zen" ]] && myHOST="$HOSTNAME" && myHOSTPort="ipfs.$HOSTNAME" && myHTTP="https://" && myASTROPORT="https://$HOSTNAME" ## WAN STATION
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
[[ $URL == "/test" || $URL == "" ]] && continue
|
[[ $URL == "/test" || $URL == "" ]] && continue
|
||||||
|
@ -138,21 +131,9 @@ while true; do
|
||||||
## / CONTACT
|
## / CONTACT
|
||||||
if [[ $URL == "/" ]]; then
|
if [[ $URL == "/" ]]; then
|
||||||
echo "/ CONTACT : $HOSTP"
|
echo "/ CONTACT : $HOSTP"
|
||||||
echo "___________________________ Preparing default return register.html"
|
|
||||||
echo "$HTTPCORS" > ~/.zen/tmp/coucou/${MOATS}.index.redirect ## HTTP 1.1 HEADER + HTML BODY
|
|
||||||
|
|
||||||
sed "s~http://127.0.0.1:1234~${myASTROPORT}~g" $HOME/.zen/Astroport.ONE/templates/register.html >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
|
||||||
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
|
||||||
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
|
||||||
sed -i "s~http://127.0.0.1:8080~${myIPFS}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
|
||||||
|
|
||||||
|
|
||||||
## Random Background image ;)
|
|
||||||
sed -i "s~.000.~.$(printf '%03d' $(echo ${RANDOM} % 18 | bc)).~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
|
||||||
|
|
||||||
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
echo " (‿/‿) ${myHTTP}$HOSTP / Execution time was "`expr $end - $start` seconds.
|
echo " (‿/‿) $myHOST:$PORT / Execution time was "`expr $end - $start` seconds.
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -208,7 +189,7 @@ while true; do
|
||||||
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key )
|
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key )
|
||||||
[[ ! ${ASTRONAUTENS} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - ASTRONAUTENS COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
[[ ! ${ASTRONAUTENS} ]] && (echo "$HTTPCORS ERROR - (╥☁╥ ) - ASTRONAUTENS COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||||
|
|
||||||
echo "TW ADDRESS : ${myHTTP}$HOSTP/ipns/${ASTRONAUTENS}"
|
echo "TW ADDRESS : $myIPFS/ipns/${ASTRONAUTENS}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
################### KEY GEN ###################################
|
################### KEY GEN ###################################
|
||||||
|
@ -288,7 +269,7 @@ while true; do
|
||||||
#~ ( ## USING IPNS SESSION KEY
|
#~ ( ## USING IPNS SESSION KEY
|
||||||
#~ REPONSE=$(cat ~/.zen/tmp/coucou/${MOATS}.messaging.json | ipfs add -q)
|
#~ REPONSE=$(cat ~/.zen/tmp/coucou/${MOATS}.messaging.json | ipfs add -q)
|
||||||
#~ ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
#~ ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
||||||
#~ echo "SESSION ${myHTTP}$HOSTP/ipns/$SESSIONNS "
|
#~ echo "SESSION ${myIPFS}/ipns/$SESSIONNS "
|
||||||
#~ ) &
|
#~ ) &
|
||||||
|
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
|
|
|
@ -65,8 +65,8 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
|
||||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
|
||||||
echo "/ipns/$ASTRONAUTENS ON $LIBRA"
|
echo "/ipns/$ASTRONAUTENS ON $LIBRA"
|
||||||
|
|
||||||
ipfs --timeout 60s -o ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html /ipns/$ASTRONAUTENS \
|
ipfs --timeout 60s get -o ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html /ipns/$ASTRONAUTENS \
|
||||||
|| curl -m 30 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" \
|
|| curl -m 60 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" \
|
||||||
|| cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
|
|| cp ~/.zen/game/players/$PLAYER/ipfs/moa/index.html ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html
|
||||||
|
|
||||||
## PLAYER TW IS ONLINE ?
|
## PLAYER TW IS ONLINE ?
|
||||||
|
|
|
@ -15,6 +15,9 @@ body {
|
||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
height: 100%
|
height: 100%
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
input[type=submit] {
|
input[type=submit] {
|
||||||
width: 12em; height: 4em;
|
width: 12em; height: 4em;
|
||||||
|
@ -48,11 +51,11 @@ html {
|
||||||
<b>--- Welkom - Mirë se vini - Willkommen - Welkomma - Welcome - Marhaban - Bari galoust - Xos gelmissiniz - Welkum - Ongi etorri- Swagata - Ansuf yiswen - ščyra zaprašajem - Kyo tzo pa eit - Ani kié - Dobro došli - Dagemer mat - Dobre doshŭl - Benvinguts - Ulihebisdi - Huān yíng - Karibu - Eoso eoseyo - Benvenuti - Bel bonjou - Bienvini - Dobrodošli - Velkommen - Bienvenido - Bonvenon - Tere tulemast - Gabitê - Vælkomin - Tervetuloa - Welkom - Wìllkòmme - Binvignut - Fàilte - Benvido - Croeso - Planvenguda - Mikouabô - Kalos irthate - -Eguahé porá - Baroukh habaim - ... ----</b><br>
|
<b>--- Welkom - Mirë se vini - Willkommen - Welkomma - Welcome - Marhaban - Bari galoust - Xos gelmissiniz - Welkum - Ongi etorri- Swagata - Ansuf yiswen - ščyra zaprašajem - Kyo tzo pa eit - Ani kié - Dobro došli - Dagemer mat - Dobre doshŭl - Benvinguts - Ulihebisdi - Huān yíng - Karibu - Eoso eoseyo - Benvenuti - Bel bonjou - Bienvini - Dobrodošli - Velkommen - Bienvenido - Bonvenon - Tere tulemast - Gabitê - Vælkomin - Tervetuloa - Welkom - Wìllkòmme - Binvignut - Fàilte - Benvido - Croeso - Planvenguda - Mikouabô - Kalos irthate - -Eguahé porá - Baroukh habaim - ... ----</b><br>
|
||||||
<header>
|
<header>
|
||||||
<form id="formlink" action = "http://127.0.0.1:1234" method = "GET" enctype="application/x-www-form-urlencoded">
|
<form id="formlink" action = "http://127.0.0.1:1234" method = "GET" enctype="application/x-www-form-urlencoded">
|
||||||
<h1><span>Astroport</span></h1>
|
<h1><span>Astroport</span> Ŋ0</h1>
|
||||||
<br>
|
<br>
|
||||||
<input type='hidden' name='salt' value='0'></br></br>
|
<input type='hidden' name='salt' value='0'></br></br>
|
||||||
<input type='hidden' name='pepper' value='0'></br></br>
|
<input type='hidden' name='pepper' value='0'></br></br>
|
||||||
<h2>ENREGISTREZ VOS VIDEOS YOUTUBE FAVORITES</h2><input type="hidden" name=g1pub value='https://www.youtube.com/playlist?list=LL'></br>
|
<h2><span>ENREGISTREZ VOS VIDEOS YOUTUBE FAVORITES</span></h2><input type="hidden" name=g1pub value='https://www.youtube.com/playlist?list=LL'></br>
|
||||||
<span>Email : </span><input name=email value=''></br></br>
|
<span>Email : </span><input name=email value=''></br></br>
|
||||||
<input type='submit' value='[(♥‿‿♥)]'>
|
<input type='submit' value='[(♥‿‿♥)]'>
|
||||||
</form>
|
</form>
|
||||||
|
@ -62,7 +65,7 @@ html {
|
||||||
</h2>
|
</h2>
|
||||||
</br>
|
</br>
|
||||||
<p>
|
<p>
|
||||||
<b><span>Besoin d'aide ? Contactez support@qo-op.com</span></b>
|
<b>Besoin d'aide ? Contactez support@qo-op.com</b>
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
@ -71,7 +74,8 @@ html {
|
||||||
<article>
|
<article>
|
||||||
<div class="row justify-center">
|
<div class="row justify-center">
|
||||||
<h1 class="video-title">
|
<h1 class="video-title">
|
||||||
<a href="https://git.p2p.legal/qo-op/Astroport.ONE" target="code">COCODING : Astroport.ONE - BunkedBOX edition -</a><br>
|
<center><a href="https://twitch.com/zicmama" target="twitch">COCODING TWITCH TW</a><br></center><br>
|
||||||
|
<a href="https://git.p2p.legal/qo-op/Astroport.ONE" target="code">Astroport.ONE - ♥BOX Edition - Olympe.Network</a><br>
|
||||||
<a target="code" href="http://opencollective.com/monnaie-libre/projects/bunker-box">Recopiez les vidéos que vous aimez dans les capsules multimédia de votre TW!
|
<a target="code" href="http://opencollective.com/monnaie-libre/projects/bunker-box">Recopiez les vidéos que vous aimez dans les capsules multimédia de votre TW!
|
||||||
<br>Une fois votre G1Visa obtenu, direction <a target="gchange" href="https://gchange.fr">https://gchange.fr</a> !</a>
|
<br>Une fois votre G1Visa obtenu, direction <a target="gchange" href="https://gchange.fr">https://gchange.fr</a> !</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
@ -192,6 +192,9 @@ NID="${myIPFSGW}" && WID="$NID/api"
|
||||||
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png
|
cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png
|
||||||
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/ipfs/G1SSB/_g1.pubkey # G1SSB NOTATION (astrXbian compatible)
|
||||||
|
|
||||||
|
qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png "https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"
|
||||||
|
|
||||||
|
|
||||||
## SEC PASS PROTECTED QRCODE
|
## SEC PASS PROTECTED QRCODE
|
||||||
secFromDunikey=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep "sec" | cut -d ' ' -f2)
|
secFromDunikey=$(cat ~/.zen/game/players/$PLAYER/secret.dunikey | grep "sec" | cut -d ' ' -f2)
|
||||||
echo "$secFromDunikey" > ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
|
echo "$secFromDunikey" > ~/.zen/tmp/${MOATS}/${PSEUDO}.sec
|
||||||
|
@ -282,14 +285,20 @@ NID="${myIPFSGW}" && WID="$NID/api"
|
||||||
|
|
||||||
## ID CARD & QRCODE
|
## ID CARD & QRCODE
|
||||||
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 ~/.zen/tmp/${MOATS}/QR.png
|
convert ~/.zen/game/players/$PLAYER/QR.png -resize 300 ~/.zen/tmp/${MOATS}/QR.png
|
||||||
convert ${MY_PATH}/../images/astroport.jpg -resize 300 ~/.zen/tmp/${MOATS}/ASTROPORT.png
|
convert ~/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png -resize 240 ~/.zen/tmp/${MOATS}/TW.png
|
||||||
|
convert ${MY_PATH}/../images/astroport.jpg -resize 240 ~/.zen/tmp/${MOATS}/ASTROPORT.png
|
||||||
|
|
||||||
|
|
||||||
composite -compose Over -gravity SouthWest -geometry +280+20 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png
|
composite -compose Over -gravity SouthWest -geometry +280+20 ~/.zen/tmp/${MOATS}/ASTROPORT.png ${MY_PATH}/../images/Brother_600x400.png ~/.zen/tmp/${MOATS}/astroport.png
|
||||||
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/one.png
|
composite -compose Over -gravity East -geometry +0+0 ~/.zen/tmp/${MOATS}/TW.png ~/.zen/tmp/${MOATS}/astroport.png ~/.zen/tmp/${MOATS}/astroport2.png
|
||||||
|
composite -compose Over -gravity NorthWest -geometry +0+0 ~/.zen/tmp/${MOATS}/QR.png ~/.zen/tmp/${MOATS}/astroport2.png ~/.zen/tmp/${MOATS}/one.png
|
||||||
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
|
# composite -compose Over -gravity NorthWest -geometry +280+280 ~/.zen/game/players/.current/QRsec.png ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
|
||||||
|
|
||||||
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
|
convert -gravity northwest -pointsize 35 -fill black -draw "text 50,300 \"$PSEUDO\"" ~/.zen/tmp/${MOATS}/one.png ~/.zen/tmp/${MOATS}/image.png
|
||||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,40 \"$PLAYER\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,40 \"$PLAYER\"" ~/.zen/tmp/${MOATS}/image.png ~/.zen/tmp/${MOATS}/pseudo.png
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" ~/.zen/tmp/${MOATS}/pseudo.png ~/.zen/tmp/${MOATS}/pass.png
|
convert -gravity northeast -pointsize 25 -fill black -draw "text 20,180 \"$PASS\"" ~/.zen/tmp/${MOATS}/pseudo.png ~/.zen/tmp/${MOATS}/pass.png
|
||||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" ~/.zen/tmp/${MOATS}/pass.png ~/.zen/tmp/${MOATS}/salt.png
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,100 \"$SALT\"" ~/.zen/tmp/${MOATS}/pass.png ~/.zen/tmp/${MOATS}/salt.png
|
||||||
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/salt.png ~/.zen/game/players/$PLAYER/ID.png
|
convert -gravity northwest -pointsize 25 -fill black -draw "text 300,140 \"$PEPPER\"" ~/.zen/tmp/${MOATS}/salt.png ~/.zen/game/players/$PLAYER/ID.png
|
||||||
|
@ -326,8 +335,6 @@ NID="${myIPFSGW}" && WID="$NID/api"
|
||||||
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
|
echo "$SALT" > ~/.zen/game/players/$PLAYER/secret.june
|
||||||
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
|
echo "$PEPPER" >> ~/.zen/game/players/$PLAYER/secret.june
|
||||||
|
|
||||||
qrencode -s 12 -o "$HOME/.zen/game/players/$PLAYER/QR.ASTRONAUTENS.png" "https://ipfs.copylaradio.com/ipns/${ASTRONAUTENS}"
|
|
||||||
|
|
||||||
echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
|
echo; echo "Création Clefs et QR codes pour accès au niveau Astroport Ŋ1"; sleep 1
|
||||||
|
|
||||||
echo "--- PLAYER : $PLAYER";
|
echo "--- PLAYER : $PLAYER";
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#shellcheck shell=sh
|
||||||
|
|
||||||
|
myHash() {
|
||||||
|
[ -f ~/.zen/game/players/localhost/latest ] \
|
||||||
|
&& myHash=$(cat ~/.zen/game/players/localhost/latest) \
|
||||||
|
|| myHash=$(template_register |ipfs add -q)
|
||||||
|
[ ! -f ~/.zen/game/players/localhost/latest ] \
|
||||||
|
&& echo "$myHash" > ~/.zen/game/players/localhost/latest
|
||||||
|
[ -n "$myHash" ] \
|
||||||
|
&& echo "$myHash"
|
||||||
|
}
|
||||||
|
|
||||||
|
myHttp() {
|
||||||
|
echo "$(myHttpHeader)"
|
||||||
|
echo
|
||||||
|
echo "$(myHttpContent)"
|
||||||
|
}
|
||||||
|
|
||||||
|
myIpfs() {
|
||||||
|
myIpfs=${myIPFS}/ipfs/$(myHash)
|
||||||
|
echo "$myIpfs"
|
||||||
|
}
|
||||||
|
|
||||||
|
myIpns() {
|
||||||
|
myIpns=${myIPFS}/ipns/$(myKey)
|
||||||
|
echo "$myIpns"
|
||||||
|
}
|
||||||
|
|
||||||
|
myKey() {
|
||||||
|
myKey=$(ipfs key list -l | awk '$2 == "self" {print $1}')
|
||||||
|
[ -n "$myKey" ] && echo "$myKey"
|
||||||
|
}
|
||||||
|
|
||||||
|
myHttpContent() {
|
||||||
|
myHash=$(myHash)
|
||||||
|
myHttpContent="<html><head><title>302 Found</title></head><body><h1>Found</h1>
|
||||||
|
<p>The document has moved <a href="ipfs/$myHash">here</a>.</p></body></html>"
|
||||||
|
echo "$myHttpContent"
|
||||||
|
}
|
||||||
|
|
||||||
|
myHttpHeader() {
|
||||||
|
myHttpContent=$(myHttpContent)
|
||||||
|
myHttpHeader="HTTP/1.0 302 Found
|
||||||
|
Content-Type: text/html; charset=UTF-8
|
||||||
|
Content-Length: $(myHttpContent |wc -c)
|
||||||
|
Date: $(date -R)
|
||||||
|
Location: ipfs/$myHash
|
||||||
|
set-cookie: AND=$myKey; expires=$(date -R -d "+1 month"); path=/; domain=.$myDomainName; Secure; SameSite=lax
|
||||||
|
Server: and"
|
||||||
|
echo "$myHttpHeader"
|
||||||
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
#shellcheck shell=sh
|
#shellcheck shell=sh
|
||||||
|
|
||||||
template_register_localhost() {
|
|
||||||
template_register | sed -e "s~<input type='hidden' name='salt' value='0'>~<input name='salt' value=''>~g" \
|
|
||||||
-e "s~<input type='hidden' name='pepper' value='0'>~<input name='pepper' value=''>~g"
|
|
||||||
}
|
|
||||||
|
|
||||||
template_register() {
|
template_register() {
|
||||||
sed -e "s~http://127.0.0.1:1234~${myASTROPORT}~g" \
|
[ -n "$isLAN" ] \
|
||||||
-e "s~http://127.0.0.1:8080~${myIPFS}~g" \
|
&& SED_SCRIPT='sed -e "s~<input type='"'hidden'"' name='"'salt'"' value='"'0'"'>~<input name='"'salt'"' value='"''"'>~g"
|
||||||
-e "s~_IPFSNODEID_~${IPFSNODEID}~g" \
|
-e "s~<input type='"'hidden'"' name='"'pepper'"' value='"'0'"'>~<input name='"'pepper'"' value='"''"'>~g"' \
|
||||||
-e "s~_HOSTNAME_~$(hostname)~g" \
|
|| SED_SCRIPT='tee'
|
||||||
-e "s~.000.~.$(printf '%03d' $(seq 0 17 |shuf -n 1)).~g" \
|
$RUN sed -e "s~http://127.0.0.1:1234~${myASTROPORT}~g" \
|
||||||
~/.zen/Astroport.ONE/templates/register.html
|
-e "s~http://127.0.0.1:8080~${myIPFS}~g" \
|
||||||
|
-e "s~_IPFSNODEID_~${IPFSNODEID}~g" \
|
||||||
|
-e "s~_HOSTNAME_~$(hostname)~g" \
|
||||||
|
-e "s~.000.~.$(printf '%03d' $(seq 0 17 |shuf -n 1)).~g" \
|
||||||
|
~/.zen/Astroport.ONE/templates/register.html | \
|
||||||
|
eval ${SED_SCRIPT:-tee}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue