TW OFFICIEL

This commit is contained in:
fred 2022-10-26 20:38:01 +02:00
parent c9a631dd6e
commit d5402ffdd1
2 changed files with 44 additions and 15 deletions

View File

@ -132,10 +132,13 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/123/${MOATS}.index.redirect
if [[ $TYPE == "messaging" ]]; then if [[ $TYPE == "messaging" ]]; then
echo "Extracting $G1PUB messages..." echo "Extracting $G1PUB messages..."
~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/123/${MOATS}.secret.key read -n 10 -j > ~/.zen/tmp/123/messin.${G1PUB}.json ${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/123/${MOATS}.secret.key read -n 10 -j > ~/.zen/tmp/123/messin.${G1PUB}.json
[[ $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/123/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/123/messin.${G1PUB}.json [[ ! -s ~/.zen/tmp/123/messin.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/123/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/123/messin.${G1PUB}.json
~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/123/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/tmp/123/messout.${G1PUB}.json ${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/123/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/tmp/123/messout.${G1PUB}.json
[[ $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/123/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/123/messout.${G1PUB}.json [[ ! -s ~/.zen/tmp/123/messout.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/123/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/123/messout.${G1PUB}.json
echo "Creating messages In/Out JSON ~/.zen/tmp/123/${MOATS}.messaging.json" echo "Creating messages In/Out JSON ~/.zen/tmp/123/${MOATS}.messaging.json"
echo '[' > ~/.zen/tmp/123/${MOATS}.messaging.json echo '[' > ~/.zen/tmp/123/${MOATS}.messaging.json
@ -161,19 +164,45 @@ cat ~/.zen/tmp/123/${MOATS}.messaging.json >> ~/.zen/tmp/123/${MOATS}.index.redi
if [[ ! -f ~/.zen/tmp/123/${MOATS}.index.redirect ]]; then if [[ ! -f ~/.zen/tmp/123/${MOATS}.index.redirect ]]; then
TWIP=$myIP TWIP=$myIP
# OFFICIAL Gateway ( increase waiting time ) - MORE SECURE # OFFICIAL Gateway ( increase waiting time ) - MORE SECURE
if [[ $TYPE="official" ]]; then if [[ $TYPE == "official" ]]; then
ipfs --timeout 3s cat /ipns/$GNS > ~/.zen/tmp/123/${MOATS}.astroindex.html && echo "LATEST TW: ~/.zen/tmp/123/${MOATS}.astroindex.html" echo "OFFICIAL latest online TW..."
[[ -s ~/.zen/tmp/123/${MOATS}.astroindex.html ]] && tiddlywiki --load ~/.zen/tmp/123/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion' YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
OLDIP=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret) && [[ ! $OLDIP ]] && (echo "+x+x+x+x+x+ SECRET IP ERROR - BAD TW - CONTINUE " | nc -l -p ${PORT} -q 1 &) && continue LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2)
# FIRST TIME PLAYER TW USING GATEWAY echo "$LIBRA/ipns/$GNS"
[[ $OLDIP == "_SECRET_" ]] && echo "_SECRET_ TW" && sed -i "s~_SECRET_~${myIP}~g" ~/.zen/tmp/123/${MOATS}.astroindex.html && OLDIP=$myIP echo "http://$myIP:8080/ipns/$GNS ($YOU)"
# AM I MANAGING TW [[ $YOU ]] && ipfs --timeout 12s cat /ipns/$GNS > ~/.zen/tmp/123/${MOATS}.astroindex.html \
[[ $OLDIP != $myIP ]] && TWIP=$OLDIP || curl -m 12 -so ~/.zen/tmp/123/${MOATS}.astroindex.html "$LIBRA/ipns/$GNS"
echo "*********** OFFICIAL LOGIN GOES TO $TWIP"
echo "~/.zen/tmp/123/${MOATS}.astroindex.html"
if [[ -s ~/.zen/tmp/123/${MOATS}.astroindex.html ]]; then
tiddlywiki --load ~/.zen/tmp/123/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
OLDIP=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
[[ ! $OLDIP ]] && (echo "ERROR - NO IP - BAD TW - CONTINUE " | nc -l -p ${PORT} -q 1 &) && continue
# FIRST TIME PLAYER TW USING GATEWAY
if [[ $OLDIP == "_SECRET_" ]]; then
echo "_SECRET_ TW PUSHING TW"
sed -i "s~_SECRET_~${myIP}~g" ~/.zen/tmp/123/${MOATS}.astroindex.html
echo "HTTP/1.1 200 OK
Server: Astroport
Content-Type: text/html; charset=UTF-8
" > ~/.zen/tmp/123/${MOATS}.index.redirect
cat ~/.zen/tmp/123/${MOATS}.astroindex.html >> ~/.zen/tmp/123/${MOATS}.index.redirect
cat ~/.zen/tmp/123/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 &
continue
fi
# REDIRECTING TO ACTUAL GATEWAY
[[ $OLDIP != $myIP ]] && TWIP=$OLDIP
echo "*********** OFFICIAL LOGIN GOES TO $TWIP"
else
(echo "ERROR - NO TW FOUND - ASK FOR VISA" | nc -l -p ${PORT} -q 1 &) && continue
fi
else else
echo "***** TRY OFFICIAL ***** http://$myIP:1234/?salt=$SALT&pepper=$PEPPER&official=on" echo "***** TRY OFFICIAL ***** http://$myIP:1234/?salt=$SALT&pepper=$PEPPER&official=on"
fi fi
sed "s~_TWLINK_~http://$TWIP:8080/ipns/$GNS~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/123/${MOATS}.index.redirect sed "s~_TWLINK_~http://$TWIP:8080/ipns/$GNS~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/123/${MOATS}.index.redirect
fi fi
## TODO PATCH _SECRET_ myIP STUFF ## TODO PATCH _SECRET_ myIP STUFF

View File

@ -37,15 +37,15 @@
</article> </article>
<center> <center>
<h2>Accédez à votre Capsule Numérique</h2> <h2>Astronaute - Activez votre Capsule Numérique - Astroport Ŋ1</h2>
<form action = "http://127.0.0.1:1234" method = "GET"> <form action = "http://127.0.0.1:1234" method = "GET">
<br> <br>
Phrase Une (identifiant) : <input name=salt value=''></br> Phrase Une (identifiant) : <input name=salt value=''></br>
Phrase Deux (mot de passe) : <input name=pepper value=''></br> Phrase Deux (mot de passe) : <input name=pepper value=''></br>
Déjà Astronaute ? Cochez cette case : <input type="checkbox" id="official" name="official"> TW OFFICIEL ? Cochez cette case : <input type="checkbox" id="official" name="official">
</br></br></br> </br></br></br>
Pas encore inscrit? Cochez cette case : <input type="checkbox" id="g1pub" name="g1pub"></br> Pas encore de Visa? Indiquez vos phrases et cochez cette case : <input type="checkbox" id="g1pub" name="g1pub"></br>
Et indiquez un Email où expédier vos clefs : <input name=email value=''></br></br> Sans oublier d'Indiquer un Email où expédier votre nouvelle TW : <input name=email value=''></br></br>
<input type='submit' value='CONNEXION ASTRONAUTE'> <input type='submit' value='CONNEXION ASTRONAUTE'>
</form> </form>
<p> <p>