@@ -13,7 +13,7 @@ const languagePhrase = `Your device language is ${language}.`;
1313const dimentionPhrase = `Your device dimentions are ${ deviceHeight } X ${ deviceWidth } .` ;
1414const colorDepthPhrase = `Your device's color depth is ${ colorDepth } .` ;
1515document . querySelector ( '.headers' ) . textContent = `LOADING.............`
16- document . querySelector ( '.pin' ) . textContent = `LOADING...............`
16+ document . querySelector ( '.pin' ) . textContent = `LOADING...............` ;
1717// Put info
1818document . querySelector ( '.memory' ) . textContent = memeoryPhrase ;
1919document . querySelector ( '.platform' ) . textContent = platformPhrase ;
@@ -41,6 +41,7 @@ function getGraphicalUnitExtensions(gl){
4141 return unMaskedInfo ;
4242}
4343document . querySelector ( ".graphics" ) . textContent = graphicsInfoPhrase ;
44+ // Device Acceleration go brrrrr
4445if ( deviceWidth < 990 ) {
4546 if ( window . DeviceMotionEvent ) {
4647 window . addEventListener ( 'devicemotion' , function ( event ) {
@@ -49,7 +50,6 @@ if (deviceWidth < 990) {
4950 Math . round ( event . rotationRate . beta ) ,
5051 Math . round ( event . rotationRate . alpha ) ,
5152 Math . round ( event . rotationRate . gamma ) )
52-
5353 getIfDeviceInAcceleration (
5454 Math . round ( event . acceleration . x ) ,
5555 Math . round ( event . acceleration . y ) ,
@@ -69,23 +69,30 @@ function getIfDeviceInAcceleration(x,y,z) {
6969 let a = x * x ;
7070 let b = y * y ;
7171 let c = z * z ;
72-
7372 if ( a + b + c > 0 ) {
7473 return document . querySelector ( '.acceleration' ) . textContent = `Your device is in accelerated motion` ;
7574 }
7675 document . querySelector ( '.acceleration' ) . textContent = `Your device isnt accelerating` ;
7776}
7877// cookie string send
7978async function bakeCookie ( data ) {
80- const response = await fetch ( "https ://mycookie-monster.herokuapp.com /generate/" + btoa ( JSON . stringify ( data ) ) , {
79+ const response = await fetch ( "http ://localhost:5000 /generate/" + btoa ( JSON . stringify ( data ) ) , {
8180 headers : { 'Content-Type' : 'application/json' } ,
8281 method : 'GET' ,
8382 } )
8483 return response . json ( )
8584}
85+ // VPN
86+ function ifVpn ( data ) {
87+ const response = await fetch ( "http://localhost:5000/if-vpn/" + btoa ( JSON . stringify ( data ) ) , {
88+ method : 'GET' ,
89+ headers : { 'Content-Type' : 'application/json' }
90+ } )
91+ return response . json ( )
92+ }
8693// init req
8794async function nowFetch ( ) {
88- const response = await fetch ( "https ://mycookie-monster.herokuapp.com /" , {
95+ const response = await fetch ( "http ://localhost:5000 /" , {
8996 headers : { 'Content-Type' : 'application/json' } ,
9097 method : 'GET'
9198 } )
@@ -125,4 +132,6 @@ nowFetch().then(response => {
125132 const cookiePhrase = `The cookie I stored to itentify you: ${ res . cookie } .` ;
126133 document . querySelector ( '.cookie' ) . textContent = cookiePhrase ;
127134 } )
135+ const vpnData = { timezone : data . timezone }
136+ ifVpn ( vpnData ) . then ( res => { console . log ( res ) } )
128137} )
0 commit comments