blob: bef49dcfba032b51537975c857d24d5764fe7cc0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
|
// Coarse touch/mobile detection for the "match/rank against desktop only"
// preference - not trying to be a precise device fingerprint, just enough
// to separate "typed on a physical keyboard" from "typed on a touchscreen"
// for fairness purposes (see anticheat.rs's comment on why this is opt-in
// tagging, not a default exclusion).
export function detectDeviceType() {
const coarsePointer = typeof window.matchMedia === 'function' && window.matchMedia('(pointer: coarse)').matches;
const touchPoints = navigator.maxTouchPoints > 0;
return coarsePointer && touchPoints ? 'mobile' : 'desktop';
}
|