diff --git a/G1VOEUX.sh b/G1VOEUX.sh index 6f42f2b3..b17d53a0 100755 --- a/G1VOEUX.sh +++ b/G1VOEUX.sh @@ -34,17 +34,17 @@ echo ######################################################## # BACKING UP Astronaute TW IPNS -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 +mkdir -p ~/.zen/tmp/TW +rm -f ~/.zen/tmp/TW/index.html +ipfs --timeout 6s cat /ipns/$ASTRONAUTENS > ~/.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) + TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1) ipfs name publish --key=$PLAYER /ipfs/$TW else # Backup + ## TODO index.html are different => Add signaling tiddler cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html fi ######################################################## @@ -159,6 +159,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO IVOEUPLAY=$(ipfs add -Hq /tmp/player.png | tail -n 1) IVOEU=$(ipfs add -Hq /tmp/voeu.png | tail -n 1) + ## Replace Template G1Voeu image sed -i "s~bafybeidhghlcx3zdzdah2pzddhoicywmydintj4mosgtygr6f2dlfwmg7a~${IVOEU}~g" ~/.zen/game/world/$WISHKEY/index.html # NEW IVEU TIDDLER @@ -189,11 +190,13 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html" cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html MOATS=$(date -u +"%Y%m%d%H%M%S%4N") - echo "Avancement blockchain $PLAYER : $MOATS" + echo "Avancement blockchain TW $PLAYER : $MOATS" cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.old - TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1) + + TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1) echo "ipfs name publish --key=$PLAYER /ipfs/$TW" ipfs name publish --key=$PLAYER /ipfs/$TW + # MAJ CACHE TW $PLAYER echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats @@ -202,7 +205,7 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO # PRINTING LP=$(ls /dev/usb/lp* | head -n1) - [[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" # && exit 1 + [[ ! $LP ]] && echo "NO PRINTER FOUND - Brother QL700 validated" echo "IMPRESSION VOEU" brother_ql_create --model QL-700 --label-size 62 /tmp/player.png > /tmp/toprint.bin 2>/dev/null sudo brother_ql_print /tmp/toprint.bin $LP @@ -217,13 +220,14 @@ convert -gravity northwest -pointsize 50 -fill black -draw "text 30,300 \"Ğ1 VO # PUBLISHING echo "## ${PLAYER} RECORDING YOU WISH INTO BLOCKCHAIN" - echo "ipfs add -rHq ~/.zen/game/world/$WISHKEY/ + echo "ipfs add -Hq ~/.zen/game/world/$WISHKEY/index.html ipfs name publish --key=${WISHKEY} /ipfs/\$IPUSH" - IPUSH=$(ipfs add -rHq ~/.zen/game/world/$WISHKEY/ | tail -n 1) - echo $IPUSH > ~/.zen/game/world/$WISHKEY/.chain # Contains last IPFS backup PLAYER KEY - echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats + IPUSH=$(ipfs add -Hq ~/.zen/game/world/$WISHKEY/index.html | tail -n 1) ipfs name publish --key=${WISHKEY} /ipfs/$IPUSH 2>/dev/null + echo $IPUSH > ~/.zen/game/world/$WISHKEY/.chain + echo $MOATS > ~/.zen/game/world/$WISHKEY/.moats + echo "Astronaute Ŋ1 : http://127.0.0.1:8080/ipns/$ASTRONAUTENS" echo "CAPSULE A REVE $PEPPER : http://127.0.0.1:8080/ipns/$VOEUXNS" diff --git a/astroscan.sh b/astroscan.sh index f62646f4..9c4495a9 100755 --- a/astroscan.sh +++ b/astroscan.sh @@ -104,9 +104,7 @@ sudo cat /dev/ttyACM0 | while read line; do else echo "Canal TW existant" # REFRESH IPNS - ipfs get -o ~/.zen/game/world/$G1PUB/ /ipns/$IPNSK - - CHECK=$(ls ~/.zen/game/world/$G1PUB/) && mv ~/.zen/game/world/$G1PUB/$CHECK ~/.zen/game/world/$G1PUB/index.html + ipfs --timeout 6s cat /ipns/$IPNSK > ~/.zen/game/world/$G1PUB/index.html fi ## CREATE GCHANGE AD diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index 2a1803df..236b8d97 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -23,17 +23,16 @@ if [[ $SALT != "" && PEPPER != "" ]]; then ${MY_PATH}/keygen -t ipfs -o ~/.zen/tmp/gchange.key "$SALT" "$PEPPER" GNS=$(ipfs key import gchange -f pem-pkcs8-cleartext ~/.zen/tmp/gchange.key ) - rm -Rf ~/.zen/tmp/TW - ipfs --timeout 5s get -o ~/.zen/tmp/TW/ /ipns/$GNS + mkdir -p ~/.zen/tmp/TW + rm -f ~/.zen/tmp/TW/index.html + ipfs --timeout 6s cat /ipns/$GNS > ~/.zen/tmp/TW/index.html # Combien de clefs? 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" + echo "Aucun ancien TW détecté! Appuyez sur ENTRER pour créer un nouveau TW Astronaute" read else ASTRO="yes" @@ -193,10 +192,10 @@ else fi ## Copy Astro TW - [[ $ASTRO == "yes" ]] && cp ~/.zen/tmp/TW.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html + [[ $ASTRO == "yes" ]] && cp ~/.zen/tmp/TW/index.html ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html echo "## PUBLISHING ${PLAYER} /ipns/$ASTRONAUTENS/" - IPUSH=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/ | tail -n 1) + IPUSH=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/index.html | tail -n 1) echo $IPUSH > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/.chain # Contains last IPFS backup PLAYER KEY echo "/ipfs/$IPUSH" echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/.$PeerID/moa/.moats diff --git a/tools/VOEUX.refresh.sh b/tools/VOEUX.refresh.sh index 5bd685f2..ce497897 100755 --- a/tools/VOEUX.refresh.sh +++ b/tools/VOEUX.refresh.sh @@ -27,26 +27,28 @@ do echo $W mkdir -p ~/.zen/tmp/work + rm -f ~/.zen/tmp/work/index.html 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 + ipfs --timeout 12s cat /ipns/$voeuns > ~/.zen/tmp/work/index.html if [[ ! -f ~/.zen/tmp/work/index.html ]]; then echo "UNAVAILABLE WISH! If you want to remove $W $voeu" echo "ipfs key rm $voeu && rm -Rf ~/.zen/game/world/$voeu" continue + else + # Update local copy + cp ~/.zen/tmp/work/index.html ~/.zen/game/world/$voeu/index.html fi # RECORDING BLOCKCHAIN TIC MOATS=$(date -u +"%Y%m%d%H%M%S%4N") cp ~/.zen/game/world/$voeu/.chain ~/.zen/game/world/$voeu/.chain.old - IPUSH=$(ipfs add -rHq ~/.zen/game/world/$voeu/ | tail -n 1) + IPUSH=$(ipfs add -Hq ~/.zen/game/world/$voeu/index.html | tail -n 1) + ipfs name publish --key=${voeu} /ipfs/$IPUSH 2>/dev/null + echo $IPUSH > ~/.zen/game/world/$voeu/.chain echo $MOATS > ~/.zen/game/world/$voeu/.moats - ipfs name publish --key=${voeu} /ipfs/$IPUSH 2>/dev/null rm -Rf ~/.zen/tmp/work @@ -72,9 +74,9 @@ for PLAYER in $(ls ~/.zen/game/players/); do ## 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 + mkdir -p ~/.zen/tmp/astro + ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/astro/index.html - 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..." continue @@ -83,7 +85,7 @@ for PLAYER in $(ls ~/.zen/game/players/); do cp ~/.zen/tmp/astro/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html fi - TW=$(ipfs add -rHq ~/.zen/game/players/$PLAYER/ipfs/moa/ | tail -n 1) + TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1) ipfs name publish --key=$PLAYER /ipfs/$TW echo "$PLAYER : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"