Spaces:
Sleeping
Sleeping
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Model Usage Information Collection</title> | |
<style> | |
.hidden-link { | |
visibility: hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Collected User Information</h1> | |
<div id="user-info"></div> | |
<script> | |
// Function to display collected information | |
function displayInfo(label, value) { | |
document.getElementById('user-info').innerHTML += `<p><strong>${label}:</strong> ${value}</p>`; | |
} | |
// Display basic browser and device information | |
displayInfo('Browser', navigator.userAgent); | |
displayInfo('Platform', navigator.platform); | |
displayInfo('Screen Resolution', `${screen.width}x${screen.height}`); | |
displayInfo('Language', navigator.language); | |
displayInfo('Time Zone', Intl.DateTimeFormat().resolvedOptions().timeZone); | |
// Capture IP address and geolocation | |
fetch('https://api.ipify.org?format=json') | |
.then(response => response.json()) | |
.then(data => { | |
displayInfo('IP Address', data.ip); | |
return fetch(`https://ipapi.co/${data.ip}/json/`); | |
}) | |
.then(response => response.json()) | |
.then(data => { | |
displayInfo('City', data.city); | |
displayInfo('Region', data.region); | |
displayInfo('Country', data.country_name); | |
displayInfo('Postal Code', data.postal); | |
displayInfo('Latitude', data.latitude); | |
displayInfo('Longitude', data.longitude); | |
}) | |
.catch(error => console.error('Error fetching IP data:', error)); | |
// Capture user's precise geolocation (requires permission) | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition( | |
position => { | |
displayInfo('Geolocation Latitude', position.coords.latitude); | |
displayInfo('Geolocation Longitude', position.coords.longitude); | |
}, | |
error => displayInfo('Geolocation', 'Permission denied or unavailable.') | |
); | |
} else { | |
displayInfo('Geolocation', 'Not supported by this browser.'); | |
} | |
// Capture referrer URL | |
displayInfo('Referrer', document.referrer || 'None'); | |
// Capture user's interaction with the model (assumed input) | |
function captureSearchQuery(query) { | |
displayInfo('Search Query', query); | |
// You would log or process this data further as needed | |
} | |
// Example function to simulate a search or interaction with the model | |
function simulateUserInteraction() { | |
const userQuery = "Example user search input"; // This would be the actual user input in practice | |
captureSearchQuery(userQuery); | |
} | |
// Simulate the user interaction (for example purposes) | |
simulateUserInteraction(); | |
// Capture page views, mouse clicks, and other interactions | |
document.addEventListener('click', function(event) { | |
displayInfo('Click Coordinates', `X: ${event.clientX}, Y: ${event.clientY}`); | |
displayInfo('Clicked Element', event.target.tagName); | |
}); | |
// Capture clipboard access (if granted by the user) | |
document.addEventListener('copy', function() { | |
navigator.clipboard.readText().then(text => { | |
displayInfo('Clipboard Content', text); | |
}).catch(err => { | |
displayInfo('Clipboard Access', 'Failed to access clipboard content.'); | |
}); | |
}); | |
// Attempt to capture user media access (Microphone/Camera) (requires permission) | |
navigator.mediaDevices.getUserMedia({ audio: true, video: true }) | |
.then(stream => { | |
displayInfo('Media Access', 'Microphone and Camera access granted.'); | |
stream.getTracks().forEach(track => track.stop()); | |
}) | |
.catch(err => { | |
displayInfo('Media Access', 'Microphone and Camera access denied.'); | |
}); | |
// Detect browsing history for specific sites | |
function detectBrowsingHistory() { | |
const urlsToCheck = [ | |
'https://www.google.com', | |
'https://www.facebook.com', | |
'https://www.youtube.com', | |
'https://www.amazon.com', | |
'https://www.wikipedia.org', | |
'https://www.baidu.com' | |
]; | |
urlsToCheck.forEach(url => { | |
const link = document.createElement('a'); | |
link.href = url; | |
link.className = 'hidden-link'; | |
document.body.appendChild(link); | |
const colorBefore = getComputedStyle(link).color; | |
link.style.color = 'blue'; | |
const colorAfter = getComputedStyle(link).color; | |
if (colorBefore !== colorAfter) { | |
displayInfo('Visited', url); | |
} else { | |
displayInfo('Not Visited', url); | |
} | |
document.body.removeChild(link); | |
}); | |
} | |
// Execute the browsing history detection | |
detectBrowsingHistory(); | |
</script> | |
</body> | |
</html> | |