MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / get_target_from_ua

Function get_target_from_ua

g2all/900/config.js:69–81  ·  view source on GitHub ↗
(useragent)

Source from the content-addressed store, hash-verified

67}
68
69function get_target_from_ua(useragent) {
70 const pattern = /^Mozilla\/5\.0 \(?(?:PlayStation; )?PlayStation (4|5)[ \/]([0-9]{1,2}\.[0-9]{2})\)? AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\)(?: Version\/[0-9.]+ Safari\/[0-9.]+)?$/;
71 const match = pattern.exec(useragent);
72 if (!match) {
73 return;
74 }
75
76 if (match[1] == "4") {
77 return parseInt(`0x0${match[2].replace(".", "").padStart(4, "0")}`);
78 } else if (match[1] == "5") {
79 return parseInt(`0x1${match[2].replace(".", "").padStart(4, "0")}`);
80 }
81}
82
83export let target = null;
84set_target(get_target_from_ua(navigator.userAgent));

Callers 1

config.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected