Random Quote Selector

This commit is contained in:
Bingus_Violet 2024-01-25 23:29:28 -06:00
parent e51b98eb0a
commit 9e7619098d
3 changed files with 30 additions and 22 deletions

20
config.json Normal file
View file

@ -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/"
]
}

View file

@ -8,19 +8,16 @@ var app = express()
const PORT = process.env.PORT || 8080 const PORT = process.env.PORT || 8080
const staticpath = path.join(__dirname, 'static') const staticpath = path.join(__dirname, 'static')
const resourcePath = path.join(__dirname, "resources") const resourcePath = path.join(__dirname, 'resources')
const mainpage = resourcePath + '/mainPage.html' const mainpage = resourcePath + '/mainPage.html'
var lanyardData = undefined var lanyardData = undefined
var discData = null var discData = null
var thumborInstances = [ var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json')))
"https://thumbor-production-0e82.up.railway.app/",
"https://enormous-book-production.up.railway.app/", var thumborInstances = config.thumborInstances
"https://unusual-back-production.up.railway.app/",
"https://axiomatic-hair-production.up.railway.app/",
]
var thumbCount = 0 var thumbCount = 0
@ -28,22 +25,14 @@ function getThumbor() {
thumbCount += 1 thumbCount += 1
return thumborInstances[thumbCount % thumborInstances.length] + "unsafe" 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.use(express.static(staticpath))
app.listen(PORT, () => { app.listen(PORT, () => {
console.log("Violet's Purgatory is now listening on port: " + PORT) console.log("Violet's Purgatory is now listening on port: " + PORT)
}) })
var randomQuotes = config.quotes
function timeFormatter(seconds) { function timeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds)
var minutes = Math.floor(seconds / 60) var minutes = Math.floor(seconds / 60)
@ -274,9 +263,8 @@ function pageUpdate() {
html = html.replace("{FAQ}", ``) html = html.replace("{FAQ}", ``)
html = html.replace("{MASTODON_FEED}", mastoData.HTML)
var now = new Date() var now = new Date()
currentMonth = now.getMonth() + 1 currentMonth = now.getMonth() + 1
if ([11, 12].includes(currentMonth)) { // The Below HTML is copy and pasted from that one site :> 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("{THUMBOR}", getThumbor())
html = html.replace("{RANDOM_QUOTE}", randomQuotes[Math.floor(Math.random() * randomQuotes.length)])
if (process.env.BRANCH == "dev") { if (process.env.BRANCH == "dev") {
html = html.replace("{OPPOSITE_URL}", "www") html = html.replace("{OPPOSITE_URL}", "www")
html = html.replace("{OPPOSITE_BRANCH}", "Main") html = html.replace("{OPPOSITE_BRANCH}", "Main")

View file

@ -23,9 +23,7 @@
<body> <body>
<h1>Welcome to Violet's Purgatory</h1> <h1>Welcome to Violet's Purgatory</h1>
<h2>Happy 200 (201) Commits!!!</h2> <p>{RANDOM_QUOTE}</p>
<p>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!</p>
<div class="fadediv"> <div class="fadediv">
<div class="container-fluid row" id="card"> <div class="container-fluid row" id="card">
<h2>Violet</h2> <h2>Violet</h2>