diff --git a/config.json b/config.json new file mode 100644 index 0000000..1663cf8 --- /dev/null +++ b/config.json @@ -0,0 +1,20 @@ +{ + "activityImages": { + "ULTRAKILL": "https://fs.violets-purgatory.dev/ULTRAKILL/etc/DiscordIcon.webp" + }, + + "quotes": [ + "Remember the 14th commandment: Thou shalt always clean thy plate and not waste anything, whether thy stomach is full, or not.", + "Remember son, dying is gay!", + "Your friendly neighborhood queer", + "Boykisser", + "I hate javascript!!!" + ], + + "thumborInstances": [ + "https://thumbor-production-0e82.up.railway.app/", + "https://enormous-book-production.up.railway.app/", + "https://unusual-back-production.up.railway.app/", + "https://axiomatic-hair-production.up.railway.app/" + ] +} \ No newline at end of file diff --git a/index.js b/index.js index 28257d7..2a69e71 100644 --- a/index.js +++ b/index.js @@ -8,19 +8,16 @@ var app = express() const PORT = process.env.PORT || 8080 const staticpath = path.join(__dirname, 'static') -const resourcePath = path.join(__dirname, "resources") +const resourcePath = path.join(__dirname, 'resources') const mainpage = resourcePath + '/mainPage.html' var lanyardData = undefined var discData = null -var thumborInstances = [ - "https://thumbor-production-0e82.up.railway.app/", - "https://enormous-book-production.up.railway.app/", - "https://unusual-back-production.up.railway.app/", - "https://axiomatic-hair-production.up.railway.app/", -] +var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'))) + +var thumborInstances = config.thumborInstances var thumbCount = 0 @@ -28,22 +25,14 @@ function getThumbor() { thumbCount += 1 return thumborInstances[thumbCount % thumborInstances.length] + "unsafe" } - -const activityImages = { - "ULTRAKILL": "https://fs.violets-purgatory.dev/ULTRAKILL/etc/DiscordIcon.webp" -} - -var mastoData = { - "lastUpdate": 0, - "HTML": "" -} - app.use(express.static(staticpath)) app.listen(PORT, () => { console.log("Violet's Purgatory is now listening on port: " + PORT) }) +var randomQuotes = config.quotes + function timeFormatter(seconds) { seconds = Math.ceil(seconds) var minutes = Math.floor(seconds / 60) @@ -274,9 +263,8 @@ function pageUpdate() { html = html.replace("{FAQ}", ``) - html = html.replace("{MASTODON_FEED}", mastoData.HTML) - var now = new Date() + currentMonth = now.getMonth() + 1 if ([11, 12].includes(currentMonth)) { // The Below HTML is copy and pasted from that one site :> @@ -289,6 +277,8 @@ function pageUpdate() { html = html.replace("{THUMBOR}", getThumbor()) + html = html.replace("{RANDOM_QUOTE}", randomQuotes[Math.floor(Math.random() * randomQuotes.length)]) + if (process.env.BRANCH == "dev") { html = html.replace("{OPPOSITE_URL}", "www") html = html.replace("{OPPOSITE_BRANCH}", "Main") diff --git a/resources/mainPage.html b/resources/mainPage.html index fd50fe4..acfb413 100644 --- a/resources/mainPage.html +++ b/resources/mainPage.html @@ -23,9 +23,7 @@

Welcome to Violet's Purgatory

-

Happy 200 (201) Commits!!!

-

Hopefully to celebrate, like I promised last time, this time I will try to ACTUALLY find a method to add a commit - count to the site!

+

{RANDOM_QUOTE}

Violet