Winner Authorization

This commit is contained in:
ssyyhhrr
2022-06-21 17:04:14 +01:00
parent 8d493b77ec
commit 2de5e8bddb
2 changed files with 6 additions and 1 deletions

1
app.js
View File

@@ -160,6 +160,7 @@ function server() {
})
app.get("/winner", (req, res) => {
if (req.headers.authorization != "Bearer kRyX3RYMRY$&yEc8") return res.end()
res.json({
"winner": drivers[driver].firstName + " " + drivers[driver].lastName
})

View File

@@ -238,7 +238,11 @@ async function submit(guess, real) {
categories.forEach((category, index) => {
document.getElementById(category).innerText = stats[index]
})
let data = await fetch(`${window.location.href}winner`)
let data = await fetch(`${window.location.href}winner`, {
headers: new Headers({
"Authorization": "Bearer kRyX3RYMRY$&yEc8"
})
})
let winner = await data.json()
let gg = document.getElementsByClassName("input")[0]
if (gg != null) {