Now closes on page close
This commit is contained in:
parent
15347cc02b
commit
faba578bf1
2 changed files with 5 additions and 6 deletions
8
index.js
8
index.js
|
@ -22,8 +22,6 @@ app.use("/fonts", express.static(fontPath))
|
|||
app.use("/cached", express.static(cachePath))
|
||||
|
||||
app.get("/disc", (req, res) => {
|
||||
var looping = true
|
||||
|
||||
res.setHeader("X-Accel-Buffering", "no")
|
||||
res.write(fs.readFileSync(path.join(__dirname, "resources/disc.html")))
|
||||
|
||||
|
@ -41,8 +39,10 @@ app.get("/disc", (req, res) => {
|
|||
res.write(`<style>#loop${iterations - 1} {display: none;}</style>`)
|
||||
}
|
||||
setTimeout(() => {
|
||||
loop()
|
||||
res.write("")
|
||||
if (!res.closed) {
|
||||
loop()
|
||||
res.write("")
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
loop()
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<noscript><p>This page uses JS :(</p></noscript>
|
||||
<br>
|
||||
<h1>Dynamicly Updating Discord Status</h1>
|
||||
<p>This page is basically the same as the one present on the site, but it updates in real time!</p>
|
||||
<p>This page is basically the same as the one present on the site, but it updates in real time! It basically only exists to serve my brain rot :P</p>
|
||||
<h2><hr>How does it work?</h2>
|
||||
<p>Its a little big buggy- Pretty much, it just keeps writing html to the client, and telling it the HTML never finished. Yeah. Not great. Very easily could cause a data leak i think? Idk, what do you think I am, a programmer????</p>
|
Loading…
Reference in a new issue