Skip to content

Commit 2a31454

Browse files
committed
basic time check
1 parent f4398f2 commit 2a31454

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

client/index.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const languagePhrase = `Your device language is ${language}.`;
1313
const dimentionPhrase = `Your device dimentions are ${deviceHeight} X ${deviceWidth}.`;
1414
const colorDepthPhrase = `Your device's color depth is ${colorDepth}.`;
1515
document.querySelector('.headers').textContent = `LOADING.............`
16-
document.querySelector('.pin').textContent = `LOADING...............`
16+
document.querySelector('.pin').textContent = `LOADING...............`;
1717
// Put info
1818
document.querySelector('.memory').textContent = memeoryPhrase;
1919
document.querySelector('.platform').textContent = platformPhrase;
@@ -41,6 +41,7 @@ function getGraphicalUnitExtensions(gl){
4141
return unMaskedInfo;
4242
}
4343
document.querySelector(".graphics").textContent = graphicsInfoPhrase;
44+
// Device Acceleration go brrrrr
4445
if (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
7978
async 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
8794
async 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
})

index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ app.get('/', async (req, res) => {
2121
const ip = req.headers['x-forwarded-for']
2222
const agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36';
2323

24-
const url = "https://api.ip8.com/ip/lookup/"+ip;
24+
// const url = "https://api.ip8.com/ip/lookup/"+ip;
25+
const url = "https://api.ip8.com/ip/lookup/223.238.97.18";
2526

2627
await Axios.get(url, {
2728
headers: {
@@ -65,6 +66,19 @@ app.get('/generate/:data', async (req, res) => { // Because URL PARAMS ARE CO
6566
})
6667

6768
app.get('/if-vpn/:data', async(req, res) => {
69+
const data = atob(req.params.data)
70+
// Timezone Stuff
71+
let options = {
72+
timeZone: data.timezone,
73+
year: 'numeric',
74+
month: 'numeric',
75+
day: 'numeric',
76+
hour: 'numeric',
77+
minute: 'numeric',
78+
second: 'numeric',
79+
},
80+
formatter = new Intl.DateTimeFormat([], options);
81+
console.log(formatter.format(new Date()));
6882
return res.json({message: "yay i work"})
6983
})
7084

0 commit comments

Comments
 (0)