From 3018ea459f9901a4f8c8cc35a54c7780867ae37f Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 5 Nov 2022 21:56:34 +0100 Subject: [PATCH] keep refresh on official --- ASTROBOT/PLAYER.refresh.sh | 27 ++++++++++++++------------- tools/Connect_PLAYER_To_Gchange.sh | 2 +- tools/VISA.new.sh | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ASTROBOT/PLAYER.refresh.sh b/ASTROBOT/PLAYER.refresh.sh index ac957fa6..471e9f1f 100755 --- a/ASTROBOT/PLAYER.refresh.sh +++ b/ASTROBOT/PLAYER.refresh.sh @@ -12,6 +12,7 @@ ME="${0##*/}" # Run TAG subprocess: tube, voeu ############################################ echo "## RUNNING PLAYER.refresh" +IPFSNODEID=$(ipfs id -f='\n') ## RUNING FOR ALL LOCAL PLAYERS for PLAYER in $(ls -t ~/.zen/game/players/); do @@ -32,10 +33,13 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do echo "##################################################################" PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null) + G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null) + ASTRONS=$(cat ~/.zen/game/players/$PLAYER/.playerns 2>/dev/null) ## REFRESH ASTRONAUTE TW ASTRONAUTENS=$(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1) - [[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY -- CONTINUE --" && continue + [[ ! $ASTRONAUTENS || $COINS -lt 0 ]] && echo "WARNING No $PLAYER IPNS KEY or Missing $COINS G1 --" && ASTRONAUTENS=$ASTRONS + [[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && continue rm -Rf ~/.zen/tmp/${PLAYER} mkdir -p ~/.zen/tmp/${PLAYER} @@ -56,7 +60,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( if [ ! -s ~/.zen/tmp/${PLAYER}/index.html ]; then echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - echo "ERROR_PLAYERTW_TIMEOUT : /ipns/$ASTRONAUTENS" + echo "ERROR_PLAYERTW_OFFLINE : /ipns/$ASTRONAUTENS" echo "------------------------------------------------" echo "MANUAL PROCEDURE NEEDED" echo "------------------------------------------------" @@ -64,6 +68,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.* echo "ipfs name publish -t 72h --key=$PLAYER /ipfs/" echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + continue else @@ -108,6 +113,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( fi ################################################## + IKEY=$G1PUB ################################################## ################## UPDATING PLAYER MOA MOATS=$(date -u +"%Y%m%d%H%M%S%4N") @@ -115,7 +121,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$(cat ~/.zen/game/players/$PLAYER/ipfs/moa/.moats) TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1) - ipfs name publish --allow-offline -t 72h --key=$PLAYER /ipfs/$TW + ipfs name publish --allow-offline -t 72h --key=$IKEY /ipfs/$TW [[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats @@ -124,23 +130,18 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( echo "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS" echo "================================================" - ## TODO ! NOT .current SO ipfs key rm - -## PUBLISHING ASTRONAUTS LIST -[[ ! $(grep -w "$ASTRONAUTENS" ~/.zen/game/astronautes.txt ) ]] && echo "$PSEUDO:$PLAYER:$ASTRONAUTENS" >> ~/.zen/game/astronautes.txt - done ################################################################# -## IPFSNODEIDE ASTRONAUTES SIGNALING ## +## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port ############################ -############################ -## TODO EVOLVE TO P2P QOS MAPPING -IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) ls ~/.zen/tmp/${IPFSNODEID}/ + ROUTING=$(ipfs add -rwq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 ) -echo "PUBLISHING ASTRONAUTES SIGNALING" + +echo "PUBLISHING SELF" ipfs name publish --allow-offline -t 72h /ipfs/$ROUTING + echo "THANK YOU." exit 0 diff --git a/tools/Connect_PLAYER_To_Gchange.sh b/tools/Connect_PLAYER_To_Gchange.sh index 46d50ee6..49053e12 100755 --- a/tools/Connect_PLAYER_To_Gchange.sh +++ b/tools/Connect_PLAYER_To_Gchange.sh @@ -144,7 +144,7 @@ do else - echo "ETOILES RECUES!! ... ENVOI MOI UN MESSAGE POUR CONNAITRE QUI" + echo "$my_star_level ETOILES RECUES ($gscore). Relayons sa politesse." $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" send -d "${G1PUB}" -t "$my_star_level ETOILES RECUES ($gscore)" -m "https://www.gchange.fr/#/app/user/${liking_me}/ VOTRE RETOUR ?" echo "LIKING LATER." diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index c5bb103f..85cbd330 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -150,7 +150,6 @@ G1PUB=$(cat /tmp/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) ASTRONAUTENS=$(ipfs key import $G1PUB -f pem-pkcs8-cleartext ~/.zen/game/players/$PLAYER/secret.player) mkdir -p ~/.zen/game/players/$PLAYER/ipfs/G1SSB # Prepare astrXbian sub-datastructure - mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.png "$G1PUB" cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png