coucou toctoc
This commit is contained in:
parent
8fd1fe6351
commit
1f7fac40c4
112
12345.sh
112
12345.sh
|
@ -22,7 +22,7 @@ PORT=12345
|
||||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); ## $USER running ipfs
|
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1); ## $USER running ipfs
|
||||||
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) ## SWARM#0 ENTRANCE URL
|
LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) ## SWARM#0 ENTRANCE URL
|
||||||
|
|
||||||
mkdir -p ~/.zen/game/players/toctoc/
|
mkdir -p ~/.zen/tmp/coucou/
|
||||||
|
|
||||||
## CHECK FOR ANY ALREADY RUNNING nc
|
## CHECK FOR ANY ALREADY RUNNING nc
|
||||||
ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
ncrunning=$(ps auxf --sort=+utime | grep -w 'nc -l -p 1234' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||||
|
@ -74,18 +74,18 @@ while true; do
|
||||||
|
|
||||||
############### ############### ############### ############### templates/index.http
|
############### ############### ############### ############### templates/index.http
|
||||||
# REPLACE myIP in http response template (fixing next API meeting point)
|
# REPLACE myIP in http response template (fixing next API meeting point)
|
||||||
sed "s~127.0.0.1:12345~$myIP:${PORT}~g" $HOME/.zen/Astroport.ONE/templates/index.http > ~/.zen/game/players/toctoc/${MOATS}.myIP.http
|
sed "s~127.0.0.1:12345~$myIP:${PORT}~g" $HOME/.zen/Astroport.ONE/templates/index.http > ~/.zen/tmp/coucou/${MOATS}.myIP.http
|
||||||
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/game/players/toctoc/${MOATS}.myIP.http
|
sed -i "s~127.0.0.1~$myIP~g" ~/.zen/tmp/coucou/${MOATS}.myIP.http
|
||||||
sed -i "s~:12345~:${PORT}~g" ~/.zen/game/players/toctoc/${MOATS}.myIP.http
|
sed -i "s~:12345~:${PORT}~g" ~/.zen/tmp/coucou/${MOATS}.myIP.http
|
||||||
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/toctoc/${MOATS}.myIP.http ## NODE PUBLISH HOSTED WHAT'S JSON
|
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/tmp/coucou/${MOATS}.myIP.http ## NODE PUBLISH HOSTED WHAT'S JSON
|
||||||
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/game/players/toctoc/${MOATS}.myIP.http ## HOSTNAME
|
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.myIP.http ## HOSTNAME
|
||||||
############### ############### ############### ###############
|
############### ############### ############### ###############
|
||||||
############################################################################
|
############################################################################
|
||||||
## SERVE LANDING REDIRECT PAGE ~/.zen/game/players/toctoc/${MOATS}.myIP.http on PORT 1234 (LOOP BLOCKING POINT)
|
## SERVE LANDING REDIRECT PAGE ~/.zen/tmp/coucou/${MOATS}.myIP.http on PORT 1234 (LOOP BLOCKING POINT)
|
||||||
############################################################################
|
############################################################################
|
||||||
URL=$(cat $HOME/.zen/game/players/toctoc/${MOATS}.myIP.http | nc -l -p 1234 -q 1 | grep '^GET' | cut -d ' ' -f2 | cut -d '?' -f2)
|
URL=$(cat $HOME/.zen/tmp/coucou/${MOATS}.myIP.http | nc -l -p 1234 -q 1 | grep '^GET' | cut -d ' ' -f2 | cut -d '?' -f2)
|
||||||
############################################################################
|
############################################################################
|
||||||
echo "URL" > ~/.zen/game/players/toctoc/${MOATS}.url ## LOGGING URL
|
echo "URL" > ~/.zen/tmp/coucou/${MOATS}.url ## LOGGING URL
|
||||||
############################################################################
|
############################################################################
|
||||||
start=`date +%s`
|
start=`date +%s`
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ while true; do
|
||||||
echo "HTTP/1.1 200 OK
|
echo "HTTP/1.1 200 OK
|
||||||
Server: Astroport
|
Server: Astroport
|
||||||
Content-Type: text/html; charset=UTF-8
|
Content-Type: text/html; charset=UTF-8
|
||||||
" > ~/.zen/game/players/toctoc/${MOATS}.index.redirect ## HTTP 1.1 HEADER + HTML BODY
|
" > ~/.zen/tmp/coucou/${MOATS}.index.redirect ## HTTP 1.1 HEADER + HTML BODY
|
||||||
sed "s~127.0.0.1~$myIP~g" $HOME/.zen/Astroport.ONE/templates/register.html >> ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
sed "s~127.0.0.1~$myIP~g" $HOME/.zen/Astroport.ONE/templates/register.html >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
sed -i "s~_IPFSNODEID_~${IPFSNODEID}~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
|
|
||||||
cat ~/.zen/game/players/toctoc/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
echo Execution time was `expr $end - $start` seconds.
|
echo Execution time was `expr $end - $start` seconds.
|
||||||
continue
|
continue
|
||||||
|
@ -139,19 +139,19 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/game/players/toctoc/${MOATS}.index.re
|
||||||
|
|
||||||
## SAVE "salt" "pepper" DEBUG REMOVE OR PASS ENCRYPT FOR SECURITY REASON
|
## SAVE "salt" "pepper" DEBUG REMOVE OR PASS ENCRYPT FOR SECURITY REASON
|
||||||
echo "PLAYER CREDENTIALS : \"$SALT\" \"$PEPPER\""
|
echo "PLAYER CREDENTIALS : \"$SALT\" \"$PEPPER\""
|
||||||
echo "\"$SALT\" \"$PEPPER\"" > ~/.zen/game/players/toctoc/${MOATS}.secret.june
|
echo "\"$SALT\" \"$PEPPER\"" > ~/.zen/tmp/coucou/${MOATS}.secret.june
|
||||||
|
|
||||||
# CALCULATING ${MOATS}.secret.key + G1PUB
|
# CALCULATING ${MOATS}.secret.key + G1PUB
|
||||||
${MY_PATH}/tools/keygen -t duniter -o ~/.zen/game/players/toctoc/${MOATS}.secret.key "$SALT" "$PEPPER"
|
${MY_PATH}/tools/keygen -t duniter -o ~/.zen/tmp/coucou/${MOATS}.secret.key "$SALT" "$PEPPER"
|
||||||
G1PUB=$(cat ~/.zen/game/players/toctoc/${MOATS}.secret.key | grep 'pub:' | cut -d ' ' -f 2)
|
G1PUB=$(cat ~/.zen/tmp/coucou/${MOATS}.secret.key | grep 'pub:' | cut -d ' ' -f 2)
|
||||||
[[ ! ${G1PUB} ]] && (echo "ERROR - KEYGEN COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
[[ ! ${G1PUB} ]] && (echo "ERROR - KEYGEN COMPUTATION DISFUNCTON" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||||
echo "G1PUB : ${G1PUB}"
|
echo "G1PUB : ${G1PUB}"
|
||||||
|
|
||||||
## CALCULATING IPNS ADDRESS
|
## CALCULATING IPNS ADDRESS
|
||||||
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
||||||
rm -f ~/.zen/game/players/toctoc/${MOATS}.${G1PUB}.ipns.key
|
rm -f ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key
|
||||||
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/game/players/toctoc/${MOATS}.${G1PUB}.ipns.key "$SALT" "$PEPPER"
|
${MY_PATH}/tools/keygen -t ipfs -o ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key "$SALT" "$PEPPER"
|
||||||
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/game/players/toctoc/${MOATS}.${G1PUB}.ipns.key )
|
ASTRONAUTENS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key )
|
||||||
echo "ASTRONAUTE TW : http://$myIP:8080/ipns/${ASTRONAUTENS}"
|
echo "ASTRONAUTE TW : http://$myIP:8080/ipns/${ASTRONAUTENS}"
|
||||||
echo
|
echo
|
||||||
################### KEY GEN ###################################
|
################### KEY GEN ###################################
|
||||||
|
@ -159,16 +159,16 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/game/players/toctoc/${MOATS}.index.re
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
## ARCHIVE TOCTOC WHATS & KEEPS LOGS CLEAN
|
## ARCHIVE TOCTOC WHATS & KEEPS LOGS CLEAN
|
||||||
mkdir -p ~/.zen/tmp/toctoc/
|
mkdir -p ~/.zen/game/players/toctoc/
|
||||||
ISTHERE=$(ls -t ~/.zen/tmp/toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1)
|
ISTHERE=$(ls -t ~/.zen/game/players/toctoc/*.${G1PUB}.ipns.key 2>/dev/null | tail -n 1)
|
||||||
TTIME=$(echo $ISTHERE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
|
TTIME=$(echo $ISTHERE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
|
||||||
if [[ ! $ISTHERE ]]; then
|
if [[ ! $ISTHERE ]]; then
|
||||||
echo "WHAT 1ST TOCTOC : $MOATS"
|
echo "WHAT 1ST TOCTOC : $MOATS"
|
||||||
cp ~/.zen/game/players/toctoc/${MOATS}.* ~/.zen/tmp/toctoc/
|
cp ~/.zen/tmp/coucou/${MOATS}.* ~/.zen/game/players/toctoc/
|
||||||
else ## KEEP 1ST CONTACT ONLY
|
else ## KEEP 1ST CONTACT ONLY
|
||||||
OLDONE=$(ls -t ~/.zen/game/players/toctoc/*.${G1PUB}.ipns.key | tail -n 1)
|
OLDONE=$(ls -t ~/.zen/tmp/coucou/*.${G1PUB}.ipns.key | tail -n 1)
|
||||||
DTIME=$(echo $OLDONE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
|
DTIME=$(echo $OLDONE | rev | cut -d '.' -f 4 | cut -d '/' -f 1 | rev)
|
||||||
[[ $DTIME != $MOATS ]] && rm ~/.zen/game/players/toctoc/$DTIME.*
|
[[ $DTIME != $MOATS ]] && rm ~/.zen/tmp/coucou/$DTIME.*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## TYPE SLECTION ########################
|
## TYPE SLECTION ########################
|
||||||
|
@ -177,32 +177,32 @@ sed -i "s~_HOSTNAME_~$(hostname)~g" ~/.zen/game/players/toctoc/${MOATS}.index.re
|
||||||
|
|
||||||
echo "Extracting ${G1PUB} messages..."
|
echo "Extracting ${G1PUB} messages..."
|
||||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \
|
~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \
|
||||||
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/toctoc/${MOATS}.secret.key read -n 10 -j > ~/.zen/game/players/toctoc/messin.${G1PUB}.json
|
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key read -n 10 -j > ~/.zen/tmp/coucou/messin.${G1PUB}.json
|
||||||
[[ ! -s ~/.zen/game/players/toctoc/messin.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/game/players/toctoc/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/game/players/toctoc/messin.${G1PUB}.json
|
[[ ! -s ~/.zen/tmp/coucou/messin.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/coucou/messin.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/coucou/messin.${G1PUB}.json
|
||||||
|
|
||||||
~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \
|
~/.zen/Astroport.ONE/tools/timeout.sh -t 3 \
|
||||||
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/game/players/toctoc/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/game/players/toctoc/messout.${G1PUB}.json
|
${MY_PATH}/tools/jaklis/jaklis.py -k ~/.zen/tmp/coucou/${MOATS}.secret.key read -n 10 -j -o > ~/.zen/tmp/coucou/messout.${G1PUB}.json
|
||||||
[[ ! -s ~/.zen/game/players/toctoc/messout.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/game/players/toctoc/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/game/players/toctoc/messout.${G1PUB}.json
|
[[ ! -s ~/.zen/tmp/coucou/messout.${G1PUB}.json || $(grep -v -E 'Aucun message à afficher' ~/.zen/tmp/coucou/messout.${G1PUB}.json) == "True" ]] && echo "[]" > ~/.zen/tmp/coucou/messout.${G1PUB}.json
|
||||||
|
|
||||||
echo "Creating messages In/Out JSON ~/.zen/game/players/toctoc/${MOATS}.messaging.json"
|
echo "Creating messages In/Out JSON ~/.zen/tmp/coucou/${MOATS}.messaging.json"
|
||||||
echo '[' > ~/.zen/game/players/toctoc/${MOATS}.messaging.json
|
echo '[' > ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||||
cat ~/.zen/game/players/toctoc/messin.${G1PUB}.json >> ~/.zen/game/players/toctoc/${MOATS}.messaging.json
|
cat ~/.zen/tmp/coucou/messin.${G1PUB}.json >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||||
echo "," >> ~/.zen/game/players/toctoc/${MOATS}.messaging.json
|
echo "," >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||||
cat ~/.zen/game/players/toctoc/messout.${G1PUB}.json >> ~/.zen/game/players/toctoc/${MOATS}.messaging.json
|
cat ~/.zen/tmp/coucou/messout.${G1PUB}.json >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||||
echo ']' >> ~/.zen/game/players/toctoc/${MOATS}.messaging.json
|
echo ']' >> ~/.zen/tmp/coucou/${MOATS}.messaging.json
|
||||||
|
|
||||||
## ADDING HTTP/1.1 PROTOCOL HEADER
|
## ADDING HTTP/1.1 PROTOCOL HEADER
|
||||||
echo "HTTP/1.1 200 OK
|
echo "HTTP/1.1 200 OK
|
||||||
Server: Astroport
|
Server: Astroport
|
||||||
Content-Type: text/html; charset=UTF-8
|
Content-Type: text/html; charset=UTF-8
|
||||||
" > ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
" > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
cat ~/.zen/game/players/toctoc/${MOATS}.messaging.json >> ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
cat ~/.zen/tmp/coucou/${MOATS}.messaging.json >> ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
|
|
||||||
### REPONSE=$(cat ~/.zen/game/players/toctoc/${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 http://$myIP:8080/ipns/$SESSIONNS "
|
### echo "SESSION http://$myIP:8080/ipns/$SESSIONNS "
|
||||||
|
|
||||||
cat ~/.zen/game/players/toctoc/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
echo Execution time was `expr $end - $start` seconds.
|
echo Execution time was `expr $end - $start` seconds.
|
||||||
continue
|
continue
|
||||||
|
@ -214,13 +214,13 @@ cat ~/.zen/game/players/toctoc/${MOATS}.messaging.json >> ~/.zen/game/players/to
|
||||||
########################################
|
########################################
|
||||||
if [[ "$TYPE" == "g1pub" && ${arr[7]} == "" ]]; then
|
if [[ "$TYPE" == "g1pub" && ${arr[7]} == "" ]]; then
|
||||||
## NO EMAIL = REDIRECT TO GCHANGE PROFILE
|
## NO EMAIL = REDIRECT TO GCHANGE PROFILE
|
||||||
sed "s~_TWLINK_~https://www.gchange.fr/#/app/user/${G1PUB}/~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
sed "s~_TWLINK_~https://www.gchange.fr/#/app/user/${G1PUB}/~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
|
|
||||||
### REPONSE=$(echo https://www.gchange.fr/#/app/user/${G1PUB}/ | ipfs add -q)
|
### REPONSE=$(echo https://www.gchange.fr/#/app/user/${G1PUB}/ | ipfs add -q)
|
||||||
### ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
### ipfs name publish --allow-offline --key=${PORT} /ipfs/$REPONSE
|
||||||
### echo "SESSION http://$myIP:8080/ipns/$SESSIONNS "
|
### echo "SESSION http://$myIP:8080/ipns/$SESSIONNS "
|
||||||
|
|
||||||
cat ~/.zen/game/players/toctoc/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
echo Execution time was `expr $end - $start` seconds.
|
echo Execution time was `expr $end - $start` seconds.
|
||||||
continue
|
continue
|
||||||
|
@ -273,42 +273,40 @@ cat ~/.zen/game/players/toctoc/${MOATS}.messaging.json >> ~/.zen/game/players/to
|
||||||
|
|
||||||
echo "OFFICIAL latest online TW... $LIBRA ($YOU)"
|
echo "OFFICIAL latest online TW... $LIBRA ($YOU)"
|
||||||
|
|
||||||
[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/game/players/toctoc/${MOATS}.astroindex.html
|
[[ $YOU ]] && echo "http://$myIP:8080/ipns/${ASTRONAUTENS} ($YOU)" && ipfs --timeout 12s cat /ipns/${ASTRONAUTENS} > ~/.zen/tmp/coucou/${MOATS}.astroindex.html
|
||||||
[[ ! -s ~/.zen/game/players/toctoc/${MOATS}.astroindex.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/game/players/toctoc/${MOATS}.astroindex.html "$LIBRA/ipns/${ASTRONAUTENS}"
|
[[ ! -s ~/.zen/tmp/coucou/${MOATS}.astroindex.html ]] && echo "$LIBRA/ipns/${ASTRONAUTENS}" && curl -m 12 -so ~/.zen/tmp/coucou/${MOATS}.astroindex.html "$LIBRA/ipns/${ASTRONAUTENS}"
|
||||||
|
|
||||||
# DEBUG
|
# DEBUG
|
||||||
# echo "tiddlywiki --load ~/.zen/game/players/toctoc/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'"
|
# echo "tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'"
|
||||||
# echo "cat ~/.zen/tmp/miz.json | jq -r .[].secret"
|
# echo "cat ~/.zen/tmp/miz.json | jq -r .[].secret"
|
||||||
|
|
||||||
if [[ -s ~/.zen/game/players/toctoc/${MOATS}.astroindex.html ]]; then
|
if [[ -s ~/.zen/tmp/coucou/${MOATS}.astroindex.html ]]; then
|
||||||
tiddlywiki --load ~/.zen/game/players/toctoc/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
tiddlywiki --load ~/.zen/tmp/coucou/${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=$(cat ~/.zen/tmp/miz.json | jq -r .[].secret)
|
||||||
[[ ! $OLDIP ]] && (echo "501 ERROR - SORRY - YOUR TW IS OUT OF SWARM#0 - CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
[[ ! $OLDIP ]] && (echo "501 ERROR - SORRY - YOUR TW IS OUT OF SWARM#0 - CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||||
# LOCKED TW BECOMING ACTIVE GATEWAY
|
# LOCKED TW BECOMING ACTIVE GATEWAY
|
||||||
if [[ $OLDIP == "_SECRET_" ]]; then
|
if [[ $OLDIP == "_SECRET_" ]]; then
|
||||||
echo "_SECRET_ TW PUSHING TW" ## BECOMING OFFICIAL BECOME R/W TW
|
echo "_SECRET_ TW PUSHING TW" ## BECOMING OFFICIAL BECOME R/W TW
|
||||||
sed -i "s~_SECRET_~${myIP}~g" ~/.zen/game/players/toctoc/${MOATS}.astroindex.html
|
sed -i "s~_SECRET_~${myIP}~g" ~/.zen/tmp/coucou/${MOATS}.astroindex.html
|
||||||
|
|
||||||
# cat ~/.zen/game/players/toctoc/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
# cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||||
# GET PLAYER FORM Dessin de $PLAYER
|
# GET PLAYER FORM Dessin de $PLAYER
|
||||||
tiddlywiki --load ~/.zen/game/players/toctoc/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'MOA.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[moa]]'
|
tiddlywiki --load ~/.zen/tmp/coucou/${MOATS}.astroindex.html --output ~/.zen/tmp --render '.' 'MOA.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[moa]]'
|
||||||
PLAYER=$(cat ~/.zen/tmp/MOA.json | jq -r .[].title | rev | cut -d ' ' -f 1 | rev)
|
PLAYER=$(cat ~/.zen/tmp/MOA.json | jq -r .[].title | rev | cut -d ' ' -f 1 | rev)
|
||||||
|
|
||||||
[[ ! $PLAYER ]] && (echo "ERROR - CANNOT FIND PLAYER IN TW - CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
[[ ! $PLAYER ]] && (echo "ERROR - CANNOT FIND PLAYER IN TW - CONTINUE " | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &) && continue
|
||||||
|
|
||||||
## CREATE $PLAYER IPNS KEY (for next 20h12)
|
## CREATE $PLAYER IPNS KEY (for next 20h12)
|
||||||
ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/game/players/toctoc/${MOATS}.${G1PUB}.ipns.key
|
ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key
|
||||||
[[ ! -d ~/.zen/game/players/$PLAYER/ipfs/moa ]] && mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa/
|
[[ ! -d ~/.zen/game/players/$PLAYER/ipfs/moa ]] && mkdir -p ~/.zen/game/players/$PLAYER/ipfs/moa/
|
||||||
# cp ~/.zen/game/players/toctoc/${MOATS}.astroindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
# cp ~/.zen/tmp/coucou/${MOATS}.astroindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
|
|
||||||
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
|
echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/"
|
||||||
IPUSH=$(ipfs add -Hq ~/.zen/game/players/toctoc/${MOATS}.astroindex.html | tail -n 1)
|
IPUSH=$(ipfs add -Hq ~/.zen/tmp/coucou/${MOATS}.astroindex.html | tail -n 1)
|
||||||
[[ $IPUSH ]] && ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
[[ $IPUSH ]] && ipfs name publish --key=${PLAYER} /ipfs/$IPUSH 2>/dev/null
|
||||||
## MEMORISE PLAYER Ŋ1 ZONE (TODO compare with VISA.new.sh)
|
## MEMORISE PLAYER Ŋ1 ZONE (TODO compare with VISA.new.sh)
|
||||||
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
|
echo "$PLAYER" > ~/.zen/game/players/$PLAYER/.player
|
||||||
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/.g1pub
|
echo "$G1PUB" > ~/.zen/game/players/$PLAYER/.g1pub
|
||||||
|
|
||||||
continue
|
|
||||||
fi
|
fi
|
||||||
# ACTIVE GATEWAY
|
# ACTIVE GATEWAY
|
||||||
[[ $OLDIP != $myIP ]] && TWIP=$OLDIP
|
[[ $OLDIP != $myIP ]] && TWIP=$OLDIP
|
||||||
|
@ -320,11 +318,11 @@ cat ~/.zen/game/players/toctoc/${MOATS}.messaging.json >> ~/.zen/game/players/to
|
||||||
echo "***** READER MODE *****"
|
echo "***** READER MODE *****"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed "s~_TWLINK_~http://$TWIP:8080/ipns/${ASTRONAUTENS}~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/game/players/toctoc/${MOATS}.index.redirect
|
sed "s~_TWLINK_~http://$TWIP:8080/ipns/${ASTRONAUTENS}~g" ~/.zen/Astroport.ONE/templates/index.redirect > ~/.zen/tmp/coucou/${MOATS}.index.redirect
|
||||||
|
|
||||||
## RESPONDING
|
## RESPONDING
|
||||||
cat ~/.zen/game/players/toctoc/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||||
echo "HTTP 1.1 PROTOCOL DOCUMENT READY ~/.zen/game/players/toctoc/${MOATS}.index.redirect"
|
echo "HTTP 1.1 PROTOCOL DOCUMENT READY ~/.zen/tmp/coucou/${MOATS}.index.redirect"
|
||||||
echo "$MOATS -----> PAGE AVAILABLE -----> http://$myIP:${PORT}"
|
echo "$MOATS -----> PAGE AVAILABLE -----> http://$myIP:${PORT}"
|
||||||
|
|
||||||
#echo "${ASTRONAUTENS}" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
#echo "${ASTRONAUTENS}" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
||||||
|
|
|
@ -106,14 +106,6 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
##############################################################
|
|
||||||
## TODO : Make it G1Voeu with program contained in a tiddler using G1AstroBot ;)
|
|
||||||
## REFRESH G1BARRE for ALL G1VOEUX in PLAYER TW
|
|
||||||
##############################################################
|
|
||||||
# ~/.zen/Astroport.ONE/tools/G1Barre4Player.sh $PLAYER
|
|
||||||
##############################################################
|
|
||||||
|
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
[[ $DIFF ]] && cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \
|
[[ $DIFF ]] && cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain \
|
||||||
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
|
~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats)
|
||||||
|
@ -128,6 +120,8 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do
|
||||||
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS"
|
||||||
echo "================================================"
|
echo "================================================"
|
||||||
|
|
||||||
|
## TODO ! NOT .current SO ipfs key rm
|
||||||
|
|
||||||
## PUBLISHING ASTRONAUTS LIST
|
## PUBLISHING ASTRONAUTS LIST
|
||||||
[[ ! $(grep -w "$ASTRONAUTENS" ~/.zen/game/astronautes.txt ) ]] && echo "$PSEUDO:$PLAYER:$ASTRONAUTENS" >> ~/.zen/game/astronautes.txt
|
[[ ! $(grep -w "$ASTRONAUTENS" ~/.zen/game/astronautes.txt ) ]] && echo "$PSEUDO:$PLAYER:$ASTRONAUTENS" >> ~/.zen/game/astronautes.txt
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue