keep refresh on official

This commit is contained in:
fred 2022-11-05 21:56:34 +01:00
parent 61956ad410
commit 3018ea459f
3 changed files with 15 additions and 15 deletions

View File

@ -12,6 +12,7 @@ ME="${0##*/}"
# Run TAG subprocess: tube, voeu # Run TAG subprocess: tube, voeu
############################################ ############################################
echo "## RUNNING PLAYER.refresh" echo "## RUNNING PLAYER.refresh"
IPFSNODEID=$(ipfs id -f='<id>\n')
## RUNING FOR ALL LOCAL PLAYERS ## RUNING FOR ALL LOCAL PLAYERS
for PLAYER in $(ls -t ~/.zen/game/players/); do for PLAYER in $(ls -t ~/.zen/game/players/); do
@ -32,10 +33,13 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do
echo "##################################################################" echo "##################################################################"
PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null) 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 ## REFRESH ASTRONAUTE TW
ASTRONAUTENS=$(ipfs key list -l | grep $PLAYER | cut -d ' ' -f1) 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} rm -Rf ~/.zen/tmp/${PLAYER}
mkdir -p ~/.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 if [ ! -s ~/.zen/tmp/${PLAYER}/index.html ]; then
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
echo "ERROR_PLAYERTW_TIMEOUT : /ipns/$ASTRONAUTENS" echo "ERROR_PLAYERTW_OFFLINE : /ipns/$ASTRONAUTENS"
echo "------------------------------------------------" echo "------------------------------------------------"
echo "MANUAL PROCEDURE NEEDED" echo "MANUAL PROCEDURE NEEDED"
echo "------------------------------------------------" 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.* cat ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.*
echo "ipfs name publish -t 72h --key=$PLAYER /ipfs/" echo "ipfs name publish -t 72h --key=$PLAYER /ipfs/"
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
continue continue
else else
@ -108,6 +113,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(
fi fi
################################################## ##################################################
IKEY=$G1PUB
################################################## ##################################################
################## UPDATING PLAYER MOA ################## UPDATING PLAYER MOA
MOATS=$(date -u +"%Y%m%d%H%M%S%4N") 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) ~/.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) 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 [[ $DIFF ]] && echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats 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 "$PLAYER : http://$myIP:8080/ipns/$ASTRONAUTENS"
echo "================================================" 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 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}/ ls ~/.zen/tmp/${IPFSNODEID}/
ROUTING=$(ipfs add -rwq ~/.zen/tmp/${IPFSNODEID}/* | tail -n 1 ) 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 ipfs name publish --allow-offline -t 72h /ipfs/$ROUTING
echo "THANK YOU." echo "THANK YOU."
exit 0 exit 0

View File

@ -144,7 +144,7 @@ do
else 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 ?" $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." echo "LIKING LATER."

View File

@ -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) 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/G1SSB # Prepare astrXbian sub-datastructure
mkdir -p ~/.zen/game/players/$PLAYER/ipfs_swarm
qrencode -s 12 -o ~/.zen/game/players/$PLAYER/QR.png "$G1PUB" 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 cp ~/.zen/game/players/$PLAYER/QR.png ~/.zen/game/players/$PLAYER/ipfs/QR.png