From dfc7339015c5a6a90011965d32d034060bb844b4 Mon Sep 17 00:00:00 2001 From: fred Date: Thu, 18 Apr 2024 16:25:02 +0200 Subject: [PATCH] Use ~/.zen/tmp/coucou/ # TODO : RECUP ANNONCES Gchange ADD TO TW + email tiddler --- RUNTIME/PLAYER.refresh.sh | 128 +++++++++--------- tools/Connect_PLAYER_To_Gchange.sh | 203 +++++++++++++++-------------- 2 files changed, 171 insertions(+), 160 deletions(-) diff --git a/RUNTIME/PLAYER.refresh.sh b/RUNTIME/PLAYER.refresh.sh index 30e6a3dc..4866d79c 100755 --- a/RUNTIME/PLAYER.refresh.sh +++ b/RUNTIME/PLAYER.refresh.sh @@ -29,7 +29,7 @@ PLAYERONE="$1" # [[ $isLAN ]] && PLAYERONE=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) [[ ! ${PLAYERONE} ]] && PLAYERONE=($(ls -t ~/.zen/game/players/ | grep "@" 2>/dev/null)) -echo "FOUND ${#PLAYERONE[@]} : ${PLAYERONE[@]}" +echo "FOUND ${#PLAYERONE[@]} ASTRONAUTS : ${PLAYERONE[@]}" CURRENT=$(readlink ~/.zen/game/players/.current | rev | cut -d '/' -f 1 | rev) echo "RENEWING LOCAL UPLANET REPOSITORY (ADMIN=${CURRENT}) @@ -426,17 +426,17 @@ for PLAYER in ${PLAYERONE[@]}; do -e "s~_SECTORTW_~${SECTORIPNS}/TW~g" \ > ~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json - echo "SECTOR $SECTOR SECTORTW=${SECTORIPNS}/TW" + echo "SECTORTW_NEWS $SECTOR SECTORTW=${SECTORIPNS}/TW :: ~/.zen/tmp/${MOATS}/SECTORTW_NEWS.json" ############################################################# # Connect_PLAYER_To_Gchange.sh : Sync FRIENDS TW - TODO : REWRITE ######################################### BETTER USE json FILE IN /ipns/$IPFSNODEID/COINS #~ echo "##################################################################" - #~ [[ $(echo "$COINS >= 500" | bc -l) -eq 1 ]] \ - #~ && echo "## Connect_PLAYER_To_Gchange.sh" \ - #~ && ${MY_PATH}/../tools/Connect_PLAYER_To_Gchange.sh "${PLAYER}" \ - #~ || echo "$COINS <= 1 G1 + 10 ẑen : bypass Gchange stars exchange (★★★★★)" + [[ -s ~/.zen/tmp/coucou/${G1PUB}.gchange.json ]] \ + && echo "## Connect_PLAYER_To_Gchange.sh (★★★★★)" \ + && ${MY_PATH}/../tools/Connect_PLAYER_To_Gchange.sh "${PLAYER}" \ + || echo "NO Gchange account found" ############################################################## # G1PalPay - 2 G1 mini -> Check for G1 TX incoming comments # @@ -480,13 +480,14 @@ for PLAYER in ${PLAYERONE[@]}; do || echo "ERROR - CANNOT CREATE TW NEWINDEX - ERROR" ########################### - - #### SEND TODAY UPlanetZINE/day${days} ZINE - ZINE2="${MY_PATH}/../templates/UPlanetZINE/day${days}/index.${lang}.html" - [[ ! -s ${ZINE2} ]] && ZINE2="${MY_PATH}/../templates/UPlanetZINE/day${days}/index.html" - [[ -s ${ZINE2} ]] \ - && echo "SENDING ZINE2 DAY ${days} + mailjet TW import " \ - && ${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ${ZINE2} "ZINE #${days}" "${HOME}/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html" \ + ######################## + ## SEND TODAY ZINE + #### UPlanetZINE/day${days}/index.${lang}.html + TODAYZINE="${MY_PATH}/../templates/UPlanetZINE/day${days}/index.${lang}.html" + [[ ! -s ${TODAYZINE} ]] && TODAYZINE="${MY_PATH}/../templates/UPlanetZINE/day${days}/index.html" + [[ -s ${TODAYZINE} ]] \ + && echo "SENDING TODAYZINE DAY ${days} + mailjet TW import " \ + && ${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ${TODAYZINE} "ZINE #${days}" "${HOME}/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html" \ || echo "NO ZINE FOR DAY ${days}" @@ -507,6 +508,9 @@ for PLAYER in ${PLAYERONE[@]}; do cp ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain \ ~/.zen/game/players/${PLAYER}/ipfs/moa/.chain.$(cat ~/.zen/game/players/${PLAYER}/ipfs/moa/.moats) + ## CLEAN .chain CACHE + find ~/.zen/game/players/${PLAYER}/ipfs/moa/ -mtime +30 -type f -exec rm -f '{}' \; + ########################################## ## TW IPFS ADD & PUBLISH ########################################## @@ -528,64 +532,66 @@ for PLAYER in ${PLAYERONE[@]}; do echo "${PLAYER}" \ > ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html -if [[ ${days} -ge 14 ]]; then - ################### - # REFRESH PLAYER_feed KEY - echo "(☉_☉ ) (☉_☉ ) (☉_☉ ) RSS" + ######################################################### + ##### AFTER 2 WEEKS : START TW JSON RSS EXPORT + if [[ ${days} -ge 14 ]]; then + ################### + # REFRESH PLAYER_feed KEY + echo "(☉_☉ ) (☉_☉ ) (☉_☉ ) RSS" - ######################################################################################### - ## CREATING 30 DAYS JSON RSS STREAM - # [days:created[-30]!is[system]!tag[G1Voeu]!externalTiddler[yes]!tag[load-external]] - ######################################################################################### - tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \ - --output ~/.zen/game/players/${PLAYER}/ipfs \ - --render '.' "${PLAYER}.rss.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-30]!is[system]!tag[G1Voeu]!externalTiddler[yes]!tag[load-external]]' + ######################################################################################### + ## CREATING 30 DAYS JSON RSS STREAM + # [days:created[-30]!is[system]!tag[G1Voeu]!externalTiddler[yes]!tag[load-external]] + ######################################################################################### + tiddlywiki --load ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \ + --output ~/.zen/game/players/${PLAYER}/ipfs \ + --render '.' "${PLAYER}.rss.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-30]!is[system]!tag[G1Voeu]!externalTiddler[yes]!tag[load-external]]' - [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json ]] \ - && echo "NO ${PLAYER} RSS - BAD " + [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json ]] \ + && echo "NO ${PLAYER} RSS - BAD " - echo "~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json" + echo "~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json" - ######################################################## - #### PLAYER ACCOUNT HAVE NEW TIDDLER or NOT ######### - if [[ $(cat ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json) == "[]" && "${CURRENT}" != "${PLAYER}" ]]; then - echo "ALERT -- RSS IS EMPTY -- COINS=$COINS / ZEN=$ZEN --" - ## DEAD PLAYER ?? - if [[ ${days} -eq 27 ]]; then - echo "

🔋WARNING

" > ~/.zen/tmp/alert - echo "

${PLAYER} TW 🔌📺

🌥 $ZEN ZEN 🌥 " >> ~/.zen/tmp/alert + ######################################################## + #### PLAYER ACCOUNT HAVE NEW TIDDLER or NOT ######### + if [[ $(cat ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json) == "[]" && "${CURRENT}" != "${PLAYER}" ]]; then + echo "ALERT -- RSS IS EMPTY -- COINS=$COINS / ZEN=$ZEN -- $days DAYS" + ## DEAD PLAYER ?? + if [[ ${days} -eq 27 ]]; then + echo "

🔋WARNING

" > ~/.zen/tmp/alert + echo "

${PLAYER} TW 🔌📺

🌥 $ZEN ZEN 🌥 " >> ~/.zen/tmp/alert + + ${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/alert "TW ALERT" + echo "<<<< PLAYER TW WARNING <<<< ${DIFF_SECONDS} > ${days} days" + fi + if [[ ${days} -gt 29 ]]; then + #################################### UNPLUG ACCOUNT + echo ">>>> PLAYER TW UNPLUG >>>>> ${days} days => BYE BYE ${PLAYER} ZEN=$ZEN" + ${MY_PATH}/PLAYER.unplug.sh ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ${PLAYER} "ALL" + continue + fi + + ## PAY 1 ZEN TO UMAPG1PUB + [[ "${UMAPG1PUB}" != "" ]] \ + && ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "0.1" "${UMAPG1PUB}" "UPLANET:TW:${YOUSER}:/ipfs/${TW}" + + else + + ### PLAYER ALIVE PUBLISH RSS & + FEEDNS=$(ipfs key list -l | grep -w "${PLAYER}_feed" | cut -d ' ' -f 1) + [[ ${FEEDNS} ]] \ + && IRSS=$(ipfs add --pin=false -q ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json | tail -n 1) \ + && echo "Publishing ${PLAYER}_feed: /ipns/${FEEDNS} => /ipfs/${IRSS}" \ + && ipfs --timeout 300s name publish --key="${PLAYER}_feed" /ipfs/${IRSS} \ + || echo ">>>>> WARNING ${PLAYER}_feed IPNS KEY PUBLISHING CUT - WARNING" - ${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/alert "TW ALERT" - echo "<<<< PLAYER TW WARNING <<<< ${DIFF_SECONDS} > ${days} days" - fi - if [[ ${days} -gt 29 ]]; then - #################################### UNPLUG ACCOUNT - echo ">>>> PLAYER TW UNPLUG >>>>> ${days} days => BYE BYE ${PLAYER} ZEN=$ZEN" - ${MY_PATH}/PLAYER.unplug.sh ~/.zen/game/players/${PLAYER}/ipfs/moa/index.html ${PLAYER} "ALL" - continue fi - ## PAY 1 ZEN TO UMAPG1PUB - [[ "${UMAPG1PUB}" != "" ]] \ - && ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "0.1" "${UMAPG1PUB}" "UPLANET:TW:${YOUSER}:/ipfs/${TW}" - - else - - ### PLAYER ALIVE PUBLISH RSS & - FEEDNS=$(ipfs key list -l | grep -w "${PLAYER}_feed" | cut -d ' ' -f 1) - [[ ${FEEDNS} ]] \ - && IRSS=$(ipfs add --pin=false -q ~/.zen/game/players/${PLAYER}/ipfs/${PLAYER}.rss.json | tail -n 1) \ - && echo "Publishing ${PLAYER}_feed: /ipns/${FEEDNS} => /ipfs/${IRSS}" \ - && ipfs --timeout 300s name publish --key="${PLAYER}_feed" /ipfs/${IRSS} \ - || echo ">>>>> WARNING ${PLAYER}_feed IPNS KEY PUBLISHING CUT - WARNING" + echo "${PLAYER}" \ + > ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}.feed.html fi - echo "${PLAYER}" \ - > ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}.feed.html - -fi - ## TODO CREATING 30 DAYS XML RSS STREAM ??? ## https://talk.tiddlywiki.org/t/has-anyone-generated-an-rss-feed-from-tiddlywiki/966/26 diff --git a/tools/Connect_PLAYER_To_Gchange.sh b/tools/Connect_PLAYER_To_Gchange.sh index 37f75791..d72de57b 100755 --- a/tools/Connect_PLAYER_To_Gchange.sh +++ b/tools/Connect_PLAYER_To_Gchange.sh @@ -25,136 +25,138 @@ 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 -w ${PLAYER} | cut -d ' ' -f1) - [[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore -- EXIT" && exit 1 - [[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] && echo "NOT MY ${PLAYER} -- EXIT" && exit 1 +ZLAT=$(cat ~/.zen/game/players/${PLAYER}/GPS.json | jq -r .[].lat) +ZLON=$(cat ~/.zen/game/players/${PLAYER}/GPS.json | jq -r .[].lon) + +## REFRESH ASTRONAUTE TW +ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1) +[[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore -- EXIT" && exit 1 +[[ ! -f ~/.zen/game/players/${PLAYER}/QR.png ]] && echo "NOT MY ${PLAYER} -- EXIT" && exit 1 mkdir -p ~/.zen/tmp/${IPFSNODEID}/GCHANGE/${PLAYER}/ -## VERIFY IT HAS ALREADY RUN +## REFRESH GCHANGE PROFILE +${MY_PATH}/timeout.sh -t 20 \ +curl -s ${myDATA}/user/profile/${G1PUB} > ~/.zen/tmp/coucou/${G1PUB}.gchange.json +[[ ! $? == 0 ]] && echo "xxxxx ERROR PROBLEM WITH GCHANGE+ NODE ${myDATA} xxxxx" && exit 1 + + +[[ ! $(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.title' 2>/dev/null) ]] \ + && echo "xxxxx GCHANGE+ MISSING ACCOUNT ${myDATA} xxxxx" \ + && ${MY_PATH}/timeout.sh -t 20 \ + ${MY_PATH}/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey set -n "qo-op" -v " " -a " " -d " " -pos ${ZLAT} ${ZLON} -s https://qo-op.com -A ${MY_PATH}/../images/plain.png \ + && exit 0 + +## GET AVATAR PICTURE +cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '._source.avatar._content' | base64 -d > "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.gchange_avatar.png" 2>/dev/null +# CLEANING BAD FILE TYPE +[[ ! $(file -b "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.gchange_avatar.png" | grep PNG) ]] && rm "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.gchange_avatar.png" + +## GET CESIUM PUBKEY & C+ PROFILE +CPUB=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '._source.pubkey' 2>/dev/null) +if [[ $CPUB && $CPUB != 'null' ]]; then + + echo "OHH ... GET CPUB+ PROFILE .... $CPUB" - ## GET GCHANGE PROFIL ${MY_PATH}/timeout.sh -t 20 \ - curl -s ${myDATA}/user/profile/${G1PUB} > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json - [[ ! $? == 0 ]] && echo "xxxxx ERROR PROBLEM WITH GCHANGE+ NODE ${myDATA} xxxxx" && exit 1 - [[ ! $(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.title' 2>/dev/null) ]] \ - && echo "xxxxx GCHANGE+ MISSING ACCOUNT ${myDATA} xxxxx" \ - && ${MY_PATH}/timeout.sh -t 20 \ - ${MY_PATH}/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey set -n " " -v " " -a " " -d " " -pos 0.00 0.00 -s https://qo-op.com -A ${MY_PATH}/../images/plain.png \ - && exit 0 + curl -s ${myCESIUM}/user/profile/${CPUB} > ~/.zen/tmp/coucou/${G1PUB}.cesium.json 2>/dev/null + [[ ! $? == 0 ]] && echo "xxxxx ERROR PROBLEM WITH CESIUM+ NODE ${myCESIUM} xxxxx" - # $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json - ## GET AVATAR PICTURE - cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '._source.avatar._content' | base64 -d > "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.gchange_avatar.png" 2>/dev/null - # CLEANING BAD FILE TYPE - [[ ! $(file -b "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.gchange_avatar.png" | grep PNG) ]] && rm "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.gchange_avatar.png" - - ## GET CESIUM PUBKEY & C+ PROFILE - CPUB=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '._source.pubkey' 2>/dev/null) - if [[ $CPUB && $CPUB != 'null' ]]; then - - echo "OHH ... GET CPUB+ PROFILE .... $CPUB" - - ${MY_PATH}/timeout.sh -t 20 \ - curl -s ${myCESIUM}/user/profile/${CPUB} > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json 2>/dev/null - [[ ! $? == 0 ]] && echo "xxxxx ERROR PROBLEM WITH CESIUM+ NODE ${myCESIUM} xxxxx" - - cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '._source.avatar._content' | base64 -d > "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.cesium_avatar.png" 2>/dev/null - # CLEANING NOT PNG FILE - [[ ! $(file -b "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.cesium_avatar.png" | grep PNG) ]] && rm "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.cesium_avatar.png" + cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '._source.avatar._content' | base64 -d > "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.cesium_avatar.png" 2>/dev/null + # CLEANING NOT PNG FILE + [[ ! $(file -b "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.cesium_avatar.png" | grep PNG) ]] && rm "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.cesium_avatar.png" - CPSEUDO=$(cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '.title' 2>/dev/null) + CPSEUDO=$(cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '.title' 2>/dev/null) - [[ ${CPSEUDO} ]] \ - && echo "♥PARTNER ${CPSEUDO}" \ - && echo "$CPUB" > ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/G1CPUB \ - || echo "NO CPUB CESIUM PROFILE" + [[ ${CPSEUDO} ]] \ + && echo "♥PARTNER ${CPSEUDO}" \ + && echo "$CPUB" > ~~/.zen/tmp/coucou/${G1PUB}G1CPUB \ + || echo "NO CPUB CESIUM PROFILE" - else +else - echo "NO CPUB CESIUM PROFILE" + echo "NO CPUB CESIUM PROFILE" - fi +fi - echo "... TRY TO GET CESIUM+ WALLET PROFILE .... " + echo "... TRY TO GET CESIUM+ WALLET PROFILE .... " - ${MY_PATH}/timeout.sh -t 20 \ - curl -s ${myCESIUM}/user/profile/${G1PUB} > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json 2>/dev/null - [[ ! $? == 0 ]] && echo "xxxxx ERROR PROBLEM WITH CESIUM+ NODE ${myCESIUM} xxxxx" + ${MY_PATH}/timeout.sh -t 20 \ + curl -s ${myCESIUM}/user/profile/${G1PUB} > ~/.zen/tmp/coucou/${G1PUB}.cesium.json 2>/dev/null + [[ ! $? == 0 ]] && echo "xxxxx ERROR PROBLEM WITH CESIUM+ NODE ${myCESIUM} xxxxx" - cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '._source.avatar._content' | base64 -d > "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.cesium_avatar.png" 2>/dev/null - [[ ! $(file -b "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.cesium_avatar.png" | grep PNG) ]] && rm "$HOME/.zen/game/players/${PLAYER}/ipfs/G1SSB/_g1.cesium_avatar.png" + cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '._source.avatar._content' | base64 -d > "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.cesium_avatar.png" 2>/dev/null + [[ ! $(file -b "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.cesium_avatar.png" | grep PNG) ]] && rm "$HOME~/.zen/tmp/coucou/${G1PUB}_g1.cesium_avatar.png" - CPSEUDO=$(cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '.title' 2>/dev/null) + CPSEUDO=$(cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '.title' 2>/dev/null) - [[ ${CPSEUDO} ]] \ - && echo "Ğ1 WALLET " \ - && echo "${G1PUB}" > ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/G1WALLET \ - || echo "NO WALLET FOR THIS PLAYER" + [[ ${CPSEUDO} ]] \ + && echo "Ğ1 WALLET " \ + && echo "${G1PUB}" > ~~/.zen/tmp/coucou/${G1PUB}G1WALLET \ + || echo "NO WALLET FOR THIS PLAYER" - ## KEEPING ALREADY EXISTING PROFILE DATA - GPSEUDO=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.title' 2>/dev/null) - [[ ! ${GPSEUDO} || ${GPSEUDO} == "null" ]] && GPSEUDO="$PSEUDO" - CPSEUDO=$(cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '.title' 2>/dev/null) - [[ ! ${CPSEUDO} || ${CPSEUDO} == "null" ]] && CPSEUDO="${PLAYER}" +## KEEPING ALREADY EXISTING PROFILE DATA +GPSEUDO=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.title' 2>/dev/null) +[[ ! ${GPSEUDO} || ${GPSEUDO} == "null" ]] && GPSEUDO="$PSEUDO" +CPSEUDO=$(cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '.title' 2>/dev/null) +[[ ! ${CPSEUDO} || ${CPSEUDO} == "null" ]] && CPSEUDO="${PLAYER}" - GDESCR=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.description' 2>/dev/null) - [[ ! ${GDESCR} || ${GDESCR} == "null" ]] && GDESCR="Astronaute GChange" - CDESCR=$(cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '.description' 2>/dev/null) - [[ ! ${CDESCR} || ${CDESCR} == "null" ]] && CDESCR="Portefeuille Astro" +GDESCR=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.description' 2>/dev/null) +[[ ! ${GDESCR} || ${GDESCR} == "null" ]] && GDESCR="Astronaute GChange" +CDESCR=$(cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '.description' 2>/dev/null) +[[ ! ${CDESCR} || ${CDESCR} == "null" ]] && CDESCR="Portefeuille Astro" - GVILLE=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.city' 2>/dev/null) - [[ ! ${GVILLE} || ${GVILLE} == "null" ]] && GVILLE="" - CVILLE=$(cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '.city' 2>/dev/null) - [[ ! ${CVILLE} || ${CVILLE} == "null" ]] && CVILLE="" +GVILLE=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.city' 2>/dev/null) +[[ ! ${GVILLE} || ${GVILLE} == "null" ]] && GVILLE="" +CVILLE=$(cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '.city' 2>/dev/null) +[[ ! ${CVILLE} || ${CVILLE} == "null" ]] && CVILLE="" - GADRESSE=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.address' 2>/dev/null) - [[ ! ${GADRESSE} || ${GADRESSE} == "null" ]] && GADRESSE="" - CADRESSE=$(cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json | jq -r '.address' 2>/dev/null) - [[ ! ${CADRESSE} || ${CADRESSE} == "null" ]] && CADRESSE="" +GADRESSE=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.address' 2>/dev/null) +[[ ! ${GADRESSE} || ${GADRESSE} == "null" ]] && GADRESSE="" +CADRESSE=$(cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json | jq -r '.address' 2>/dev/null) +[[ ! ${CADRESSE} || ${CADRESSE} == "null" ]] && CADRESSE="" - # POSITION=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.geoPoint') - # SITE=$(cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json | jq -r '.socials' 2>/dev/null) - echo ">> GCHANGE+ : ${GPSEUDO} - ${GDESCR} : ${G1PUB} ($CPUB) <<" - echo ">> CESIUM+ : ${CPSEUDO} - ${CDESCR} : ${G1PUB} <<" +# POSITION=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.geoPoint') +# SITE=$(cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json | jq -r '.socials' 2>/dev/null) +echo ">> GCHANGE+ : ${GPSEUDO} - ${GDESCR} : ${G1PUB} ($CPUB) <<" +echo ">> CESIUM+ : ${CPSEUDO} - ${CDESCR} : ${G1PUB} <<" - ######################################################################## - # echo "set -n "${GPSEUDO}" -d "${GDESCR}" -v "${GVILLE}" -a "${GADRESSE}"" - ######################################################################## - #~ if [[ ! -s ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/G1WALLET && -s ~/.zen/game/players/${PLAYER}/QRTWavatar.png ]]; then +######################################################################## +# echo "set -n "${GPSEUDO}" -d "${GDESCR}" -v "${GVILLE}" -a "${GADRESSE}"" +######################################################################## +#~ if [[ ! -s ~~/.zen/tmp/coucou/${G1PUB}G1WALLET && -s ~/.zen/game/players/${PLAYER}/QRTWavatar.png ]]; then - #~ echo "CREATING GCHANGE+ PROFILE https://www.gchange.fr/#/app/user?q=${G1PUB}" + #~ echo "CREATING GCHANGE+ PROFILE https://www.gchange.fr/#/app/user?q=${G1PUB}" - #~ ${MY_PATH}/timeout.sh -t 20 \ - #~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey set -n "${GPSEUDO}" -d "${GDESCR}" -v "${GVILLE}" -a "${GADRESSE}" -s "$LIBRA/ipns/$ASTRONAUTENS" -A ~/.zen/game/players/${PLAYER}/QRG1avatar.png #GCHANGE+ - #~ [[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" \ - #~ || cat ~/.zen/game/players/${PLAYER}/ipfs/gchange.json > ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/gchange.1st.json + #~ ${MY_PATH}/timeout.sh -t 20 \ + #~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey set -n "${GPSEUDO}" -d "${GDESCR}" -v "${GVILLE}" -a "${GADRESSE}" -s "$LIBRA/ipns/$ASTRONAUTENS" -A ~/.zen/game/players/${PLAYER}/QRG1avatar.png #GCHANGE+ + #~ [[ ! $? == 0 ]] && echo "GCHANGE PROFILE CREATION FAILED" \ + #~ || cat ~/.zen/tmp/coucou/${G1PUB}.gchange.json > ~~/.zen/tmp/coucou/${G1PUB}gchange.1st.json - #~ echo " CREATING CESIUM+ https://demo.cesium.app/#/app/wot/lg?q=${G1PUB}" + #~ echo " CREATING CESIUM+ https://demo.cesium.app/#/app/wot/lg?q=${G1PUB}" - #~ ${MY_PATH}/timeout.sh -t 20 \ - #~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myCESIUM} set -n "${CPSEUDO}" -d "${CDESCR}" -v "${CVILLE}" -a "${CADRESSE}" --s "http://ipfs.localhost:8080/ipns/$ASTRONAUTENS" -A ~/.zen/game/players/${PLAYER}/QRTWavatar.png #CESIUM+ - #~ [[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" \ - #~ || cat ~/.zen/game/players/${PLAYER}/ipfs/cesium.json > ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/cesium.1st.json + #~ ${MY_PATH}/timeout.sh -t 20 \ + #~ $MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myCESIUM} set -n "${CPSEUDO}" -d "${CDESCR}" -v "${CVILLE}" -a "${CADRESSE}" --s "http://ipfs.localhost:8080/ipns/$ASTRONAUTENS" -A ~/.zen/game/players/${PLAYER}/QRTWavatar.png #CESIUM+ + #~ [[ ! $? == 0 ]] && echo "CESIUM PROFILE CREATION FAILED" \ + #~ || cat ~/.zen/tmp/coucou/${G1PUB}.cesium.json > ~~/.zen/tmp/coucou/${G1PUB}cesium.1st.json - #~ fi +#~ fi ## GET LAST ONLINE gchange & cesium PROFILE ${MY_PATH}/timeout.sh -t 20 \ -$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myDATA} get > ~/.zen/game/players/${PLAYER}/ipfs/gchange.json +$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myDATA} get > ~/.zen/tmp/coucou/${G1PUB}.gchange.json ${MY_PATH}/timeout.sh -t 20 \ -$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myCESIUM} get > ~/.zen/game/players/${PLAYER}/ipfs/cesium.json +$MY_PATH/jaklis/jaklis.py -k ~/.zen/game/players/${PLAYER}/secret.dunikey -n ${myCESIUM} get > ~/.zen/tmp/coucou/${G1PUB}.cesium.json ######################################################################## - # Get PLAYER wallet amount :: ~/.zen/game/players/${PLAYER}/ipfs/G1SSB/COINS + # Get PLAYER wallet amount :: ~~/.zen/tmp/coucou/${G1PUB}COINS COINS=$($MY_PATH/COINScheck.sh ${G1PUB} | tail -n 1) echo "+++ YOU have ${COINS} Ğ1 Coins +++" ######################################################################## @@ -206,14 +208,19 @@ do ## COUNT NUMBER OF STAR COLLECT TRIES try=$(cat ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}.try 2>/dev/null) || try=0 - [[ $try > 2 && ( $try < 30 || $try > 31 ) ]] \ + [[ $try > 2 && ( $try < 29 || $try > 31 ) ]] \ && echo "${liking_me} TOO MANY TRY ( $try )" \ && ((try++)) && echo $try > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}.try \ && continue -#### TODO RECUP ANNONCES Gchange ADD TO TW +######################################################################################### +######################################################################################### +#### TODO RECUP ANNONCES Gchange ADD TO TW + email tiddler ## https://www.gchange.fr/#/app/records/wallet?q=2geH4d2sndR47XWtfDWsfLLDVyNNnRsnUD3b1sk9zYc4&old ## https://www.gchange.fr/#/app/market/records/42LqLa7ARTZqUKGz2Msmk79gwsY8ZSoFyMyPyEnoaDXR +######################################################################################### +## https://forum.monnaie-libre.fr/t/proposition-damelioration-de-gchange/1940/49 +######################################################################################### ## DATA EXTRACTION FROM ~/.zen/tmp/${IPFSNODEID}/GCHANGE/${PLAYER}/${liking_me}.Gstars.json my_star_level=$(cat ~/.zen/tmp/${IPFSNODEID}/GCHANGE/${PLAYER}/${liking_me}.Gstars.json | jq -r '.yours.level') || my_star_level=1 @@ -248,10 +255,6 @@ do YOU=$(ipfs swarm peers >/dev/null 2>&1 && echo "$USER" || ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | xargs | cut -d " " -f 1); LIBRA=$(head -n 2 ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | tail -n 1 | xargs | cut -d ' ' -f 2) - # DISPLAY TIMER - # ${MY_PATH}/displaytimer.sh 60 & - - [[ $YOU ]] \ && echo "ipfs --timeout 120s cat --progress=false /ipns/${FRIENDNS} > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html" \ && ipfs --timeout 120s cat --progress=false /ipns/${FRIENDNS} > ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/index.html @@ -356,6 +359,8 @@ do cp ~/.zen/game/players/${PLAYER}/FRIENDS/${liking_me}/FoF_$nid.json \ ~/.zen/tmp/${IPFSNODEID}/GCHANGE/${PLAYER}/${liking_me}.FoF_$nid.json + ## TODO : Send message to Friend(s) of my Friend + done else