diff --git a/G1VOEUX.sh b/G1VOEUX.sh index 9eadab77..020a56ff 100755 --- a/G1VOEUX.sh +++ b/G1VOEUX.sh @@ -34,15 +34,18 @@ echo ######################################################## # BACKING UP Astronaute TW IPNS -rm -f ~/.zen/tmp/index.html -ipfs --timeout 5s get -o ~/.zen/tmp/index.html /ipns/$ASTRONAUTENS -if [ ! -f ~/.zen/tmp/index.html ]; then +rm -Rf ~/.zen/tmp/TW +ipfs --timeout 6s get -o ~/.zen/tmp/TW /ipns/$ASTRONAUTENS + +CHECK=(ls ~/.zen/tmp/TW/) && mv ~/.zen/tmp/TW/$CHECK ~/.zen/tmp/TW/index.html + +if [ ! -f ~/.zen/tmp/TW/index.html ]; then echo "ERROR IPNS TIMEOUT. Restoring local backup..." TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1) ipfs name publish --key=$PLAYER /ipfs/$TW else # Backup - cp ~/.zen/tmp/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html + cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html fi ######################################################## diff --git a/astroscan.sh b/astroscan.sh index 384cdcbd..0d1cdc93 100755 --- a/astroscan.sh +++ b/astroscan.sh @@ -104,13 +104,9 @@ sudo cat /dev/ttyACM0 | while read line; do else echo "Canal TW existant" # REFRESH IPNS - ipfs get -o ~/.zen/game/world/$G1PUB/index.html /ipns/$IPNSK + ipfs get -o ~/.zen/game/world/$G1PUB /ipns/$IPNSK - cd ~/.zen/game/world/ - tiddlywiki $G1PUB --load ~/.zen/game/world/$G1PUB/index.html & - sleep 3 && killall node # TRASH PUNK PROGRAMMING - echo "BACKUP DONE !!" - cd $MY_PATH + CHECK=(ls ~/.zen/game/world/$G1PUB/) && mv ~/.zen/game/world/$G1PUB/$CHECK ~/.zen/game/world/$G1PUB/index.html fi ## CREATE GCHANGE AD diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index 2270c185..a3b03767 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -30,16 +30,17 @@ if [[ $SALT != "" && PEPPER != "" ]]; then ipfs key list -l | grep -w $GNS ipfs key list -l | grep -w $GNS | wc -l + CHECK=(ls ~/.zen/tmp/TW/) && mv ~/.zen/tmp/TW/$CHECK ~/.zen/tmp/TW/index.html -if [ ! -f ~/.zen/tmp/TW/index.html ]; then - echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute" - read -else - ASTRO="yes" - echo "Bienvenue Astronaute. Nous avons capté votre TW" - echo "http://127.0.0.1:8080/ipns/$GNS" - echo "Initialisation de votre compte local" -fi + if [ ! -f ~/.zen/tmp/TW/index.html ]; then + echo "Première connexion? Appuyez sur ENTRER pour créer un nouveau TW Astronaute" + read + else + ASTRO="yes" + echo "Bienvenue Astronaute. Nous avons capté votre TW" + echo "http://127.0.0.1:8080/ipns/$GNS" + echo "Initialisation de votre compte local" + fi fi diff --git a/tools/VOEUX.refresh.sh b/tools/VOEUX.refresh.sh index 38b16056..8b93d7ae 100755 --- a/tools/VOEUX.refresh.sh +++ b/tools/VOEUX.refresh.sh @@ -31,6 +31,8 @@ do echo "Getting latest online TW..." ipfs --timeout 12s get -o ~/.zen/tmp/work /ipns/$voeuns + # CORRECT FileName + CHECK=(ls ~/.zen/tmp/work/) && mv ~/.zen/tmp/work/$CHECK ~/.zen/tmp/work/index.html if [[ ! -f ~/.zen/tmp/work/index.html ]]; then echo "UNAVAILABLE WISH! If you want to remove $W $voeu" @@ -61,12 +63,13 @@ done ## PLAYER TW for PLAYER in $(ls ~/.zen/game/players/); do - echo "PLAYER $PLAYER" + echo "PLAYER : $PLAYER" ## REFRESH ASTRONAUTE TW ASTRONAUTENS=$(cat ~/.zen/game/players/$PLAYER/.playerns) rm -Rf ~/.zen/tmp/astro ipfs --timeout 12s get -o ~/.zen/tmp/astro /ipns/$ASTRONAUTENS + CHECK=(ls ~/.zen/tmp/astro/) && mv ~/.zen/tmp/astro/$CHECK ~/.zen/tmp/astro/index.html if [ ! -f ~/.zen/tmp/astro/index.html ]; then echo "ERROR IPNS TIMEOUT. Using local backup..." else