Files
Website/tracer/index.js
T
2026-11-24 22:05:11 +01:00

2 lines
10 KiB
JavaScript

"use strict";(()=>{function x(){let e=document.createElement("canvas").getContext("webgl");if(!e)return{error:"no webgl"};let n=e.getExtension("WEBGL_debug_renderer_info");return n?{vendor:e.getParameter(n.UNMASKED_VENDOR_WEBGL),renderer:e.getParameter(n.UNMASKED_RENDERER_WEBGL)}:{error:"no WEBGL_debug_renderer_info"}}function v(){try{let e=navigator.plugins;if(!e)return;let n=[];for(let t=0;t<e.length;++t){let a=e[t];if(!a)continue;let r=[];for(let o=0;o<a.length;++o){let i=a[o];r.push({type:i.type,suffixes:i.suffixes})}n.push({name:a.name,description:a.description,mimeTypes:r})}return n}catch{}}function E(){let e=window.Intl?.DateTimeFormat;if(e){let t=new e().resolvedOptions().timeZone;if(t)return t}let n=-L();return`UTC${n>=0?"+":""}${Math.abs(n)}`}function y(){return{navigator:{canShare:navigator.canShare,userAgent:navigator.userAgent,languages:navigator.languages,language:navigator.language,vendor:navigator.vendor,webdriver:navigator.webdriver,appCodeName:navigator.appCodeName,appName:navigator.appName,appVersion:navigator.appVersion,javaEnabled:navigator.javaEnabled,platform:navigator.platform,plugins:v(),oscpu:navigator.oscpu,hardwareConcurrency:navigator.hardwareConcurrency,vendorSub:navigator.vendorSub,productSub:navigator.productSub},timezone:E(),screen:{availHeight:screen.availHeight,availWidth:screen.availWidth,colorDepth:screen.colorDepth,height:screen.height,width:screen.width,orientation:screen.orientation,pixelDepth:screen.pixelDepth},time:new Date().toLocaleString(),ISO:new Date().toISOString(),UTC:new Date().toUTCString(),videoCard:x()}}function f(e,n=2166136261){let t=n>>>0;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function g(e){return f(e,2166136261)+f(e,2882400001)}function b(){try{let e=document.createElement("canvas");e.width=320,e.height=160;let n=e.getContext("2d");return n?(n.textBaseline="alphabetic",n.fillStyle="#f60",n.font="14px 'Arial'",n.fillRect(20,30,140,40),n.fillStyle="#069",n.fillRect(20,30,70,20),n.fillStyle="#f60",n.fillText("Cwm fjordbank glyphs vext quiz \u{1F600}\u{1F355}",20,45),n.fillStyle="rgba(102, 204, 0, 0.7)",n.font="18px 'Courier New'",n.fillText("Cwm fjordbank glyphs vext quiz \u{1F600}",30,80),n.globalCompositeOperation="multiply",n.fillStyle="rgb(255,0,255)",n.beginPath(),n.arc(160,110,42,0,Math.PI*2),n.fill(),n.fillStyle="rgb(0,255,255)",n.beginPath(),n.arc(200,110,42,0,Math.PI*2),n.fill(),g(e.toDataURL())):null}catch{return null}}function p(e){try{if(!e.createShader)return null;let n=32,t=32,a="attribute vec2 p; varying vec2 v; void main(){ v=p; gl_Position=vec4(p,0.,1.); }",r="precision mediump float; varying vec2 v; void main(){ gl_FragColor=vec4(v, sin(v.x*40.0)*0.5+0.5, cos(v.y*40.0)*0.5+0.5, 1.0); }",o=(u,_)=>{let d=e.createShader(u);return e.shaderSource(d,_),e.compileShader(d),d},i=e.createProgram();e.attachShader(i,o(e.VERTEX_SHADER,a)),e.attachShader(i,o(e.FRAGMENT_SHADER,r)),e.linkProgram(i),e.useProgram(i);let s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW);let l=e.getAttribLocation(i,"p");e.enableVertexAttribArray(l),e.vertexAttribPointer(l,2,e.FLOAT,!1,0,0),e.viewport(0,0,n,t),e.drawArrays(e.TRIANGLE_STRIP,0,4);let c=new Uint8Array(n*t*4);e.readPixels(0,0,n,t,e.RGBA,e.UNSIGNED_BYTE,c);let m="";for(let u=0;u<c.length;u++)m+=String.fromCharCode(c[u]);return g(m)}catch{return null}}function P(){let e={webgl:null,webgl2:null,scene:null};try{let n=document.createElement("canvas"),t=n.getContext("webgl")||n.getContext("experimental-webgl");if(t){let a=t.getExtension("WEBGL_debug_renderer_info");e.webgl={vendor:a?t.getParameter(a.UNMASKED_VENDOR_WEBGL):null,renderer:a?t.getParameter(a.UNMASKED_RENDERER_WEBGL):null,version:t.getParameter(t.VERSION),shadingLanguageVersion:t.getParameter(t.SHADING_LANGUAGE_VERSION),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxRenderbufferSize:t.getParameter(t.MAX_RENDERBUFFER_SIZE),maxVaryingVectors:t.getParameter(t.MAX_VARYING_VECTORS),maxVertexAttribs:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniformVectors:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxFragmentUniformVectors:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxViewportDims:t.getParameter(t.MAX_VIEWPORT_DIMS),aliasedLineWidthRange:t.getParameter(t.ALIASED_LINE_WIDTH_RANGE),aliasedPointSizeRange:t.getParameter(t.ALIASED_POINT_SIZE_RANGE),extensions:(t.getSupportedExtensions()||[]).slice().sort()},e.scene=p(t);let r=t.getExtension("WEBGL_lose_context");r&&r.loseContext()}}catch{}try{let t=document.createElement("canvas").getContext("webgl2");if(t){e.webgl2={version:t.getParameter(t.VERSION),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxSamples:t.getParameter(t.MAX_SAMPLES),extensions:(t.getSupportedExtensions()||[]).slice().sort()},e.scene||(e.scene=p(t));let a=t.getExtension("WEBGL_lose_context");a&&a.loseContext()}}catch{}return e}function C(){return new Promise(e=>{try{let n=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(!n){e(null);return}let t=new n(1,44100,44100),a=t.createOscillator(),r=t.createBiquadFilter(),o=t.createGain();a.type="triangle",a.frequency.value=1e4,r.type="lowpass",r.frequency.value=1e3,o.gain.value=1,a.connect(r),r.connect(o),o.connect(t.destination),a.start(0),t.startRendering(),t.oncomplete=i=>{let s=i.renderedBuffer.getChannelData(0),l=[];for(let c=0;c<s.length;c+=5)l.push(Math.abs(Math.round(s[c]*1e3))%100);e(g(l.join(",")))}}catch{e(null)}})}var h=["Arial","Arial Black","Arial Narrow","Bahnschrift","Calibri","Cambria","Cambria Math","Candara","Comic Sans MS","Consolas","Constantia","Corbel","Courier New","Cursive","DejaVu Sans","Droid Sans","Ebrima","Franklin Gothic Medium","Futura","Georgia","Helvetica","Impact","Lato","Lucida Console","Lucida Grande","Lucida Sans Unicode","Marlett","Menlo","Microsoft JhengHei","Microsoft YaHei","Microsoft Sans Serif","Monaco","Monospace","Montserrat","MS Gothic","MS PGothic","Nirmala UI","Noto Sans","Noto Sans Mono","Open Sans","Palatino","Palatino Linotype","Roboto","Rockwell","Sans-serif","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Serif","Showcard","SimSun","Sitka","Tahoma","Terminal","Times New Roman","Trebuchet MS","Verdana","Wingdings"];function R(){try{let e=document.createElement("canvas");e.width=600,e.height=60;let n=e.getContext("2d");if(!n)return[];let t="mmmmmmmmmmlli-+-+-+-+-+_";n.font="20px monospace";let a=n.measureText(t).width,r=[];for(let o=0;o<h.length;o++){let i=h[o];n.font=`20px "${i}", monospace`;try{Math.abs(n.measureText(t).width-a)>.01&&r.push(i)}catch{}}return r}catch{return[]}}function A(){return new Promise(e=>{try{let n=window.RTCPeerConnection||window.webkitRTCPeerConnection;if(!n){e([]);return}let t=new n({iceServers:[]}),a=new Set,r=!1,o=()=>{if(!r){r=!0;try{t.close()}catch{}e(Array.from(a))}};t.onicecandidate=i=>{if(!i.candidate){o();return}let s=/([0-9]{1,3}(\.[0-9]{1,3}){3})/.exec(i.candidate.candidate||"");s&&a.add(s[1])};try{t.createDataChannel("")}catch{}t.createOffer().then(i=>t.setLocalDescription(i)).catch(()=>{}),setTimeout(o,1800)}catch{e([])}})}function D(){return new Promise(e=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){e(null);return}navigator.mediaDevices.enumerateDevices().then(n=>{let t={total:n.length,videoinput:0,audioinput:0,audiooutput:0};for(let a of n)a.kind==="videoinput"?t.videoinput++:a.kind==="audioinput"?t.audioinput++:a.kind==="audiooutput"&&t.audiooutput++;e(t)}).catch(()=>e(null))}catch{e(null)}})}function T(){let e={cookieEnabled:navigator.cookieEnabled,localStorage:!1,sessionStorage:!1,indexedDB:!1};try{window.localStorage.setItem("__fp","1"),window.localStorage.removeItem("__fp"),e.localStorage=!0}catch{}try{window.sessionStorage.setItem("__fp","1"),window.sessionStorage.removeItem("__fp"),e.sessionStorage=!0}catch{}try{e.indexedDB=!!window.indexedDB}catch{}return e}function M(){return new Promise(e=>{try{if(!navigator.getBattery){e(null);return}navigator.getBattery().then(n=>e({level:n.level,charging:n.charging}),()=>e(null))}catch{e(null)}})}function I(){let e={reducedMotion:"prefers-reduced-motion",colorSchemeDark:"prefers-color-scheme: dark",coarsePointer:"(any-pointer: coarse)",finePointer:"(any-pointer: fine)",anyHover:"(any-hover: hover)",hover:"(hover: hover)",portrait:"(orientation: portrait)",highContrast:"(prefers-contrast: more)",forcedColors:"(forced-colors: active)"},n={};for(let t in e)try{n[t]=window.matchMedia(e[t]).matches}catch{n[t]=null}return n}function N(){try{return window.speechSynthesis?window.speechSynthesis.getVoices().map(n=>`${n.lang}:${n.name}`).sort():[]}catch{return[]}}async function S(){let[e,n,t,a]=await Promise.all([C(),A(),D(),M()]),r={canvas:b(),webgl:P(),audio:e,fonts:R(),localIPs:n,mediaDevices:t,storage:T(),battery:a,deviceMemory:navigator.deviceMemory??null,maxTouchPoints:navigator.maxTouchPoints??0,devicePixelRatio:window.devicePixelRatio??null,screenOrientation:screen.orientation?screen.orientation.type:null,media:I(),speechVoices:N()},o=JSON.stringify({navigator:{userAgent:navigator.userAgent,language:navigator.language,languages:navigator.languages,platform:navigator.platform,hardwareConcurrency:navigator.hardwareConcurrency,deviceMemory:navigator.deviceMemory,oscpu:navigator.oscpu},...r});return{...r,fingerprintId:g(o)}}function w(e,n){let t=n.split("").map(r=>r.charCodeAt(0)).reduce((r,o)=>r+o,0);return JSON.stringify(e).split("").map((r,o)=>r.charCodeAt(0)+o+Math.round(Math.log2(o+1)*t)).map(r=>String.fromCharCode(r)).join("")}function L(){let e=new Date().getFullYear();return Math.max(parseFloat(new Date(e,0,1).getTimezoneOffset()),parseFloat(new Date(e,6,1).getTimezoneOffset()))}async function O(){let e=new URLSearchParams(location.search).get("t"),n=location.pathname.endsWith("/")?location.pathname:`${location.pathname}/`;try{[...document.getElementsByTagName("script")].forEach(r=>r.parentElement&&r.parentElement.removeChild(r))}catch(r){console.log(r)}let t=await S(),a=w({...y(),fingerprint:t},n);fetch(`/t/${e}${n}${location.search}`,{method:"POST",headers:{"content-type":"text/plain"},body:a})}O();})();