forked from STI/Astroport.ONE
refreshing UMap DApp page
This commit is contained in:
parent
c188f6b194
commit
0fdd37e43c
@ -23,144 +23,146 @@ mkdir ~/.zen/tmp/${MOATS}
|
|||||||
#################################################################
|
#################################################################
|
||||||
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
## IPFSNODEID ASTRONAUTES SIGNALING ## 12345 port
|
||||||
############################
|
############################
|
||||||
## RUNING FOR ALL UMAP FOUND IN STATION MAP CACHE : "_LAT_LON"
|
## RUNING FOR ALL UMAP FOUND IN STATION MAP CACHE : "_LAT_LON"
|
||||||
|
|
||||||
## SEARCH UMAP (created by PLAYER.refresh.sh) /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
## 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))
|
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))
|
SWARMMAPS=($(ls -Gd ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/* 2>/dev/null | rev | cut -d '/' -f 1 | rev | sort | uniq))
|
||||||
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
combined=("${MEMAPS[@]}" "${SWARMMAPS[@]}")
|
||||||
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
unique_combined=($(echo "${combined[@]}" | tr ' ' '\n' | sort -u))
|
||||||
echo "ACTIVATED UMAPS : ${unique_combined[@]}" # "_LAT_LON" directories
|
echo "ACTIVATED UMAPS : ${unique_combined[@]}" # "_LAT_LON" directories
|
||||||
|
|
||||||
for UMAP in ${unique_combined[@]}; do
|
for UMAP in ${unique_combined[@]}; do
|
||||||
|
|
||||||
start=`date +%s`
|
start=`date +%s`
|
||||||
echo "____________REFRESHING ${UMAP}__________"
|
echo "____________REFRESHING ${UMAP}__________"
|
||||||
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
LAT=$(echo ${UMAP} | cut -d '_' -f 2)
|
||||||
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
LON=$(echo ${UMAP} | cut -d '_' -f 3)
|
||||||
|
|
||||||
[[ ${LAT} == "" || ${LON} == "" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
[[ ${LAT} == "" || ${LON} == "" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||||
[[ ${LAT} == "null" || ${LON} == "null" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
[[ ${LAT} == "null" || ${LON} == "null" ]] && echo ">> ERROR BAD ${LAT} ${LON}" && continue
|
||||||
|
|
||||||
## SECTOR BANK COORD
|
## SECTOR BANK COORD
|
||||||
SECLAT="${LAT::-1}"
|
SECLAT="${LAT::-1}"
|
||||||
SECLON="${LON::-1}"
|
SECLON="${LON::-1}"
|
||||||
## REGION
|
## REGION
|
||||||
REGLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
REGLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||||
REGLON=$(echo ${LON} | cut -d '.' -f 1)
|
REGLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
## UMAP WALLET CHECK
|
## UMAP WALLET CHECK
|
||||||
##############################################################
|
##############################################################
|
||||||
G1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}")
|
G1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}")
|
||||||
[[ ! ${G1PUB} ]] && echo "ERROR generating WALLET" && exit 1
|
[[ ! ${G1PUB} ]] && echo "ERROR generating WALLET" && exit 1
|
||||||
COINS=$($MY_PATH/../tools/COINScheck.sh ${G1PUB} | tail -n 1)
|
COINS=$($MY_PATH/../tools/COINScheck.sh ${G1PUB} | tail -n 1)
|
||||||
echo "UMAP (${COINS} G1) WALLET : ${G1PUB}"
|
echo "UMAP (${COINS} G1) WALLET : ${G1PUB}"
|
||||||
|
|
||||||
## ORIGIN ##########################################################
|
## ORIGIN ##########################################################
|
||||||
## CALCULATE INITIAL UMAP GEOSPACIAL IPNS KEY
|
## CALCULATE INITIAL UMAP GEOSPACIAL IPNS KEY
|
||||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${UMAP}.priv "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${UMAP}.priv "${UPLANETNAME}${LAT}" "${UPLANETNAME}${LON}"
|
||||||
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
ipfs key rm ${G1PUB} > /dev/null 2>&1
|
||||||
UMAPNS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${UMAP}.priv)
|
UMAPNS=$(ipfs key import ${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${UMAP}.priv)
|
||||||
echo "ORIGIN : ${myIPFS}/ipns/${UMAPNS}"
|
echo "ORIGIN : ${myIPFS}/ipns/${UMAPNS}"
|
||||||
|
|
||||||
###################### SPATIO TEMPORAL KEYS
|
###################### SPATIO TEMPORAL KEYS
|
||||||
## YESTERDATE ###############
|
## TODATE #########################################
|
||||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv "${YESTERDATE}${UPLANETNAME}${LAT}" "${YESTERDATE}${UPLANETNAME}${LON}"
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${TODATE}.priv "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}"
|
||||||
ipfs key rm ${YESTERDATE}${G1PUB} > /dev/null 2>&1
|
ipfs key rm ${TODATE}${G1PUB} > /dev/null 2>&1
|
||||||
YESTERDATENS=$(ipfs key import ${YESTERDATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv)
|
TODATENS=$(ipfs key import ${TODATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${TODATE}.priv)
|
||||||
echo "YESTERDAY : ${myIPFS}/ipns/${YESTERDATENS}"
|
echo "TODAY : ${myIPFS}/ipns/${TODATENS}"
|
||||||
|
|
||||||
## TODATE #########################################
|
## YESTERDATE ###############
|
||||||
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${TODATE}.priv "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}"
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv "${YESTERDATE}${UPLANETNAME}${LAT}" "${YESTERDATE}${UPLANETNAME}${LON}"
|
||||||
ipfs key rm ${TODATE}${G1PUB} > /dev/null 2>&1
|
ipfs key rm ${YESTERDATE}${G1PUB} > /dev/null 2>&1
|
||||||
TODATENS=$(ipfs key import ${TODATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${TODATE}.priv)
|
YESTERDATENS=$(ipfs key import ${YESTERDATE}${G1PUB} -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/${YESTERDATE}.priv)
|
||||||
echo "TODAY : ${myIPFS}/ipns/${TODATENS}"
|
echo "YESTERDAY : ${myIPFS}/ipns/${YESTERDATENS}"
|
||||||
|
|
||||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
## IPFS GET YESTERDATENS
|
echo "## IPFS GET YESTERDATENS"
|
||||||
mkdir ~/.zen/tmp/${MOATS}/${UMAP}
|
mkdir ~/.zen/tmp/${MOATS}/${UMAP}
|
||||||
ipfs --timeout 240s get -o ~/.zen/tmp/${MOATS}/${UMAP}/ /ipns/${YESTERDATENS}/
|
ipfs --timeout 240s get -o ~/.zen/tmp/${MOATS}/${UMAP}/ /ipns/${YESTERDATENS}/
|
||||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
|
||||||
## FORMAT CONTROL WARNING
|
## FORMAT CONTROL WARNING
|
||||||
[[ ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN || ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} ]] \
|
[[ ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN || ! -d ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} ]] \
|
||||||
&& echo ">>> INFO - INTIALIZE UMAP FORMAT - NEW UMAP KEY -" \
|
&& echo ">>> INFO - INTIALIZE UMAP FORMAT - NEW UMAP KEY -" \
|
||||||
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} \
|
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON} \
|
||||||
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN \
|
&& mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN \
|
||||||
&& echo ${MOATS} > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats
|
&& echo ${MOATS} > ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats
|
||||||
|
|
||||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
||||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW
|
||||||
|
|
||||||
echo "~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/"
|
echo "~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/"
|
||||||
|
|
||||||
## zday of the week for IPFSNODEID
|
## zday of the week for IPFSNODEID
|
||||||
rm -f ~/.zen/tmp/${MOATS}/${UMAP}/z*.html 2>/dev/null
|
rm -f ~/.zen/tmp/${MOATS}/${UMAP}/z*.html 2>/dev/null
|
||||||
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
ZCHAIN=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_chain 2>/dev/null | rev | cut -d ':' -f 1 | rev 2>/dev/null)
|
||||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/z$(date +%A-%d_%m_%Y).html
|
[[ "${ZCHAIN}" != "" ]] \
|
||||||
|
&& echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/z$(date +%A-%d_%m_%Y).html
|
||||||
|
|
||||||
# ++++++++++++++++++++ - - - - ADAPT TO NODE TREATMENT TIME
|
########################################################
|
||||||
ZMOATS=$(cat ~/.zen/tmp/${MOATS}/${UMAP}/${G1PUB}:ZEN/_moats 2>/dev/null)
|
## NODE SELECTION in UMAP.refresher
|
||||||
# ZMOATS SHOULD BE MORE THAT 5 HOURS.
|
UREFRESH="${HOME}/.zen/tmp/${MOATS}/${UMAP}/${LAT}_${LON}/UMAP.refresher"
|
||||||
MOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${MOATS})
|
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
||||||
ZMOATS_SECONDS=$(${MY_PATH}/../tools/MOATS2seconds.sh ${ZMOATS})
|
STRAPS=($(cat ~/.zen/Astroport.ONE/A_boostrap_nodes.txt | grep -Ev "#" | rev | cut -d '/' -f 1 | rev | grep -v '^[[:space:]]*$')) ## ${STRAPS[@]}
|
||||||
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 "
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
########################################################
|
|
||||||
## 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
|
if [[ ${ALLNODES[@]} == "" ]]; then
|
||||||
for STRAP in ${STRAPS[@]}; do
|
|
||||||
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
|
||||||
done
|
|
||||||
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]}
|
|
||||||
|
|
||||||
## IF NOT UPDATED FOR TOO LONG
|
|
||||||
[ ${DIFF_SECONDS} -gt $(( 26 * 60 * 60 )) ] \
|
|
||||||
&& echo "More than 26H update - BOOSTRAP 0 ACTION -" \
|
|
||||||
&& ACTINGNODE=${STRAPS[0]}
|
|
||||||
|
|
||||||
echo "* ACTINGNODE=${ACTINGNODE}"
|
|
||||||
|
|
||||||
[[ "${ACTINGNODE}" != "${IPFSNODEID}" ]] \
|
|
||||||
&& echo ">> ACTINGNODE=${ACTINGNODE} is not ME - CONTINUE -" \
|
|
||||||
&& ipfs key rm "${TODATE}${G1PUB}" "${YESYERDATE}${G1PUB}" "${G1PUB}" \
|
|
||||||
&& continue
|
|
||||||
########################################
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PASSING THERE MAKE IPFSNODEID UMAP REFRESHER
|
|
||||||
|
|
||||||
## NEXT REFRESHER
|
|
||||||
# TODO: INTRODUCE NODE BALANCE AND CHOOSE THE MOST CONFIDENT ONE
|
|
||||||
rm ${UREFRESH}
|
|
||||||
for STRAP in ${STRAPS[@]}; do
|
for STRAP in ${STRAPS[@]}; do
|
||||||
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
echo ${STRAP} >> ${UREFRESH} ## FILL UMAP.refresher file with all STRAPS
|
||||||
done
|
done
|
||||||
# SHUFFLE UMAP.refresher
|
ALLNODES=($(cat ${UREFRESH} 2>/dev/null)) # ${ALLNODES[@]}
|
||||||
cat ${UREFRESH} | sort | uniq | shuf > ${UREFRESH}.shuf
|
fi
|
||||||
mv ${UREFRESH}.shuf ${UREFRESH}
|
|
||||||
## NEXT REFRESHER
|
|
||||||
echo ">> NEXT REFRESHER WILL BE $(cat ${UREFRESH} | head -n 1)"
|
|
||||||
######################################################## # NODE SELECTION in UMAP.refresher
|
|
||||||
|
|
||||||
# %%%%%%%%%% ##################################################
|
ACTINGNODE=${ALLNODES[0]} ## FIST NODE IN UMAP.refresher
|
||||||
## SECTOR LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>${SLAT}_${SLON}
|
|
||||||
# %%%%%%%%%% ##################################################
|
## IN CASE OLD BOOSTRAP IS STILL IN CHARGE - CHOOSE 1ST STRAP -
|
||||||
|
[[ ! $(echo ${STRAPS[@]} | grep ${ACTINGNODE}) ]] && ACTINGNODE=${STRAPS[0]}
|
||||||
|
|
||||||
|
# ++++++++++++++++++++ - - - - FIND LAST TREATMENT TIME
|
||||||
|
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 "
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
## IF NOT UPDATED FOR TOO LONG
|
||||||
|
[ ${DIFF_SECONDS} -gt $(( 26 * 60 * 60 )) || ${DIFF_SECONDS} -eq 0 ] \
|
||||||
|
&& echo "More than 26H update - BOOSTRAP 0 ACTION -" \
|
||||||
|
&& ACTINGNODE=${STRAPS[0]}
|
||||||
|
|
||||||
|
echo "* ACTINGNODE=${ACTINGNODE}"
|
||||||
|
|
||||||
|
[[ "${ACTINGNODE}" != "${IPFSNODEID}" ]] \
|
||||||
|
&& echo ">> ACTINGNODE=${ACTINGNODE} is not ME - CONTINUE -" \
|
||||||
|
&& ipfs key rm "${TODATE}${G1PUB}" "${YESTERDATE}${G1PUB}" "${G1PUB}" \
|
||||||
|
&& continue
|
||||||
|
########################################
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PASSING THERE MAKE IPFSNODEID UMAP REFRESHER
|
||||||
|
|
||||||
|
## NEXT REFRESHER
|
||||||
|
# TODO: INTRODUCE NODE BALANCE AND CHOOSE THE MOST CONFIDENT ONE
|
||||||
|
rm ${UREFRESH}
|
||||||
|
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
|
||||||
|
|
||||||
|
# %%%%%%%%%% ##################################################
|
||||||
|
## SECTOR LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>${SLAT}_${SLON}
|
||||||
|
# %%%%%%%%%% ##################################################
|
||||||
SLAT="${LAT::-1}"
|
SLAT="${LAT::-1}"
|
||||||
SLON="${LON::-1}"
|
SLON="${LON::-1}"
|
||||||
SECTOR="_${SLAT}_${SLON}"
|
SECTOR="_${SLAT}_${SLON}"
|
||||||
@ -179,9 +181,9 @@ echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/
|
|||||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${SLAT}_${SLON}
|
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
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${SECTORNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${SLAT}_${SLON}/index.html
|
||||||
|
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## REGION LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ${RLAT}_${RLON}
|
## REGION LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ${RLAT}_${RLON}
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
RLAT=$(echo ${LAT} | cut -d '.' -f 1)
|
||||||
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
RLON=$(echo ${LON} | cut -d '.' -f 1)
|
||||||
REGION="_${RLAT}_${RLON}"
|
REGION="_${RLAT}_${RLON}"
|
||||||
@ -200,35 +202,35 @@ echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/
|
|||||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}
|
||||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${TODATEREGIONNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}/index.html
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${TODATEREGIONNS}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/${RLAT}_${RLON}/index.html
|
||||||
|
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## COLLECT RSS FROM ALL PLAYERS WITH SAME UMAP IN SWARM MEMORY /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
## COLLECT RSS FROM ALL PLAYERS WITH SAME UMAP IN SWARM MEMORY /UPLANET/__/_*_*/_*.?_*.?/_*.??_*.??
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json ~/.zen/tmp/${MOATS}/${UMAP}/RSS/ 2>/dev/null
|
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json ~/.zen/tmp/${MOATS}/${UMAP}/RSS/ 2>/dev/null
|
||||||
RSSFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json 2>/dev/null))
|
RSSFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/RSS/*.rss.json 2>/dev/null))
|
||||||
for RSSFILE in ${RSSFILES[@]}; do
|
for RSSFILE in ${RSSFILES[@]}; do
|
||||||
cp ${RSSFILE} ~/.zen/tmp/${MOATS}/${UMAP}/RSS/
|
cp ${RSSFILE} ~/.zen/tmp/${MOATS}/${UMAP}/RSS/
|
||||||
done
|
done
|
||||||
|
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## COLLECT TW LINKS FROM NODE & SWARM
|
## COLLECT TW LINKS FROM NODE & SWARM
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
cp -r ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/* ~/.zen/tmp/${MOATS}/${UMAP}/TW/ 2>/dev/null
|
cp -r ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/* ~/.zen/tmp/${MOATS}/${UMAP}/TW/ 2>/dev/null
|
||||||
TWFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
TWFILES=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
||||||
for TWRED in ${TWFILES[@]}; do
|
for TWRED in ${TWFILES[@]}; do
|
||||||
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
||||||
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}
|
mkdir -p ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}
|
||||||
cp ${TWRED} ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}/
|
cp ${TWRED} ~/.zen/tmp/${MOATS}/${UMAP}/TW/${ZMAIL}/
|
||||||
done
|
done
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
## OSM2IPFS
|
## OSM2IPFS
|
||||||
### UMAP = 0.01° Planet Slice
|
### UMAP = 0.01° Planet Slice
|
||||||
UMAPGEN="${EARTHCID}/Umap.html?southWestLat=${LAT}&southWestLon=${LON}°=0.01&ipns=${TODATENS}/_index.html"
|
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"
|
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='${UMAPGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Umap.html
|
||||||
echo "<meta http-equiv=\"refresh\" content=\"0; url='${USATGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Usat.html
|
echo "<meta http-equiv=\"refresh\" content=\"0; url='${USATGEN}'\" />" > ~/.zen/tmp/${MOATS}/${UMAP}/Usat.html
|
||||||
|
|
||||||
## ¤$£€ removed copy OSM map to IPFS. TODO. scrap tiles instead of screen copy
|
## ¤$£€ removed copy OSM map to IPFS. TODO. scrap tiles instead of screen copy
|
||||||
## TODO # GET SCREENSHOT UMAP SECTOR & REGION JPG
|
## TODO # GET SCREENSHOT UMAP SECTOR & REGION JPG
|
||||||
## PROBLEM ON LIBRA ... MORE TEST NEEDED ...
|
## PROBLEM ON LIBRA ... MORE TEST NEEDED ...
|
||||||
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg ]] \
|
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Umap.jpg ]] \
|
||||||
@ -238,9 +240,9 @@ echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/
|
|||||||
#~ [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg ]] \
|
#~ [[ ! -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 \
|
#~ && 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
|
#~ && [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/Usat.jpg ]] && killall chrome
|
||||||
#### NOT WORKING !!!
|
#### NOT WORKING !!!
|
||||||
|
|
||||||
## GEOLINKING CALCULATE SURROUNDING UMAPS ###############################
|
## GEOLINKING CALCULATE SURROUNDING UMAPS ###############################
|
||||||
#~ if [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/geolinks.json ]]; then
|
#~ if [[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/geolinks.json ]]; then
|
||||||
|
|
||||||
#~ ${MY_PATH}/../tools/Umap_geolinks.sh "${LAT}" "${LON}" "${UMAP}" "${MOATS}" "${UMAPNS}"
|
#~ ${MY_PATH}/../tools/Umap_geolinks.sh "${LAT}" "${LON}" "${UMAP}" "${MOATS}" "${UMAPNS}"
|
||||||
@ -249,149 +251,149 @@ echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipfs/${ZCHAIN}'\" />" > ~/
|
|||||||
#~ ### SET navigator.html ## MAKE EVOLVE template/umap.html
|
#~ ### SET navigator.html ## MAKE EVOLVE template/umap.html
|
||||||
#~ cp ${MY_PATH}/../templates/umap.html ~/.zen/tmp/${MOATS}/${UMAP}/navigator_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
|
#~ cat ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Umap.html | sed "s~Umap~Usat~g" > ~/.zen/tmp/${MOATS}/${UMAP}/navigator_Usat.html
|
||||||
#### IS IT USEFUL ?..??
|
#### IS IT USEFUL ?..??
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## GET FROM WEB2.0 POI's AROUND >>>>>>>>>>>>>>>>>>>>>>>>>
|
## GET FROM WEB2.0 POI's AROUND >>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
####################################
|
####################################
|
||||||
echo "################### WEB2.0 SCRAPING TIME >>>>>>>>>>>>>>>>"
|
echo "################### WEB2.0 SCRAPING TIME >>>>>>>>>>>>>>>>"
|
||||||
## RECORD P4N SPOT DATA
|
## RECORD P4N SPOT DATA
|
||||||
echo "* park4night : https://www.park4night.com/api/places/around?lat=${LAT}&lng=${LON}&radius=200&filter=%7B%7D&lang=fr"
|
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}/p4n.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json
|
||||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
||||||
&& curl -s "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 \
|
&& curl -s "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 \
|
||||||
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json) ]] \
|
&& [[ $(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 \
|
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json \
|
||||||
&& echo "UPDATED PARK4NIGHT" \
|
&& echo "UPDATED PARK4NIGHT" \
|
||||||
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
echo "* gchange : ./tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON}"
|
echo "* gchange : ./tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON}"
|
||||||
## GET 100KM GCHANGE ADS ( https://data.gchange.fr )
|
## 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
|
${MY_PATH}/../tools/gchange_get_50km_around_LAT_LON_ads.sh ${LAT} ${LON} > ~/.zen/tmp/${MOATS}/${UMAP}/gchange50.json
|
||||||
|
|
||||||
echo "MAKING _index.p4n.html with ./templates/P4N/index.html"
|
echo "MAKING _index.p4n.html with ./templates/P4N/index.html"
|
||||||
## CREATE INDEX LOADING JSONs ON OPENSTREETMAP
|
## CREATE INDEX LOADING JSONs ON OPENSTREETMAP
|
||||||
cat ${MY_PATH}/../templates/P4N/index.html \
|
cat ${MY_PATH}/../templates/P4N/index.html \
|
||||||
| sed -e "s~43.2218~${LAT}~g" \
|
| sed -e "s~43.2218~${LAT}~g" \
|
||||||
-e "s~1.3977~${LON}~g" \
|
-e "s~1.3977~${LON}~g" \
|
||||||
-e "s~_SERVICE_~Commons~g" \
|
-e "s~_SERVICE_~Commons~g" \
|
||||||
-e "s~_UMAP_~${UMAP}~g" \
|
-e "s~_UMAP_~${UMAP}~g" \
|
||||||
-e "s~http://127.0.0.1:8080~~g" \
|
-e "s~http://127.0.0.1:8080~~g" \
|
||||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.p4n.html
|
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.p4n.html
|
||||||
|
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
########################################################
|
########################################################
|
||||||
echo "CREATING SPHERICAL LOCATIONS"
|
echo "CREATING SPHERICAL LOCATIONS"
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## PREPARE SPHERE MAP ##################################################################
|
## PREPARE SPHERE MAP ##################################################################
|
||||||
echo "var examples = {};
|
echo "var examples = {};
|
||||||
examples['locations'] = function() {
|
examples['locations'] = function() {
|
||||||
var locations = {
|
var locations = {
|
||||||
" > ~/.zen/tmp/world.js
|
" > ~/.zen/tmp/world.js
|
||||||
floop=1
|
floop=1
|
||||||
|
|
||||||
SWARMTW=($(ls ~/.zen/tmp/swarm/*/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
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))
|
NODETW=($(ls ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_*_*/_*.?_*.?/_${LAT}_${LON}/TW/*/index.html 2>/dev/null))
|
||||||
TWFILES=("${SWARMTW[@]}" "${NODETW[@]}")
|
TWFILES=("${SWARMTW[@]}" "${NODETW[@]}")
|
||||||
|
|
||||||
for TWRED in ${TWFILES[@]}; do
|
for TWRED in ${TWFILES[@]}; do
|
||||||
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
ZMAIL=$(echo ${TWRED} | rev | cut -d '/' -f 2 | rev)
|
||||||
TWADD=$(cat ${TWRED} | grep -o "/ipns/[^\"]*" | sed "s/'$//")
|
TWADD=$(cat ${TWRED} | grep -o "/ipns/[^\"]*" | sed "s/'$//")
|
||||||
[[ -z ${TWADD} ]] && TWADD=$(cat ${TWRED} | grep -o "/ipfs/[^\"]*" | sed "s/'$//")
|
[[ -z ${TWADD} ]] && TWADD=$(cat ${TWRED} | grep -o "/ipfs/[^\"]*" | sed "s/'$//")
|
||||||
|
|
||||||
## ADD ASTRONAUTNS ON SECTOR WORLD MAP
|
## ADD ASTRONAUTNS ON SECTOR WORLD MAP
|
||||||
echo "${floop}: {
|
echo "${floop}: {
|
||||||
alpha: Math.random() * 2 * Math.PI,
|
alpha: Math.random() * 2 * Math.PI,
|
||||||
delta: Math.random() * 2 * Math.PI,
|
delta: Math.random() * 2 * Math.PI,
|
||||||
name: '"${ZMAIL}"',
|
name: '"${ZMAIL}"',
|
||||||
link: '"${TWADD}"'
|
link: '"${TWADD}"'
|
||||||
}
|
}
|
||||||
," >> ~/.zen/tmp/world.js
|
," >> ~/.zen/tmp/world.js
|
||||||
|
|
||||||
((floop++))
|
|
||||||
done
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
###########################################################################################
|
|
||||||
### APPLY ON APP MODEL
|
|
||||||
SECLAT="${LAT::-1}"
|
|
||||||
SECLON="${LON::-1}"
|
|
||||||
SECTOR="_${SECLAT}_${SECLON}"
|
|
||||||
TODATESECTORNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}")
|
|
||||||
|
|
||||||
PHONEBOOTH="${G1PUB::30}"
|
|
||||||
cat ${MY_PATH}/../templates/UPlanetUmap/index.html \
|
|
||||||
| sed -e "s~_ZONE_~UMAP ${UMAP}~g" \
|
|
||||||
-e "s~_UPZONE_~SECTOR ${SECTOR}~g" \
|
|
||||||
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
|
||||||
-e "s~_ZONENS_~${TODATENS}~g" \
|
|
||||||
-e "s~_UPZONENS_~${TODATESECTORNS}~g" \
|
|
||||||
-e "s~_PHONEBOOTH_~${PHONEBOOTH}~g" \
|
|
||||||
-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
|
|
||||||
##################################
|
|
||||||
|
|
||||||
###########################################################################################
|
|
||||||
########################################################
|
|
||||||
## CREATE .all.json for RSS in this UMAP
|
|
||||||
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
|
||||||
|
|
||||||
##############################################################
|
|
||||||
############################ PUBLISHING UMAP
|
|
||||||
##############################################################
|
|
||||||
UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1)
|
|
||||||
|
|
||||||
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} \
|
|
||||||
&& echo "UPDATING MOATS"
|
|
||||||
|
|
||||||
## 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 \
|
|
||||||
&& UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1) && echo "ROOT was ${ZCHAIN}"
|
|
||||||
|
|
||||||
echo "PUBLISHING ${TODATE} UMAPROOT : ${myIPFS}/ipfs/${UMAPROOT}"
|
|
||||||
|
|
||||||
ipfs name publish --key=${TODATE}${G1PUB} /ipfs/${UMAPROOT}
|
|
||||||
end=`date +%s`
|
|
||||||
echo "(UMAP) ${UMAP} ${TODATE} PUBLISH time was "`expr $end - $start` seconds.
|
|
||||||
|
|
||||||
ipfs key rm "${TODATE}${G1PUB}" "${YESYERDATE}${G1PUB}" "${G1PUB}" ## REMOVE IPNS KEY
|
|
||||||
|
|
||||||
|
((floop++))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
###########################################################################################
|
||||||
|
### APPLY ON APP MODEL
|
||||||
|
SECLAT="${LAT::-1}"
|
||||||
|
SECLON="${LON::-1}"
|
||||||
|
SECTOR="_${SECLAT}_${SECLON}"
|
||||||
|
TODATESECTORNS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${SECTOR}" "${TODATE}${UPLANETNAME}${SECTOR}")
|
||||||
|
|
||||||
|
PHONEBOOTH="${G1PUB::30}"
|
||||||
|
cat ${MY_PATH}/../templates/UPlanetUmap/index.html \
|
||||||
|
| sed -e "s~_ZONE_~UMAP ${UMAP}~g" \
|
||||||
|
-e "s~_UPZONE_~SECTOR ${SECTOR}~g" \
|
||||||
|
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
|
||||||
|
-e "s~_ZONENS_~${TODATENS}~g" \
|
||||||
|
-e "s~_UPZONENS_~${TODATESECTORNS}~g" \
|
||||||
|
-e "s~_PHONEBOOTH_~${PHONEBOOTH}~g" \
|
||||||
|
-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
|
||||||
|
##################################
|
||||||
|
|
||||||
|
###########################################################################################
|
||||||
|
########################################################
|
||||||
|
## CREATE .all.json for RSS in this UMAP
|
||||||
|
${MY_PATH}/../tools/json_dir.all.sh ~/.zen/tmp/${MOATS}/${UMAP}/RSS
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
############################ PUBLISHING UMAP
|
||||||
|
##############################################################
|
||||||
|
UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1)
|
||||||
|
|
||||||
|
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} \
|
||||||
|
&& echo "UPDATING MOATS"
|
||||||
|
|
||||||
|
## 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 \
|
||||||
|
&& UMAPROOT=$(ipfs add -rwHq ~/.zen/tmp/${MOATS}/${UMAP}/* | tail -n 1) && echo "ROOT was ${ZCHAIN}"
|
||||||
|
|
||||||
|
echo "PUBLISHING ${TODATE} UMAPROOT : ${myIPFS}/ipfs/${UMAPROOT}"
|
||||||
|
|
||||||
|
ipfs name publish --key=${TODATE}${G1PUB} /ipfs/${UMAPROOT}
|
||||||
|
end=`date +%s`
|
||||||
|
echo "(UMAP) ${UMAP} ${TODATE} PUBLISH time was "`expr $end - $start` seconds.
|
||||||
|
|
||||||
|
ipfs key rm "${TODATE}${G1PUB}" "${YESTERDATE}${G1PUB}" "${G1PUB}" ## REMOVE IPNS KEY
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
### SECTOR = 0.1° Planet Slice
|
### SECTOR = 0.1° Planet Slice
|
||||||
${MY_PATH}/SECTOR.refresh.sh "${unique_combined[@]}"
|
${MY_PATH}/SECTOR.refresh.sh "${unique_combined[@]}"
|
||||||
|
|
||||||
### REGION = 1° Planet Slice
|
### REGION = 1° Planet Slice
|
||||||
${MY_PATH}/REGION.refresh.sh "${unique_combined[@]}"
|
${MY_PATH}/REGION.refresh.sh "${unique_combined[@]}"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user