2023-09-11 01:45:42 +02:00
|
|
|
#!/bin/bash
|
|
|
|
################################################################################
|
|
|
|
# Author: Fred (support@qo-op.com)
|
|
|
|
# Version: 0.2
|
|
|
|
# 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
|
|
|
|
. "$MY_PATH/../tools/my.sh"
|
|
|
|
################################################################################
|
|
|
|
## SEEK FOR UPLANET KEYS
|
|
|
|
# GET & UPDATE IPNS
|
|
|
|
############################################
|
2024-02-11 20:47:20 +01:00
|
|
|
echo "############################################"
|
2024-02-27 23:46:23 +01:00
|
|
|
echo "
|
|
|
|
_________________________
|
|
|
|
< RUNNING UPLANET.refresh >
|
|
|
|
-------------------------
|
|
|
|
\ ^__^
|
|
|
|
\ (oo)\_______
|
2024-03-15 22:32:13 +01:00
|
|
|
(__)\ )\\/\\
|
2024-02-27 23:46:23 +01:00
|
|
|
||----w |
|
|
|
|
|| ||
|
|
|
|
|
|
|
|
"
|
2024-02-11 20:47:20 +01:00
|
|
|
echo "############################################"
|
|
|
|
echo "############################################"
|
2023-09-11 01:45:42 +02:00
|
|
|
[[ ${IPFSNODEID} == "" ]] && echo "IPFSNODEID is empty - EXIT -" && exit 1
|
|
|
|
|
|
|
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
|
|
|
mkdir ~/.zen/tmp/${MOATS}
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
|
|
|
############################
|
2024-02-13 22:44:58 +01:00
|
|
|
## RUNING FOR ALL UMAP FOUND IN STATION MAP CACHE : "_LAT_LON"
|
2023-10-14 18:31:07 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
## SEARCH UMAP (created by PLAYER.refresh.sh) /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
|
|
|
MEMAPS=($(ls -td ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
|
|
|
SWARMMAPS=($(ls -Gd ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
|
|
|
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
|
|
|
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
2024-03-30 12:50:37 +01:00
|
|
|
echo "ACTIVATED ${#unique_combined[@]} UMAPS : ${unique_combined[@]}" # "_LAT_LON" directories
|
2023-10-16 18:28:43 +02:00
|
|
|
|
2024-02-26 12:52:21 +01:00
|
|
|
######################################################
|
|
|
|
### LEVEL 1 ###########################################
|
|
|
|
######################################################
|
2024-02-13 22:44:58 +01:00
|
|
|
for UMAP in ${unique_combined[@]}; do
|
2023-09-25 14:08:04 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
start=`date +%s`
|
2024-02-28 23:25:24 +01:00
|
|
|
echo
|
2024-03-17 14:23:38 +01:00
|
|
|
echo "-------------------------------------------------------------------"
|
2024-03-15 14:25:21 +01:00
|
|
|
echo "____________REFRESHING ${UMAP}__________ $(date)"
|
2024-02-13 22:44:58 +01:00
|
|
|
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
|
|
|
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
2023-09-11 01:45:42 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
[[ ${LAT} == "" || ${LON} == "" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
|
|
|
[[ ${LAT} == "null" || ${LON} == "null" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
2023-10-14 18:31:07 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
## SECTOR BANK COORD
|
2024-03-27 11:10:34 +01:00
|
|
|
SLAT="${LAT::-1}"
|
|
|
|
SLON="${LON::-1}"
|
2024-02-13 22:44:58 +01:00
|
|
|
## REGION
|
2024-03-27 11:10:34 +01:00
|
|
|
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
|
|
|
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
2023-10-20 01:05:33 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
##############################################################
|
|
|
|
## UMAP WALLET CHECK
|
|
|
|
##############################################################
|
2024-02-28 23:25:24 +01:00
|
|
|
${MY_PATH}/../tools/keygen -t duniter -o ~/.zen/tmp/${MOATS}/${UMAP}.dunikey "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
|
|
|
G1PUB=$(cat ~/.zen/tmp/${MOATS}/${UMAP}.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|
|
|
[[ ! ${G1PUB} ]] && echo "ERROR generating UMAP WALLET" && exit 1
|
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
COINS=$($MY_PATH/../tools/COINScheck.sh ${G1PUB} | tail -n 1)
|
2024-02-26 12:52:21 +01:00
|
|
|
ZEN=$(echo "($COINS - 1) * 10" | bc | cut -d '.' -f 1)
|
|
|
|
|
2024-04-01 22:50:41 +02:00
|
|
|
echo "UMAP (${COINS} G1) ${ZEN} ZEN : ${G1PUB}"
|
2024-02-13 22:44:58 +01:00
|
|
|
|
|
|
|
## ORIGIN ##########################################################
|
|
|
|
## CALCULATE INITIAL UMAP GEOSPACIAL IPNS KEY
|
2024-03-19 14:57:36 +01:00
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${UMAP}.priv "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
2024-02-13 22:44:58 +01:00
|
|
|
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
|
|
|
UMAPNS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${UMAP}.priv)
|
|
|
|
echo "ORIGIN : ${myIPFS}/ipns/${UMAPNS}"
|
|
|
|
|
|
|
|
###################### SPATIO TEMPORAL KEYS
|
|
|
|
## TODATE #########################################
|
2024-03-19 14:57:36 +01:00
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${TODATE}.priv "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}"
|
2024-02-13 22:44:58 +01:00
|
|
|
ipfs key rm ${TODATE}${G1PUB} > /dev/null 2>&1
|
|
|
|
TODATENS=$(ipfs key import ${TODATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${TODATE}.priv)
|
|
|
|
echo "TODAY : ${myIPFS}/ipns/${TODATENS}"
|
|
|
|
|
|
|
|
## YESTERDATE ###############
|
2024-03-19 14:57:36 +01:00
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv "${YESTERDATE}${UPLANETNAME}${LAT}" "${YESTERDATE}${UPLANETNAME}${LON}"
|
2024-02-13 22:44:58 +01:00
|
|
|
ipfs key rm ${YESTERDATE}${G1PUB} > /dev/null 2>&1
|
|
|
|
YESTERDATENS=$(ipfs key import ${YESTERDATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv)
|
|
|
|
echo "YESTERDAY : ${myIPFS}/ipns/${YESTERDATENS}"
|
|
|
|
|
|
|
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
2024-03-08 14:29:58 +01:00
|
|
|
start=`date +%s`
|
2024-02-13 22:44:58 +01:00
|
|
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
mkdir ~/.zen/tmp/${MOATS}/${UMAP}
|
2024-04-25 00:52:41 +02:00
|
|
|
echo "## IPFS GET YESTERDATENS /ipns/${YESTERDATENS}/"
|
2024-03-27 12:11:37 +01:00
|
|
|
ipfs --timeout 300s get --progress=false -o ~/.zen/tmp/${MOATS}/${UMAP}/ /ipns/${YESTERDATENS}/
|
2024-02-26 12:52:21 +01:00
|
|
|
if [[ $? != 0 ]]; then
|
2024-03-16 15:05:39 +01:00
|
|
|
echo "(╥☁╥ ) swarm online memory empty (╥☁╥ )"
|
2024-04-01 22:50:41 +02:00
|
|
|
# Try retieve memory from UPlanet ZEN Memory
|
2024-02-26 12:52:21 +01:00
|
|
|
[[ ${ZEN} -gt 0 ]] \
|
2024-04-01 22:50:41 +02:00
|
|
|
&& echo "INTERCOM Refreshing from ZEN MEMORY" \
|
2024-03-08 14:29:58 +01:00
|
|
|
&& ${MY_PATH}/../RUNTIME/ZEN.UMAP.memory.sh "${UMAP}" "${MOATS}" "${G1PUB}"
|
2024-02-26 12:52:21 +01:00
|
|
|
fi
|
2024-02-13 22:44:58 +01:00
|
|
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
2024-03-08 14:29:58 +01:00
|
|
|
end=`date +%s`
|
|
|
|
echo "_____UMAP${UMAP} GET time was "`expr $end - $start` seconds.
|
2024-02-13 22:44:58 +01:00
|
|
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
|
|
|
## FORMAT CONTROL WARNING
|
|
|
|
[[ ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN || ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} ]] \
|
|
|
|
&& echo ">>> INFO - INTIALIZE UMAP FORMAT - NEW UMAP KEY -" \
|
|
|
|
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} \
|
|
|
|
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN \
|
|
|
|
&& echo ${MOATS} > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats
|
|
|
|
|
|
|
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
|
|
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW
|
2023-11-02 01:33:05 +01:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
echo "~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/"
|
2023-10-14 18:31:07 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
## zday of the week for IPFSNODEID
|
|
|
|
rm -f ~/.zen/tmp/${MOATS}/${UMAP}/z*.html 2>/dev/null
|
|
|
|
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain 2>/dev/null | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
|
|
|
[[ "${ZCHAIN}" != "" ]] \
|
|
|
|
&& echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/z$(date +%A-%d_%m_%Y).html
|
2023-09-11 17:08:22 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
########################################################
|
|
|
|
## NODE SELECTION in UMAP.refresher
|
|
|
|
UREFRESH="${HOME}/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON}/UMAP.refresher"
|
|
|
|
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
|
|
|
STRAPS=($(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | rev | cut -d '/' -f 1 | rev | grep -v '^[[:space:]]*$')) ## ${STRAPS[@]}
|
|
|
|
|
|
|
|
if [[ ${ALLNODES[@]} == "" ]]; then
|
2023-10-20 01:05:33 +02:00
|
|
|
for STRAP in ${STRAPS[@]}; do
|
2023-10-26 16:00:52 +02:00
|
|
|
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
2023-10-20 01:05:33 +02:00
|
|
|
done
|
2024-02-13 22:44:58 +01:00
|
|
|
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
|
|
|
fi
|
|
|
|
|
|
|
|
ACTINGNODE=${ALLNODES[0]} ## FIST NODE IN UMAP.refresher
|
|
|
|
|
|
|
|
## IN CASE OLD BOOSTRAP IS STILL IN CHARGE - CHOOSE 1ST STRAP -
|
|
|
|
[[ ! $(echo ${STRAPS[@]} | grep ${ACTINGNODE}) ]] && ACTINGNODE=${STRAPS[0]}
|
|
|
|
|
|
|
|
# ++++++++++++++++++++ - - - - FIND LAST TREATMENT TIME
|
2024-03-19 14:57:36 +01:00
|
|
|
ZMOATS=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats 2>/dev/null) || ZMOATS=${MOATS}
|
|
|
|
# ZMOATS SHOULD BE MORE THAT 5 HOURS.
|
|
|
|
MOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${MOATS})
|
|
|
|
ZMOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${ZMOATS})
|
|
|
|
DIFF_SECONDS=$((MOATS_SECONDS - ZMOATS_SECONDS))
|
|
|
|
hours=$((DIFF_SECONDS / 3600))
|
|
|
|
minutes=$(( (DIFF_SECONDS % 3600) / 60 ))
|
|
|
|
seconds=$((DIFF_SECONDS % 60))
|
|
|
|
echo "UMAP DATA is ${hours} hours ${minutes} minutes ${seconds} seconds "
|
2024-02-13 22:44:58 +01:00
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
## IF NOT UPDATED FOR TOO LONG
|
2024-02-14 22:56:38 +01:00
|
|
|
[[ ${DIFF_SECONDS} -gt $(( 26 * 60 * 60 )) || ${DIFF_SECONDS} -eq 0 ]] \
|
2024-04-16 03:54:56 +02:00
|
|
|
&& echo ">>>>>>>>>>>>>> More than 26H update - BOOSTRAP 0 ACTION -" \
|
2024-02-13 22:44:58 +01:00
|
|
|
&& ACTINGNODE=${STRAPS[0]}
|
|
|
|
|
|
|
|
echo "* ACTINGNODE=${ACTINGNODE}"
|
|
|
|
|
2024-02-22 22:46:04 +01:00
|
|
|
if [[ "${ACTINGNODE}" != "${IPFSNODEID}" ]]; then
|
2024-02-27 23:46:23 +01:00
|
|
|
echo ">> ACTINGNODE NOT ME - CONTINUE -"
|
2024-02-22 22:46:04 +01:00
|
|
|
ipfs key rm "${TODATE}${G1PUB}" "${YESTERDATE}${G1PUB}" "${G1PUB}"
|
2024-02-27 23:46:23 +01:00
|
|
|
echo "------8<-------------8<------------------8<-----------------8<-----------------8<"
|
2024-02-22 22:46:04 +01:00
|
|
|
continue
|
|
|
|
fi
|
2024-03-19 14:57:36 +01:00
|
|
|
################################################################################
|
|
|
|
# ~~~~~~~~~~~~~ GOING FURTHER ~~~ MEANS IPFSNODEID IS UMAP REFRESHER ~~~~~~~~~~~
|
|
|
|
################################################################################
|
2024-02-13 22:44:58 +01:00
|
|
|
## NEXT REFRESHER
|
|
|
|
# TODO: INTRODUCE NODE BALANCE AND CHOOSE THE MOST CONFIDENT ONE
|
2024-03-19 14:57:36 +01:00
|
|
|
rm ${UREFRESH}
|
2024-02-13 22:44:58 +01:00
|
|
|
for STRAP in ${STRAPS[@]}; do
|
|
|
|
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
|
|
|
done
|
|
|
|
# SHUFFLE UMAP.refresher
|
|
|
|
cat ${UREFRESH} | sort | uniq | shuf > ${UREFRESH}.shuf
|
|
|
|
mv ${UREFRESH}.shuf ${UREFRESH}
|
|
|
|
## NEXT REFRESHER
|
|
|
|
echo ">> NEXT REFRESHER WILL BE $(cat ${UREFRESH} | head -n 1)"
|
|
|
|
######################################################## # NODE SELECTION in UMAP.refresher
|
|
|
|
|
2024-07-11 22:23:16 +02:00
|
|
|
############ 0 ZEN (1 G1) INITIALIZE UMAP
|
2024-03-17 14:37:51 +01:00
|
|
|
CURRENT=$(readlink ~/.zen/game/players/.current | rev | cut -d '/' -f 1 | rev)
|
|
|
|
[[ ${COINS} == "" || ${COINS} == "null" ]] \
|
|
|
|
&& [[ ${ZEN} -lt 100 && ${CURRENT} != "" ]] \
|
|
|
|
&& MIUSER=$(${MY_PATH}/../tools/clyuseryomail.sh "${CURRENT}") \
|
2024-07-11 22:23:16 +02:00
|
|
|
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/.current/secret.dunikey" "1" "${G1PUB}" "UPLANET:INIT:${UMAP}:${MIUSER}" \
|
|
|
|
&& echo "UPLANET:INIT:${UMAP}:${MIUSER}" && echo " ~~~ (ZEN‿‿ZEN) ~~ _${LAT}_${LON} ~~ (ZEN‿‿ZEN) ~~~ "
|
2024-03-17 14:37:51 +01:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
## SECTOR LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>${SLAT}_${SLON}
|
|
|
|
# %%%%%%%%%% ##################################################
|
2024-03-12 00:40:23 +01:00
|
|
|
SLAT="${LAT::-1}"
|
|
|
|
SLON="${LON::-1}"
|
2023-10-21 19:48:56 +02:00
|
|
|
SECTOR="_${SLAT}_${SLON}"
|
|
|
|
echo "SECTOR ${SECTOR}"
|
2023-11-27 20:40:46 +01:00
|
|
|
############################################################## "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
|
|
|
SECTORG1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${SECTOR}" "${UPLANETNAME}${SECTOR}")
|
2023-10-21 19:48:56 +02:00
|
|
|
[[ ! ${SECTORG1PUB} ]] && echo "ERROR generating SECTOR WALLET" && exit 1
|
|
|
|
COINS=$($MY_PATH/../tools/COINScheck.sh ${SECTORG1PUB} | tail -n 1)
|
|
|
|
echo "SECTOR : ${SECTOR} (${COINS} G1) WALLET : ${SECTORG1PUB}"
|
|
|
|
|
2024-02-05 14:05:19 +01:00
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${SECTOR}.priv "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}"
|
2023-10-21 19:48:56 +02:00
|
|
|
ipfs key rm ${SECTORG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
|
|
|
SECTORNS=$(ipfs key import ${SECTORG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${SECTOR}.priv)
|
|
|
|
ipfs key rm ${SECTORG1PUB}
|
|
|
|
##############################################################
|
2023-11-04 23:10:02 +01:00
|
|
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${SLAT}_${SLON}
|
|
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${SECTORNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${SLAT}_${SLON}/index.html
|
2023-10-21 19:48:56 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
## REGION LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ${RLAT}_${RLON}
|
|
|
|
# %%%%%%%%%% ##################################################
|
2023-12-04 12:58:28 +01:00
|
|
|
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
|
|
|
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
|
|
|
REGION="_${RLAT}_${RLON}"
|
2023-10-21 19:48:56 +02:00
|
|
|
echo "REGION ${REGION}"
|
|
|
|
##############################################################
|
2023-11-27 20:40:46 +01:00
|
|
|
REGIONG1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${REGION}" "${UPLANETNAME}${REGION}")
|
2023-10-21 19:48:56 +02:00
|
|
|
[[ ! ${REGIONG1PUB} ]] && echo "ERROR generating REGION WALLET" && exit 1
|
|
|
|
COINS=$($MY_PATH/../tools/COINScheck.sh ${REGIONG1PUB} | tail -n 1)
|
|
|
|
echo "REGION : ${REGION} (${COINS} G1) WALLET : ${REGIONG1PUB}"
|
|
|
|
|
2024-02-05 13:28:01 +01:00
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/REGION.priv "${TODATE}${UPLANETNAME}${REGION}" "${TODATE}${UPLANETNAME}${REGION}"
|
2023-10-21 19:48:56 +02:00
|
|
|
ipfs key rm ${REGIONG1PUB} > /dev/null 2>&1 ## AVOID ERROR ON IMPORT
|
2024-02-05 13:28:01 +01:00
|
|
|
TODATEREGIONNS=$(ipfs key import ${REGIONG1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/REGION.priv)
|
2023-10-21 19:48:56 +02:00
|
|
|
ipfs key rm ${REGIONG1PUB}
|
|
|
|
##############################################################
|
2023-12-04 12:58:28 +01:00
|
|
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}
|
2024-02-05 13:28:01 +01:00
|
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${TODATEREGIONNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}/index.html
|
2023-10-21 19:48:56 +02:00
|
|
|
|
2024-03-19 14:57:36 +01:00
|
|
|
####################################################################################
|
2024-04-01 00:42:49 +02:00
|
|
|
#######################################################################################
|
|
|
|
echo "# NEXTNS : UMAP, SECTOR, REGION ## BOOSTRAP TO SWARM ##"
|
2024-03-20 16:30:41 +01:00
|
|
|
mkdir -p ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
|
|
|
####################################################################################
|
|
|
|
#################################################################################
|
|
|
|
## DEMAIN DATA
|
2024-03-19 14:57:36 +01:00
|
|
|
####################################################################################
|
|
|
|
## UMAP NEXTNS ############### INFORM "PLAYER.refresh.sh" WITH _next.umap
|
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/next.priv "${DEMAINDATE}${UPLANETNAME}${LAT}" "${DEMAINDATE}${UPLANETNAME}${LON}"
|
|
|
|
ipfs key rm "next" > /dev/null 2>&1
|
|
|
|
NEXTNS=$(ipfs key import "next" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/next.priv)
|
|
|
|
echo "UMAP NEXTNS : ${myIPFS}/ipns/${NEXTNS}"
|
|
|
|
ipfs key rm "next" > /dev/null 2>&1
|
|
|
|
rm ~/.zen/tmp/${MOATS}/next.priv
|
2024-03-20 16:30:41 +01:00
|
|
|
## BOOSTRAP SWARM PUBLICATION _next.umapns
|
|
|
|
echo "${G1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
2024-04-01 22:50:41 +02:00
|
|
|
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.umapns
|
|
|
|
|
|
|
|
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.umapns \
|
|
|
|
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
|
|
|
|
2024-03-19 14:57:36 +01:00
|
|
|
## SECTOR NEXTNS ############### INFORM "PLAYER.refresh.sh" WITH _next.sector
|
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/next.priv "${DEMAINDATE}${UPLANETNAME}${SECTOR}" "${DEMAINDATE}${UPLANETNAME}${SECTOR}"
|
|
|
|
ipfs key rm "next" > /dev/null 2>&1
|
|
|
|
NEXTNS=$(ipfs key import "next" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/next.priv)
|
|
|
|
echo "SECTOR NEXTNS : ${myIPFS}/ipns/${NEXTNS}"
|
|
|
|
ipfs key rm "next" > /dev/null 2>&1
|
|
|
|
rm ~/.zen/tmp/${MOATS}/next.priv
|
2024-03-20 16:30:41 +01:00
|
|
|
## BOOSTRAP SWARM PUBLICATION _next.sectorns
|
|
|
|
echo "${SECTORG1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
2024-04-01 22:50:41 +02:00
|
|
|
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.sectorns
|
|
|
|
|
|
|
|
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.sectorns \
|
|
|
|
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
|
|
|
|
2024-03-19 14:57:36 +01:00
|
|
|
## REGION NEXTNS ############### INFORM "PLAYER.refresh.sh" WITH _next.region
|
|
|
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/next.priv "${DEMAINDATE}${UPLANETNAME}${REGION}" "${DEMAINDATE}${UPLANETNAME}${REGION}"
|
|
|
|
ipfs key rm "next" > /dev/null 2>&1
|
|
|
|
NEXTNS=$(ipfs key import "next" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/next.priv)
|
|
|
|
echo "REGION NEXTNS : ${myIPFS}/ipns/${NEXTNS}"
|
|
|
|
ipfs key rm "next" > /dev/null 2>&1
|
|
|
|
rm ~/.zen/tmp/${MOATS}/next.priv
|
2024-03-20 16:30:41 +01:00
|
|
|
## BOOSTRAP SWARM PUBLICATION _next.regionns
|
|
|
|
echo "${REGIONG1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
2024-04-01 22:50:41 +02:00
|
|
|
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.regionns
|
|
|
|
|
|
|
|
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.regionns \
|
|
|
|
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
|
|
|
|
2024-03-19 14:57:36 +01:00
|
|
|
####################################################################################
|
2024-03-20 16:30:41 +01:00
|
|
|
## TODATE DATA
|
2024-04-16 16:12:40 +02:00
|
|
|
echo "WRITE $TODATE DATA ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}"
|
2024-03-20 16:30:41 +01:00
|
|
|
####################################################################################
|
|
|
|
echo "${TODATENS}" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/TODATENS
|
|
|
|
echo "${SECTORNS}" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORNS
|
|
|
|
echo "${TODATEREGIONNS}" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONNS
|
|
|
|
echo "${G1PUB}" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/G1PUB
|
|
|
|
echo "${SECTORG1PUB}" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORG1PUB
|
|
|
|
echo "${REGIONG1PUB}" \
|
|
|
|
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONG1PUB
|
2024-03-19 17:55:25 +01:00
|
|
|
|
2024-03-19 14:57:36 +01:00
|
|
|
####################################################################################
|
2024-04-16 16:12:40 +02:00
|
|
|
ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
2024-03-19 14:57:36 +01:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
## COLLECT RSS FROM ALL PLAYERS WITH SAME UMAP IN SWARM MEMORY /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
|
|
|
# %%%%%%%%%% ##################################################
|
2024-02-26 02:56:37 +01:00
|
|
|
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json \
|
|
|
|
~/.zen/tmp/${MOATS}/${UMAP}/RSS/ 2>/dev/null
|
2024-02-13 22:44:58 +01:00
|
|
|
RSSFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json 2>/dev/null))
|
|
|
|
for RSSFILE in ${RSSFILES[@]}; do
|
|
|
|
cp ${RSSFILE} ~/.zen/tmp/${MOATS}/${UMAP}/RSS/
|
|
|
|
done
|
2023-10-13 13:14:13 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
## COLLECT TW LINKS FROM NODE & SWARM
|
|
|
|
# %%%%%%%%%% ##################################################
|
2024-02-26 02:56:37 +01:00
|
|
|
cp -r ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/* \
|
|
|
|
~/.zen/tmp/${MOATS}/${UMAP}/TW/ 2>/dev/null
|
2024-02-13 22:44:58 +01:00
|
|
|
TWFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
|
|
|
for TWRED in ${TWFILES[@]}; do
|
|
|
|
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
|
|
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}
|
|
|
|
cp ${TWRED} ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}/
|
|
|
|
done
|
2023-10-13 13:14:13 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
##################################
|
2023-10-12 22:04:37 +02:00
|
|
|
## OSM2IPFS
|
2024-02-13 22:44:58 +01:00
|
|
|
### UMAP = 0.01° Planet Slice
|
|
|
|
UMAPGEN="${EARTHCID}/Umap.html?southWestLat=${LAT}&southWestLon=${LON}°=0.01&ipns=${TODATENS}/_index.html"
|
|
|
|
USATGEN="${EARTHCID}/Usat.html?southWestLat=${LAT}&southWestLon=${LON}°=0.01&ipns=${TODATENS}/_index.html"
|
|
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='${UMAPGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Umap.html
|
|
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='${USATGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Usat.html
|
2023-09-25 14:08:04 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
## ¤$£€ removed copy OSM map to IPFS. TODO. scrap tiles instead of screen copy
|
2023-12-05 14:39:06 +01:00
|
|
|
## TODO # GET SCREENSHOT UMAP SECTOR & REGION JPG
|
|
|
|
## PROBLEM ON LIBRA ... MORE TEST NEEDED ...
|
2023-12-05 23:50:44 +01:00
|
|
|
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg ]] \
|
|
|
|
#~ && python ${MY_PATH}/../tools/page_screenshot.py "${myIPFS}${UMAPGEN}" ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg 900 900 2>/dev/null \
|
|
|
|
#~ && [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg ]] && killall chrome
|
2023-10-03 13:07:31 +02:00
|
|
|
|
2023-12-05 23:50:44 +01:00
|
|
|
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg ]] \
|
|
|
|
#~ && python ${MY_PATH}/../tools/page_screenshot.py "${myIPFS}${USATGEN}" ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg 900 900 2>/dev/null \
|
|
|
|
#~ && [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg ]] && killall chrome
|
2024-02-13 22:44:58 +01:00
|
|
|
#### NOT WORKING !!!
|
2023-09-25 14:08:04 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
## GEOLINKING CALCULATE SURROUNDING UMAPS ###############################
|
2024-02-03 15:18:29 +01:00
|
|
|
#~ if [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/geolinks.json ]]; then
|
2023-09-11 01:45:42 +02:00
|
|
|
|
2024-02-03 15:18:29 +01:00
|
|
|
#~ ${MY_PATH}/../tools/Umap_geolinks.sh "${LAT}" "${LON}" "${UMAP}" "${MOATS}" "${UMAPNS}"
|
2023-09-12 17:19:36 +02:00
|
|
|
|
2024-02-03 15:18:29 +01:00
|
|
|
#~ fi
|
|
|
|
#~ ### SET navigator.html ## MAKE EVOLVE template/umap.html
|
|
|
|
#~ cp ${MY_PATH}/../templates/umap.html ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Umap.html
|
|
|
|
#~ cat ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Umap.html | sed "s~Umap~Usat~g" > ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Usat.html
|
2024-02-13 22:44:58 +01:00
|
|
|
#### IS IT USEFUL ?..??
|
2023-09-12 17:19:36 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
####################################
|
|
|
|
# %%%%%%%%%% ##################################################
|
2024-02-03 15:18:29 +01:00
|
|
|
## GET FROM WEB2.0 POI's AROUND >>>>>>>>>>>>>>>>>>>>>>>>>
|
2024-02-13 22:44:58 +01:00
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
####################################
|
|
|
|
echo "################### WEB2.0 SCRAPING TIME >>>>>>>>>>>>>>>>"
|
|
|
|
## RECORD P4N SPOT DATA
|
|
|
|
echo "* park4night : https://www.park4night.com/api/places/around?lat=${LAT}&lng=${LON}&radius=200&filter=%7B%7D&lang=fr"
|
|
|
|
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json
|
|
|
|
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
2024-02-25 05:18:14 +01:00
|
|
|
&& curl -s -L "https://www.park4night.com/api/places/around?lat=${LAT}&lng=${LON}&radius=200&filter=%7B%7D&lang=fr" -o ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json \
|
2024-02-13 22:44:58 +01:00
|
|
|
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json) ]] \
|
|
|
|
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json \
|
|
|
|
&& echo "UPDATED PARK4NIGHT" \
|
|
|
|
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
|
|
|
|
|
|
|
####################################
|
|
|
|
echo "* gchange : ./tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON}"
|
|
|
|
## GET 100KM GCHANGE ADS ( https://data.gchange.fr )
|
|
|
|
${MY_PATH}/../tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON} > ~/.zen/tmp/${MOATS}/${UMAP}/gchange50.json
|
|
|
|
|
2024-02-26 02:56:37 +01:00
|
|
|
## GET ALL WALLETS
|
2024-02-24 01:16:47 +01:00
|
|
|
echo "* GET WALLETS https://g1-stats.axiom-team.fr/data/geoloc-members.json"
|
2024-02-26 02:56:37 +01:00
|
|
|
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json
|
2024-02-24 01:16:47 +01:00
|
|
|
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
|
|
|
&& curl -s "https://g1-stats.axiom-team.fr/data/geoloc-members.json" -o ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json \
|
2024-02-26 02:56:37 +01:00
|
|
|
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json) ]] \
|
|
|
|
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json \
|
|
|
|
&& echo "UPDATED WALLALL" \
|
2024-02-24 01:16:47 +01:00
|
|
|
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
|
|
|
|
2024-02-26 02:56:37 +01:00
|
|
|
## FILTER LOCAL WALLETS
|
|
|
|
target_lat=${LAT}
|
|
|
|
target_lon=${LON}
|
|
|
|
precision=0.1
|
|
|
|
jq --argjson target_lat "$target_lat" \
|
|
|
|
--argjson target_lon "$target_lon" \
|
|
|
|
--argjson precision "$precision" \
|
2024-02-26 22:44:43 +01:00
|
|
|
'.wallets | map(select((.geoPoint.lat | tonumber) >= ($target_lat - $precision) and (.geoPoint.lat | tonumber) <= ($target_lat + $precision) and (.geoPoint.lon | tonumber) >= ($target_lon - $precision) and (.geoPoint.lon | tonumber) <= ($target_lon + $precision)))' ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json \
|
2024-02-26 02:56:37 +01:00
|
|
|
> ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json
|
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
echo "MAKING _index.p4n.html with ./templates/P4N/index.html"
|
|
|
|
## CREATE INDEX LOADING JSONs ON OPENSTREETMAP
|
|
|
|
cat ${MY_PATH}/../templates/P4N/index.html \
|
2024-02-26 02:56:37 +01:00
|
|
|
| sed -e "s~43.61000~${LAT}~g" \
|
|
|
|
-e "s~1.43000~${LON}~g" \
|
2024-02-13 22:44:58 +01:00
|
|
|
-e "s~_SERVICE_~Commons~g" \
|
|
|
|
-e "s~_UMAP_~${UMAP}~g" \
|
|
|
|
-e "s~http://127.0.0.1:8080~~g" \
|
|
|
|
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.p4n.html
|
|
|
|
|
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
########################################################
|
|
|
|
echo "CREATING SPHERICAL LOCATIONS"
|
|
|
|
# %%%%%%%%%% ##################################################
|
|
|
|
## PREPARE SPHERE MAP ##################################################################
|
|
|
|
echo "var examples = {};
|
|
|
|
examples['locations'] = function() {
|
|
|
|
var locations = {
|
|
|
|
" > ~/.zen/tmp/world.js
|
|
|
|
floop=1
|
|
|
|
|
|
|
|
SWARMTW=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
|
|
|
NODETW=($(ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
|
|
|
TWFILES=("${SWARMTW[@]}" "${NODETW[@]}")
|
|
|
|
|
|
|
|
for TWRED in ${TWFILES[@]}; do
|
|
|
|
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
|
|
|
TWADD=$(cat ${TWRED} | grep -o "/ipns/[^\"]*" | sed "s/'$//")
|
|
|
|
[[ -z ${TWADD} ]] && TWADD=$(cat ${TWRED} | grep -o "/ipfs/[^\"]*" | sed "s/'$//")
|
|
|
|
|
|
|
|
## ADD ASTRONAUTNS ON SECTOR WORLD MAP
|
|
|
|
echo "${floop}: {
|
|
|
|
alpha: Math.random() * 2 * Math.PI,
|
|
|
|
delta: Math.random() * 2 * Math.PI,
|
|
|
|
name: '"${ZMAIL}"',
|
|
|
|
link: '"${TWADD}"'
|
|
|
|
}
|
|
|
|
," >> ~/.zen/tmp/world.js
|
|
|
|
|
|
|
|
((floop++))
|
|
|
|
done
|
2023-12-01 17:25:10 +01:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
# REMOVE la dernière virgule
|
|
|
|
sed -i '$ d' ~/.zen/tmp/world.js
|
|
|
|
##################################
|
|
|
|
## FINISH LOCATIONS
|
|
|
|
echo "
|
|
|
|
};
|
|
|
|
\$('#sphere').earth3d({
|
|
|
|
locationsElement: \$('#locations'),
|
|
|
|
dragElement: \$('#locations'),
|
|
|
|
locations: locations
|
|
|
|
});
|
|
|
|
};
|
|
|
|
" >> ~/.zen/tmp/world.js
|
|
|
|
|
|
|
|
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
|
|
|
|
echo "JSON UMAP WORLD READY /ipfs/${IAMAP}/world.js"
|
2023-12-01 17:25:10 +01:00
|
|
|
###########################################################################################
|
2024-02-13 22:44:58 +01:00
|
|
|
### APPLY ON APP MODEL
|
2024-03-27 11:10:34 +01:00
|
|
|
SLAT="${LAT::-1}"
|
|
|
|
SLON="${LON::-1}"
|
|
|
|
SECTOR="_${SLAT}_${SLON}"
|
2024-02-13 22:44:58 +01:00
|
|
|
TODATESECTORNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}")
|
|
|
|
|
|
|
|
PHONEBOOTH="${G1PUB::30}"
|
|
|
|
cat ${MY_PATH}/../templates/UPlanetUmap/index.html \
|
2024-04-11 21:01:09 +02:00
|
|
|
| sed -e "s~_ZONE_~${UMAP}~g" \
|
2024-02-13 22:44:58 +01:00
|
|
|
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
|
|
|
-e "s~_ZONENS_~${TODATENS}~g" \
|
2024-04-23 02:26:20 +02:00
|
|
|
-e "s~_ZCHAIN_~${ZCHAIN}~g" \
|
2024-02-15 01:47:40 +01:00
|
|
|
-e "s~_IPFSNINJA_~${VDONINJA}~g" \
|
2024-02-16 19:16:40 +01:00
|
|
|
-e "s~_HACKGIPFS_~${HACKGIPFS}~g" \
|
2024-02-24 02:40:08 +01:00
|
|
|
-e "s~_UPZONE_~SECTOR ${SECTOR}~g" \
|
2024-02-13 22:44:58 +01:00
|
|
|
-e "s~_UPZONENS_~${TODATESECTORNS}~g" \
|
2024-02-24 02:40:08 +01:00
|
|
|
-e "s~_UPUPZONE_~REGION ${REGION}~g" \
|
|
|
|
-e "s~_UPUPZONENS_~${TODATEREGIONNS}~g" \
|
2024-02-13 22:44:58 +01:00
|
|
|
-e "s~_PHONEBOOTH_~${PHONEBOOTH}~g" \
|
2024-03-05 03:53:46 +01:00
|
|
|
-e "s~_CESIUMIPFS_~${CESIUMIPFS}~g" \
|
|
|
|
-e "s~_G1PUB_~${G1PUB}~g" \
|
2024-02-13 22:44:58 +01:00
|
|
|
-e "s~_DATE_~$(date +%A-%d_%m_%Y)~g" \
|
|
|
|
-e "s~_UPLANETLINK_~${EARTHCID}/map_render.html\?southWestLat=${LAT}\&southWestLon=${LON}\°=0.01~g" \
|
|
|
|
-e "s~http://127.0.0.1:8080~~g" \
|
|
|
|
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.html
|
|
|
|
|
|
|
|
## Make it root App
|
|
|
|
#~ mv ~/.zen/tmp/${MOATS}/${UMAP}/_index.html \
|
|
|
|
#~ ~/.zen/tmp/${MOATS}/${UMAP}/index.html
|
|
|
|
##################################
|
2023-12-01 17:25:10 +01:00
|
|
|
|
|
|
|
###########################################################################################
|
2023-09-28 12:58:54 +02:00
|
|
|
########################################################
|
2024-02-13 22:44:58 +01:00
|
|
|
## CREATE .all.json for RSS in this UMAP
|
|
|
|
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
2023-10-21 19:48:56 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
##############################################################
|
|
|
|
############################ PUBLISHING UMAP
|
|
|
|
##############################################################
|
|
|
|
UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1)
|
2023-09-11 23:55:07 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
|
|
|
ZMOATS=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats 2>/dev/null)
|
|
|
|
[[ ${ZCHAIN} && ${ZMOATS} ]] \
|
|
|
|
&& cp ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain.${ZMOATS} \
|
2024-04-16 16:12:40 +02:00
|
|
|
&& echo "UPDATING MOATS=${MOATS}"
|
2023-09-11 23:55:07 +02:00
|
|
|
|
2024-02-26 12:52:21 +01:00
|
|
|
######################################################
|
2024-04-01 22:50:41 +02:00
|
|
|
## ZEN CHAINING
|
|
|
|
# Send 1 ZEN to UPlanet SECTORG1PUB Wallet containing REGION TW HASH
|
2024-02-26 12:52:21 +01:00
|
|
|
INTERCOM="UPLANET:${UMAP}:${TODATE}:/ipfs/${UMAPROOT}"
|
2024-04-01 22:50:41 +02:00
|
|
|
echo "> INTERCOM ${INTERCOM} (${ZEN} ZEN > 11 ?)"
|
2024-02-26 12:52:21 +01:00
|
|
|
if [[ ${ZEN} -gt 11 ]]; then
|
2024-04-01 22:50:41 +02:00
|
|
|
echo "---ZZZ-- UMAP 2 SECTOR ZEN CHAINING ---ZZZ------ZZZ----"
|
2024-07-11 22:23:16 +02:00
|
|
|
#~ ${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/${UMAP}.dunikey "0.1" "${SECTORG1PUB}" "${INTERCOM}"
|
2024-02-26 12:52:21 +01:00
|
|
|
fi
|
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
## MICRO LEDGER CHAIN CHANGED or INIT ?
|
|
|
|
[[ ${ZCHAIN} != ${UMAPROOT} || ${ZCHAIN} == "" ]] \
|
|
|
|
&& echo "${MOATS}:${IPFSNODEID}:${UMAPROOT}" > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain \
|
|
|
|
&& echo "${MOATS}" > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats \
|
2024-03-30 17:00:22 +01:00
|
|
|
&& UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1) \
|
|
|
|
&& echo "ROOT was ${ZCHAIN}"
|
2023-09-11 23:55:07 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
echo "PUBLISHING ${TODATE} UMAPROOT : ${myIPFS}/ipfs/${UMAPROOT}"
|
2023-09-11 23:55:07 +02:00
|
|
|
|
2024-03-19 12:20:26 +01:00
|
|
|
ipfs --timeout 300s name publish --key=${TODATE}${G1PUB} /ipfs/${UMAPROOT}
|
2024-02-13 22:44:58 +01:00
|
|
|
end=`date +%s`
|
|
|
|
echo "(UMAP) ${UMAP} ${TODATE} PUBLISH time was "`expr $end - $start` seconds.
|
2023-09-11 23:55:07 +02:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
ipfs key rm "${TODATE}${G1PUB}" "${YESTERDATE}${G1PUB}" "${G1PUB}" ## REMOVE IPNS KEY
|
2024-03-30 17:00:22 +01:00
|
|
|
[[ ${ZCHAIN} != "" ]] && ipfs pin rm ${ZCHAIN}
|
|
|
|
|
2024-05-15 01:58:00 +02:00
|
|
|
################# PUBLISH UPlanet UMAP to G1PODs
|
|
|
|
${MY_PATH}/../tools/timeout.sh -t 20 \
|
|
|
|
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${UMAP}.dunikey -n ${myDATA} \
|
|
|
|
set -n "UPlanet ${UMAP}" -v " " -a " " -d "UPlanet ${myUPLANET}" \
|
|
|
|
-pos ${LAT} ${LON} -s ${myLIBRA}/ipfs/${UMAPROOT} \
|
|
|
|
-A ${MY_PATH}/../images/extension_territoire.jpg
|
|
|
|
${MY_PATH}/../tools/timeout.sh -t 20 \
|
|
|
|
${MY_PATH}/../tools/jaklis/jaklis.py -k ~/.zen/tmp/${MOATS}/${UMAP}.dunikey -n ${myCESIUM} \
|
|
|
|
set -n "UPlanet ${UMAP}" -v " " -a " " -d "UPlanet ${myUPLANET}" \
|
|
|
|
-pos ${LAT} ${LON} -s ${myLIBRA}/ipfs/${UMAPROOT} \
|
|
|
|
-A ${MY_PATH}/../images/extension_territoire.jpg
|
|
|
|
|
2024-02-28 23:18:15 +01:00
|
|
|
rm ~/.zen/tmp/${MOATS}/*.priv
|
|
|
|
rm ~/.zen/tmp/${MOATS}/${UMAP}.dunikey
|
2024-02-10 12:36:57 +01:00
|
|
|
|
2024-02-13 22:44:58 +01:00
|
|
|
done
|
2023-09-11 01:45:42 +02:00
|
|
|
|
2024-04-14 17:37:53 +02:00
|
|
|
|
2024-02-26 12:52:21 +01:00
|
|
|
######################################################
|
|
|
|
### LEVEL 2 ###########################################
|
|
|
|
######################################################
|
2023-10-21 18:27:59 +02:00
|
|
|
### SECTOR = 0.1° Planet Slice
|
2024-02-13 22:44:58 +01:00
|
|
|
${MY_PATH}/SECTOR.refresh.sh "${unique_combined[@]}"
|
2023-10-21 18:27:59 +02:00
|
|
|
|
2024-02-26 12:52:21 +01:00
|
|
|
######################################################
|
|
|
|
### LEVEL 3 ###########################################
|
|
|
|
######################################################
|
2023-10-21 18:27:59 +02:00
|
|
|
### REGION = 1° Planet Slice
|
2024-02-13 22:44:58 +01:00
|
|
|
${MY_PATH}/REGION.refresh.sh "${unique_combined[@]}"
|
2024-02-26 12:52:21 +01:00
|
|
|
######################################################
|
2024-01-14 16:47:30 +01:00
|
|
|
|
2024-04-14 17:37:53 +02:00
|
|
|
|
2024-02-26 12:52:21 +01:00
|
|
|
######################################################
|
|
|
|
exit 0
|
|
|
|
######################################################
|