Activities are back!
This commit is contained in:
parent
a66a3a9198
commit
10ed08795a
9 changed files with 368 additions and 93 deletions
40
index.js
40
index.js
|
@ -11,7 +11,6 @@ const PORT = process.env.PORT || 8080
|
|||
const staticpath = path.join(__dirname, 'static')
|
||||
|
||||
var mostRecentVideo = undefined
|
||||
var lanyardData = undefined
|
||||
|
||||
var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json')))
|
||||
|
||||
|
@ -39,38 +38,17 @@ app.listen(PORT, () => {
|
|||
console.log("Violet's Purgatory is now listening on port: " + PORT)
|
||||
})
|
||||
|
||||
if (!fs.existsSync(path.join(staticpath, 'cached'))) {
|
||||
fs.mkdirSync(path.join(staticpath, 'cached'))
|
||||
}
|
||||
var cachePath = path.join(staticpath, 'cached')
|
||||
var imgPath = path.join(staticpath, 'imgs')
|
||||
|
||||
var randomQuotes = config.quotes
|
||||
|
||||
var commitCount = "300+"
|
||||
|
||||
function timeFormatter(seconds) {
|
||||
seconds = Math.ceil(seconds)
|
||||
var minutes = Math.floor(seconds / 60)
|
||||
|
||||
if (seconds % 60 < 10) {
|
||||
return `${minutes}:0${seconds % 60}`
|
||||
} else {
|
||||
return `${minutes}:${seconds % 60}`
|
||||
if (!fs.existsSync(cachePath)) {
|
||||
fs.mkdirSync(cachePath)
|
||||
} else {
|
||||
var files = fs.readdirSync(cachePath)
|
||||
for (let index = 0; index < files.length; index++) {
|
||||
const file = files[index];
|
||||
fs.rmSync(path.join(cachePath, file))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function gameTimeFormatter(seconds) {
|
||||
seconds = Math.ceil(seconds)
|
||||
var minutes = Math.ceil(seconds / 60)
|
||||
var hours = Math.floor(minutes / 60)
|
||||
if (seconds <= 60) {
|
||||
return 'about ' + seconds + ' seconds'
|
||||
} else if (minutes < 60) {
|
||||
return `${minutes} Minutes`
|
||||
}
|
||||
|
||||
return `${hours} hours and ${minutes % 60} minutes`
|
||||
|
||||
}
|
||||
|
||||
app.use(pageUpdater.middleWare)
|
Loading…
Add table
Add a link
Reference in a new issue