yop
This commit is contained in:
parent
143c60d139
commit
96d7215b57
|
@ -177,7 +177,11 @@ for PLAYER in ${PLAYERONE[@]}; do
|
||||||
echo "LAT=${LAT}; LON=${LON}; UMAPNS=${UMAPNS}"
|
echo "LAT=${LAT}; LON=${LON}; UMAPNS=${UMAPNS}"
|
||||||
|
|
||||||
## TODATENS ################
|
## TODATENS ################
|
||||||
TODATENS=$(${MY_PATH}/../tools/keygen -t ipfs "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}")
|
${MY_PATH}/../tools/keygen -t ipfs -o ~/.zen/tmp/${MOATS}/todate.ipfskey "${TODATE}${UPLANETNAME}${LAT}" "${TODATE}${UPLANETNAME}${LON}"
|
||||||
|
ipfs key rm "_todate" 2>/dev/null
|
||||||
|
TODATENS=$(ipfs key import "_todate" -f pem-pkcs8-cleartext ~/.zen/tmp/${MOATS}/todate.ipfskey)
|
||||||
|
ipfs key rm "_todate" 2>/dev/null
|
||||||
|
|
||||||
echo "GPS UMAP LINK UPDATE
|
echo "GPS UMAP LINK UPDATE
|
||||||
${YESTERDATE} : ${myIPFS}${UMAPNS}
|
${YESTERDATE} : ${myIPFS}${UMAPNS}
|
||||||
${TODATE} : ${myIPFS}/ipns/${TODATENS}"
|
${TODATE} : ${myIPFS}/ipns/${TODATENS}"
|
||||||
|
|
|
@ -208,7 +208,8 @@ for UMAP in ${unique_combined[@]}; do
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## 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/
|
||||||
|
@ -217,7 +218,8 @@ for UMAP in ${unique_combined[@]}; do
|
||||||
# %%%%%%%%%% ##################################################
|
# %%%%%%%%%% ##################################################
|
||||||
## 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)
|
||||||
|
@ -277,21 +279,31 @@ for UMAP in ${unique_combined[@]}; do
|
||||||
## 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
|
||||||
|
|
||||||
## GET WALLETS
|
## GET ALL WALLETS
|
||||||
echo "* GET WALLETS https://g1-stats.axiom-team.fr/data/geoloc-members.json"
|
echo "* GET WALLETS https://g1-stats.axiom-team.fr/data/geoloc-members.json"
|
||||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json
|
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json ]] && touch ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json
|
||||||
[[ ! -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
|
[[ ! -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 \
|
&& curl -s "https://g1-stats.axiom-team.fr/data/geoloc-members.json" -o ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json \
|
||||||
&& [[ $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json) -gt $(stat -c %s ~/.zen/tmp/${MOATS}/${UMAP}/wallets.json) ]] \
|
&& [[ $(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}/wallets.json \
|
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/wallall.json \
|
||||||
&& echo "UPDATED WALLETS" \
|
&& echo "UPDATED WALLALL" \
|
||||||
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
|| rm ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json
|
||||||
|
|
||||||
|
## 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" \
|
||||||
|
'.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)))' wallall.json \
|
||||||
|
> ~/.zen/tmp/${MOATS}/${UMAP}/wallets.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.61000~${LAT}~g" \
|
||||||
-e "s~1.3977~${LON}~g" \
|
-e "s~1.43000~${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" \
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 10 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.2 KiB |
|
@ -3,8 +3,12 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" type="image/x-icon" href="./favicon.ico">
|
||||||
|
|
||||||
<title>UPlanet _UMAP_ _SERVICE_ Data</title>
|
<title>UPlanet _UMAP_ _SERVICE_ Data</title>
|
||||||
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmUBL1cAkKbwnkxCcjvN6B9ydgoNgYGt1sYBqij8Wy2AjS/leaflet.css" />
|
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmZX8YdRWqqJFirdDg1z66Suy7JQrWWufTjPeX51mGoQix/leaflet.css" />
|
||||||
|
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmZX8YdRWqqJFirdDg1z66Suy7JQrWWufTjPeX51mGoQix/leaflet.awesome-markers.css" />
|
||||||
|
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmZX8YdRWqqJFirdDg1z66Suy7JQrWWufTjPeX51mGoQix/all.min.css" />
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -25,7 +29,7 @@
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 18px;
|
font-size: 20px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: 2; /* Ensure the rolling text is above the map */
|
z-index: 2; /* Ensure the rolling text is above the map */
|
||||||
}
|
}
|
||||||
|
@ -34,12 +38,81 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div id="rollingText" class="rolling-text-container"></div>
|
<div id="rollingText" class="rolling-text-container"></div>
|
||||||
<script src="http://127.0.0.1:8080/ipfs/QmUBL1cAkKbwnkxCcjvN6B9ydgoNgYGt1sYBqij8Wy2AjS/leaflet.js"></script>
|
<script src="http://127.0.0.1:8080/ipfs/QmZX8YdRWqqJFirdDg1z66Suy7JQrWWufTjPeX51mGoQix/leaflet.js"></script>
|
||||||
<script src="http://127.0.0.1:8080/ipfs/QmUBL1cAkKbwnkxCcjvN6B9ydgoNgYGt1sYBqij8Wy2AjS/axios.min.js"></script>
|
<script src="http://127.0.0.1:8080/ipfs/QmZX8YdRWqqJFirdDg1z66Suy7JQrWWufTjPeX51mGoQix/leaflet.awesome-markers.min.js"></script>
|
||||||
|
<script src="http://127.0.0.1:8080/ipfs/QmZX8YdRWqqJFirdDg1z66Suy7JQrWWufTjPeX51mGoQix/axios.min.js"></script>
|
||||||
|
<!-- Include the tweetnacl library for Ed25519 operations -->
|
||||||
|
<script src="./nacl.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Custom Base58 encoding and decoding functions
|
||||||
|
function base58Encode(bytes) {
|
||||||
|
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||||
|
const base = BigInt(ALPHABET.length);
|
||||||
|
let encoded = '';
|
||||||
|
|
||||||
|
let value = BigInt('0');
|
||||||
|
for (let i = 0; i < bytes.length; i++) {
|
||||||
|
value = value * BigInt(256) + BigInt(bytes[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (value > BigInt(0)) {
|
||||||
|
const remainder = value % base;
|
||||||
|
value = value / base;
|
||||||
|
encoded = ALPHABET[Number(remainder)] + encoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
function base58Decode(encoded) {
|
||||||
|
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||||
|
const base = BigInt(ALPHABET.length);
|
||||||
|
|
||||||
|
let value = BigInt('0');
|
||||||
|
for (let i = 0; i < encoded.length; i++) {
|
||||||
|
const char = encoded[i];
|
||||||
|
const charValue = BigInt(ALPHABET.indexOf(char));
|
||||||
|
value = value * base + charValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const valueBytes = [];
|
||||||
|
while (value > BigInt(0)) {
|
||||||
|
const byteValue = Number(value % BigInt(256));
|
||||||
|
value = value / BigInt(256);
|
||||||
|
valueBytes.unshift(byteValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Uint8Array(valueBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertPublicKey(pubkey) {
|
||||||
|
const g1PublicKey = pubkey;
|
||||||
|
|
||||||
|
// Decode the Base58 encoded G1 public key using custom function
|
||||||
|
const decodedShared = base58Decode(g1PublicKey);
|
||||||
|
|
||||||
|
// Create a new Uint8Array to hold the IPNS public key bytes
|
||||||
|
const ipnsPublicKeyBytes = new Uint8Array(decodedShared.length + 6);
|
||||||
|
|
||||||
|
// Prefix bytes for IPNS public key
|
||||||
|
const prefixBytes = new Uint8Array([0, 36, 8, 1, 18, 32]);
|
||||||
|
|
||||||
|
// Copy the prefix bytes and G1 public key bytes into the new array
|
||||||
|
ipnsPublicKeyBytes.set(prefixBytes, 0);
|
||||||
|
ipnsPublicKeyBytes.set(decodedShared, prefixBytes.length);
|
||||||
|
|
||||||
|
// Encode the IPNS public key using custom Base58 encoding
|
||||||
|
const ipnsPublicKey = '1' + base58Encode(ipnsPublicKeyBytes); // Prepend '1'
|
||||||
|
|
||||||
|
return ipnsPublicKey;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// Initialize Leaflet map
|
// Initialize Leaflet map
|
||||||
const map = L.map('map').setView([43.2218, 1.3977], 11);
|
const map = L.map('map').setView([43.61000, 1.43000], 11);
|
||||||
// Add OpenStreetMap layer
|
// Add OpenStreetMap layer
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© OpenStreetMap contributors'
|
attribution: '© OpenStreetMap contributors'
|
||||||
|
@ -48,23 +121,33 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
// Fetch wallets data
|
// Fetch wallets data
|
||||||
axios.get('./wallets.json')
|
axios.get('./wallets.json')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const walletData = response.data;
|
const walletPlaces = response.data;
|
||||||
const walletPlaces = walletData.wallets;
|
|
||||||
|
|
||||||
// Iterate through wallet data
|
// Iterate through wallet data
|
||||||
walletPlaces.forEach(place => {
|
walletPlaces.forEach(place => {
|
||||||
const { geoPoint, title, description, socials } = place;
|
const { geoPoint, title, description, socials, pubkey } = place;
|
||||||
const { lat, lon } = geoPoint;
|
const { lat, lon } = geoPoint;
|
||||||
|
|
||||||
|
// Add a marker with a FontAwesome icon
|
||||||
|
var customIcon = L.AwesomeMarkers.icon({
|
||||||
|
icon: 'coffee', // Specify the FontAwesome icon name
|
||||||
|
markerColor: 'red' // Customize marker color
|
||||||
|
});
|
||||||
|
|
||||||
// Create a marker on the map
|
// Create a marker on the map
|
||||||
const marker = L.marker([lat, lon]).addTo(map);
|
const marker = L.marker([lat, lon], { icon: customIcon }).addTo(map);
|
||||||
|
|
||||||
// Create a popup content
|
// Create a popup content
|
||||||
const popupContent = `
|
let popupContent = `<b>${title}</b><br>${description}<br>`;
|
||||||
<b>${title}</b><br>
|
|
||||||
${description}<br>
|
// Check if socials is defined
|
||||||
<a href="${socials[0].url}" target="_blank">Visit Website</a>
|
if (socials && socials.length > 0) {
|
||||||
`;
|
popupContent += `<a href="${socials[0].url}" target="_blank">Visit Website</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
popupContent += `<br>* <a href="/ipfs/QmXex8PTnQehx4dELrDYuZ2t5ag85crYCBxm3fcTjVWo2k/#/app/wot/tx/${pubkey}/" target="_blank">Cesium</a>`;
|
||||||
|
popupContent += `<br>* <a href="/ipfs/QmadaNua8Cj8fwRNeEfzkMAjQ8XJuBJpD41w5pb2DBC8uc/#/app/user/${pubkey}/" target="_blank">GChange</a>`;
|
||||||
|
popupContent += `<br>* <a href="/ipns/${convertPublicKey(pubkey)}" target="_blank">+ TW +</a>`;
|
||||||
|
|
||||||
// Bind popup to the marker
|
// Bind popup to the marker
|
||||||
marker.bindPopup(popupContent);
|
marker.bindPopup(popupContent);
|
||||||
|
@ -82,6 +165,8 @@ axios.get('./p4n.json')
|
||||||
// Iterate through p4n data
|
// Iterate through p4n data
|
||||||
p4nPlaces.forEach(place => {
|
p4nPlaces.forEach(place => {
|
||||||
const { lat, lng, title_short, description, services, activities } = place;
|
const { lat, lng, title_short, description, services, activities } = place;
|
||||||
|
|
||||||
|
// Create a marker on the map
|
||||||
const marker = L.marker([lat, lng]).addTo(map);
|
const marker = L.marker([lat, lng]).addTo(map);
|
||||||
|
|
||||||
// Create a popup content
|
// Create a popup content
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue