This commit is contained in:
Daniel LaForce 2024-08-01 17:59:19 -06:00
parent 38222000dd
commit 560edb8845
3 changed files with 65 additions and 3 deletions

26
gaia-landing.html Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to Gaia GPS...</title>
<script>
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
const referrer = decodeURIComponent(urlParams.get('referrer'));
const storedToken = localStorage.getItem('gaiaAccessToken');
const allowedReferrer = 'https://yourwebsite.github.io'; // Update with your actual website URL
if (token && token === storedToken && referrer.startsWith(allowedReferrer)) {
// Clear the token from local storage after use to ensure it's one-time use
localStorage.removeItem('gaiaAccessToken');
window.location.href = 'https://www.gaiagps.com/map/?lat=39.03966489533956&lon=-105.32945964046155&zoom=14&loc=14.0/-105.3120/39.0318&pubLink=VVXcZPvEfvAbvRWi5F0DQPNT&folderId=e810350b-1b3f-49bf-8f67-6a497827f190';
} else {
document.body.innerHTML = 'Access denied. Invalid or expired token.';
}
});
</script>
</head>
<body>
Redirecting to Gaia GPS...
</body>
</html>

26
google-maps-landing.html Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to Google Maps...</title>
<script>
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
const referrer = decodeURIComponent(urlParams.get('referrer'));
const storedToken = localStorage.getItem('googleMapsAccessToken');
const allowedReferrer = 'https://yourwebsite.github.io'; // Update with your actual website URL
if (token && token === storedToken && referrer.startsWith(allowedReferrer)) {
// Clear the token from local storage after use to ensure it's one-time use
localStorage.removeItem('googleMapsAccessToken');
window.location.href = 'https://www.google.com/maps/d/u/0/viewer?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.035283304733184%2C-105.2908042761522&z=14';
} else {
document.body.innerHTML = 'Access denied. Invalid or expired token.';
}
});
</script>
</head>
<body>
Redirecting to Google Maps...
</body>
</html>

View File

@ -56,6 +56,10 @@
return result; return result;
} }
function getReferrer() {
return document.referrer;
}
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
if (!localStorage.getItem('consentGiven')) { if (!localStorage.getItem('consentGiven')) {
document.getElementById('consent-banner').style.display = 'block'; document.getElementById('consent-banner').style.display = 'block';
@ -63,8 +67,14 @@
document.getElementById('gaia-gps-link').addEventListener('click', function(event) { document.getElementById('gaia-gps-link').addEventListener('click', function(event) {
const token = generateToken(16); const token = generateToken(16);
localStorage.setItem('accessToken', token); localStorage.setItem('gaiaAccessToken', token);
this.href = 'landing.html?token=' + token; this.href = 'gaia-landing.html?token=' + token + '&referrer=' + encodeURIComponent(getReferrer());
});
document.getElementById('google-maps-link').addEventListener('click', function(event) {
const token = generateToken(16);
localStorage.setItem('googleMapsAccessToken', token);
this.href = 'google-maps-landing.html?token=' + token + '&referrer=' + encodeURIComponent(getReferrer());
}); });
}); });
@ -78,7 +88,7 @@
<h1>CSMS Claims and Neighbors</h1> <h1>CSMS Claims and Neighbors</h1>
<iframe src="https://www.google.com/maps/d/embed?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.03966489533956%2C-105.32945964046155&z=14" width="800" height="600"></iframe> <iframe src="https://www.google.com/maps/d/embed?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.03966489533956%2C-105.32945964046155&z=14" width="800" height="600"></iframe>
<br> <br>
<a href="https://www.google.com/maps/d/u/0/viewer?mid=1uaJCMW64w_zwERr9nFcVJchrZdocNbA&ll=39.035283304733184%2C-105.2908042761522&z=14" target="_blank" class="button">View in Google Maps</a> <a href="#" target="_blank" class="button" id="google-maps-link">View in Google Maps</a>
<a href="#" target="_blank" class="button" id="gaia-gps-link">View in Gaia GPS</a> <a href="#" target="_blank" class="button" id="gaia-gps-link">View in Gaia GPS</a>
<div id="consent-banner"> <div id="consent-banner">
This site uses cookies to improve your experience. By continuing to browse, you accept the use of cookies. This site uses cookies to improve your experience. By continuing to browse, you accept the use of cookies.