2022-08-23 13:38:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
################################################################################
|
|
|
|
# Author: Fred (support@qo-op.com)
|
|
|
|
# Version: 0.1
|
|
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
|
|
################################################################################
|
|
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
2022-12-29 14:51:05 +01:00
|
|
|
. "$MY_PATH/../tools/my.sh"
|
|
|
|
|
2022-08-23 13:38:37 +02:00
|
|
|
################################################################################
|
|
|
|
# Inspect game wishes, refresh latest IPNS version
|
2022-10-10 00:39:07 +02:00
|
|
|
# SubProcess Backup and chain
|
2023-09-28 17:03:25 +02:00
|
|
|
# ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/*
|
2023-07-11 13:26:11 +02:00
|
|
|
# ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/*
|
|
|
|
# _PLAYER.json
|
|
|
|
|
2024-02-17 15:34:47 +01:00
|
|
|
# change SWARM memory
|
|
|
|
### # ~/.zen/tmp/${IPFSNODEID}/WISH/${WISHNAME}/${PLAYER}/*
|
2023-07-11 13:26:11 +02:00
|
|
|
|
2022-12-28 23:11:16 +01:00
|
|
|
PLAYER="$1" ## IPNS KEY NAME - G1PUB - PLAYER ...
|
2023-07-06 17:06:09 +02:00
|
|
|
[[ ! ${PLAYER} ]] && echo "Please provide PLAYER publish key" && exit 1
|
2022-08-23 19:27:38 +02:00
|
|
|
|
2022-12-30 17:07:08 +01:00
|
|
|
MOATS="$2"
|
|
|
|
|
2023-01-08 20:02:49 +01:00
|
|
|
PSEUDO=$(cat ~/.zen/game/players/${PLAYER}/.pseudo 2>/dev/null)
|
|
|
|
G1PUB=$(cat ~/.zen/game/players/${PLAYER}/.g1pub 2>/dev/null)
|
2023-04-08 12:18:27 +02:00
|
|
|
COINS=$(cat $HOME/.zen/tmp/coucou/${G1PUB}.COINS)
|
2023-01-08 20:02:49 +01:00
|
|
|
ASTRONS=$(cat ~/.zen/game/players/${PLAYER}/.playerns 2>/dev/null)
|
2022-11-05 22:08:18 +01:00
|
|
|
|
|
|
|
## REFRESH ASTRONAUTE TW
|
2023-03-04 00:22:08 +01:00
|
|
|
ASTRONAUTENS=$(ipfs key list -l | grep -w ${PLAYER} | cut -d ' ' -f1)
|
2023-01-08 20:02:49 +01:00
|
|
|
[[ ! $ASTRONAUTENS ]] && echo "WARNING No ${PLAYER} in keystore --" && ASTRONAUTENS=$ASTRONS
|
|
|
|
[[ ! $ASTRONAUTENS ]] && echo "Missing ${PLAYER} IPNS KEY - CONTINUE --" && exit 1
|
2022-08-25 17:21:39 +02:00
|
|
|
|
2023-01-02 01:58:09 +01:00
|
|
|
INDEX="$3"
|
2023-01-08 20:02:49 +01:00
|
|
|
[[ ! $INDEX ]] && INDEX="$HOME/.zen/game/players/${PLAYER}/ipfs/moa/index.html"
|
|
|
|
[[ ! -s $INDEX ]] && echo "TW ${PLAYER} manquant" && exit 1
|
2022-10-28 01:51:34 +02:00
|
|
|
|
2023-09-28 17:03:25 +02:00
|
|
|
mkdir -p ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu
|
|
|
|
|
2023-09-07 02:07:41 +02:00
|
|
|
###############################
|
2024-04-06 16:14:19 +02:00
|
|
|
####### NEED G1 / ZEN TO RUN
|
2023-09-07 02:07:41 +02:00
|
|
|
[[ ${COINS} == "null" || ${COINS} == "" ]] \
|
|
|
|
&& echo ">>> ${COINS} : DESACTIVATED - NEED G1 TO REFRESH WISH - EXIT - " \
|
|
|
|
&& exit 0
|
2023-11-12 20:12:51 +01:00
|
|
|
echo "%% ${COINS} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
|
|
|
|
2024-04-06 16:14:19 +02:00
|
|
|
[[ $(echo "$COINS < 2" | bc -l) -eq 1 ]] && echo ">>> ${COINS} ONLY : 1 G1 + 10 ZEN NEEDED TO CONTINUE" && exit 0
|
2023-11-12 20:12:51 +01:00
|
|
|
|
2022-10-12 23:29:14 +02:00
|
|
|
###############################
|
|
|
|
## EXTRACT G1Voeu from PLAYER TW
|
2024-03-29 14:58:03 +01:00
|
|
|
echo "Exporting ${PLAYER} TW [days:created[-360]tag[G1Voeu]]"
|
2023-09-28 17:03:25 +02:00
|
|
|
rm -f ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json
|
2024-03-29 14:58:03 +01:00
|
|
|
tiddlywiki --load ${INDEX} --output ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu --render '.' "${PLAYER}.g1voeu.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:created[-360]tag[G1Voeu]]'
|
2022-10-12 23:29:14 +02:00
|
|
|
|
2024-02-27 03:12:15 +01:00
|
|
|
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json ]] \
|
|
|
|
&& echo "AUCUN G1VOEU - EXIT -" && exit 0
|
2022-10-24 16:19:33 +02:00
|
|
|
|
2024-02-27 03:12:15 +01:00
|
|
|
cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq -r 'map(select(.wish != null)) | .[].wish' > ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt
|
2024-01-05 17:58:09 +01:00
|
|
|
wishnumbers=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt | wc -l)
|
|
|
|
echo "${wishnumbers} VOEUX : ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt "
|
2022-10-16 02:57:29 +02:00
|
|
|
|
2023-07-06 17:06:09 +02:00
|
|
|
## ${PLAYER}.g1wishes.txt contains all TW G1PUB : IPNS key name
|
2022-10-24 14:59:14 +02:00
|
|
|
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
|
|
|
|
2022-10-12 23:29:14 +02:00
|
|
|
## GET VoeuTitle LIST
|
2022-10-16 02:57:29 +02:00
|
|
|
while read WISH
|
2022-08-23 13:38:37 +02:00
|
|
|
do
|
2023-02-27 15:10:21 +01:00
|
|
|
[[ ${WISH} == "" || ${WISH} == "null" ]] && echo "BLURP. EMPTY WISH" && continue
|
2022-10-24 14:59:14 +02:00
|
|
|
echo "==============================="
|
2023-03-02 23:48:10 +01:00
|
|
|
## Get ${WISHNAME}
|
2023-09-28 17:03:25 +02:00
|
|
|
WISHNAME=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .title')
|
2022-10-28 02:01:23 +02:00
|
|
|
[[ ! ${WISHNAME} ]] && echo "WISH sans NOM - CONTINUE -" && continue
|
2023-06-30 02:24:30 +02:00
|
|
|
echo "G1Voeu ${WISH} (${WISHNAME})"
|
2022-10-24 16:19:33 +02:00
|
|
|
|
2023-09-28 17:03:25 +02:00
|
|
|
IPNS_VOEUNS=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wishns')
|
|
|
|
VOEUKEY=$(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json | jq .[] | jq -r 'select(.wish=="'${WISH}'") | .wish')
|
2022-10-12 23:29:14 +02:00
|
|
|
|
2023-03-05 01:45:08 +01:00
|
|
|
ICHECK=$(ipfs key list -l | grep -w "$VOEUKEY" | cut -d ' ' -f 1 )
|
|
|
|
|
|
|
|
if [[ ! $ICHECK ]]; then
|
2023-04-15 21:59:50 +02:00
|
|
|
echo ">>> STATION MISSING $VOEUKEY - RESET ASTRONAUT WISHES - DERIVATED KEYS RECREATE -"
|
2023-03-05 01:45:08 +01:00
|
|
|
sed -i "s~G1Voeu~voeu~g" $INDEX
|
2023-07-06 17:06:09 +02:00
|
|
|
break
|
2023-03-05 01:45:08 +01:00
|
|
|
else
|
2023-03-13 18:50:20 +01:00
|
|
|
VCOINS=$($MY_PATH/../tools/COINScheck.sh $VOEUKEY | tail -n 1)
|
2023-03-05 01:45:08 +01:00
|
|
|
[[ $VCOINS == "" || $VCOINS == "null" ]] \
|
2023-04-06 14:58:24 +02:00
|
|
|
&& echo "G1WALLET NOT EXISTING YET : $VCOINS" \
|
2023-03-05 01:45:08 +01:00
|
|
|
|| echo "WISH G1WALLET = $VCOINS G1"
|
|
|
|
fi
|
|
|
|
|
2023-07-06 17:06:09 +02:00
|
|
|
## RUNNING WISH REFRESH : PLAYER CACHE
|
2023-09-28 17:03:25 +02:00
|
|
|
mkdir -p ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/${WISH}
|
2024-03-29 14:58:03 +01:00
|
|
|
cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1voeu.json \
|
|
|
|
| jq .[] | jq -r 'select(.wish=="'${WISH}'")' \
|
|
|
|
> ~/.zen/tmp/${MOATS}/${WISH}.json
|
2022-11-16 04:42:27 +01:00
|
|
|
##########################################################################
|
|
|
|
##########################################################################
|
2022-10-30 18:27:08 +01:00
|
|
|
## RUN SPECIFIC G1Voeu ASTROBOT PROGRAM (like G1CopierYoutube.sh)
|
2023-07-11 21:13:56 +02:00
|
|
|
if [[ -s $MY_PATH/../ASTROBOT/G1${WISHNAME}.sh ]]; then
|
2023-07-11 13:26:11 +02:00
|
|
|
echo "........................ Astrobot G1${WISHNAME}.sh PROGRAM FOUND !"
|
2022-10-12 23:29:14 +02:00
|
|
|
echo "________________________________ Running it *****"
|
2024-03-29 14:58:03 +01:00
|
|
|
${MY_PATH}/../ASTROBOT/G1${WISHNAME}.sh "$INDEX" "${PLAYER}" "$MOATS" "~/.zen/tmp/${MOATS}/${WISH}.json"
|
2022-10-12 23:29:14 +02:00
|
|
|
echo "________________________________ Finished ******"
|
2022-10-24 14:59:14 +02:00
|
|
|
else
|
2023-07-11 13:26:11 +02:00
|
|
|
echo "......................... NO G1${WISHNAME} PROGRAM... "
|
2022-10-12 23:29:14 +02:00
|
|
|
fi
|
2022-11-16 04:42:27 +01:00
|
|
|
##########################################################################
|
|
|
|
##########################################################################
|
2022-10-12 23:29:14 +02:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
###########################################################################################
|
|
|
|
##################################
|
2024-05-23 18:50:36 +02:00
|
|
|
## MAKE MY OWN EXTRACTION : [tag[G1'${WISHNAME}']!tag[G1Voeu]!sort[modified]limit[30]]
|
2023-07-11 13:26:11 +02:00
|
|
|
################################## MOA MAINTENANT
|
2024-01-07 22:32:36 +01:00
|
|
|
echo "> EXPORT [tag[G1${WISHNAME}]!tag[G1Voeu]] § $myIPFSGW${IPNS_VOEUNS}/_${PLAYER}.tiddlers.rss.json"
|
|
|
|
tiddlywiki --load ${INDEX} \
|
2023-09-28 17:03:25 +02:00
|
|
|
--output ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME} \
|
2024-05-23 18:50:36 +02:00
|
|
|
--render '.' _${PLAYER}'.tiddlers.rss.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]!sort[modified]limit[30]]'
|
2023-07-11 13:26:11 +02:00
|
|
|
|
|
|
|
|
2022-11-16 04:42:27 +01:00
|
|
|
## RUN TW Ŋ1 search & copy treatment
|
2022-10-24 14:59:14 +02:00
|
|
|
echo "*********************************"
|
2022-10-12 23:29:14 +02:00
|
|
|
##################################
|
2022-10-28 02:01:23 +02:00
|
|
|
## Search for [tag[G1${WISHNAME}]] in all Friends TW.
|
2022-10-12 23:29:14 +02:00
|
|
|
## Copy tiddlers ...
|
|
|
|
##################################
|
2022-11-11 18:22:35 +01:00
|
|
|
echo "NOW SEARCH Ŋ1 FRIENDS TW's FOR tag=G1${WISHNAME}"
|
2023-01-08 20:02:49 +01:00
|
|
|
echo "ls ~/.zen/game/players/${PLAYER}/FRIENDS/*/index.html"
|
2022-10-24 16:19:33 +02:00
|
|
|
echo "*********************************"
|
2022-10-12 23:29:14 +02:00
|
|
|
## Search in Local World (NB! G1Voeu TW copied by Connect_PLAYER_To_Gchange.sh)
|
2023-01-08 20:02:49 +01:00
|
|
|
FINDEX=($( ls $HOME/.zen/game/players/${PLAYER}/FRIENDS/*/index.html))
|
2022-09-27 00:09:24 +02:00
|
|
|
|
2023-03-19 15:11:43 +01:00
|
|
|
## PREPARE Ŋ1 WORLD MAP
|
|
|
|
echo "var examples = {};
|
|
|
|
examples['locations'] = function() {
|
2023-03-29 14:52:53 +02:00
|
|
|
var locations = {
|
|
|
|
" > ~/.zen/tmp/world.js
|
2023-03-19 15:11:43 +01:00
|
|
|
floop=1
|
|
|
|
|
2022-10-24 16:19:33 +02:00
|
|
|
for FRIENDTW in ${FINDEX[@]};
|
|
|
|
do
|
2023-03-20 21:21:46 +01:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
[[ ! -s ${FRIENDTW} ]] && echo "$floop / ${#FINDEX[@]} ${FRIENDTW} VIDE (AMI SANS TW)" && echo && ((floop++)) && continue
|
2023-03-20 21:31:51 +01:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
## GET FRIEND EMAIL = APLAYER (VERIFY TW IS OK)
|
|
|
|
tiddlywiki --load ${FRIENDTW} \
|
2023-03-20 21:21:46 +01:00
|
|
|
--output ~/.zen/tmp/${MOATS} \
|
|
|
|
--render '.' 'MadeInZion.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'MadeInZion'
|
|
|
|
[[ ! -s ~/.zen/tmp/${MOATS}/MadeInZion.json ]] && echo "${PLAYER} MadeInZion : BAD TW (☓‿‿☓) " && continue
|
2023-03-20 21:31:51 +01:00
|
|
|
|
2023-03-20 21:21:46 +01:00
|
|
|
APLAYER=$(cat ~/.zen/tmp/${MOATS}/MadeInZion.json | jq -r .[].player)
|
2022-10-27 20:36:25 +02:00
|
|
|
|
2024-01-07 22:32:36 +01:00
|
|
|
## EXPORT LAST 30 DAYS G1WishName in _${APLAYER}.tiddlers.rss.json
|
|
|
|
rm -f ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json
|
2023-03-20 21:21:46 +01:00
|
|
|
echo "$floop / ${#FINDEX[@]} TRY EXPORT [tag[G1${WISHNAME}]] FROM $APLAYER TW"
|
2023-07-11 13:26:11 +02:00
|
|
|
tiddlywiki --load ${FRIENDTW} \
|
2023-09-28 17:03:25 +02:00
|
|
|
--output ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME} \
|
2024-01-07 22:32:36 +01:00
|
|
|
--render '.' _${APLAYER}'.tiddlers.rss.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[G1'${WISHNAME}']!tag[G1Voeu]!sort[modified]limit[30]]'
|
2023-03-20 21:31:51 +01:00
|
|
|
|
2024-01-07 22:32:36 +01:00
|
|
|
[[ ! -s ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json ]] \
|
2023-03-20 21:31:51 +01:00
|
|
|
&& echo "NO ${WISHNAME} - CONTINUE -" \
|
|
|
|
&& echo && ((floop++)) && continue
|
|
|
|
|
2024-01-07 22:32:36 +01:00
|
|
|
[[ $(cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json) == "[]" ]] \
|
2023-07-14 15:45:07 +02:00
|
|
|
&& echo "EMPTY ${WISHNAME} - CONTINUE -" && echo && ((floop++)) \
|
2024-01-07 22:32:36 +01:00
|
|
|
&& rm ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json \
|
2023-07-14 15:45:07 +02:00
|
|
|
&& continue
|
2022-10-24 16:19:33 +02:00
|
|
|
|
2024-02-10 21:58:31 +01:00
|
|
|
#####################################################
|
2022-12-28 17:21:50 +01:00
|
|
|
echo "## TIDDLERS FOUND ;) MIAM >>> (◕‿‿◕) <<<"
|
2024-02-10 21:58:31 +01:00
|
|
|
##############################
|
|
|
|
## WRITE FRIEND SAME WISH TIDDLERS IN PLAYER TW ########
|
|
|
|
##############################
|
|
|
|
## SIGN Tiddlers
|
|
|
|
cat ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.rss.json \
|
|
|
|
| sed "s~${PLAYER}~~g" \
|
|
|
|
| sed "s~${APLAYER}~${APLAYER} ${PLAYER}~g" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.signed.json
|
|
|
|
|
|
|
|
## ADD TO TW
|
|
|
|
tiddlywiki --load ${INDEX} \
|
|
|
|
--import ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/_${APLAYER}.tiddlers.signed.json "application/json" \
|
|
|
|
--output ~/.zen/tmp/${MOATS} --render "$:/core/save/all" "newindex.html" "text/plain"
|
|
|
|
## CHECK IT IS OK
|
|
|
|
[[ -s ~/.zen/tmp/${MOATS}/newindex.html ]] \
|
|
|
|
&& cp ~/.zen/tmp/${MOATS}/newindex.html ${INDEX} \
|
|
|
|
&& rm ~/.zen/tmp/${MOATS}/newindex.html
|
|
|
|
|
|
|
|
##############################
|
2024-01-07 22:32:36 +01:00
|
|
|
echo ">>> G1FRIEND § $myIPFS${IPNS_VOEUNS}/_${APLAYER}.tiddlers.rss.json ${WISHNAME}"
|
2022-08-28 19:18:46 +02:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
# Extract Origin G1Voeu Tiddler
|
2023-03-19 15:11:43 +01:00
|
|
|
tiddlywiki --load ${FRIENDTW} --output ~/.zen/tmp --render '.' "${APLAYER}.${WISHNAME}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${WISHNAME}"
|
2023-07-11 13:26:11 +02:00
|
|
|
FWISHNS=$(cat ~/.zen/tmp/${APLAYER}.${WISHNAME}.json | jq -r '.[].wishns')
|
2023-11-30 18:23:35 +01:00
|
|
|
# FWISHPROG=$(cat ~/.zen/tmp/${APLAYER}.${WISHNAME}.json | jq -r '.[].text')
|
2023-12-31 15:06:34 +01:00
|
|
|
# TIDDLER COULD CONTAIN #!/bin/bash PROGRAM !!!
|
2023-07-11 13:26:11 +02:00
|
|
|
[[ $FWISHNS == "null" ]] && echo "NO FWISHNS in ~/.zen/tmp/${APLAYER}.${WISHNAME}.json" && echo && ((floop++)) && continue
|
|
|
|
echo ">>> ${myIPFS}${FWISHNS}"
|
2023-03-19 15:11:43 +01:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
###########################################################################################
|
|
|
|
## ADD WISH ON THE WORLD MAP (TODO: EXTRACT REAL GPS)
|
2023-03-25 15:03:14 +01:00
|
|
|
echo "${floop}: {
|
2023-03-19 15:11:43 +01:00
|
|
|
alpha: Math.random() * 2 * Math.PI,
|
|
|
|
delta: Math.random() * 2 * Math.PI,
|
|
|
|
name: '"${WISNAME} ${APLAYER}"',
|
2023-07-11 13:26:11 +02:00
|
|
|
link: '"${myIPFS}${FWISHNS}"'
|
2023-03-20 21:31:51 +01:00
|
|
|
}
|
|
|
|
," >> ~/.zen/tmp/world.js
|
2023-03-19 15:11:43 +01:00
|
|
|
|
|
|
|
((floop++))
|
2022-10-24 16:19:33 +02:00
|
|
|
done
|
2023-03-20 21:31:51 +01:00
|
|
|
|
|
|
|
# REMOVE la dernière virgule
|
|
|
|
sed -i '$ d' ~/.zen/tmp/world.js
|
2023-01-02 01:58:09 +01:00
|
|
|
##################################
|
2023-03-19 15:11:43 +01:00
|
|
|
## FINISH LOCATIONS
|
2023-04-10 12:34:38 +02:00
|
|
|
echo "
|
|
|
|
};
|
2023-03-20 13:33:16 +01:00
|
|
|
\$('#sphere').earth3d({
|
|
|
|
locationsElement: \$('#locations'),
|
|
|
|
dragElement: \$('#locations'),
|
2023-03-19 15:11:43 +01:00
|
|
|
locations: locations
|
|
|
|
});
|
2023-03-24 00:05:02 +01:00
|
|
|
};
|
2023-03-19 15:11:43 +01:00
|
|
|
" >> ~/.zen/tmp/world.js
|
|
|
|
|
|
|
|
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
|
2023-07-11 13:26:11 +02:00
|
|
|
echo "JSON WISH WORLD READY /ipfs/${IAMAP}/world.js"
|
2023-03-19 15:11:43 +01:00
|
|
|
##################################
|
2023-07-11 13:26:11 +02:00
|
|
|
## PREPARE PLAYER G1 QRCODE : QRG1avatar.png
|
2023-04-16 22:43:36 +02:00
|
|
|
[[ -s ~/.zen/game/players/${PLAYER}/voeux/${WISHNAME}/${VOEUKEY}/voeu.png ]] \
|
|
|
|
&& QRLINK=$(ipfs add -q ~/.zen/game/players/${PLAYER}/voeux/${WISHNAME}/${VOEUKEY}/voeu.png | tail -n 1)
|
2023-04-14 21:28:32 +02:00
|
|
|
[[ $QRLINK == "" ]] && QRLINK=$(ipfs add -q ~/.zen/game/players/${PLAYER}/QRG1avatar.png | tail -n 1)
|
2023-04-13 14:52:12 +02:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
### APPLY FOR ${WISHNAME} APP MODEL : make index.html
|
2023-06-30 21:36:25 +02:00
|
|
|
################################## ${WISHNAME}/index.html
|
2023-10-09 15:24:40 +02:00
|
|
|
if [[ -s ${MY_PATH}/../WWW/${WISHNAME}/index.html ]]; then
|
2023-03-16 16:17:21 +01:00
|
|
|
|
2023-10-09 15:24:40 +02:00
|
|
|
cat ${MY_PATH}/../WWW/${WISHNAME}/index.html \
|
2023-02-27 17:19:17 +01:00
|
|
|
| sed -e "s~_LIBRA_~$(myIpfsGw)~g" \
|
|
|
|
-e "s~_G1VOEU_~${WISHNAME}~g" \
|
|
|
|
-e "s~_PLAYER_~${PLAYER}~g" \
|
2023-04-08 14:37:21 +02:00
|
|
|
-e "s~_____~${COINS}~g" \
|
2023-03-26 19:53:57 +02:00
|
|
|
-e "s~_G1PUB_~${G1PUB}~g" \
|
2023-04-16 21:22:28 +02:00
|
|
|
-e "s~_VOEUNS_~${IPNS_VOEUNS}~g" \
|
2023-03-26 21:07:53 +02:00
|
|
|
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
|
2023-03-27 23:42:50 +02:00
|
|
|
-e "s~http://astroport.localhost:1234~${myASTROPORT}~g" \
|
2023-03-19 15:11:43 +01:00
|
|
|
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
2023-02-27 17:19:17 +01:00
|
|
|
-e "s~_ASTRONAUTENS_~${ASTRONAUTENS}~g" \
|
2023-04-11 15:34:55 +02:00
|
|
|
-e "s~QmWUpjGFuF7NhpXgkrCmx8Tbu4xjcFpKhE7Bsvt6HeKYxu/g1ticket_qrcode.png~${QRLINK}~g" \
|
2023-03-26 19:15:56 +02:00
|
|
|
-e "s~http://127.0.0.1:8080~~g" \
|
2023-09-28 17:03:25 +02:00
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/index.html
|
2023-06-06 21:21:51 +02:00
|
|
|
|
|
|
|
fi
|
2023-07-11 13:26:11 +02:00
|
|
|
### PREPARE WISHNAME index.html - CREATE YOUR OWN DAPP -
|
2023-02-27 17:19:17 +01:00
|
|
|
##################################
|
2023-02-27 15:10:21 +01:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
###########################################################################################
|
2023-11-30 18:23:35 +01:00
|
|
|
## N1Program are run through PLAYER G1PalPay RUNTIME
|
|
|
|
## CAN BE EXTENDED WITH DATA POST TREATMENT PROGRAMS
|
2023-08-01 01:17:38 +02:00
|
|
|
## RUN Z1Program ASTROBOT PROGRAM
|
|
|
|
#~ if [[ -s $MY_PATH/../ASTROBOT/Z1${WISHNAME}.sh ]]; then
|
|
|
|
#~ echo "........................ Astrobot Z1${WISHNAME}.sh post-treatment found !"
|
2023-07-24 11:26:39 +02:00
|
|
|
#~ echo "________________________________ Running it *****"
|
2023-09-28 17:03:25 +02:00
|
|
|
#~ ${MY_PATH}/../ASTROBOT/Z1${WISHNAME}.sh "~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}" "${PLAYER}" "$MOATS"
|
2023-07-24 11:26:39 +02:00
|
|
|
#~ echo "________________________________ Finished ******"
|
|
|
|
#~ fi
|
2023-07-10 11:51:36 +02:00
|
|
|
|
2023-07-11 13:26:11 +02:00
|
|
|
###########################################################################################
|
2023-09-28 17:03:25 +02:00
|
|
|
### ADD ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/*
|
2023-07-11 13:26:11 +02:00
|
|
|
### AND PUBLISH WISH TO IPFS
|
2023-09-28 17:03:25 +02:00
|
|
|
echo "++WISH PUBLISHING++ ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/*"
|
|
|
|
ls ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/
|
2023-03-02 23:48:10 +01:00
|
|
|
|
2024-01-07 22:32:36 +01:00
|
|
|
## CREATE .all.json for WISHNAME
|
|
|
|
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}
|
|
|
|
|
2023-09-28 17:03:25 +02:00
|
|
|
WISHFLUX=$(ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/* | tail -n 1) # ADDING JSONS TO IPFS
|
2024-03-15 13:04:12 +01:00
|
|
|
ipfs --timeout 180s name publish -k $VOEUKEY /ipfs/$WISHFLUX # PUBLISH $VOEUKEY
|
2023-03-26 18:03:42 +02:00
|
|
|
|
2023-11-24 18:02:20 +01:00
|
|
|
echo "## ASK ${myIPFSGW}${IPNS_VOEUNS} TO REFRESH" ## TODO LOOP BOOSTRAP & ONLINE FRIENDS
|
2023-04-16 21:22:28 +02:00
|
|
|
curl -m 120 -so ~/.zen/tmp/${WISHNAME}.astroindex.html "${myIPFSGW}${IPNS_VOEUNS}" &
|
2022-12-28 17:21:50 +01:00
|
|
|
|
|
|
|
## MOVE INTO PLAYER AREA
|
2024-03-27 16:12:41 +01:00
|
|
|
echo ">>> ${PLAYER} G1${WISHNAME} Ŋ1 FLUX $(myIpfsGw)${IPNS_VOEUNS}"
|
2023-03-25 19:49:45 +01:00
|
|
|
echo "WALLET ${VOEUKEY} FOUNDED by ${G1PUB}"
|
2023-09-28 17:03:25 +02:00
|
|
|
cp -f ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${WISHNAME}/* ~/.zen/game/players/${PLAYER}/G1${WISHNAME}/${G1PUB}/ 2>/dev/null
|
2023-01-14 01:08:14 +01:00
|
|
|
|
2024-03-19 22:55:37 +01:00
|
|
|
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
|
|
|
echo "SEARCH WORLD SAME WISH CACHE"
|
|
|
|
[[ "$WISHNAME" != "" ]] && cat ~/.zen/game/world/$WISHNAME/*/.link 2>/dev/null
|
|
|
|
## ANYTIME A PLAYER CHOOSE AN ASTROPORT - LOCAL WISH CACHE IS EXTENDED -
|
|
|
|
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
|
|
|
|
2023-09-28 17:03:25 +02:00
|
|
|
done < ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/${PLAYER}.g1wishes.txt
|
2022-10-12 23:29:14 +02:00
|
|
|
|
2023-12-31 15:06:34 +01:00
|
|
|
################################################
|
|
|
|
### SEND GRATITUDE TO SECTOR
|
|
|
|
## GET "GPS" TIDDLER
|
2024-01-05 17:58:09 +01:00
|
|
|
if [[ ${wishnumbers} -gt 0 ]]; then
|
|
|
|
tiddlywiki --load ${INDEX} \
|
|
|
|
--output ~/.zen/tmp/${MOATS} \
|
|
|
|
--render '.' 'GPS.json' 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' 'GPS' ## GPS Tiddler
|
|
|
|
TWMAPNS=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].umap)
|
2024-02-11 01:56:43 +01:00
|
|
|
[[ $TWMAPNS == "null" || $TWMAPNS == "" ]] && TWMAPNS="/ipns/k51qzi5uqu5djg1gqzujq5p60w25mi235gdg0lgkk5qztkfrpi5c22oolrriyu"
|
2024-01-05 17:58:09 +01:00
|
|
|
LAT=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lat)
|
2024-02-11 01:56:43 +01:00
|
|
|
[[ ${LAT} == "null" || ${LAT} == "" ]] && LAT="0.00"
|
2024-01-05 17:58:09 +01:00
|
|
|
LAT=$(makecoord $LAT)
|
|
|
|
LON=$(cat ~/.zen/tmp/${MOATS}/GPS.json | jq -r .[].lon)
|
2024-02-11 01:56:43 +01:00
|
|
|
[[ ${LON} == "null" || ${LON} == "" ]] && LON="0.00"
|
2024-01-05 17:58:09 +01:00
|
|
|
LON=$(makecoord $LON)
|
|
|
|
echo "LAT=${LAT}; LON=${LON}; UMAPNS=${TWMAPNS}"
|
|
|
|
rm ~/.zen/tmp/${MOATS}/GPS.json
|
2024-03-27 15:51:04 +01:00
|
|
|
|
|
|
|
## GET UMAP ENV
|
|
|
|
$(${MY_PATH}/../tools/getUMAP_ENV.sh ${LAT} ${LON} | tail -n 1)
|
2024-03-27 15:58:39 +01:00
|
|
|
echo "export UMAPG1PUB=$UMAPG1PUB UMAPIPNS=$UMAPIPNS SECTOR=$SECTOR SECTORG1PUB=$SECTORG1PUB SECTORIPNS=$SECTORIPNS REGION=$REGION REGIONG1PUB=$REGIONG1PUB REGIONIPNS=$REGIONIPNS LAT=$LAT LON=$LON SLAT=$SLAT SLON=$SLON RLAT=$RLAT RLON=$RLON"
|
2024-03-27 15:51:04 +01:00
|
|
|
|
2024-01-05 17:58:09 +01:00
|
|
|
##############################################################
|
|
|
|
GRATITUDE=$($MY_PATH/../tools/getcoins_from_gratitude_box.sh)
|
2024-01-08 05:04:06 +01:00
|
|
|
G1AMOUNT=$(echo "$GRATITUDE / 10" | bc -l | xargs printf "%.2f" | sed "s~,~.~g" )
|
2024-01-05 17:58:09 +01:00
|
|
|
echo "***** PLAYER $PLAYER *************************************"
|
2024-04-06 16:14:19 +02:00
|
|
|
echo "GRATITUDE ${GRATITUDE} ZEN (${G1AMOUNT} G1)
|
2024-03-05 03:49:59 +01:00
|
|
|
to UMAP_${LAT}_${LON} WALLET ${UMAPG1PUB}"
|
2024-01-05 17:58:09 +01:00
|
|
|
echo "************************************************************"
|
2024-03-14 17:43:31 +01:00
|
|
|
YOUSER=$($MY_PATH/../tools/clyuseryomail.sh "${PLAYER}")
|
2024-01-05 17:58:09 +01:00
|
|
|
MYWISHFLUX=$(ipfs add -qHwr ~/.zen/tmp/${IPFSNODEID}/WISH/${PLAYER}/g1voeu/* | tail -n 1) # ADDING JSONS TO IPFS
|
2024-07-11 22:23:16 +02:00
|
|
|
#~ ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "${G1AMOUNT}" "${UMAPG1PUB}" "UPLANET:UWISH:$YOUSER:/ipfs/${MYWISHFLUX}"
|
2024-01-05 17:58:09 +01:00
|
|
|
fi
|
2023-12-31 15:06:34 +01:00
|
|
|
################################################
|
|
|
|
################################################ GRATITUDE SENT TO SECTOR
|
|
|
|
|
2022-08-23 19:27:38 +02:00
|
|
|
exit 0
|