From a58de11cc29ed278a85ee2693646a5404f464567 Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Sun, 3 Mar 2024 23:57:30 -0600 Subject: [PATCH] It's a terrible day for rain --- config.json | 2 +- pageUpdater.js | 22 ++++- resources/snow.html | 196 ------------------------------------------- resources/stars.html | 85 ------------------- static/global.css | 2 - static/index.html | 4 + static/root.css | 4 +- static/subpage.css | 4 + weatherGenerator.js | 98 ++++++++++++++++++++++ 9 files changed, 129 insertions(+), 288 deletions(-) delete mode 100644 resources/snow.html delete mode 100644 resources/stars.html create mode 100644 weatherGenerator.js diff --git a/config.json b/config.json index 2f96cec..c1b7fe8 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "activityImages": { - "ULTRAKILL": "https://fs.violets-purgatory.dev/ULTRAKILL/etc/DiscordIcon.webp" + "ULTRAKILL": "https://cdn.violets-purgatory.dev/fallbackImages/ULTRAKILL.webp" }, "discStatuses": { "online": { diff --git a/pageUpdater.js b/pageUpdater.js index 0f7f273..a174cc7 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -2,7 +2,8 @@ const path = require('path'), fs = require('fs'), WebSocket = require('ws'), minify = require('minify-html'), - activityToHTML = require("./overcomplicatedStatuses.js") + activityToHTML = require("./overcomplicatedStatuses.js"), + weatherGenerator = require("./weatherGenerator") var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'))) @@ -16,7 +17,7 @@ var lanyardData = undefined var uptime = Date.now() -function converter(html) { +function converter(html, query) { while (html.includes("{PATH_")) { var pagePath = html.substring(html.indexOf("{PATH_")) pagePath = pagePath.substring(6, pagePath.indexOf('}')) @@ -43,6 +44,8 @@ function converter(html) { var username = "bingus_violet" } + var time = new Date(Date.now()) + var replacers = { "COMMIT_COUNT": commitCount, "RANDOM_QUOTE": quotes[Math.floor(Math.random() * quotes.length)], @@ -79,6 +82,19 @@ function converter(html) { html = html.substring(0, html.indexOf("")) + bodyHTML + html.substring(html.indexOf("") + 7) + var weathers = ["rain", "none", "none", "none", "none", "none"] + + var weather = weathers[time.getDate() % weathers.length] + + if (weather == "rain") { + html = html.replaceAll("{WEATHER_MODIFIER}", weatherGenerator.makeRain("hardRain" in query)) + + html = html.replaceAll("{WEATHER_TEXT}", `The rain is so pretty... I wish I saw it more...`) + } else { + html = html.replaceAll("{WEATHER_MODIFIER}", "") + html = html.replaceAll("{WEATHER_TEXT}", "") + } + return html } @@ -110,7 +126,7 @@ module.exports = { if (req.path.includes(".css")) { res.setHeader("Content-Type", "text/css") } else if (!req.path.includes(".woff2")) { - data = converter(data) + data = converter(data, req.query) } res.send(minify.minify(data)) diff --git a/resources/snow.html b/resources/snow.html deleted file mode 100644 index 280b713..0000000 --- a/resources/snow.html +++ /dev/null @@ -1,196 +0,0 @@ - -
-

I love the winter :>

- - \ No newline at end of file diff --git a/resources/stars.html b/resources/stars.html deleted file mode 100644 index e45475b..0000000 --- a/resources/stars.html +++ /dev/null @@ -1,85 +0,0 @@ - -
-
-
-
-
-
-
-
- - \ No newline at end of file diff --git a/static/global.css b/static/global.css index c0dfcb6..525f94e 100644 --- a/static/global.css +++ b/static/global.css @@ -61,8 +61,6 @@ body { min-height: 100vh; - padding: 5vh 0; - animation: hideContent 2.5s; } diff --git a/static/index.html b/static/index.html index 567c5dc..1f9aaf8 100644 --- a/static/index.html +++ b/static/index.html @@ -19,6 +19,7 @@ + {WEATHER_MODIFIER}

Welcome to Violet's PurgatoryCommit {COMMIT_COUNT}

{RANDOM_QUOTE}

@@ -52,6 +53,9 @@

Socials

{PATH_SOCIALS} +
+

{WEATHER_TEXT}

+
diff --git a/static/root.css b/static/root.css index e5f9775..3986f55 100644 --- a/static/root.css +++ b/static/root.css @@ -11,7 +11,8 @@ } #card { - background-color: rgb(25, 5, 80); + background-color: rgba(25, 5, 80, 0.5); + backdrop-filter: blur(10px); padding: 15px; border: 2px white solid; margin: 20px auto; @@ -26,6 +27,7 @@ animation: mainText 2s cubic-bezier(0.075, 0.82, 0.165, 1); margin: auto; max-width: 75%; + padding-top: 30px; /* outline: 1px white solid; */ } diff --git a/static/subpage.css b/static/subpage.css index 7c0ee52..11a651b 100644 --- a/static/subpage.css +++ b/static/subpage.css @@ -8,6 +8,10 @@ h1:nth-of-type(1) { font-size: 2.5rem; } +body { + padding: 5vh 0; +} + main { animation: fadeUp 2s cubic-bezier(0.075, 0.82, 0.165, 1); } diff --git a/weatherGenerator.js b/weatherGenerator.js new file mode 100644 index 0000000..5488c90 --- /dev/null +++ b/weatherGenerator.js @@ -0,0 +1,98 @@ +module.exports = { + + makeRain: function (hardRain) { + var html = "" + + html += `
` + + html += + ` + + ` + + var amount = 20 + + var iterationReducer = 3 + + if (hardRain) { + amount = 100 + iterationReducer = 1 + } + + for (let index = 0; index < amount; index++) { + html += `
` + } + html += "" + html += "
" + + return html + } +} \ No newline at end of file