Skip to content

Commit 7df5d15

Browse files
authored
Create browser.js
1 parent 43e5b53 commit 7df5d15

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

browser.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { getCurrentBrowserFingerPrint } from "@rajesh896/broprint.js";
2+
3+
const getRetropieIp = async(fingerprint: string): Promise<string[]> => {
4+
try {
5+
let response: any = await fetch(`http://127.0.0.1:1338/getHosts`, {
6+
method: "POST",
7+
body: JSON.stringify({
8+
browserId: fingerprint
9+
}),
10+
headers: {
11+
'content-type': 'application/x-www-form-urlencoded'
12+
}
13+
});
14+
15+
response = await response.json();
16+
if (!(response instanceof Array)) response = [];
17+
response = response.filter((i: any) => typeof i === 'string' && i.length);
18+
if (response.length) return response;
19+
20+
}
21+
catch (e) {
22+
23+
}
24+
return [];
25+
}
26+
27+
28+
29+
(async() => {
30+
const fingerprint = String(await getCurrentBrowserFingerPrint());
31+
document.body.innerHTML += '<div>' + fingerprint + '</div>';
32+
33+
const retropieIps = await getRetropieIp(fingerprint);
34+
document.body.innerHTML += '<div>' + 'retropieIp' + JSON.stringify(retropieIps) + '</div>';
35+
36+
37+
38+
const hostName = `//start_${fingerprint}-${Date.now()}end.local`;
39+
40+
navigator.sendBeacon(hostNameWithPrefix);
41+
42+
const img = new Image();
43+
img.src = hostNameWithPrefix;
44+
45+
})();

0 commit comments

Comments
 (0)