TYPE=testcraft

This commit is contained in:
fred 2022-10-27 13:27:17 +02:00
parent 9fd2bdc018
commit 8e9f7e72e5
4 changed files with 36 additions and 15 deletions

View File

@ -81,9 +81,11 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/123/${MOATS}.index.redirect
echo "=================================================="
echo "GET RECEPTION : $URL"
arr=(${URL//[=&]/ })
echo "PARAM : ${arr[0]} = ${arr[1]} & ${arr[2]} = ${arr[3]} & ${arr[4]} = ${arr[5]} & ${arr[6]} = ${arr[7]}"
echo "PARAM : ${arr[0]} = ${arr[1]} & ${arr[2]} = ${arr[3]} & ${arr[4]} = ${arr[5]} & ${arr[6]} = ${arr[7]} & ${arr[8]} = ${arr[9]}"
# CHECK TYPE
TYPE=$(urldecode ${arr[4]})
[[ ${arr[0]} == "" && ${arr[1]} == "" ]] && (echo "GET NO DATA" | nc -l -p ${PORT} -q 1 &) && continue
[[ ${arr[0]} == "" || ${arr[1]} == "" ]] && (echo "ERROR - MISSING DATA" | nc -l -p ${PORT} -q 1 &) && continue
########## CHECK GET PARAM NAMES
###################################################################################################
@ -160,6 +162,19 @@ cat ~/.zen/tmp/123/${MOATS}.messaging.json >> ~/.zen/tmp/123/${MOATS}.index.redi
# G1PUB -> Open Gchange Profile
[[ "$TYPE" == "g1pub" ]] && sed "s~_TWLINK_~https://www.gchange.fr/#/app/user/$G1PUB/~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/123/${MOATS}.index.redirect
#testcraft nodeid dataid
if [[ "$TYPE" == "testcraft" ]]; then
SALT=$(urldecode ${arr[1]} | xargs)
PEPPER=$(urldecode ${arr[3]} | xargs)
NODEID=$(urldecode ${arr[7]} | xargs)
DATAID=$(urldecode ${arr[9]} | xargs)
ipfs --timeout 12s ping $NODEID &
ipfs --timeout 12s ls /ipfs/$DATAID &
echo "OK - $NODEID GONE GET YOUR /ipfs/$DATAID"
(echo "OK - $NODEID WE GONE GET YOUR /ipfs/$DATAID " | nc -l -p ${PORT} -q 1 &) && continue
fi
## ELSE IPNS TW REDIRECT
if [[ ! -f ~/.zen/tmp/123/${MOATS}.index.redirect ]]; then
TWIP=$myIP
@ -183,7 +198,7 @@ cat ~/.zen/tmp/123/${MOATS}.messaging.json >> ~/.zen/tmp/123/${MOATS}.index.redi
[[ ! $OLDIP ]] && (echo "ERROR - $OLDIP WRONG TW - CONTINUE " | nc -l -p ${PORT} -q 1 &) && continue
# FIRST TIME PLAYER TW USING GATEWAY
if [[ $OLDIP == "_SECRET_" ]]; then
echo "_SECRET_ TW PUSHING TW"
echo "_SECRET_ TW PUSHING TW" ## SEND FULL TW
sed -i "s~_SECRET_~${myIP}~g" ~/.zen/tmp/123/${MOATS}.astroindex.html
echo "HTTP/1.1 200 OK
Server: Astroport
@ -200,7 +215,7 @@ Content-Type: text/html; charset=UTF-8
(echo "ERROR - NO TW FOUND - ASK FOR VISA" | nc -l -p ${PORT} -q 1 &) && continue
fi
else
echo "***** TRY OFFICIAL ***** http://$myIP:1234/?salt=$SALT&pepper=$PEPPER&official=on"
echo "***** READER MODE - R/W USE OFFICIAL ***** http://$myIP:1234/?salt=$SALT&pepper=$PEPPER&official=on"
fi
sed "s~_TWLINK_~http://$TWIP:8080/ipns/$GNS~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/123/${MOATS}.index.redirect
@ -221,12 +236,12 @@ Content-Type: text/html; charset=UTF-8
fi
###################################################################################################
###################################################################################################
# API ONE : ?salt=PHRASE%20UNE&pepper=PHRASE%20DEUX&g1pub=on&email/elastic=ELASTICID&pseudo=PROFILENAME
if [[ ${arr[6]} == "email" || ${arr[6]} == "elastic" ]]; then
# CHECK TYPE
TYPE=$(urldecode ${arr[4]})
[[ $TYPE != "g1pub" ]] && (echo "ERROR - BAD COMMAND TYPE" | nc -l -p ${PORT} -q 1 &) && continue
start=`date +%s`

View File

@ -42,11 +42,13 @@
<br>
Phrase Une (identifiant) : <input name=salt value=''></br>
Phrase Deux (mot de passe) : <input name=pepper value=''></br>
TW OFFICIEL ! Cochez cette case : <input type="checkbox" id="official" name="official">
TW officiel ! cochez la case : <input type="checkbox" id="official" name="official">
<input type='submit' value='CONNEXION'>
</br></br></br>
Créer un TW officiel? Choisissez vos phrases, cochez cette case : <input type="checkbox" id="g1pub" name="g1pub"></br>
Indiquez un Email pour activer votre portail TW : <input name=email value=''></br></br>
<input type='submit' value='CONNEXION ASTRONAUTE'>
Nouveau Ici? Choisissez vos phrases, cochez cette case : <input type="checkbox" id="g1pub" name="g1pub"></br>
Indiquez un Email où livrer votre TW Officiel : <input name=email value=''></br></br>
<input type='submit' value='CREATION ASTRONAUTE TW'>
</form>
<p>
<b>Activez votre TW. Faites vos "voeux", partagez les entre amis !</b><br>

View File

@ -19,7 +19,7 @@ Content-Type: text/html; charset=UTF-8
<center>
<h1>ASTROPORT Ŋ1</h1>
<b>Astronaute... ouverture du sas... S'il a du mal à s'ouvrir: insistez !</b><br>
<a href="/ipns/_IPFSNODEID_" target="json"><img src='http://127.0.0.1:8080/ipfs/QmS4xmYNpto1ce65VBPJsDjiaoupmxTTE7o5RD2zrnJcVb/QRCode.gif' id='wait'/></a>
<a href="/ipns/_IPFSNODEID_" target="json"><img src='http://127.0.0.1:8080/ipfs/QmbY3R4UV43Bz7eQDEYgXZKWnszArGwnJqMmfSZ7CCWFcq' id='wait'/></a>
</center>
</body>
</html>

View File

@ -21,17 +21,21 @@ ASTRONAUTENS=$(ipfs key list -l | grep -w "$PLAYER" | cut -d ' ' -f 1)
## Directory is created, So this script already run once.
if [[ ! -d ~/.zen/game/players/$PLAYER/FRIENDS/ ]]; then
## GET GCHANGE
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" get > ~/.zen/game/players/$PLAYER/ipfs/gchange.json
########################################################################
echo "CREATING $PLAYER GCHANGE+ PROFILE"
echo "UPDATE $PLAYER GCHANGE+ PROFILE"
########################################################################
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" set --site "http://tube.copylaradio.com:8080/ipns/$ASTRONAUTENS" #GCHANGE+
[[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" && echo "Action Manuelle " $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" set --name "Astronaute $PSEUDO" --avatar "/home/$USER/.zen/Astroport.ONE/images/logo.png" --site "http://qo-op.com:8080/ipns/$ASTRONAUTENS" #GCHANGE+
[[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED"
## GET CESIUM
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" get > ~/.zen/game/players/$PLAYER/ipfs/cesium.json
########################################################################
#echo "CREATING $PLAYER CESIUM+ PROFILE"
echo "UPDATE $PLAYER CESIUM+ PROFILE"
########################################################################
$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" set --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" && echo "Action Manuelle " $ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" set --name "Astronaute $PLAYER" --avatar "/home/$USER/.zen/Astroport.ONE/images/logo.png" --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+
[[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED"
fi
########################################################################