Skip to content

Commit 8f59002

Browse files
committed
added the funcs
1 parent 0409c04 commit 8f59002

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

client/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const hardwareConcurrencyPhrase = `You have ${hardwareConcurrency} logical proce
1717
const languagePhrase = `Your device language is ${language}.`;
1818
const dimentionPhrase = `Your device dimensions are ${deviceHeight} X ${deviceWidth}.`;
1919
const colorDepthPhrase = `Your device's color depth is ${colorDepth}.`;
20-
document.querySelector('.headers').textContent = `LOADING.............`
20+
document.querySelector('.headers').textContent = `LOADING.............`;
2121
document.querySelector('.pin').textContent = `LOADING...............`;
2222

2323
// Put info
@@ -100,6 +100,15 @@ async function bakeCookie(data) {
100100
return response.json()
101101
}
102102

103+
// Add SHA
104+
async function addSHA(sha) {
105+
const response = await fetch("https://mycookie-monster.herokuapp.com/add-sha/"+sha, {
106+
headers: {'Content-Type': 'application/json'},
107+
method: 'GET'
108+
})
109+
return response.json()
110+
}
111+
103112
// init req
104113
async function nowFetch() {
105114
const response = await fetch("https://mycookie-monster.herokuapp.com/", {
@@ -149,6 +158,9 @@ nowFetch().then(response => {
149158

150159
const encodedDynamic = btoa(JSON.stringify(dynamicData))
151160
const HASH = sha1(encodedDynamic)
161+
addSHA(HASH).then(shaRESPONSE => {
162+
console.log(shaRESPONSE)
163+
})
152164
console.log("HASH:" + HASH)
153165
const hashPhrase = `Your identity HASH: ${HASH}`
154166
const ipPhrase = `Your IP address is ${data.ip}.`;

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const express = require('express');
22
var cors = require('cors');
33
var app = express();
44
const atob = require('atob');
5+
const KEY = require('./key');e
56

67
app.use(cors())
78

@@ -74,6 +75,11 @@ app.get('/generate/:data', async (req, res) => { // Because URL PARAMS ARE COOLE
7475
})
7576
})
7677

78+
app.get('/add-sha/:sha', async (req, res) => {
79+
console.log(req.params.sha)
80+
res.json({ "message": "Created" })
81+
})
82+
7783
const port = process.env.PORT || 4000;
7884
app.listen(port, () => {
7985
console.log(`Waiting on port for someone :) ${port}`);

0 commit comments

Comments
 (0)