From 8632516c6ea1a70b3bf2371112eee222691db472 Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Thu, 16 Nov 2023 22:00:16 -0600 Subject: [PATCH] New loading system, local font! --- .gitignore | 2 + index.js | 78 ++++++++++++++++++++++---------------- resources/mainPage.html | 6 ++- static/hosted/index.html | 8 ++-- static/pronouns/index.html | 1 - static/socials/index.html | 1 - static/style.css | 12 ++++-- 7 files changed, 64 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index ceaea36..8327e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,5 @@ dist .yarn/install-state.gz .pnp.* +# Violet's Purgatory +static/assets/ \ No newline at end of file diff --git a/index.js b/index.js index 11d0f73..87b32da 100644 --- a/index.js +++ b/index.js @@ -22,51 +22,65 @@ app.listen(PORT, () => { }) app.get("/", (req, res) => { - var html = fs.readFileSync(mainpage).toString() - var addedHTML = "" + res.setHeader("X-Content-Type-Options", "") + + var statuses = { + "online": { + "text": "Online", + "color": "rgb(100, 255, 100)" + }, + "dnd": { + "text": "DND", + "color": "rgb(255, 100, 100)" + }, + "idle": { + "text": "Idle", + "color": "rgb(255, 255, 75)" + }, + "offline": { + "text": "Offline", + "color": "rgb(125, 125, 125)" + } + } + + var html = fs.readFileSync(mainpage).toString() + + var checkpoint = ["{LANYARD_STATUS}", "{LANYARD}"] + + function io(numb, end=false) { + if (end) { + return html.indexOf(checkpoint[numb]) + checkpoint[numb].length + } + return html.indexOf(checkpoint[numb]) + } + + res.write(html.substring(0, io(0))) + + var statusData = statuses[lanyardData.discord_status] + + res.write(`

${statusData.text}

`) + res.write(``) + + res.write(html.substring(io(0, true), io(1))) if (lanyardData) { for (let index = 0; index < lanyardData.activities.length; index++) { const activity = lanyardData.activities[index]; console.log(activity) if (activity.type == 2) { - addedHTML += `

Listening to on ${activity.name}: ${activity.details} (by ${activity.state})

` + res.write(`

Listening on ${activity.name}: ${activity.details} (by ${activity.state})

`) } else if (activity.type == 4) { - addedHTML += `

"${lanyardData.activities[0].state}" - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}

` + res.write(`

"${lanyardData.activities[0].state}" - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}

`) } } - var statuses = { - "online": { - "text": "Online", - "color": "rgb(100, 255, 100)" - }, - "dnd": { - "text": "DND", - "color": "rgb(255, 100, 100)" - }, - "idle": { - "text": "Idle", - "color": "rgb(255, 255, 75)" - }, - "offline": { - "text": "Offline", - "color": "rgb(125, 125, 125)" - } - } - var statusData = statuses[lanyardData.discord_status] - - addedHTML += `` - console.log(lanyardData.activities) } - - html = html.replace("{LANYARD_STATUS}", `

${statusData.text}

`) - - html = html.replace("{LANYARD}", addedHTML) - - res.send(html) + console.log(io(checkpoint.length - 1, true)) + res.write(html.substring(io(checkpoint.length - 1, true), html.length) + "

Thank you for checking out my website <3

", () => { + res.end() + }) }) // Lanyard Stuffs diff --git a/resources/mainPage.html b/resources/mainPage.html index a6ba5c6..31ac833 100644 --- a/resources/mainPage.html +++ b/resources/mainPage.html @@ -5,16 +5,18 @@ - + Violet's Purgatory + + - + diff --git a/static/hosted/index.html b/static/hosted/index.html index 7d88003..eef18c4 100644 --- a/static/hosted/index.html +++ b/static/hosted/index.html @@ -19,9 +19,8 @@ -
Home -

Stuff i'm hosting!

+

Hosting

Warning:

Due to changes in hosting, some services are still down. SearX (the original) has decent uptime, but SearXNG will be continiously going back up and down. Univerter & Fortnite have currently no efforts put towards getting them back up.

@@ -29,15 +28,16 @@

Things with a green border are up, things with a yellow border are inconsistent or have problems, things with a red border are down.


Social Media:

-

Univerter (Report issues here!): yt.violets-purgatory.dev

+

Univerter (Report issues here!): yt.violets-purgatory.dev

Planned: Matrix, Mastodon


Search engines/utilities:

+

Whoogle: wg.violets-purgatory.dev

SearX: sx.violets-purgatory.dev

SearXNG: sxng.violets-purgatory.dev

Nothing planned...


Etc / Funny

Fortnite (Web edition!): fortnite.violets-purgatory.dev

-

Nothing planned.

+

Nothing planned...


Have any ideas of what I should host? Submit an issue with your idea to codeberg!

All ideas are welcome, just make sure that they have not been tried in the past! Please also ensure that it is not listed on the codeberg page.

diff --git a/static/pronouns/index.html b/static/pronouns/index.html index 6ac3971..3134e3e 100644 --- a/static/pronouns/index.html +++ b/static/pronouns/index.html @@ -23,7 +23,6 @@ -

Home

Pronouns

diff --git a/static/socials/index.html b/static/socials/index.html index 66a150c..d67f1f9 100644 --- a/static/socials/index.html +++ b/static/socials/index.html @@ -18,7 +18,6 @@ -
Home

Socials
diff --git a/static/style.css b/static/style.css index c58bf6c..1f5b1b1 100644 --- a/static/style.css +++ b/static/style.css @@ -1,4 +1,9 @@ -@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400&display=swap'); +@font-face { + font-family: 'Rubik'; + src: url("/assets/Fonts/Rubik/Rubik-VariableFont_wght.ttf"); + font-style: normal; + font-weight: 400; +} * { font-family: 'Rubik', Verdana, Geneva, Tahoma, sans-serif; @@ -10,7 +15,6 @@ h1 { color: rgb(225, 215, 255); font-size: 2.5rem; - margin-top: 20px; } h2 { @@ -48,7 +52,7 @@ a { .chip { font-size: 1.3rem; border: 2px gray solid; - /* border-radius: 4px; */ + border-radius: 6px; background-color: black; padding: 8px; margin: 3px; @@ -102,7 +106,7 @@ hr { background-color: rgb(75, 25, 100); padding: 15px; border: 2px white solid; - margin: 25px auto; + margin: 20px auto; width: 95%; }