diff --git a/ASTROBOT/PLAYER.refresh.sh b/ASTROBOT/PLAYER.refresh.sh index 2f367cc6..b55d1fde 100755 --- a/ASTROBOT/PLAYER.refresh.sh +++ b/ASTROBOT/PLAYER.refresh.sh @@ -41,8 +41,8 @@ for PLAYER in $(ls -t ~/.zen/game/players/); do [[ ! $ASTRONAUTENS || $COINS -lt 0 ]] && echo "WARNING No $PLAYER in keystore or Missing $COINS G1 --" && ASTRONAUTENS=$ASTRONS [[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && continue - rm -Rf ~/.zen/tmp/${PLAYER} - mkdir -p ~/.zen/tmp/${PLAYER} + rm -Rf ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/ + mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/ myIP=$(hostname -I | awk '{print $1}' | head -n 1) isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") @@ -53,11 +53,11 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) echo "$LIBRA/ipns/$ASTRONAUTENS" echo "http://$myIP:8080/ipns/$ASTRONAUTENS ($YOU)" - [[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${PLAYER}/index.html \ - || curl -m 12 -so ~/.zen/tmp/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" + [[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html \ + || curl -m 12 -so ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html "$LIBRA/ipns/$ASTRONAUTENS" ## PLAYER TW IS ONLINE ? - if [ ! -s ~/.zen/tmp/${PLAYER}/index.html ]; then + if [ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ]; then echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" echo "ERROR_PLAYERTW_OFFLINE : /ipns/$ASTRONAUTENS" @@ -75,7 +75,7 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( ## FOUND TW ############################################################# ## CHECK IF myIP IS ACTUAL OFFICIAL GATEWAY - tiddlywiki --load ~/.zen/tmp/${PLAYER}/index.html --output ~/.zen/tmp --render '.' 'miz.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion' + tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.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 ]] && echo "(╥☁╥ ) ERROR - SORRY - TW IS BROKEN - (╥☁╥ ) " && continue # WHO IS OFFICIAL TW GATEWAY. @@ -86,27 +86,27 @@ isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|( ############################################################## ## SPECIAL TAG "voeu" => Creation G1Voeu (G1Titre) makes AstroBot TW G1Processing ############################################################## - $MY_PATH/VOEUX.create.sh ~/.zen/tmp/${PLAYER}/index.html $PLAYER + $MY_PATH/VOEUX.create.sh ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html $PLAYER # VOEUX.refresh.sh ############################################################## ## RUN ASTROBOT G1Voeux SUBPROCESS (SPECIFIC AND STANDARD Ŋ1 SYNC) ############################################################## - $MY_PATH/VOEUX.refresh.sh ~/.zen/tmp/${PLAYER}/index.html $PLAYER + $MY_PATH/VOEUX.refresh.sh ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html $PLAYER ############################################################## #################### # LOCKING TW : myIP becomes _SECRET_ - sed -i "s~${myIP}~_SECRET_~g" ~/.zen/tmp/${PLAYER}/index.html + sed -i "s~${myIP}~_SECRET_~g" ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html #################### ## ANY CHANGES ? ############################################################## - DIFF=$(diff ~/.zen/tmp/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html) + DIFF=$(diff ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html) if [[ $DIFF ]]; then echo "DIFFERENCE DETECTED !! " echo "Backup & Upgrade TW local copy..." - cp ~/.zen/tmp/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html + cp ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/index.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html fi ############################################################## diff --git a/ASTROBOT/VOEUX.refresh.sh b/ASTROBOT/VOEUX.refresh.sh index a7aa1904..d0f59d41 100755 --- a/ASTROBOT/VOEUX.refresh.sh +++ b/ASTROBOT/VOEUX.refresh.sh @@ -33,19 +33,19 @@ myIP=$(hostname -I | awk '{print $1}' | head -n 1) isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") [[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" -mkdir -p ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS} +mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" ############################### ## EXTRACT G1Voeu from PLAYER TW echo "Exporting $PLAYER TW [tag[G1Voeu]]" -rm -f ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1voeu.json -tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS} --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]]' +rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json +tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1Voeu]]' -[[ ! -s ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1voeu.json ]] && echo "AUCUN G1VOEU - EXIT -" && exit 1 +[[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json ]] && echo "AUCUN G1VOEU - EXIT -" && exit 1 -cat ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1voeu.json | jq -r '.[].wish' > ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1wishes.txt -echo "NB DE VOEUX : "$(cat ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1wishes.txt | wc -l) +cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq -r '.[].wish' > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt +echo "NB DE VOEUX : "$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt | wc -l) echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" @@ -56,11 +56,11 @@ do echo "===============================" echo "G1Voeu ${WISH}" ## Get ${WISHNAME} TW - WISHNAME=$(cat ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .title') + WISHNAME=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .title') [[ ! ${WISHNAME} ]] && echo "WISH sans NOM - CONTINUE -" && continue - VOEUNS=$(cat ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .ipns') + VOEUNS=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .ipns') - mkdir -p ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME}/${WISH} + mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${WISH} ## RUN SPECIFIC G1Voeu ASTROBOT PROGRAM (like G1CopierYoutube.sh) @@ -90,12 +90,12 @@ do [[ ! -s $FRIENDTW ]] && echo "$FRIENDTW VIDE (AMI SANS TW)" && continue PLAYER=$(ls $FRIENDTW | cut -d '/' -f 7) - rm -f ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME}/${PLAYER}.tiddlers.json + rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${PLAYER}.tiddlers.json echo "TRY EXPORT [tag[G1${WISHNAME}]] FROM $FRIENDTW" tiddlywiki --load $FRIENDTW \ - --output ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME} --render '.' ${PLAYER}'.tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']]' - [[ ! -s ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME}/${PLAYER}.tiddlers.json ]] && echo "NO ${WISHNAME} - CONTINUE -" && continue - [[ $(cat ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME}/${PLAYER}.tiddlers.json) == "[]" ]] && echo "EMPTY ${WISHNAME} - CONTINUE -" && continue + --output ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME} --render '.' ${PLAYER}'.tiddlers.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']]' + [[ ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${PLAYER}.tiddlers.json ]] && echo "NO ${WISHNAME} - CONTINUE -" && continue + [[ $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${PLAYER}.tiddlers.json) == "[]" ]] && echo "EMPTY ${WISHNAME} - CONTINUE -" && continue echo "## WISHES FOUND ;) MIAM " ###################################### @@ -103,10 +103,10 @@ do # Remove G1${WISHNAME} with WISHNAME Initial TIDDLER # Reduce importation with extra filters days:created[-1] # Apply Extra filters... TODO LEARN https://talk.tiddlywiki.org/t/how-to-filter-and-delete-multiple-tiddlers/4950/2?u=papiche - echo ">>> Importing ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME}/${PLAYER}.tiddlers.json" + echo ">>> Importing ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${PLAYER}.tiddlers.json" tiddlywiki --load $INDEX \ - --import "$HOME/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${WISHNAME}/${PLAYER}.tiddlers.json" "application/json" \ + --import "$HOME/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${WISHNAME}/${PLAYER}.tiddlers.json" "application/json" \ --output ~/.zen/tmp --render "$:/core/save/all" "${ASTRONAUTENS}.newindex.html" "text/plain" if [[ -s ~/.zen/tmp/${ASTRONAUTENS}.newindex.html ]]; then @@ -119,7 +119,7 @@ do done -done < ~/.zen/tmp/${IPFSNODEID}/g1voeu/${ASTRONAUTENS}/${PLAYER}.g1wishes.txt +done < ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" diff --git a/tools/Connect_PLAYER_To_Gchange.sh b/tools/Connect_PLAYER_To_Gchange.sh index a998fec1..0ad5fca6 100755 --- a/tools/Connect_PLAYER_To_Gchange.sh +++ b/tools/Connect_PLAYER_To_Gchange.sh @@ -7,66 +7,70 @@ myIP=$(hostname -I | awk '{print $1}' | head -n 1) isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") [[ ! $myIP || $isLAN ]] && myIP="127.0.1.1" +IPFSNODEID=$(ipfs id -f='\n') + ME="${0##*/}" ######################################################################### CONNECT PLAYER WITH GCHANGE # Check who is .current PLAYER PLAYER="$1" -[[ $PLAYER == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) -[[ $PLAYER == "" ]] && echo "ERROR PLAYER - EXIT" && exit 1 -PSEUDO=$(cat ~/.zen/game/players/$PLAYER/.pseudo 2>/dev/null) -[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/$PLAYER/.g1pub 2>/dev/null) +[[ ${PLAYER} == "" ]] && PLAYER=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) +[[ ${PLAYER} == "" ]] && echo "ERROR PLAYER - EXIT" && exit 1 +PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null) +[[ $G1PUB == "" ]] && G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null) [[ $G1PUB == "" ]] && echo "ERROR G1PUB - EXIT" && exit 1 - 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) + 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 "WARNING No $PLAYER in keystore --" && ASTRONAUTENS=$ASTRONS - [[ ! $ASTRONAUTENS ]] && echo "Missing $PLAYER IPNS KEY - CONTINUE --" && exit 1 + ASTRONAUTENS=$(ipfs key list -l | grep ${PLAYER} | cut -d ' ' -f1) + [[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore --" && ASTRONAUTENS=$ASTRONS + [[ ! $ASTRONAUTENS ]] && echo "Missing ${PLAYER} IPNS KEY - CONTINUE --" && exit 1 + +mkdir -p ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/ ## Directory is created, So this script already run once. -if [[ ! -d ~/.zen/game/players/$PLAYER/FRIENDS/ ]]; then +if [[ ! -d ~/.zen/game/players/${PLAYER}/FRIENDS/ ]]; then ## GET GCHANGE - $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" get > ~/.zen/game/players/$PLAYER/ipfs/gchange.json + $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json ######################################################################## - echo "UPDATE $PLAYER GCHANGE+ PROFILE" + echo "UPDATE ${PLAYER} GCHANGE+ PROFILE" ######################################################################## - $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" set --site "http://tube.copylaradio.com:8080/ipns/$ASTRONAUTENS" #GCHANGE+ + $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" set --site "http://tube.copylaradio.com:8080/ipns/$ASTRONAUTENS" #GCHANGE+ [[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" ## GET CESIUM - $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" get > ~/.zen/game/players/$PLAYER/ipfs/cesium.json + $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.presles.fr" get > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json ######################################################################## - echo "UPDATE $PLAYER CESIUM+ PROFILE" + echo "UPDATE ${PLAYER} CESIUM+ PROFILE" ######################################################################## - $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://g1.data.presles.fr" set --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+ + $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://g1.data.presles.fr" set --site "http://127.0.0.1:8080/ipns/$ASTRONAUTENS" #CESIUM+ [[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" fi ######################################################################## echo "########################################################################" -echo "SCANNING $PLAYER - $G1PUB - Gchange FRIENDS" +echo "SCANNING ${PLAYER} - $G1PUB - Gchange FRIENDS" echo "########################################################################" ################## CHECKING WHO GAVE ME STARS ################## BOOTSTRAP LIKES THEM BACK ################## SEND ipfstryme MESSAGES to FRIENDS -rm -f ~/.zen/tmp/my_star_level +rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/my_star_level ## Getting Gchange liking_me list echo "Getting received stars" ################################## JAKLIS PLAYER stars ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \ ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py \ --k ~/.zen/game/players/$PLAYER/secret.dunikey \ --n "https://data.gchange.fr" stars > ~/.zen/tmp/received_stars.json +-k ~/.zen/game/players/${PLAYER}/secret.dunikey \ +-n "https://data.gchange.fr" stars > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json -cat ~/.zen/tmp/received_stars.json | jq -r '.likes[].issuer' | uniq > ~/.zen/tmp/liking_me -echo "cat ~/.zen/tmp/received_stars.json | jq -r" +cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r '.likes[].issuer' | uniq > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/liking_me +echo "cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/received_stars.json | jq -r" -for liking_me in $(cat ~/.zen/tmp/liking_me | sort | uniq); +for liking_me in $(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/liking_me | sort | uniq); do [[ "${liking_me}" == "" ]] && continue ## Protect from empty line !! echo "........................." @@ -79,32 +83,32 @@ do ################################## JAKLIS LIKING_ME stars ~/.zen/Astroport.ONE/tools/timeout.sh -t 20 \ ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py \ - -k ~/.zen/game/players/$PLAYER/secret.dunikey \ + -k ~/.zen/game/players/${PLAYER}/secret.dunikey \ -n "https://data.gchange.fr" \ - stars -p ${liking_me} > ~/.zen/tmp/${liking_me}.Gstars.json + stars -p ${liking_me} > ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json - echo "Got Stars - DEBUG - cat ~/.zen/tmp/${liking_me}.Gstars.json | jq -r" + echo "Got Stars - DEBUG - cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r" ## ZOMBIE PROTECTION - [[ "$?" == "0" && ! -s ~/.zen/tmp/${liking_me}.Gstars.json ]] && rm -Rf ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me} && echo "${liking_me} is a ZOMBIE..." && continue + [[ "$?" == "0" && ! -s ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json ]] && rm -Rf ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me} && echo "${liking_me} is a ZOMBIE..." && continue #### RECUP ANNONCES Gchange ## https://www.gchange.fr/#/app/records/wallet?q=2geH4d2sndR47XWtfDWsfLLDVyNNnRsnUD3b1sk9zYc4&old ## https://www.gchange.fr/#/app/market/records/42LqLa7ARTZqUKGz2Msmk79gwsY8ZSoFyMyPyEnoaDXR - ## DATA EXTRACTION FROM ~/.zen/tmp/${liking_me}.Gstars.json - my_star_level=$(cat ~/.zen/tmp/${liking_me}.Gstars.json | jq -r '.yours.level'); - gscore=$(cat ~/.zen/tmp/${liking_me}.Gstars.json | jq -r '.score'); - myfriendship=$(cat ~/.zen/tmp/${liking_me}.Gstars.json | jq -r '.likes[] | select(.issuer | strings | test("'$G1PUB'"))') + ## DATA EXTRACTION FROM ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json + my_star_level=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r '.yours.level'); + gscore=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r '.score'); + myfriendship=$(cat ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json | jq -r '.likes[] | select(.issuer | strings | test("'$G1PUB'"))') ## OH MY FRIEND ! if [[ "$my_star_level" != "null" && "${liking_me}" != "$G1PUB" ]] then # ADD ${liking_me} TO MY ipfs FRIENDS list echo "LIKING with $my_star_level stars : Friend Ŋ1 SCORE $gscore " - mkdir -p ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me} + mkdir -p ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me} - cp ~/.zen/tmp/${liking_me}.Gstars.json ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/ && rm -f ~/.zen/tmp/${liking_me}.Gstars.json - echo "$my_star_level" > ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/stars.level && echo "***** $my_star_level STARS *****" + cp ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/ && rm -f ~/.zen/tmp/${IPFSNODEID}/${PLAYER}/${liking_me}.Gstars.json + echo "$my_star_level" > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/stars.level && echo "***** $my_star_level STARS *****" ## GET FRIEND TW !! echo "Getting latest online TW..." @@ -112,21 +116,21 @@ do LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | cut -d ' ' -f 2) echo "$LIBRA/ipns/$ASTRONAUTENS" echo "http://$myIP:8080/ipns/$ASTRONAUTENS ($YOU)" - [[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/index.html - [[ ! -s ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/index.html ]] && curl -m 12 -so ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/index.html "$LIBRA/ipns/$ASTRONAUTENS" + [[ $YOU ]] && ipfs --timeout 12s cat /ipns/$ASTRONAUTENS > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html + [[ ! -s ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html ]] && curl -m 12 -so ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html "$LIBRA/ipns/$ASTRONAUTENS" ## PLAYER TW EXISTING ? - if [ ! -s ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/index.html ]; then + if [ ! -s ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html ]; then # # # # # # # # # # # # # # # ## AUCUN VISA ASTRONAUTE ENVOYER UN MESSAGE PAR GCHANGE echo "AUCUN TW ACTIF. ENVOYONS LUI UN MESSAGE..." - $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/$PLAYER/secret.dunikey -n "https://data.gchange.fr" send -d "${liking_me}" -t "SALUT. Je suis sur Astroport. Tu viens." -m "Active ton TW avec moi : http://libra.copylaradio.com:1234 - DEV MODE -" + $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n "https://data.gchange.fr" send -d "${liking_me}" -t "SALUT. Je suis sur Astroport. Tu viens." -m "Active ton TW avec moi : http://libra.copylaradio.com:1234 - DEV MODE -" else echo "COOL MON AMI PUBLIE SUR IPFS" - ls -al ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/index.html + ls -al ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html # # # # # # # # # # # # # # # TODO # CHECK Dessin de Moa ?? (DIS)CONNECT PLAYERS # # # # # # # # # # # # # # # @@ -136,22 +140,22 @@ do ## ACTIVER RECUP ANNONCES... ## Get Ŋ2 LEVEL - echo "(°▃▃°) (°▃▃°) (°▃▃°) Ŋ2 scraping ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/friend_of_friend.json" - for nid in $(cat ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/${liking_me}.Gstars.json | jq -r '.likes[].issuer'); + echo "(°▃▃°) (°▃▃°) (°▃▃°) Ŋ2 scraping ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/friend_of_friend.json" + for nid in $(cat ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/${liking_me}.Gstars.json | jq -r '.likes[].issuer'); do echo "Ami(s) de cet Ami $linking_me : $nid" - friend_of_friend=$(cat ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/${liking_me}.Gstars.json | jq -r '.likes[] | select(.issuer | strings | test("'$nid'"))') - echo "$friend_of_friend" | jq -r > ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/friend_of_friend.json + friend_of_friend=$(cat ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/${liking_me}.Gstars.json | jq -r '.likes[] | select(.issuer | strings | test("'$nid'"))') + echo "$friend_of_friend" | jq -r > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/friend_of_friend.json done echo "***** Keep G1/IPNS conversion *****" - echo ${G1PUB} > ~/.zen/game/players/$PLAYER/FRIENDS/${liking_me}/${ASTRONAUTENS} + echo ${G1PUB} > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/${ASTRONAUTENS} else 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." fi diff --git a/tools/mailjet.sh b/tools/mailjet.sh index 92662d8b..f6bd2087 100755 --- a/tools/mailjet.sh +++ b/tools/mailjet.sh @@ -23,7 +23,7 @@ messfile="$2" # CORPS MESSAGE [[ ! $1 ]] && mail="support@qo-op.com" SUBJECT="[(♥‿‿♥)] message personnel. merci. " -MESSAGE="( ◕‿◕) Bonjour $PLAYER\n\nBootez sur votre TW personnelle http://qo-op.com:1234 .\n\nAstroport" +MESSAGE="( ◕‿◕) Bonjour $PLAYER\n\nBootez sur votre TW http://qo-op.com:1234 .\n\nAstroport" echo "From: fred@g1sms.fr To: EMAIL