Update and rename tracker.js to tracker-dev.js
This commit is contained in:
parent
44ab3922f1
commit
b8879c238d
@ -1,10 +1,8 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const collectData = async () => {
|
||||
// 基础信息
|
||||
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
let osName = 'unknown', osVersion = 'unknown';
|
||||
|
||||
// 操作系统检测
|
||||
if (navigator.userAgentData) {
|
||||
try {
|
||||
const data = await navigator.userAgentData.getHighEntropyValues([
|
||||
@ -16,13 +14,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
osName = data.platform.toLowerCase();
|
||||
osVersion = data.platformVersion;
|
||||
|
||||
// Windows版本处理
|
||||
if (osName === 'windows') {
|
||||
const majorVer = parseInt(osVersion.split('.')[0]);
|
||||
osVersion = majorVer >= 13 ? '11' : majorVer > 0 ? '10' : '8.1';
|
||||
}
|
||||
|
||||
// macOS版本转换
|
||||
if (osName === 'macos') {
|
||||
const macVersionMap = {
|
||||
'13': 'Ventura', '12': 'Monterey',
|
||||
@ -31,17 +27,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
osVersion = macVersionMap[osVersion.split('.')[0]] || osVersion;
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('High Entropy API error:', e);
|
||||
// 错误静默处理
|
||||
}
|
||||
} else {
|
||||
// 传统User-Agent分析
|
||||
const ua = navigator.userAgent;
|
||||
if (/Windows NT 10/.test(ua)) osName = 'windows', osVersion = '10';
|
||||
if (/Mac OS X 10_15/.test(ua)) osName = 'macos', osVersion = 'Catalina';
|
||||
if (/iPhone OS 16_/.test(ua)) osName = 'ios', osVersion = '16';
|
||||
}
|
||||
|
||||
// CPU架构检测
|
||||
let cpuArch = 'unknown';
|
||||
if (navigator.userAgentData?.architecture) {
|
||||
cpuArch = navigator.userAgentData.architecture;
|
||||
@ -50,7 +44,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
/arm|aarch64/i.test(navigator.userAgent) ? 'arm' : 'x86';
|
||||
}
|
||||
|
||||
// GPU检测
|
||||
let gpuVendor = 'unknown', gpuModel = 'unknown';
|
||||
try {
|
||||
const canvas = document.createElement('canvas');
|
||||
@ -61,18 +54,17 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
gpuModel = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('GPU detection failed:', e);
|
||||
// 错误静默处理
|
||||
}
|
||||
|
||||
// 发送数据
|
||||
fetch(hardwareTracker.ajax_url, {
|
||||
fetch(hardwareTrackerDev.ajax_url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
action: 'hardware_tracker',
|
||||
security: hardwareTracker.security,
|
||||
action: 'hardware_tracker_dev',
|
||||
security: hardwareTrackerDev.security,
|
||||
os_name: osName,
|
||||
os_version: osVersion,
|
||||
cpu_arch: cpuArch,
|
||||
@ -84,6 +76,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
};
|
||||
|
||||
// 延迟2秒执行避免影响首屏加载
|
||||
collectData();
|
||||
setTimeout(collectData, 300);
|
||||
# 延迟300ms错开稳定版
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user