--ignore=.git --ignore-rules-path=.gitignore

This commit is contained in:
fred 2024-05-01 18:23:50 +02:00
parent d722a04332
commit a103be6d5f
3 changed files with 121 additions and 100 deletions

View File

@ -138,7 +138,9 @@ console.log(station)
<h1>♥ U Planet ♥</h1> <h1>♥ U Planet ♥</h1>
<button onclick="homeAstroportStation(station+'/?qrcode=station', '', 21654)">Ẑen Station</button> <button onclick="homeAstroportStation(station+'/?qrcode=station', '', 21654)">Ẑen Station</button>
<div id="countdown"></div> <div id="countdown"></div>
<br><a href="login/">LOGIN</a> <!--
<br><a href="login/">SCAN</a>
-->
<div id="container"> <div id="container">
<br><br> <br><br>
@ -148,31 +150,24 @@ console.log(station)
<div id="flights"></div> <div id="flights"></div>
<div id="locations"></div> <div id="locations"></div>
</div> </div>
<div class="choose_example"> <div class="choose_example">
Planet : <select id="example"> Planet : <select id="example">
<!--
<option value="simple">Simple earth</option>
<option value="simple_tilted">Simple tilted earth</option>
-->
<option value="simple_mars">New</option> <option value="simple_mars">New</option>
<!--
<option value="flights">Earth with locations and flights</option>
-->
<option value="locations" selected >Earth</option> <option value="locations" selected >Earth</option>
</select> </select>
</div> </div>
<h2></h2>
<form id="addressForm"> <form id="addressForm">
<label for="address">Address: </label> <h1><label for="address"></label></h1>
<input type="text" id="address" size=30 required> <input type="text" id="address" size=26 required><br>
<button type="button" onclick="getCoordinates()">Go</button> <button type="button" onclick="getCoordinates()">¯\_༼qO͡〰op༽_/¯</button>
</form> </form>
<h2> <h2>
<a target="pad" href="/ipfs/QmcSkcJ2j7GAsC2XhVqGSNAKVRpXgxfjjvDbhD5YxrncZY/?room=UPLANET">VISIO ROOM</a> <a target="pad" href="/ipfs/QmcSkcJ2j7GAsC2XhVqGSNAKVRpXgxfjjvDbhD5YxrncZY/?room=UPLANET">MEETING ROOM</a>
</h2> </h2>
<p id="result">- <a href="mailto:support@qo-op.com">support</a> -</p>
<p id="result">- <a href="mailto:support@qo-op.com">contact</a> -</p>
<!-- <!--
<div class="code"> <div class="code">
@ -187,86 +182,104 @@ console.log(station)
<iframe name="aframe" id="aframe" src="https://pad.p2p.legal/p/UPlanet_HELP" width="100%" height="100%"></iframe> <iframe name="aframe" id="aframe" src="https://pad.p2p.legal/p/UPlanet_HELP" width="100%" height="100%"></iframe>
</div> </div>
<script> <script>
// Function to extract URL parameters // Function to extract URL parameters
function getUrlParameter(name) { function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); const regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
const results = regex.exec(location.search); const results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
const defaultIPNS = '';
const defaultIPFS = '';
const defaultPUB = '';
const myIPFS = getUrlParameter('ipfs') || defaultIPFS;
const myPUBKEY = getUrlParameter('g1pub') || defaultPUB;
const sectorIPNS = getUrlParameter('ipns') || defaultIPNS;
console.log('myIPFS: /ipfs/', myIPFS);
console.log('myPUBKEY: /g1pub/', myPUBKEY);
console.log('sectorIPNS: /ipns/', sectorIPNS);
if (sectorIPNS !== '' ) {
const buttonContainer = document.createElement('div');
buttonContainer.id = 'button-container'
buttonContainer.style.position = 'absolute';
buttonContainer.style.bottom = '0px';
buttonContainer.style.left = '0px';
buttonContainer.style.width = '200px';
buttonContainer.style.height = '150px';
buttonContainer.style.zIndex = '1001';
buttonContainer.style.display = 'flex';
buttonContainer.style.flexDirection = 'column';
buttonContainer.style.alignItems = 'center';
buttonContainer.style.justifyContent = 'center';
const button = document.createElement('button');
button.innerText = 'EXPLORE';
button.className = 'button';
// Add an event listener to the button
button.addEventListener('click', function() {
window.open( '/ipns/'+ sectorIPNS, "AstroTab");
});
// Append the button to the button container
buttonContainer.appendChild(button);
document.body.appendChild(buttonContainer);
}
function getCoordinates() {
const addressInput = document.getElementById('address');
const address = addressInput.value.trim(); // Trim to remove leading/trailing spaces
if (address === '') {
// If address is empty, proceed to retrieve geolocation
getLocation();
} else {
// Replace spaces with '+' for the URL
const formattedAddress = address.replace(/ /g, '+');
// Make a request to the Nominatim API
fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${formattedAddress}`)
.then(response => response.json())
.then(data => {
if (data.length > 0) {
const latitude = (parseFloat(data[0].lat) - 0.025).toFixed(2);
const longitude = (parseFloat(data[0].lon) - 0.025).toFixed(2);
window.location.replace(`map_render.html?southWestLat=${latitude}&southWestLon=${longitude}&deg=0.1`);
} else {
document.getElementById('result').innerText = 'Coordinates not found. Click on surrounding dots to zoom in.';
}
})
.catch(error => {
console.error('Error:', error);
document.getElementById('result').innerText = 'An error occurred while fetching coordinates.';
});
} }
const defaultIPNS = ''; }
const defaultIPFS = '';
const defaultPUB = '';
const myIPFS = getUrlParameter('ipfs') || defaultIPFS; // Add event listener for the "Enter" key
const myPUBKEY = getUrlParameter('g1pub') || defaultPUB; document.getElementById('address').addEventListener('keypress', function (e) {
const sectorIPNS = getUrlParameter('ipns') || defaultIPNS; if (e.key === 'Enter') {
console.log('myIPFS: /ipfs/', myIPFS); getCoordinates();
console.log('myPUBKEY: /g1pub/', myPUBKEY);
console.log('sectorIPNS: /ipns/', sectorIPNS);
if (sectorIPNS !== '' ) {
const buttonContainer = document.createElement('div');
buttonContainer.id = 'button-container'
buttonContainer.style.position = 'absolute';
buttonContainer.style.bottom = '0px';
buttonContainer.style.left = '0px';
buttonContainer.style.width = '200px';
buttonContainer.style.height = '150px';
buttonContainer.style.zIndex = '1001';
buttonContainer.style.display = 'flex';
buttonContainer.style.flexDirection = 'column';
buttonContainer.style.alignItems = 'center';
buttonContainer.style.justifyContent = 'center';
const button = document.createElement('button');
button.innerText = 'EXPLORE';
button.className = 'button';
// Add an event listener to the button
button.addEventListener('click', function() {
window.open( '/ipns/'+ sectorIPNS, "AstroTab");
});
// Append the button to the button container
buttonContainer.appendChild(button);
document.body.appendChild(buttonContainer);
} }
});
function getLocation() {
function getCoordinates() { if (navigator.geolocation) {
const addressInput = document.getElementById('address'); navigator.geolocation.getCurrentPosition(function(position) {
const address = addressInput.value; const latitude = (position.coords.latitude - 0.025).toFixed(1);
const longitude = (position.coords.longitude - 0.025).toFixed(1);
// Replace spaces with '+' for the URL window.location.replace(`map_render.html?southWestLat=${latitude}&southWestLon=${longitude}&deg=0.1`);
const formattedAddress = address.replace(/ /g, '+'); }, function(error) {
console.error('Error getting geolocation:', error);
// Make a request to the Nominatim API document.getElementById('result').innerText = 'Geolocation not available. Enter an address to proceed.';
fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${formattedAddress}`)
.then(response => response.json())
.then(data => {
if (data.length > 0) {
const latitude = data[0].lat;
const longitude = data[0].lon;
const lat = parseFloat(data[0].lat).toFixed(2);
const lon = parseFloat(data[0].lon).toFixed(2);
window.location.replace(`map_render.html?southWestLat=${lat}&southWestLon=${lon}&deg=0.01`);
} else {
document.getElementById('result').innerText = 'Coordinates not found. Clic on surrounding dots to zoom in.';
}
})
.catch(error => {
console.error('Error:', error);
document.getElementById('result').innerText = 'An error occurred while fetching coordinates.';
});
}
// Add event listener for the "Enter" key
document.getElementById('address').addEventListener('keypress', function (e) {
if (e.key === 'Enter') {
getCoordinates();
}
}); });
} else {
document.getElementById('result').innerText = 'Geolocation is not supported by this browser. Enter an address to proceed.';
}
}
</script> </script>

View File

@ -61,7 +61,7 @@
<div id="coordinates-display"></div> <!-- Coordinates display element --> <div id="coordinates-display"></div> <!-- Coordinates display element -->
<div id="map" style="width: 100%; height: 100vh;"></div> <div id="map" style="width: 100%; height: 100vh;"></div>
</div> </div>
<button id="upper-layer-button">UP</button> <button id="upper-layer-button">⬆️</button>
<script src="leaflet.js"></script> <script src="leaflet.js"></script>
<script> <script>
@ -229,7 +229,10 @@ document.getElementById('upper-layer-button').addEventListener('click', function
window.location.href = 'welcome.html'; window.location.href = 'welcome.html';
} else { } else {
const newDeg = deg * 10; const newDeg = deg * 10;
const url = `map_render.html?southWestLat=${southWestLat}&southWestLon=${southWestLon}&deg=${newDeg}`; const decalage = 2.5 * deg;
const adjustedSouthWestLat = (parseFloat(southWestLat) - decalage).toFixed(2);
const adjustedSouthWestLon = (parseFloat(southWestLon) - decalage).toFixed(2);
const url = `map_render.html?southWestLat=${adjustedSouthWestLat}&southWestLon=${adjustedSouthWestLon}&deg=${newDeg}`;
window.location.href = url; window.location.href = url;
} }
}); });

View File

@ -7,13 +7,14 @@
MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
echo '
############################################################### ipfs ############################################################### ipfs
## __ __ ___ ____ ____ ___ _ _____ ____ ____ _____ ____ ## __ __ ___ ____ ____ ___ _ _____ ____ ____ _____ ____
## | \/ |_ _/ ___| _ \ / _ \ | | | ____| _ \ / ___| ____| _ \ ## | \/ |_ _/ ___| _ \ / _ \ | | | ____| _ \ / ___| ____| _ \
## | |\/| || | | | |_) | | | | | | | _| | | | | | _| _| | |_) | ## | |\/| || | | | |_) | | | | | | | _| | | | | | _| _| | |_) |
## | | | || | |___| _ <| |_| | | |___| |___| |_| | |_| | |___| _ < ## | | | || | |___| _ <| |_| | | |___| |___| |_| | |_| | |___| _ <
## |_| |_|___\____|_| \_\\___/ |_____|_____|____/ \____|_____|_| \_\ me ## |_| |_|___\____|_| \_\\___/ |_____|_____|____/ \____|_____|_| \_\ me
'
MOATS=$(date -u +"%Y%m%d%H%M%S%4N") MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
@ -21,26 +22,30 @@ OLD=$(cat ${MY_PATH}/.chain)
[[ -z ${OLD} ]] \ [[ -z ${OLD} ]] \
&& GENESYS=$(ipfs add -rwHq ${MY_PATH}/* | tail -n 1) \ && GENESYS=$(ipfs add -rwHq ${MY_PATH}/* | tail -n 1) \
&& echo ${GENESYS} > ${MY_PATH}/.chain \ && echo ${GENESYS} > ${MY_PATH}/.chain \
&& echo "### - (^‿‿^) - " >> ${MY_PATH}/README.md \
&& echo /ipfs/${GENESYS} >> ${MY_PATH}/README.md \ && echo /ipfs/${GENESYS} >> ${MY_PATH}/README.md \
&& echo "CHAIN BLOC ZERO : ${GENESYS}" \ && echo "CHAIN BLOC ZERO : ${GENESYS}" \
## TIMESTAMP SHIFTING ## TIMESTAMP CHAIN SHIFTING
cp ${MY_PATH}/.chain \ cp ${MY_PATH}/.chain \
${MY_PATH}/.chain.$(cat ${MY_PATH}/.moats) ${MY_PATH}/.chain.$(cat ${MY_PATH}/.moats)
TW=$(ipfs add -rwHq ${MY_PATH}/* | tail -n 1) IPFSME=$(ipfs add -rwHq --ignore=.git --ignore-rules-path=.gitignore ${MY_PATH}/* | tail -n 1)
[[ ${TW} == ${OLD} ]] && echo "No change." && exit 1 [[ ${IPFSME} == ${OLD} ]] && echo "No change." && exit 0
echo ${TW} > ${MY_PATH}/.chain ## CHAIN UPGRADE
echo ${IPFSME} > ${MY_PATH}/.chain
echo ${MOATS} > ${MY_PATH}/.moats echo ${MOATS} > ${MY_PATH}/.moats
sed -i "s~${OLD}~${TW}~g" ${MY_PATH}/README.md ## README UPGRADE
sed -i "s~${OLD}~${IPFSME}~g" ${MY_PATH}/README.md
echo '# ENTER COMMENT FOR THIS COMMIT' ## AUTO GIT
echo '# ENTER COMMENT FOR YOUR COMMIT :'
git add . git add .
read COMMENT \ read COMMENT \
&& git commit -m "$COMMENT : https://ipfs.copylaradio.com/ipfs/${TW}/earth" \ && git commit -m "$COMMENT : https://ipfs.copylaradio.com/ipfs/${IPFSME}" \
&& git push && git push
exit 0 exit 0