Dynamic Discord!
This commit is contained in:
parent
65e9dd1854
commit
e74fb532ab
6 changed files with 56 additions and 3 deletions
28
index.js
28
index.js
|
@ -19,6 +19,34 @@ var cachePath = path.join(staticpath, 'cached')
|
|||
var fontPath = path.join(staticpath, "fonts")
|
||||
|
||||
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")))
|
||||
|
||||
var iterations = 0
|
||||
var lastAct = null
|
||||
|
||||
function loop() {
|
||||
var currentAct = pageUpdater.getActivities()
|
||||
if (currentAct != lastAct) {
|
||||
lastAct = currentAct
|
||||
iterations += 1
|
||||
res.write(`<div id="loop${iterations}">`)
|
||||
res.write(currentAct.substring(currentAct.indexOf("<div")))
|
||||
res.write(`</div>`)
|
||||
res.write(`<style>#loop${iterations - 1} {display: none;}</style>`)
|
||||
}
|
||||
setTimeout(() => {
|
||||
loop()
|
||||
res.write("")
|
||||
}, 5000);
|
||||
}
|
||||
loop()
|
||||
})
|
||||
|
||||
if (!fs.existsSync(cachePath)) {
|
||||
fs.mkdirSync(cachePath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue