From 2d1df01fcfb164829e4ca3af60523077c4683d34 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Sat, 8 Jun 2024 17:04:53 -0500 Subject: [PATCH 01/10] Remove realtime status updates --- static/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/main.js b/static/main.js index ad3cc34..e4fd234 100644 --- a/static/main.js +++ b/static/main.js @@ -176,11 +176,11 @@ function socketeer() { resetPFP() } - if (lanyard.activities[0] && lanyard.activities[0].type == 4) { - document.querySelector(".customStatus").innerHTML = `

${lanyard.activities[0].state}

` - } else { - document.querySelector(".customStatus").innerHTML = "" - } + // if (lanyard.activities[0] && lanyard.activities[0].type == 4) { + // document.querySelector(".customStatus").innerHTML = `

${lanyard.activities[0].state}

` + // } else { + // document.querySelector(".customStatus").innerHTML = "" + // } var discFetch = await (await fetch("/discHTML")).text() document.querySelector("#activityHtml").innerHTML = discFetch From 5c0b892e2237c222cf97495dc5d872e071e32bee Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Sat, 8 Jun 2024 18:31:34 -0500 Subject: [PATCH 02/10] Emojis! --- .gitignore | 3 ++- index.js | 8 ++------ pageUpdater.js | 50 ++++++++++++++++++++++++++++++++++---------------- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 17398b6..8a9acf7 100644 --- a/.gitignore +++ b/.gitignore @@ -133,4 +133,5 @@ dist # Violet's Purgatory static/cached cached -config \ No newline at end of file +config +emojis \ No newline at end of file diff --git a/index.js b/index.js index 25eb585..d60fdbb 100644 --- a/index.js +++ b/index.js @@ -39,14 +39,10 @@ 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) -} else { - var files = fs.readdirSync(cachePath) - for (let index = 0; index < files.length; index++) { - const file = files[index]; - fs.rmSync(path.join(cachePath, file)) - } } app.get("/discHTML", (req, res) => { diff --git a/pageUpdater.js b/pageUpdater.js index fbdf822..455b968 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -49,18 +49,6 @@ function converter(html) { var statusText = "" - if (lanyardData) { - var statusData = constants.discStatuses[lanyardData.discord_status] - var username = lanyardData.discord_user.username - - if (lanyardData.activities[0] && lanyardData.activities[0].type == 4) { - var statusText = `

${lanyardData.activities[0].state}

` - } - } else { - var statusData = constants.discStatuses.offline - var username = "bingus_violet" - } - var bnchName = "Beta" var bnchSub = "beta." @@ -79,12 +67,27 @@ function converter(html) { "QUOTE_COUNT": quotes.length, "RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)], "DISCORD_STATUS": - `${statusData.text}` + - ``, + `${constants.discStatuses[lanyardData.discord_status].text}` + + ``, "UPTIME": uptime, "TOPBAR": ``, - "DISCORD_USER": username, - "CUSTOM_STATUS": statusText, + "CUSTOM_STATUS": () => { + if (lanyardData && lanyardData.activities[0] && lanyardData.activities[0].type == 4) { + var status = lanyardData.activities[0] + var addedHTML = "

" + if (status.emoji) { + if (status.emoji.id) { + addedHTML += `` + } else { + addedHTML += status.emoji.name + } + } + addedHTML += status.state + addedHTML += "

" + return addedHTML + } + return "" + }, "SELECTED_VIDEO": () => { if (config.dailyVideoURL) { return `


Random video!

I would call it random daily video but its not at all daily...

@@ -309,6 +312,21 @@ function socketeer() { } else if (data.op == 0) { lanyardData = data.d lastLanyardUpdate = Date.now() + + for (var i = 0; i < lanyardData.activities.length; i++) { + var activity = lanyardData.activities[i] + if (activity.type == 4 && activity.emoji) { + + if (activity.emoji.id) { + if (activity.emoji.animated) { + var emoji = Buffer.from(await (await fetch(`https://cdn.discordapp.com/emojis/${activity.emoji.id}.gif?quality=lossless`)).arrayBuffer()) + } else { + var emoji = Buffer.from(await (await fetch(`https://cdn.discordapp.com/emojis/${activity.emoji.id}.png?quality=lossless`)).arrayBuffer()) + } + fs.writeFileSync(path.join(__dirname, "cached/emojis", activity.emoji.id), emoji) + } + } + } } else if (data.op == 4) { globalSpins = data.spins } From a3181e2f4df36bd3d9fec02255882145197342be Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Sat, 8 Jun 2024 19:16:44 -0500 Subject: [PATCH 03/10] Fix --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index d60fdbb..e83a605 100644 --- a/index.js +++ b/index.js @@ -45,6 +45,10 @@ if (!fs.existsSync(cachePath)) { fs.mkdirSync(cachePath) } +if (!fs.existsSync(path.join(cachePath, "emojis"))) { + fs.mkdirSync(path.join(cachePath, "emojis")) +} + app.get("/discHTML", (req, res) => { res.send(pageUpdater.getActivities()) }) From b61dc0435611bcdcf6c5b7bafe4bbbadc8697fdc Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 11 Jun 2024 02:40:38 -0500 Subject: [PATCH 04/10] Add Liberapay to highlights and socials, remove Kofi, fix Discord --- constants.json | 3 +++ static/socials/index.html | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/constants.json b/constants.json index 3943f93..68aa9e7 100644 --- a/constants.json +++ b/constants.json @@ -150,6 +150,9 @@ "Risk of Rain 2": { "color": "rgb(150, 220, 255)", "caseInsensitive": true + }, + "Liberapay": { + "color": "yellow" } } } \ No newline at end of file diff --git a/static/socials/index.html b/static/socials/index.html index 33d6575..2482aff 100644 --- a/static/socials/index.html +++ b/static/socials/index.html @@ -36,14 +36,15 @@

Social Media

Fedi: bingus_violet​@floofy.city Youtube: {Violet}'s Fiasco - Ko-fi: Bingus_{Violet} + + Liberapay: bingus_violet From bbf2c5113fc35bd468056c6eec6f6f57c2fcb053 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 11 Jun 2024 02:45:55 -0500 Subject: [PATCH 05/10] Add Roblox --- constants.json | 3 +++ static/socials/index.html | 1 + 2 files changed, 4 insertions(+) diff --git a/constants.json b/constants.json index 68aa9e7..fa6e333 100644 --- a/constants.json +++ b/constants.json @@ -153,6 +153,9 @@ }, "Liberapay": { "color": "yellow" + }, + "Roblox": { + "color": "rgb(225, 225, 225)" } } } \ No newline at end of file diff --git a/static/socials/index.html b/static/socials/index.html index 2482aff..fc22499 100644 --- a/static/socials/index.html +++ b/static/socials/index.html @@ -61,6 +61,7 @@ From f5324a7aa67be69d51ef1ab605def8d19abc3635 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 11 Jun 2024 21:47:13 -0500 Subject: [PATCH 06/10] Reduce emoji size, improve code --- pageUpdater.js | 2 +- static/root.css | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pageUpdater.js b/pageUpdater.js index 455b968..f9598de 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -77,7 +77,7 @@ function converter(html) { var addedHTML = "

" if (status.emoji) { if (status.emoji.id) { - addedHTML += `` + addedHTML += `` } else { addedHTML += status.emoji.name } diff --git a/static/root.css b/static/root.css index bf00327..382f55d 100644 --- a/static/root.css +++ b/static/root.css @@ -65,6 +65,12 @@ display: inline-block; } +.emoji { + max-width: 32px !important; + vertical-align: top; + padding: 0; +} + img:not(.project-inner > div > img):not(.activity>img) { width: 100%; max-width: 168px; From 2674b553b2a5f8fb820bb968758808ff3b995cf0 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 11 Jun 2024 22:02:08 -0500 Subject: [PATCH 07/10] show emoji name on hover --- pageUpdater.js | 2 +- static/root.css | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pageUpdater.js b/pageUpdater.js index f9598de..4e28eac 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -77,7 +77,7 @@ function converter(html) { var addedHTML = "


" if (status.emoji) { if (status.emoji.id) { - addedHTML += `` + addedHTML += `` } else { addedHTML += status.emoji.name } diff --git a/static/root.css b/static/root.css index 382f55d..bd6ba5c 100644 --- a/static/root.css +++ b/static/root.css @@ -66,9 +66,14 @@ } .emoji { - max-width: 32px !important; + max-width: 2rem !important; vertical-align: top; padding: 0; + margin-right: 10px; +} + +.emoji:hover { + transform: scale(1.5); } img:not(.project-inner > div > img):not(.activity>img) { From 73a01c9964e43e8f79ae73b013162a1f8c42f233 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 11 Jun 2024 23:20:57 -0500 Subject: [PATCH 08/10] Spin back to default when not touched --- static/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/main.js b/static/main.js index e4fd234..a8648c4 100644 --- a/static/main.js +++ b/static/main.js @@ -60,7 +60,6 @@ function spinLoop() { document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1); } spins += 1/spinSpeed / 3 - document.querySelector(".pfp").style.rotate = (spins * 360) + "deg" if (Math.floor(spins) != lastSent && sock && sock.OPEN) { document.querySelector(".globalSpins").innerHTML = globalSpins + 1 lastSent = Math.floor(spins) @@ -71,7 +70,9 @@ function spinLoop() { } else { music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed) music.volume = lerp(music.volume, 0, 1/spinSpeed * 4) + spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3) } + document.querySelector(".pfp").style.rotate = (spins * 360) + "deg" spinLoop() }, 1/spinSpeed * 1000); } @@ -110,7 +111,7 @@ window.onload = function () { spinning = false - pfp.style.transition = "all 3s cubic-bezier(0.39, 0.575, 0.565, 1)" + // pfp.style.transition = "all 3s cubic-bezier(0.39, 0.575, 0.565, 1)" pfp.style.scale = "1" } From 1f09314e31c5ad2eb0358fc402547f2dd7f9fc5a Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Sun, 16 Jun 2024 15:00:23 -0500 Subject: [PATCH 09/10] Add a space after a non-custom emoji --- pageUpdater.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pageUpdater.js b/pageUpdater.js index 4e28eac..6824cc7 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -79,7 +79,7 @@ function converter(html) { if (status.emoji.id) { addedHTML += `` } else { - addedHTML += status.emoji.name + addedHTML += status.emoji.name + " " } } addedHTML += status.state From 035a7a838e3e4ed195ba2f16e4e12f8d39e4c974 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Tue, 18 Jun 2024 02:49:24 -0500 Subject: [PATCH 10/10] Teto Tuesday appreciation update --- constants.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/constants.json b/constants.json index fa6e333..e7bafbb 100644 --- a/constants.json +++ b/constants.json @@ -156,6 +156,14 @@ }, "Roblox": { "color": "rgb(225, 225, 225)" + }, + "Teto Tuesday": { + "color": "rgb(255, 100, 100)", + "caseInsensitive": true + }, + "Teto": { + "color": "rgb(255, 100, 100)", + "caseInsensitive": true } } } \ No newline at end of file