Skip to content

Commit 3cf3692

Browse files
committed
collect hash and scan funcs
1 parent aff8916 commit 3cf3692

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

client/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,22 @@ function getIfDeviceInAcceleration(x,y,z) {
9191
}
9292
}
9393

94-
// cookie string send
95-
async function bakeCookie(data) {
96-
const response = await fetch("https://mycookie-monster.herokuapp.com/generate/"+ btoa(JSON.stringify(data)) , {
94+
async function collectHASH(sha) {
95+
const response = await fetch("https://mycookie-monster.herokuapp.com/collect-sha/"+sha, {
9796
headers: {'Content-Type': 'application/json'},
9897
method: 'GET',
9998
})
10099
return response.json()
101100
}
102101

102+
async function scan() {
103+
const response = await fetch("https://mycookie-monster.herokuapp.com/scan", {
104+
headers: {'Content-Type': 'application/json'},
105+
method: 'GET'
106+
})
107+
return response.json()
108+
}
109+
103110
// Add SHA
104111
async function addSHA(sha) {
105112
const response = await fetch("https://mycookie-monster.herokuapp.com/add-sha/"+sha, {

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ app.get('/collect-sha/:sha', async (req, res) => {
117117
}
118118
})
119119

120-
app.get('/scan/:ip', async (req, res) => {
121-
const ip = req.params.ip
120+
app.get('/scan', async (req, res) => {
121+
const ip = req.headers['x-forwarded-for']
122122
const items = await Item.findAll({
123123
where: {ip: ip}
124124
})

0 commit comments

Comments
 (0)