diff --git a/constants.json b/constants.json index 8255576..6a75428 100644 --- a/constants.json +++ b/constants.json @@ -124,235 +124,171 @@ } } }, - "highlightedWords": [ - { - "words": [ - "birds", - "Pissing", - "Starwalker", - - "word highlighting", - "highlight", - "Highlight", - - "Javascript", - "JSON", - "JQuery", - ".js", - - "enby", - - "Slay the Spire" - ], + "highlightedWords": { + "birds": { "color": "yellow" }, - { - "words": [ - "Teto Tuesday", - "Teto Territory", - "Teto", - "Kasane" - ], - "color": "#d5738d", - "caseInsensitive": true + "Pissing": { + "color": "yellow" }, - { - "words": [ - "YouTube", - "ULTRAKILL", - "Lethal Company" - ], - "color": "red", - "caseInsensitive": true + "Starwalker": { + "color": "yellow" }, - { - "words": [ - "Spooky's Jump Scare Mansion" - ], - "color": "rgb(150, 175, 255)" + "word highlighting": { + "color": "yellow" }, - { - "words": [ - "Forgejo", - "HTML", - "Shortcat", - "Valve", - "Spooky", - "The Ironclad" - ], - "color": "orange" - }, - { - "words": [ - "NodeJS", - "Spotify", - "Wambu", - "Matrix", - "The Silent" - ], - "color": "limegreen" - }, - { - "words": [ - "Godot Engine" - ], + "Godot Engine": { "color": "#64B5F6" }, - { - "words": [ - "Violet", - "Purgatory", - "Limbo", - "The Watcher" - ], + "Javascript": { + "color": "yellow" + }, + "JSON": { + "color": "yellow" + }, + "JQuery": { + "color": "yellow" + }, + "NodeJS": { + "color": "limegreen" + }, + "Violet": { "color": "rgb(200, 150, 255)" }, - { - "words": [ - "bisexual" - ], + "Purgatory": { + "color": "rgb(200, 150, 255)" + }, + "Limbo": { + "color": "rgb(200, 150, 255)" + }, + "Asahi": { + "color": "rgb(255, 175, 175)", + "caseInsensitive": true + }, + "Lunya": { + "color": "rgb(255, 175, 175)" + }, + "Sylvie": { + "color": "#f768a4" + }, + "bisexual": { "color": "rgb(214, 2, 112)" }, - { - "words": [ - "Fedi" - ], + "enby": { + "color": "rgb(252, 244, 52)" + }, + "YouTube": { + "color": "rgb(255, 0, 0)", + "caseInsensitive": true + }, + "Fedi": { "color": "rgb(175, 125, 200)" }, - { - "words": [ - "Element" - ], + "Matrix": { + "color": "limegreen" + }, + "Element": { "color": "rgb(100, 255, 200)" }, - { - "words": [ - "Codeberg" - ], + "Codeberg": { "color": "rgb(0, 255, 255)" }, - { - "words": [ - "Code" - ], + "Code": { "color": "rgb(150, 175, 255)" }, - { - "words": [ - "Codium" - ], - "color": "rgb(150, 175, 255)" - }, - { - "words": [ - "Docker" - ], + "Docker": { "color": "blue" }, - { - "words": [ - "Github" - ], + "Github": { "color": "gray" }, - { - "words": [ - "Steam" - ], + "Steam": { "color": "lightgray" }, - { - "words": [ - "Univerter" - ], + "Univerter": { "link": "https://univerter.dev/", "color": "rgb(200, 175, 255)" }, - { - "words": [ - "Ko-fi" - ], + "Ko-fi": { "color": "rgb(255, 150, 150)" }, - { - "words": [ - "Revolt" - ], + "Revolt": { "color": "rgb(255, 50, 50)" }, - { - "words": [ - "Discord" - ], + "Discord": { "color": "rgb(150, 150, 255)" }, - { - "words": [ - "SearXNG" - ], + "SearXNG": { "color": "rgb(100, 100, 255)" }, - { - "words": [ - "CSS", - "Neow", - "The Defect" - ], + "highlight": { + "color": "yellow", + "caseInsensitive": true + }, + "Forgejo": { + "color": "orange" + }, + "HTML": { + "color": "orange" + }, + "CSS": { "color": "rgb(50, 200, 255)" }, - { - "words": [ - "Thumbor" - ], + "Thumbor": { "color": "rgb(225, 225, 255)" }, - { - "words": [ - "Risk of Rain 2" - ], + "Spotify": { + "color": "limegreen" + }, + "Ultrakill": { + "color": "red", + "caseInsensitive": true + }, + "Risk of Rain 2": { "color": "rgb(150, 220, 255)", "caseInsensitive": true }, - { - "words": [ - "Liberapay" - ], + "Liberapay": { "color": "yellow" }, - { - "words": [ - "Roblox" - ], + "Roblox": { "color": "rgb(225, 225, 225)" }, - { - "words": [ - "Ryouiki Tenkai" - ], + "Teto Tuesday": { + "color": "rgb(255, 100, 100)", + "caseInsensitive": true + }, + "Teto Territory": { + "color": "rgb(255, 100, 100)", + "caseInsensitive": true + }, + "Teto": { + "color": "rgb(255, 100, 100)", + "caseInsensitive": true + }, + "Kasane": { + "color": "rgb(255, 100, 100)", + "caseInsensitive": true + }, + "Ryouiki Tenkai": { "bold": true, "italicized": true, "caseInsensitive": true }, - { - "words": [ - "Pokerogue" - ], + "Pokerogue": { "caseInsensitive": true, "color": "#366383", "outline": "#d43131", "bold": true }, - { - "words": [ - "page embed" - ], + "page embed": { "link": "/faq#embeds" }, - { - "words": [ - "YIP" - ], + "YIP": { "italicized": true + }, + "Lethal Company": { + "color": "red" } - ] + } } \ No newline at end of file diff --git a/expressHandler.js b/expressHandler.js deleted file mode 100644 index 8e3dd47..0000000 --- a/expressHandler.js +++ /dev/null @@ -1,28 +0,0 @@ -const express = require("express"), -path = require("path") - -var app = express() - -const PORT = process.env.PORT || 8080 - -const cachePath = path.join(__dirname, 'cached') -const assetPath = path.join(__dirname, "assets") - -app.listen(PORT, () => { - console.log("Violet's Purgatory is now listening on port: " + PORT) -}) - -const pageUpdater = require("./pageUpdater.js") - -app.use("/fonts", express.static(path.join(assetPath, "fonts"))) -app.use("/cached", express.static(cachePath)) -app.use("/imgs", express.static(path.join(assetPath, "Images"))) -app.use("/snds", express.static(path.join(assetPath, "Sounds"))) - -app.use("/emojis", express.static(path.join(cachePath, "emojis"))) - -app.use(pageUpdater.middleWare) - -module.exports = { - app: app -} \ No newline at end of file diff --git a/fileHandler.js b/fileHandler.js deleted file mode 100644 index d25be32..0000000 --- a/fileHandler.js +++ /dev/null @@ -1,29 +0,0 @@ -const path = require("path"), -fs = require("fs") - -const cachePath = path.join(__dirname, 'cached') -const assetPath = path.join(__dirname, "assets") -const configPath = path.join(__dirname, 'config') - -const configFile = path.join(configPath, "config.json") -const announcementFile = path.join(configPath, "announcement.html") - -if (!fs.existsSync(configPath)) { - fs.mkdirSync(configPath) -} - -if (!fs.existsSync(configFile)) { - fs.writeFileSync(configFile, fs.readFileSync(path.join(assetPath, "defaults/config.json"))) -} - -if (!fs.existsSync(announcementFile)) { - fs.writeFileSync(announcementFile, ``) -} - -if (!fs.existsSync(cachePath)) { - fs.mkdirSync(cachePath) -} - -if (!fs.existsSync(path.join(cachePath, "emojis"))) { - fs.mkdirSync(path.join(cachePath, "emojis")) -} \ No newline at end of file diff --git a/index.js b/index.js index f18948c..df08653 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,61 @@ -const fs = require("fs") +const express = require('express'), + path = require('path'), + fs = require('fs'), + WebSocket = require("ws") -require("./fileHandler.js") -require('./expressHandler.js') -// require("./imageEmbedder.js") +var app = express() + +const PORT = process.env.PORT || 8080 + +const staticpath = path.join(__dirname, 'static') +const cachePath = path.join(__dirname, 'cached') +const assetPath = path.join(__dirname, "assets") +const configPath = path.join(__dirname, 'config') + +const configFile = path.join(configPath, "config.json") +const announcementFile = path.join(configPath, "announcement.html") + +if (!fs.existsSync(configPath)) { + fs.mkdirSync(configPath) +} + +if (!fs.existsSync(configFile)) { + fs.writeFileSync(configFile, fs.readFileSync(path.join(assetPath, "defaults/config.json"))) +} + +if (!fs.existsSync(announcementFile)) { + fs.writeFileSync(announcementFile, ``) +} + +const pageUpdater = require('./pageUpdater.js') + +var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json'))) + +app.listen(PORT, () => { + console.log("Violet's Purgatory is now listening on port: " + PORT) +}) + +app.use("/fonts", express.static(path.join(assetPath, "fonts"))) +app.use("/cached", express.static(cachePath)) +app.use("/imgs", express.static(path.join(assetPath, "Images"))) +app.use("/snds", express.static(path.join(assetPath, "Sounds"))) + +app.use("/emojis", express.static(path.join(cachePath, "emojis"))) + +if (!fs.existsSync(cachePath)) { + fs.mkdirSync(cachePath) +} + +if (!fs.existsSync(path.join(cachePath, "emojis"))) { + fs.mkdirSync(path.join(cachePath, "emojis")) +} + +app.use(pageUpdater.middleWare) process.on('uncaughtException', (err, origin) => { fs.writeSync( - process.stderr.fd, - `Caught exception: ${err}\n` + - `Exception origin: ${origin}`, + process.stderr.fd, + `Caught exception: ${err}\n` + + `Exception origin: ${origin}`, ); -}); \ No newline at end of file + }); \ No newline at end of file diff --git a/overcomplicatedStatuses.js b/overcomplicatedStatuses.js index bf5d9fd..44045aa 100644 --- a/overcomplicatedStatuses.js +++ b/overcomplicatedStatuses.js @@ -137,17 +137,16 @@ module.exports = { time = activity.timestamps.start } if (!activity.assets) { - activity.assets = { "large_text": "", "small_text": "" } + activity.assets = { "large_text": " ", "small_text": " " } } - var text1 = onlyIfExists("
" + activity.song + "", activity.song) || activity.details - var text2 = onlyIfExists("By: " + activity.artist, activity.artist) || activity.state - var text3 = onlyIfExists("On: " + activity.album, activity.album != activity.song && activity.album) + var text1 = onlyIfExists("
" + activity.song + "", activity.song) || activity.details || activity.assets.large_text + var text2 = onlyIfExists("By: " + activity.artist, activity.artist) || activity.state || activity.assets.small_text + var text3 = onlyIfExists("On: " + activity.album, activity.album) addedHTML += `
- ${onlyIfExists(``, activity.assets.small_image)}

${activity.name} ${onlyIfExists("
" + text1, text1)} diff --git a/pageUpdater.js b/pageUpdater.js index 1aae9f6..d0b2505 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -90,103 +90,82 @@ function highlighter(json, full = true) { element.children = highlighter(element.children, full) } } else if (element.type == "text") { - var index = 0 - for (let i = 0; i < highlightedWords.length; i++) { - var dict = highlightedWords[i] - for (let x = 0; x < dict.words.length; x++) { - index += 1 - var term = dict.words[x]; - var termProps = dict + var highTable = Object.keys(highlightedWords) - var reg = term - if (termProps.caseInsensitive) { - reg = new RegExp(`(${term})`, "gi") - } + for (let index = 0; index < highTable.length; index++) { + var term = highTable[index]; + var termProps = highlightedWords[term] - element.content = element.content.replaceAll(`{${term}}`, "TEMPORARY_REPLACE") - element.content = element.content.replaceAll(reg, "{TERM" + index + "}") - element.content = element.content.replaceAll("TEMPORARY_REPLACE", `${term}`) + var reg = term + if (termProps.caseInsensitive) { + reg = new RegExp(`(${term})`, "gi") } + + element.content = element.content.replaceAll(`{${term}}`, "TEMPORARY_REPLACE") + element.content = element.content.replaceAll(reg, "{TERM" + index + "}") + element.content = element.content.replaceAll("TEMPORARY_REPLACE", `${term}`) } if (full) { - var index = 0 - for (let i = 0; i < highlightedWords.length; i++) { - var dict = highlightedWords[i] - for (let x = 0; x < dict.words.length; x++) { - index += 1 - var termKey = "{TERM" + index + "}" - var termProps = dict - while (element.content.includes(termKey)) { - var termIndex = element.content.indexOf(termKey) + for (let index = 0; index < highTable.length; index++) { + var termKey = "{TERM" + index + "}" + var termProps = highlightedWords[highTable[index]] + while (element.content.includes(termKey)) { + var termIndex = element.content.indexOf(termKey) - var spanEnd = element.content.indexOf(" ", termIndex) + var spanEnd = element.content.indexOf(" ", termIndex) - if (spanEnd == -1) { - spanEnd = element.content.length - } - - var spanStart = element.content.substring(0, termIndex).lastIndexOf(" ") + 1 - - // if (highTable[index] == "ULTRAKILL") { - // console.log(startContent, " ---- ", endContent) - // } - - var startContent = element.content.substring(spanStart - 1, termIndex) - var endContent = element.content.substring(termIndex + termKey.length, spanEnd) - - if (startContent.includes("(") && !endContent.includes(")")) { - spanEnd = element.content.indexOf(")", spanStart) + 1 - endContent = element.content.substring(termIndex + termKey.length, spanEnd) - } - else if (endContent.includes(")") && !startContent.includes("(")) { - spanStart = element.content.substring(0, spanStart).lastIndexOf("(") - startContent = element.content.substring(spanStart - 1, termIndex) - } - - var style = termProps.style || "" - var classes = termProps.classes || "" - var link = termProps.link || "" - - if (termProps.color) { - style += `color: ${termProps.color};` - } - - if (termProps.italicized) { - style += "font-style: italic;" - } - - if (termProps.outline) { - var width = 2 - // style += `text-shadow: -1px -1px 0 ${termProps.outline}, 1px -1px 0 ${termProps.outline}, -1px 1px 0 ${termProps.outline}, 1px 1px 0 ${termProps.outline};` - style += `-webkit-text-stroke: 1px ${termProps.outline};` - // ^ Not in use because it looks bad :30 - } - - if (termProps.bold) { - classes += "bold" - } - - if (style.length > 2) { - style = `style="${style}"` - } - - if (classes.length > 2) { - classes = `class="${classes}"` - } - - var stuff = (startContent + dict.words[x] + endContent).trim() - - if (!stuff.includes("span")) { - var replacement = `${stuff}` - - if (link) { - replacement = `${replacement}` - } - element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd) - } else { - element.content = element.content.replace(termKey, dict.words[x]) + if (spanEnd == -1) { + spanEnd = element.content.length + } + + var endContent = element.content.substring(termIndex + termKey.length, spanEnd) + + var spanStart = element.content.substring(0, termIndex).lastIndexOf(" ") + 1 + var startContent = element.content.substring(spanStart - 1, termIndex) + + var style = termProps.style || "" + var classes = termProps.classes || "" + var link = termProps.link || "" + + if (termProps.color) { + style += `color: ${termProps.color};` + } + + if (termProps.italicized) { + style += "font-style: italic;" + } + + if (termProps.outline) { + var width = 2 + // style += `text-shadow: -1px -1px 0 ${termProps.outline}, 1px -1px 0 ${termProps.outline}, -1px 1px 0 ${termProps.outline}, 1px 1px 0 ${termProps.outline};` + style += `-webkit-text-stroke: 1px ${termProps.outline};` + // ^ Not in use because it looks bad :30 + } + + if (termProps.bold) { + classes += "bold" + } + + if (style.length > 2) { + style = `style="${style}"` + } + + if (classes.length > 2) { + classes = `class="${classes}"` + } + + var stuff = (startContent + highTable[index] + endContent).trim() + + if (!stuff.includes("span")) { + var replacement = `${stuff}` + + if (link) { + replacement = `${replacement}` } + element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd) + } else { + element.content = element.content.replace(termKey, highTable[index]) } } } @@ -202,16 +181,9 @@ function highlighter(json, full = true) { function converter(html, dynamic = true) { var startTime = Date.now() var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/config.json'))) - + var staticReplacers = { - "ALL_HIGHLIGHTS": () => { - var addedHTML = "" - for (var i = 0; i < highlightedWords.length; i++) { - addedHTML += highlightedWords[i].words.join(", ") - addedHTML += ", " - } - return addedHTML.substring(0, addedHTML.length - 2) - }, + "ALL_HIGHLIGHTS": Object.keys(highlightedWords).join(", "), "BRANCH_NAME": () => { if (process.env.BRANCH == "dev") { return "Stable" diff --git a/static/asahi/index.html b/static/asahi/index.html new file mode 100644 index 0000000..69debc8 --- /dev/null +++ b/static/asahi/index.html @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + Violet's Purgatory + + + + + + + + + + + {WEATHER_MODIFIER} + {TOPBAR} +

Welcome to myHumble Abode +

+
+

nice seeing you here! while you're at it, why not check out my socials or about me?

+
+
+

Asahi

+
+
+ +
+
+
+

They/Them

+

Marcy & Violet <3

+
+ +
+
+
+
+

+
hi! my name is Asahi Lunya :3 i'm a bisexual enby who's a very queer mess + +
i have interests in tech, aerospace, trains, art, and music! i'm also a privacy/security + enthusiast + +
i'm currently learning many new things in my life, expanding my knowledge + +
i hope you got to know me a little ^^ +

+ + +
+
+ +


Disclaimer!

+

+ This is NOT Asahi's real site! Please find it here instead! +

+ +


Quotes:

+ + +

“literally anything from the 1995 movie 'Hackers' will absolutely fit here” -tyberry
+"ooooo you like boys, ur a boykisser" -Elodie
+"asahi is twink-esk in spirit. aspirational." -Juniper
+"cute huggable nice huggable cute cute" -marcy
+"Petting Asahi makes the world better” -yassie
+"meow meow meow mrrrp nya~" -gettie
+"cute and queer catenby that functions as fedi's algorithm on the side" -7331
+"sometimes this one still forgets how friendly some people are here… like Asahi, for instance!” -Ariadne
+"Asahi wa sugoi desu ne?" -Bard
+"this is a quote :3c" -Ukko
+"best Asahi I've ever met (awww!)" -Kristina
+"asahi is friend shaped and they have a good heart" -Drew
+"10/10 will give loving headpats and will protect them!" -Natsura

+ + +
+ + + \ No newline at end of file diff --git a/static/index.html b/static/index.html index ffa41d8..ee2a0c3 100644 --- a/static/index.html +++ b/static/index.html @@ -86,7 +86,6 @@ {PATH_SOCIALS}


FAQ

- See the full FAQ here! {PATH_FAQ} {SELECTED_VIDEO} diff --git a/static/main.js b/static/main.js index 5c50bc3..1b48300 100644 --- a/static/main.js +++ b/static/main.js @@ -86,7 +86,7 @@ function timeFormatter(seconds) { } } -function spinLoop() { +function loop() { spinWaiting = true setTimeout(() => { spinWaiting = false @@ -125,31 +125,26 @@ function spinLoop() { spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3) } $(".pfp").css("rotate", (spins * 360) + "deg") - spinLoop() + + $(".durationBarFormatter").each((_, item) => { + item = $(item) + item.text(`${timeFormatter((Date.now() - item.attr("data-start")))}/${timeFormatter((item.attr("data-end") - item.attr("data-start")))}`) + }) + + $(".timeEstimate").each((_, item) => { + item = $(item) + item.text(gameTimeFormatter(Date.now() - item.attr("data-start"))) + }) + + $(".endEstimate").each((_, item) => { + item = $(item) + item.text(timeFormatter((item.attr("data-end") - Date.now()))) + }) + + loop() }, 1/spinSpeed * 1000); } -function secondLoop() { - $(".durationBarFormatter").each((_, item) => { - item = $(item) - item.text(`${timeFormatter((Date.now() - item.attr("data-start")))}/${timeFormatter((item.attr("data-end") - item.attr("data-start")))}`) - }) - - $(".timeEstimate").each((_, item) => { - item = $(item) - item.text(gameTimeFormatter(Date.now() - item.attr("data-start"))) - }) - - $(".endEstimate").each((_, item) => { - item = $(item) - item.text(timeFormatter((item.attr("data-end") - Date.now()))) - }) - - setTimeout(() => { - secondLoop() - }, 1000); -} - window.onbeforeunload = function () { window.scrollTo(0, 0); } @@ -159,8 +154,7 @@ window.onload = function () { pfp = $(".pfp") - spinLoop() - secondLoop() + loop() pfp.on("mousedown", () => { // if (!spinWaiting) { diff --git a/static/themes/magic/style.css b/static/themes/magic/style.css index 1721029..05b8512 100644 --- a/static/themes/magic/style.css +++ b/static/themes/magic/style.css @@ -1,6 +1,6 @@ #card { - background-color: rgba(25, 0, 70, 1); + background-color: rgba(20, 5, 90, 0.5); /* backdrop-filter: blur(5px); */ } .magicStuff { diff --git a/static/themes/rain/style.css b/static/themes/rain/style.css index d10daae..3302382 100644 --- a/static/themes/rain/style.css +++ b/static/themes/rain/style.css @@ -1,6 +1,6 @@ #card { - background-color: rgba(25, 0, 70, 1); + background-color: rgba(50, 0, 90, 0.5); /* backdrop-filter: blur(5px); */ } .rainStuff {