[days[-1]]
This commit is contained in:
parent
71d24341b3
commit
d0db377309
|
@ -204,10 +204,10 @@ echo "====(•‿‿•)======= %%%%% (°▃▃°) %%%%%%% ======(•‿‿•)=
|
|||
## SEARCH FOR TODAY MODIFIED TIDDLERS WITH MULTIPLE EMAILS IN TAG
|
||||
# This can could happen in case Tiddler is copied OR PLAYER manualy adds an email tag to Tiddler to share with someone...
|
||||
#################################################################
|
||||
echo "# EXTRACT [days:modified[-1]] DAYS TIDDLERS"
|
||||
echo "# EXTRACT [days[-1]] DAYS TIDDLERS"
|
||||
tiddlywiki --load ${INDEX} \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "today.${PLAYER}.tiddlers.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days:modified[-1]]'
|
||||
--render '.' "today.${PLAYER}.tiddlers.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' '[days[-1]]'
|
||||
|
||||
# cat ~/.zen/tmp/${MOATS}/today.${PLAYER}.tiddlers.json | jq -rc # LOG
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ TEXT="<a target='_blank' href='#:[tag[G1"${VoeuName}"]]' ><img src='"/ipfs/${IVO
|
|||
<\$list filter='[tag[G1"${VoeuName}"]]'>\n
|
||||
<\$action-navigate \$to=<<currentTiddler>> \$scroll=no/>\n
|
||||
</\$list>\n
|
||||
SHOW G1"${VoeuName}"\n
|
||||
ALL G1"${VoeuName}"\n
|
||||
</\$button>"
|
||||
|
||||
# NEW IVEU TIDDLER
|
||||
|
|
|
@ -58,9 +58,9 @@ for PLAYER in ${PLAYERONE[@]}; do
|
|||
cat ~/.zen/tmp/${MOATS}/${PLAYER}.COINScheck ###DEBUG MODE
|
||||
COINS=$(cat ~/.zen/tmp/${MOATS}/${PLAYER}.COINScheck | tail -n 1)
|
||||
ZEN=$(echo "($COINS - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
echo "+++ WALLET BALANCE _ $COINS (G1) _ / $ZEN ♥ /"
|
||||
echo "+++ WALLET BALANCE _ $COINS (G1) _ / $ZEN ZEN /"
|
||||
|
||||
#~ ## ZENCARD ARE ACTIVATED WITH 1 G1 + 10 ♥ (= 10 €/OC) ?
|
||||
#~ ## ZENCARD ARE ACTIVATED WITH 1 G1 + 10 ZEN (= 10 €/OC) ?
|
||||
echo "## >>>>>>>>>>>>>>>> REFRESH ASTRONAUTE TW"
|
||||
## REFRESH ASTRONAUTE TW
|
||||
ASTRONAUTENS=$(ipfs key list -l | grep -w ${G1PUB} | cut -d ' ' -f1)
|
||||
|
@ -327,18 +327,6 @@ for PLAYER in ${PLAYERONE[@]}; do
|
|||
|
||||
## GET ORIGINH FROM LAST KNOWN TW STATE
|
||||
mkdir -p ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}
|
||||
if [[ -s ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html ]]; then
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "${FPLAYER}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${FPLAYER}" ## GET ORIGIN
|
||||
|
||||
ORIGINH=$(cat ~/.zen/tmp/${MOATS}/${FPLAYER}.json | jq -r '.[].text' | sha256sum | cut -d ' ' -f 1)
|
||||
echo "ORIGINH: $ORIGINH"
|
||||
fi
|
||||
|
||||
( ## REFRESH LOCAL PLAYER CACHE with FRIEND ACTUAL TW (&) will be used TOMORROW
|
||||
ipfs --timeout 480s cat --progress=false ${FTW} > ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html
|
||||
) &
|
||||
|
||||
## CHECK ALREADY IN ${FPLAYER^^} IHASH
|
||||
rm -f ~/.zen/tmp/${MOATS}/finside.json
|
||||
|
@ -349,6 +337,23 @@ for PLAYER in ${PLAYERONE[@]}; do
|
|||
INSIDEH=$(cat ~/.zen/tmp/${MOATS}/finside.json | jq -rc '.[].ihash')
|
||||
echo "INSIDEH: $INSIDEH"
|
||||
|
||||
if [[ -s ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html ]]; then
|
||||
tiddlywiki --load ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html \
|
||||
--output ~/.zen/tmp/${MOATS} \
|
||||
--render '.' "${FPLAYER}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${FPLAYER}" ## GET ORIGIN
|
||||
|
||||
ORIGINH=$(cat ~/.zen/tmp/${MOATS}/${FPLAYER}.json | jq -r '.[].text' | sha256sum | cut -d ' ' -f 1)
|
||||
## USE IPFSH=$(cat ~/.zen/tmp/${MOATS}/${FPLAYER}.json | jq -r '.[].text' | ipfs add -q)
|
||||
## TODO MICROLEDGER TIDDLER
|
||||
echo "ORIGINH: $ORIGINH"
|
||||
else
|
||||
ORIGINH="$INSIDEH"
|
||||
fi
|
||||
|
||||
( ## REFRESH LOCAL PLAYER CACHE with FRIEND ACTUAL TW (&) will be used TOMORROW
|
||||
ipfs --timeout 480s cat --progress=false ${FTW} > ~/.zen/game/players/${PLAYER}/FRIENDS/${FPLAYER}/index.html
|
||||
) &
|
||||
|
||||
## UPDATE IF IHASH CHANGED -> New drawing => Friend get informed
|
||||
if [[ -z $INSIDEH || $INSIDEH != $IHASH || $ORIGINH != $INSIDEH ]]; then
|
||||
cat ${MY_PATH}/../templates/data/_UPPERFPLAYER_.json \
|
||||
|
@ -370,7 +375,7 @@ for PLAYER in ${PLAYERONE[@]}; do
|
|||
[[ -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html \
|
||||
|| echo "ERROR - CANNOT CREATE TW NEWINDEX - ERROR"
|
||||
|| echo "ERROR - CANNOT IMPORT ${FPLAYER^^}.json - ERROR"
|
||||
|
||||
if [[ $ORIGINH != $INSIDEH && $ORIGINH != "" ]]; then
|
||||
echo "ORIGINH Update"
|
||||
|
@ -382,7 +387,7 @@ for PLAYER in ${PLAYERONE[@]}; do
|
|||
[[ -s ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ]] \
|
||||
&& cp ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/index.html \
|
||||
&& rm ~/.zen/tmp/${IPFSNODEID}/TW/${PLAYER}/newindex.html \
|
||||
|| echo "ERROR - CANNOT CREATE TW NEWINDEX - ERROR"
|
||||
|| echo "ERROR - CANNOT IMPORT ${FPLAYER}.json - ERROR"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -535,7 +540,7 @@ if [[ ${days} -ge 14 ]]; then
|
|||
## DEAD PLAYER ??
|
||||
if [[ ${days} -eq 27 ]]; then
|
||||
echo "<html><body><h1>WARNING.</h1> Your TW will be UNPLUGGED and stop being published..." > ~/.zen/tmp/alert
|
||||
echo "<br><h3>TW : <a href=$(myIpfsGw)/ipfs/${CURCHAIN}> ${PLAYER}</a></h3> ADD MORE ♥ ($ZEN) </body></html>" >> ~/.zen/tmp/alert
|
||||
echo "<br><h3>TW : <a href=$(myIpfsGw)/ipfs/${CURCHAIN}> ${PLAYER}</a></h3> ADD MORE ZEN ($ZEN) </body></html>" >> ~/.zen/tmp/alert
|
||||
|
||||
${MY_PATH}/../tools/mailjet.sh "${PLAYER}" ~/.zen/tmp/alert "TW ALERT"
|
||||
echo "<<<< PLAYER TW WARNING <<<< ${DIFF_SECONDS} > ${days} days"
|
||||
|
@ -547,7 +552,7 @@ if [[ ${days} -ge 14 ]]; then
|
|||
continue
|
||||
fi
|
||||
|
||||
## PAY 1 ♥ TO UMAPG1PUB
|
||||
## PAY 1 ZEN TO UMAPG1PUB
|
||||
[[ "${UMAPG1PUB}" != "" ]] \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/${PLAYER}/secret.dunikey" "0.1" "${UMAPG1PUB}" "UPLANET:TW:${YOUSER}:/ipfs/${TW}"
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ for UMAP in ${unique_combined[@]}; do
|
|||
COINS=$($MY_PATH/../tools/COINScheck.sh ${G1PUB} | tail -n 1)
|
||||
ZEN=$(echo "($COINS - 1) * 10" | bc | cut -d '.' -f 1)
|
||||
|
||||
echo "UMAP (${COINS} G1) ${ZEN} ♥ : ${G1PUB}"
|
||||
echo "UMAP (${COINS} G1) ${ZEN} ZEN : ${G1PUB}"
|
||||
|
||||
## ORIGIN ##########################################################
|
||||
## CALCULATE INITIAL UMAP GEOSPACIAL IPNS KEY
|
||||
|
@ -104,9 +104,9 @@ for UMAP in ${unique_combined[@]}; do
|
|||
ipfs --timeout 300s get --progress=false -o ~/.zen/tmp/${MOATS}/${UMAP}/ /ipns/${YESTERDATENS}/
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "(╥☁╥ ) swarm online memory empty (╥☁╥ )"
|
||||
# Try retieve memory from UPlanet ♥ Memory
|
||||
# Try retieve memory from UPlanet ZEN Memory
|
||||
[[ ${ZEN} -gt 0 ]] \
|
||||
&& echo "INTERCOM Refreshing from ♥ MEMORY" \
|
||||
&& echo "INTERCOM Refreshing from ZEN MEMORY" \
|
||||
&& ${MY_PATH}/../RUNTIME/ZEN.UMAP.memory.sh "${UMAP}" "${MOATS}" "${G1PUB}"
|
||||
fi
|
||||
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
|
@ -191,13 +191,13 @@ for UMAP in ${unique_combined[@]}; do
|
|||
echo ">> NEXT REFRESHER WILL BE $(cat ${UREFRESH} | head -n 1)"
|
||||
######################################################## # NODE SELECTION in UMAP.refresher
|
||||
|
||||
############ 101 ♥ REFILL ?!
|
||||
############ 101 ZEN REFILL ?!
|
||||
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}") \
|
||||
&& ${MY_PATH}/../tools/PAY4SURE.sh "${HOME}/.zen/game/players/.current/secret.dunikey" "11.1" "${G1PUB}" "UPLANET:101ZEN:${UMAP}:${MIUSER}" \
|
||||
&& echo "UPLANET:101:${UMAP}:${MIUSER}" && echo " ~~~ (♥‿‿♥) ~~ _${LAT}_${LON} ~~ (♥‿‿♥) ~~~ "
|
||||
&& echo "UPLANET:101:${UMAP}:${MIUSER}" && echo " ~~~ (ZEN‿‿ZEN) ~~ _${LAT}_${LON} ~~ (ZEN‿‿ZEN) ~~~ "
|
||||
|
||||
# %%%%%%%%%% ##################################################
|
||||
## SECTOR LINKING >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>${SLAT}_${SLON}
|
||||
|
@ -258,10 +258,11 @@ for UMAP in ${unique_combined[@]}; do
|
|||
rm ~/.zen/tmp/${MOATS}/next.priv
|
||||
## BOOSTRAP SWARM PUBLICATION _next.umapns
|
||||
echo "${G1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_next.umapns
|
||||
## IN UMAP KEY PUBLICATION
|
||||
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_next.umapns \
|
||||
~/.zen/tmp/${MOATS}/${UMAP}/
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.umapns
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.umapns \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
## 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
|
||||
|
@ -271,10 +272,11 @@ for UMAP in ${unique_combined[@]}; do
|
|||
rm ~/.zen/tmp/${MOATS}/next.priv
|
||||
## BOOSTRAP SWARM PUBLICATION _next.sectorns
|
||||
echo "${SECTORG1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_next.sectorns
|
||||
## IN UMAP KEY PUBLICATION
|
||||
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_next.sectorns \
|
||||
~/.zen/tmp/${MOATS}/${UMAP}/
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.sectorns
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.sectorns \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
## 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
|
||||
|
@ -284,10 +286,11 @@ for UMAP in ${unique_combined[@]}; do
|
|||
rm ~/.zen/tmp/${MOATS}/next.priv
|
||||
## BOOSTRAP SWARM PUBLICATION _next.regionns
|
||||
echo "${REGIONG1PUB}:${DEMAINDATE}:${NEXTNS}" \
|
||||
> ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_next.regionns
|
||||
## IN UMAP KEY PUBLICATION
|
||||
cp ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/_next.regionns \
|
||||
~/.zen/tmp/${MOATS}/${UMAP}/
|
||||
> ~/.zen/tmp/${MOATS}/${UMAP}/_next.regionns
|
||||
|
||||
cp ~/.zen/tmp/${MOATS}/${UMAP}/_next.regionns \
|
||||
~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/
|
||||
|
||||
####################################################################################
|
||||
## TODATE DATA
|
||||
echo "WRITE $TODATE DATA /UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}"
|
||||
|
@ -507,12 +510,12 @@ for UMAP in ${unique_combined[@]}; do
|
|||
&& echo "UPDATING MOATS"
|
||||
|
||||
######################################################
|
||||
## ♥ CHAINING
|
||||
# Send 1 ♥ to UPlanet SECTORG1PUB Wallet containing REGION TW HASH
|
||||
## ZEN CHAINING
|
||||
# Send 1 ZEN to UPlanet SECTORG1PUB Wallet containing REGION TW HASH
|
||||
INTERCOM="UPLANET:${UMAP}:${TODATE}:/ipfs/${UMAPROOT}"
|
||||
echo "> INTERCOM ${INTERCOM} (${ZEN} ♥ > 11 ?)"
|
||||
echo "> INTERCOM ${INTERCOM} (${ZEN} ZEN > 11 ?)"
|
||||
if [[ ${ZEN} -gt 11 ]]; then
|
||||
echo "---ZZZ-- UMAP 2 SECTOR ♥ CHAINING ---ZZZ------ZZZ----"
|
||||
echo "---ZZZ-- UMAP 2 SECTOR ZEN CHAINING ---ZZZ------ZZZ----"
|
||||
${MY_PATH}/../tools/PAY4SURE.sh ~/.zen/tmp/${MOATS}/${UMAP}.dunikey "0.1" "${SECTORG1PUB}" "${INTERCOM}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -56,7 +56,8 @@ if [[ -s ~/.zen/tmp/${MOATS}/${REGION}.g1history.json ]]; then
|
|||
if [[ $ipfs_pop ]]; then
|
||||
g1pub=$(jq -r '.[] | select(.comment | test("UPLANET:'"${SECTOR}"'")) | .pubkey' ~/.zen/tmp/${MOATS}/${REGION}.g1history.json | tail -n 1)
|
||||
echo "INFO :: $g1pub Memory updater"
|
||||
ipfs --timeout 180s get --progress="false" -o ~/.zen/tmp/${MOATS}/${SECTOR} $ipfs_pop \
|
||||
ipfs --timeout 180s get --progress="false" -o ~/.zen/tmp/${MOATS}/${SECTOR} $ipfs_pop
|
||||
&& ipfs pin rm $ipfs_pop \
|
||||
|| echo "$ipfs_pop ERROR ... "
|
||||
else
|
||||
echo "WARNING cannot revover any memory !!"
|
||||
|
|
|
@ -61,6 +61,7 @@ if [[ -s ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json ]]; then
|
|||
g1pub=$(jq -r '.[] | select(.comment | test("UPLANET:'"${UMAP}"'")) | .pubkey' ~/.zen/tmp/${MOATS}/${SECTOR}.g1history.json | tail -n 1)
|
||||
echo "INFO :: $g1pub Memory updater"
|
||||
ipfs --timeout 180s get --progress="false" -o ~/.zen/tmp/${MOATS}/${UMAP} $ipfs_pop \
|
||||
&& ipfs pin rm $ipfs_pop \
|
||||
|| echo "$ipfs_pop ERROR ... "
|
||||
else
|
||||
echo "WARNING cannot revover any memory !!"
|
||||
|
|
|
@ -3,128 +3,71 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Compass</title>
|
||||
<title>Map with Markers</title>
|
||||
<script src="http://127.0.0.1:8080/ipfs/QmX5zu86RT2umWTkKqwT2trcyrP5MYTJpB3o3G1Jt8qYYf/leaflet.js"></script>
|
||||
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmX5zu86RT2umWTkKqwT2trcyrP5MYTJpB3o3G1Jt8qYYf/leaflet.css"/>
|
||||
<script src="http://127.0.0.1:8080/ipfs/QmX5zu86RT2umWTkKqwT2trcyrP5MYTJpB3o3G1Jt8qYYf/leaflet.markercluster.js"></script>
|
||||
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmX5zu86RT2umWTkKqwT2trcyrP5MYTJpB3o3G1Jt8qYYf/MarkerCluster.css"/>
|
||||
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmX5zu86RT2umWTkKqwT2trcyrP5MYTJpB3o3G1Jt8qYYf/MarkerCluster.Default.css"/>
|
||||
<style>
|
||||
#compass {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
border: 2px solid black;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
margin: 50px auto;
|
||||
}
|
||||
.needle {
|
||||
width: 2px;
|
||||
height: 150px;
|
||||
background-color: red;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
transition: transform 0.5s ease;
|
||||
}
|
||||
#location-info {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
#map {
|
||||
width: 800px;
|
||||
height: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="compass">
|
||||
<div id="needle-1" class="needle"></div>
|
||||
<div id="needle-2" class="needle"></div>
|
||||
<div id="needle-3" class="needle"></div>
|
||||
<div id="needle-4" class="needle"></div>
|
||||
<div id="needle-5" class="needle"></div>
|
||||
<div id="needle-6" class="needle"></div>
|
||||
<div id="needle-7" class="needle"></div>
|
||||
<div id="needle-8" class="needle"></div>
|
||||
</div>
|
||||
<div id="location-info"></div>
|
||||
<div id="map"></div>
|
||||
|
||||
<script>
|
||||
function degreesToRadians(degrees) {
|
||||
return degrees * (Math.PI/180);
|
||||
}
|
||||
var map = L.map('map');
|
||||
|
||||
function distanceBetweenCoords(lat1, lon1, lat2, lon2) {
|
||||
var earthRadiusKm = 6371;
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
}).addTo(map);
|
||||
|
||||
var dLat = degreesToRadians(lat2-lat1);
|
||||
var dLon = degreesToRadians(lon2-lon1);
|
||||
var markers = L.markerClusterGroup();
|
||||
|
||||
var a =
|
||||
Math.sin(dLat/2) * Math.sin(dLat/2) +
|
||||
Math.cos(degreesToRadians(lat1)) * Math.cos(degreesToRadians(lat2)) *
|
||||
Math.sin(dLon/2) * Math.sin(dLon/2);
|
||||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
||||
var distance = earthRadiusKm * c;
|
||||
function addMarkersAroundLocation(latitude, longitude, zoom) {
|
||||
markers.clearLayers(); // Clear previous markers
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
function updateCompass(heading) {
|
||||
var needles = document.querySelectorAll('.needle');
|
||||
needles.forEach(function(needle) {
|
||||
needle.style.transform = `translateX(-50%) translateY(-50%) rotate(${heading}deg)`;
|
||||
});
|
||||
}
|
||||
|
||||
function showLocationInfo(latitude, longitude) {
|
||||
var infoElement = document.getElementById('location-info');
|
||||
infoElement.innerHTML = `Latitude: ${latitude.toFixed(5)}, Longitude: ${longitude.toFixed(5)}`;
|
||||
|
||||
// Calculate distances to key spots with different precisions
|
||||
var distances = {
|
||||
'Sector 1 (0.01°)': distanceBetweenCoords(latitude, longitude, latitude + 0.01, longitude),
|
||||
'Sector 2 (0.01°)': distanceBetweenCoords(latitude, longitude, latitude, longitude + 0.01),
|
||||
'Sector 3 (0.01°)': distanceBetweenCoords(latitude, longitude, latitude - 0.01, longitude),
|
||||
'Sector 4 (0.01°)': distanceBetweenCoords(latitude, longitude, latitude, longitude - 0.01),
|
||||
'Region 1 (0.1°)': distanceBetweenCoords(latitude, longitude, latitude + 0.1, longitude),
|
||||
'Region 2 (0.1°)': distanceBetweenCoords(latitude, longitude, latitude, longitude + 0.1),
|
||||
'Region 3 (0.1°)': distanceBetweenCoords(latitude, longitude, latitude - 0.1, longitude),
|
||||
'Region 4 (0.1°)': distanceBetweenCoords(latitude, longitude, latitude, longitude - 0.1)
|
||||
};
|
||||
|
||||
// Check proximity and open URL if less than 10 meters
|
||||
for (var key in distances) {
|
||||
var distance = distances[key];
|
||||
if (distance < 0.01) { // Less than 10 meters (0.01 in degrees is approximately 10 meters)
|
||||
window.open('https://example.com'); // Change URL to the desired one
|
||||
break; // Stop checking once a key spot within proximity is found
|
||||
if (zoom > 11) {
|
||||
var radius = 2; // in kilometers
|
||||
var step = 0.01; // 0.01° precision
|
||||
var markerArray = [];
|
||||
for (var lat = latitude - radius; lat <= latitude + radius; lat += step) {
|
||||
for (var lng = longitude - radius; lng <= longitude + radius; lng += step) {
|
||||
markerArray.push(L.marker([lat, lng]).on('click', function(e) {
|
||||
var markerLat = e.latlng.lat;
|
||||
var markerLng = e.latlng.lng;
|
||||
console.log(`Clicked marker at: (${markerLat}, ${markerLng})`);
|
||||
window.open(`https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=${markerLat}%2C${markerLng}%3B${latitude}%2C${longitude}`, '_blank');
|
||||
}));
|
||||
}
|
||||
}
|
||||
markers.addLayers(markerArray);
|
||||
map.addLayer(markers);
|
||||
}
|
||||
}
|
||||
|
||||
// Display distances
|
||||
for (var key in distances) {
|
||||
infoElement.innerHTML += `<br>${key}: ${distances[key].toFixed(2)} km`;
|
||||
}
|
||||
}
|
||||
|
||||
function getLocation() {
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
var latitude = position.coords.latitude;
|
||||
var longitude = position.coords.longitude;
|
||||
|
||||
showLocationInfo(latitude, longitude);
|
||||
|
||||
navigator.geolocation.watchPosition(function(position) {
|
||||
var newLatitude = position.coords.latitude;
|
||||
var newLongitude = position.coords.longitude;
|
||||
|
||||
var heading = Math.atan2(newLongitude - longitude, newLatitude - latitude) * (180 / Math.PI);
|
||||
updateCompass(heading);
|
||||
|
||||
showLocationInfo(newLatitude, newLongitude);
|
||||
|
||||
latitude = newLatitude;
|
||||
longitude = newLongitude;
|
||||
});
|
||||
});
|
||||
} else {
|
||||
alert("Geolocation is not supported by this browser.");
|
||||
}
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
var latitude = position.coords.latitude;
|
||||
var longitude = position.coords.longitude;
|
||||
console.log(`Detected location: (${latitude}, ${longitude})`);
|
||||
map.setView([latitude, longitude], 13);
|
||||
addMarkersAroundLocation(latitude, longitude, 13); // Initial setup at zoom level 13
|
||||
map.on('zoomend', function() {
|
||||
var zoom = map.getZoom();
|
||||
console.log(`Zoom level changed to: ${zoom}`);
|
||||
addMarkersAroundLocation(latitude, longitude, zoom);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
alert("Geolocation is not supported by this browser.");
|
||||
}
|
||||
}
|
||||
|
||||
getLocation();
|
||||
|
|
|
@ -36,19 +36,19 @@ UMAPIPNS="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_$
|
|||
echo "UMAPIPNS=$UMAPIPNS"
|
||||
|
||||
echo "SECTOR : _${SLAT}_${SLON}"
|
||||
SECTORG1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORG1PUB 2>/dev/null | tail -n 1)
|
||||
[[ ! $SECTORG1PUB ]] && SECTORG1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORG1PUB 2>/dev/null | tail -n 1)
|
||||
SECTORG1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_*_*/SECTORG1PUB 2>/dev/null | tail -n 1)
|
||||
[[ ! $SECTORG1PUB ]] && SECTORG1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_*_*/SECTORG1PUB 2>/dev/null | tail -n 1)
|
||||
echo "SECTORG1PUB=$SECTORG1PUB"
|
||||
SECTORIPNS="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORNS 2>/dev/null | tail -n 1)
|
||||
[[ $SECTORIPNS == "/ipns/" ]] && SECTORIPNS="/ipns/"$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/SECTORNS 2>/dev/null | tail -n 1)
|
||||
SECTORIPNS="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_*_*/SECTORNS 2>/dev/null | tail -n 1)
|
||||
[[ $SECTORIPNS == "/ipns/" ]] && SECTORIPNS="/ipns/"$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_*_*/SECTORNS 2>/dev/null | tail -n 1)
|
||||
echo "SECTORIPNS=$SECTORIPNS"
|
||||
|
||||
echo "REGION : _${RLAT}_${RLON}"
|
||||
REGIONG1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONG1PUB 2>/dev/null | tail -n 1)
|
||||
[[ ! $REGIONG1PUB ]] && REGIONG1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONG1PUB 2>/dev/null | tail -n 1)
|
||||
REGIONG1PUB=$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_*_*/_*_*/REGIONG1PUB 2>/dev/null | tail -n 1)
|
||||
[[ ! $REGIONG1PUB ]] && REGIONG1PUB=$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_*_*/_*_*/REGIONG1PUB 2>/dev/null | tail -n 1)
|
||||
echo "REGIONG1PUB=$REGIONG1PUB"
|
||||
REGIONIPNS="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONNS 2>/dev/null | tail -n 1)
|
||||
[[ $REGIONIPNS == "/ipns/" ]] && REGIONIPNS="/ipns/"$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_${SLAT}_${SLON}/_${LAT}_${LON}/REGIONNS 2>/dev/null | tail -n 1)
|
||||
REGIONIPNS="/ipns/"$(cat ~/.zen/tmp/swarm/*/UPLANET/__/_${RLAT}_${RLON}/_*_*/_*_*/REGIONNS 2>/dev/null | tail -n 1)
|
||||
[[ $REGIONIPNS == "/ipns/" ]] && REGIONIPNS="/ipns/"$(cat ~/.zen/tmp/${IPFSNODEID}/UPLANET/__/_${RLAT}_${RLON}/_*_*/_*_*/REGIONNS 2>/dev/null | tail -n 1)
|
||||
echo "REGIONIPNS=$REGIONIPNS"
|
||||
|
||||
echo "## LAST LINE EXPORT"
|
||||
|
|
Loading…
Reference in New Issue