UPlanet UMap App = All TW from same Umap

This commit is contained in:
fred 2023-12-01 17:25:10 +01:00
parent 774d6f7e7a
commit 8c3c8ac157
4 changed files with 77 additions and 18 deletions

View File

@ -165,8 +165,8 @@ for SECTOR in ${SECTORS[@]}; do
###########################################################################################
## MAKE SECTOR PLANET WITH ASTONAUTENS LINKS
###########################################################################################
## PREPARE Ŋ1 WORLD MAP
###########################################################################################
## PREPARE Ŋ1 WORLD MAP ##################################################################
echo "var examples = {};
examples['locations'] = function() {
var locations = {
@ -207,12 +207,12 @@ for SECTOR in ${SECTORS[@]}; do
IAMAP=$(ipfs add -qw ~/.zen/tmp/world.js | tail -n 1)
echo "JSON WISH WORLD READY /ipfs/${IAMAP}/world.js"
###########################################################################################
### APPLY ON APP MODEL
cat ${MY_PATH}/../templates/UPlanetSector/index.html \
| sed -e "s~_SECTOR_~${SECTOR}~g" \
| sed -e "s~_ZONE_~SECTOR ${SECTOR}~g" \
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
-e "s~_SECTORNS_~${SECTORNS}~g" \
-e "s~_ZONENS_~${SECTORNS}~g" \
-e "s~http://127.0.0.1:8080~~g" \
> ~/.zen/tmp/${MOATS}/${SECTOR}/_index.html

View File

@ -239,18 +239,77 @@ echo "<meta http-equiv=\"refresh\" content=\"0; url='/ipns/${IPFSNODEID}'\" />"
####################################
## RECORD P4N SPOT DATA
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
[[ -s ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ]] \
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json
echo "P4N : https://www.park4night.com/api/places/around?lat=${LAT}&lng=${LON}&radius=200&filter=%7B%7D&lang=fr"
[[ -s ~/.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) ]] \
&& mv ~/.zen/tmp/${MOATS}/${UMAP}/fetch.json ~/.zen/tmp/${MOATS}/${UMAP}/p4n.json
&& echo "UPDATED" \
|| echo "NO CHANGE"
echo "GET GCHANGE ADS..."
## 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
## CREATE GCHANGE ACCOUNT ??!! DO ANYTHING RELATED TO UMAP
########################################################
## ACTIVATE IN CASE OF PROTOCOL BRAKE
## TODO : BACKUP STATE IN // PRIVATE KEY
## TODO : SNIFF IPFS DHT MODIFICATIONS ## FAIL2BAN ## DEFCON
## PREPARE Ŋ1 WORLD MAP ##################################################################
echo "var examples = {};
examples['locations'] = function() {
var locations = {
" > ~/.zen/tmp/world.js
floop=1
ZONETW=($(cat ~/.zen/tmp/swarm/*/UPLANET/_${LAT}_${LON}/TW/*/index.html | grep -o "/ipns/[^\"]*" | sed "s/'$//" | sort | uniq))
for TWADD in ${ZONETW[@]};
do
## ADD ASTRONAUTNS ON SECTOR WORLD MAP
echo "${floop}: {
alpha: Math.random() * 2 * Math.PI,
delta: Math.random() * 2 * Math.PI,
name: '"${floop}"',
link: '"${TWADD}"'
}
," >> ~/.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 WISH WORLD READY /ipfs/${IAMAP}/world.js"
###########################################################################################
### APPLY ON APP MODEL
cat ${MY_PATH}/../templates/UPlanetSector/index.html \
| sed -e "s~_ZONE_~UMAP ${UMAP}~g" \
-e "s~QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/world.js~${IAMAP}/world.js~g" \
-e "s~_ZONENS_~${UMAPNS}~g" \
-e "s~http://127.0.0.1:8080~~g" \
> ~/.zen/tmp/${MOATS}/${UMAP}/_index.html
## Make it root App for ZONENS key
#~ mv ~/.zen/tmp/${MOATS}/${UMAP}/_index.html \
#~ ~/.zen/tmp/${MOATS}/${UMAP}/index.html
##################################
###########################################################################################
########################################################
##############################################################

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>UPlanet : _SECTOR_ : TW from UMAPS </title>
<title>UPlanet : _ZONE_ : TW from UMAPS </title>
<meta charset="UTF-8">
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<link rel="stylesheet" href="http://127.0.0.1:8080/ipfs/QmYdWBx32dP14XcbXF7hhtDq7Uu6jFmDaRnuL5t7ARPYkW/index_fichiers/demo.css">
@ -135,7 +135,7 @@
</head>
<body>
<button style="position: fixed; top: 10px; left: 10px;" onclick="document.getElementById('console').style.visibility = (document.getElementById('console').style.visibility === 'hidden' ? 'visible' : 'hidden');">(-/+)</button>
<button style="position: fixed; top: 10px; left: 10px;" onclick="document.getElementById('console').style.visibility = (document.getElementById('console').style.visibility === 'visible' ? 'hidden' : 'visible');">(-/+)</button>
<div id="demo">
<div id="description">
@ -153,19 +153,19 @@
</div>
<p><a target="_SECTOR_" href="http://127.0.0.1:8080/ipns/_SECTORNS_">"_SECTOR_"</a></p>
<p><a href="http://127.0.0.1:8080/ipns/_ZONENS_">"ZONE _ZONE_"</a></p>
<p>
<br>
<br> 👍 IPFS DATA STORAGE 👍 </p>
<p>Powered by <a href="https://github.com/papiche/Astroport.ONE">Astroport.ONE</a></p>
<p>/ <a href="https://opencollective.com/monnaie-libre/projects/stiits">STI</a> / <a href="https://opencollective.com/monnaie-libre/projects/coeurbox">La♥BOX</a> /
<br> 👍 UPlanet Ditributed Data Storage 👍 </p>
<p>/ powered by <a href="https://github.com/papiche/Astroport.ONE">Astroport.ONE</a>
- designed by <a href="https://opencollective.com/monnaie-libre/projects/stiits">STI</a> - run with <a href="https://opencollective.com/monnaie-libre/projects/coeurbox">La♥BOX</a> /
</div>
</div>
<div id="console"> ___ <a href="/ipns/_SECTORNS_/TW" target="aframe">SECTOR TW _SECTOR_ (@@@) </a> ___ <button onclick="document.getElementById('console').style.visibility = 'hidden';"> X </button>
<div id="console"> ___ <a href="/ipns/_ZONENS_/TW" target="aframe">ZONE TW _ZONE_ (@@@) </a> ___ <button onclick="document.getElementById('console').style.visibility = 'hidden';"> X </button>
<iframe name="aframe" id="aframe" src="https://pad.p2p.legal/p/AstroportSectorTW" width="100%" height="100%"></iframe>
</div>

View File

@ -113,7 +113,7 @@ a:active{
<button onclick="homeAstroportStation('/?qrcode=station', 'tab', 33000)">ẐenStation</button>
</div>
-->
<button style="position: fixed; top: 10px; left: 10px;" onclick="document.getElementById('console').style.visibility = (document.getElementById('console').style.visibility === 'hidden' ? 'visible' : 'hidden');">(-/+)</button>
<button style="position: fixed; top: 10px; left: 10px;" onclick="document.getElementById('console').style.visibility = (document.getElementById('console').style.visibility === 'visible' ? 'hidden' : 'visible');">(-/+)</button>
<span><div id="ainfo"></div></span>
<div id="debug"></div>
<!--