diff --git a/API/ZONE.sh b/API/ZONE.sh index 48057ddac..6cfb72fc2 100755 --- a/API/ZONE.sh +++ b/API/ZONE.sh @@ -58,12 +58,27 @@ LAT=${THIS} LON=${WHAT} [[ -z $LON ]] && LON=0.00 +function makecoord() { + local input="$1" + + if [[ ${input} =~ ^-?[0-9]+\.[0-9]$ ]]; then + input="${input}0" + elif [[ ${input} =~ ^-?[0-9]+$ ]]; then + input="${input}.00" + fi + + echo "${input}" +} + # PREPARE HTTP RESPONSE (application/json) echo "${HTTPCORS}" > ~/.zen/tmp/${MOATS}.http sed -i "s~text/html~application/json~g" ~/.zen/tmp/${MOATS}.http if [[ $DEG == "0.001" ]]; then + LAT=$(makecoord $LAT) + LON=$(makecoord $LON) + G1PUB=$(${MY_PATH}/../tools/keygen -t duniter "${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 ## AVOID ERROR ON IMPORT @@ -73,7 +88,7 @@ if [[ $DEG == "0.001" ]]; then cat ~/.zen/tmp/${MOATS}.http | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 & rm -Rf ~/.zen/tmp/${MOATS}/ end=`date +%s` - echo "(EXPLORE ZONE $DEG) Operation time was "`expr $end - $start` seconds. + echo "(EXPLORE ZONE $DEG)_${LAT}_${LON} $UMAPNS Operation time was "`expr $end - $start` seconds. exit 0 fi diff --git a/RUNTIME/SECTOR.refresh.sh b/RUNTIME/SECTOR.refresh.sh index ec1f98885..25ce92fc6 100755 --- a/RUNTIME/SECTOR.refresh.sh +++ b/RUNTIME/SECTOR.refresh.sh @@ -223,9 +223,6 @@ for SECTOR in ${SECTORS[@]}; do -e "s~http://127.0.0.1:8080~~g" \ > ~/.zen/tmp/${MOATS}/${SECTOR}/_index.html - ## Make it root App for SECTORNS key - mv ~/.zen/tmp/${MOATS}/${SECTOR}/_index.html \ - ~/.zen/tmp/${MOATS}/${SECTOR}/index.html ################################## ########################################################################################### diff --git a/RUNTIME/UPLANET.refresh.sh b/RUNTIME/UPLANET.refresh.sh index 00c879431..a7eeb2847 100755 --- a/RUNTIME/UPLANET.refresh.sh +++ b/RUNTIME/UPLANET.refresh.sh @@ -315,7 +315,7 @@ echo "" > ~/.z -e "s~_UPZONE_~SECTOR ${SECTOR}~g" \ -e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \ -e "s~_ZONENS_~${UMAPNS}~g" \ - -e "s~_UPZONENS_~${SECTORNS}~g" \ + -e "s~_UPZONENS_~${SECTORNS}/TW~g" \ -e "s~http://127.0.0.1:8080~~g" \ > ~/.zen/tmp/${MOATS}/${UMAP}/_index.html