Skip to content

Commit f54bb23

Browse files
committed
finally some fresh air lol
1 parent e8a3d67 commit f54bb23

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

client/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const language = navigator.language;
55
const deviceWidth = screen.availWidth;
66
const deviceHeight = screen.availHeight;
77
const colorDepth = screen.colorDepth;
8+
89
// Phrases
910
const memeoryPhrase = `Your device memory [RAM] is around ${memory} GB.`;
1011
const platformPhrase = `You are possibly running: ${platform}.`;
@@ -14,19 +15,22 @@ const dimentionPhrase = `Your device dimensions are ${deviceHeight} X ${deviceWi
1415
const colorDepthPhrase = `Your device's color depth is ${colorDepth}.`;
1516
document.querySelector('.headers').textContent = `LOADING.............`
1617
document.querySelector('.pin').textContent = `LOADING...............`;
18+
1719
// Put info
1820
document.querySelector('.memory').textContent = memeoryPhrase;
1921
document.querySelector('.platform').textContent = platformPhrase;
2022
document.querySelector('.con').textContent = hardwareConcurrencyPhrase;
2123
document.querySelector('.lang').textContent = languagePhrase;
2224
document.querySelector('.depth').textContent = colorDepthPhrase;
2325
document.querySelector('.dimentions').textContent = dimentionPhrase;
26+
2427
// Try to get the graphichal processing unit info
2528
const canv = document.getElementById("canv");
2629
const gl = canv.getContext("experimental-webgl");
2730
const graphicsVendor = getGraphicalUnitExtensions(gl).vendor;
2831
const graphicsRenderer = getGraphicalUnitExtensions(gl).renderer;
2932
const graphicsInfoPhrase = `Your identified graphics: ${graphicsRenderer}, VENDOR: ${graphicsVendor}.`;
33+
3034
// Getting graphic extensions with WEBGL
3135
function getGraphicalUnitExtensions(gl){
3236
const unMaskedInfo = {
@@ -40,6 +44,7 @@ function getGraphicalUnitExtensions(gl){
4044
}
4145
return unMaskedInfo;
4246
}
47+
4348
document.querySelector(".graphics").textContent = graphicsInfoPhrase;
4449
// Device Acceleration go brrrrr
4550
if (deviceWidth < 990) {
@@ -61,13 +66,15 @@ if (deviceWidth < 990) {
6166
} else {
6267
document.querySelector('.rotation-rate').textContent = `Open this website on your mobile device to see device motion tracker information`;
6368
}
69+
6470
function guessIfTheDeviceIsOnTable(x,y,z) {
6571
if (x === 0 && y === 0 && z === 0) {
6672
document.querySelector('.rotation-rate').textContent = `Your device is on something like a table`;
6773
} else {
6874
document.querySelector('.rotation-rate').textContent = `Your device is in your hands`;
6975
}
7076
}
77+
7178
function getIfDeviceInAcceleration(x,y,z) {
7279
let a = x*x;
7380
let b = y*y;
@@ -78,6 +85,7 @@ function getIfDeviceInAcceleration(x,y,z) {
7885
document.querySelector('.acceleration').textContent = `Your device isnt accelerating`;
7986
}
8087
}
88+
8189
// cookie string send
8290
async function bakeCookie(data) {
8391
const response = await fetch("https://mycookie-monster.herokuapp.com/generate/"+ btoa(JSON.stringify(data)) , {
@@ -86,6 +94,7 @@ async function bakeCookie(data) {
8694
})
8795
return response.json()
8896
}
97+
8998
// init req
9099
async function nowFetch() {
91100
const response = await fetch("https://mycookie-monster.herokuapp.com/", {
@@ -94,6 +103,7 @@ async function nowFetch() {
94103
})
95104
return response.json()
96105
}
106+
97107
// weather
98108
async function weather(city) {
99109
const response = await fetch("https://mycookie-monster.herokuapp.com/weather/"+city, {
@@ -102,6 +112,7 @@ async function weather(city) {
102112
})
103113
return response.json()
104114
}
115+
105116
// Visits
106117
let visitCount = localStorage.getItem("visits")
107118
if (!visitCount) {
@@ -112,6 +123,7 @@ if (!visitCount) {
112123
localStorage.setItem("visits", visitCount)
113124
document.querySelector('.visits').textContent = `You have visited this page ${visitCount} times`;
114125
}
126+
115127
// PLay with cookies
116128
nowFetch().then(response => {
117129
const data = {
@@ -122,12 +134,14 @@ nowFetch().then(response => {
122134
graphics: graphicsRenderer, graphicsVendor: graphicsVendor, pin: response.pin, deviceWidth: deviceWidth,
123135
deviceHeight: deviceHeight
124136
}
137+
125138
const dynamicData = {
126139
headers: data.headers, city: data.city, timezone: data.timezone,
127140
memory: data.memory, platform: data.platform, hardwareConcurrency: data.hardwareConcurrency,
128141
graphics: graphicsRenderer, graphicsVendor: graphicsVendor, deviceWidth: deviceWidth,
129142
deviceHeight: deviceHeight, language: language, colorDepth: colorDepth, isp: data.isp
130143
}
144+
131145
const encodedDinamic = btoa(JSON.stringify(dynamicData))
132146
const HASH = sha1(encodedDinamic)
133147
console.log("HASH:" + HASH)
@@ -139,6 +153,7 @@ nowFetch().then(response => {
139153
const cityPhrase = `Your city is ${data.city}.`
140154
const timezonePhrase = `Your timezone is ${data.timezone}.`;
141155
const pinPhrase = `Your pin code is around ${data.pin}.`
156+
142157
document.querySelector('.ip').textContent = ipPhrase;
143158
document.querySelector('.isp').textContent = ispPhrase;
144159
document.querySelector('.headers').textContent = headersPhrase;
@@ -147,13 +162,15 @@ nowFetch().then(response => {
147162
document.querySelector('.timezone').textContent = timezonePhrase;
148163
document.querySelector('.pin').textContent = pinPhrase;
149164
document.querySelector('.hash').textContent = hashPhrase;
165+
150166
// weather
151167
weather(data.city).then(weatherData => {
152168
const weatherPhrase = `The weather of your area: ${weatherData.description}.`;
153169
const temperaturePhrase = `Temperature of area: ${weatherData.temperature} deg C.`;
154170
document.querySelector('.weather').textContent = weatherPhrase;
155171
document.querySelector('.temperature').textContent = temperaturePhrase;
156172
})
173+
157174
// VPN DETECTION
158175
if (deviceWidth > 990) {
159176
const date = new Date(Date.now())

0 commit comments

Comments
 (0)