Skip to content

Commit 95f8919

Browse files
committed
reverse last
1 parent 4622b18 commit 95f8919

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

client/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ body {
1111
padding: 1.6%;
1212
}
1313

14+
.scan-results {
15+
color: rgb(121, 251, 15);
16+
}
17+
1418
.visits {
1519
color: rgb(121, 251, 15);
1620
}

client/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ <h2>Opt In for a scan?</h2>
7878
<br>
7979
<br>
8080
<button class="scanButton">Scan</button>
81+
<br> <br>
82+
<div class="scan-results"></div>
8183
</div>
8284

8385
<div class="copy">

client/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,18 @@ nowFetch().then(response => {
173173

174174
const scanButton = document.querySelector('.scanButton')
175175
scanButton.addEventListener('click', async (e) => {
176+
document.querySelector('.scan-results').textContent = `Scanning.....`;
176177
await collectHASH(HASH).then(resp => {console.log(resp)})
177178
.catch(e => {console.log(e)})
178179

179-
scan().then(resp => {
180-
console.log(resp)
180+
scan().then(scanRes => {
181+
document.querySelector('.scan-results').textContent = ``;
182+
scanRes.items.map((item, i) => {
183+
if (item.sha === HASH) {
184+
scanRes.items.splice(i, 1)
185+
}
186+
})
187+
console.log(scanRes)
181188
}).catch(e => {console.log(e)})
182189
})
183190

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ app.get('/add-sha/:sha', (req, res) => {
108108
app.get('/collect-sha/:sha', async (req, res) => {
109109
const ip = req.headers['x-forwarded-for']
110110
const item = await Item.findOne({where: { sha: req.params.sha }})
111-
if (item.sha.length > 2) {
111+
if (item === null) {
112112
return res.json({message: "visited"})
113113
} else {
114114
console.log(JSON.stringify(item, null, 2))

0 commit comments

Comments
 (0)