This commit is contained in:
Daniel LaForce 2024-08-01 17:55:14 -06:00
parent cf83e3ca8c
commit 38222000dd
2 changed files with 40 additions and 10 deletions

View File

@ -44,22 +44,28 @@
text-align: center; text-align: center;
display: none; display: none;
} }
#gaia-gps-link {
display: none;
}
</style> </style>
<script> <script>
function generateToken(length) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
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';
} }
var allowedReferrer = 'https://yourwebsite.com'; // Update with your actual website URL document.getElementById('gaia-gps-link').addEventListener('click', function(event) {
var referrer = document.referrer; const token = generateToken(16);
localStorage.setItem('accessToken', token);
if (referrer && referrer.indexOf(allowedReferrer) === 0) { this.href = 'landing.html?token=' + token;
document.getElementById('gaia-gps-link').style.display = 'inline-block'; });
}
}); });
function acceptConsent() { function acceptConsent() {
@ -73,7 +79,7 @@
<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="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="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" 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.
<button onclick="acceptConsent()">Accept</button> <button onclick="acceptConsent()">Accept</button>

24
landing.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Redirecting...</title>
<script>
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
const storedToken = localStorage.getItem('accessToken');
if (token && token === storedToken) {
// Clear the token from local storage after use to ensure it's one-time use
localStorage.removeItem('accessToken');
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...
</body>
</html>