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/constants.json b/constants.json index 3943f93..e7bafbb 100644 --- a/constants.json +++ b/constants.json @@ -150,6 +150,20 @@ "Risk of Rain 2": { "color": "rgb(150, 220, 255)", "caseInsensitive": true + }, + "Liberapay": { + "color": "yellow" + }, + "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 diff --git a/index.js b/index.js index 25eb585..e83a605 100644 --- a/index.js +++ b/index.js @@ -39,14 +39,14 @@ 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)) - } +} + +if (!fs.existsSync(path.join(cachePath, "emojis"))) { + fs.mkdirSync(path.join(cachePath, "emojis")) } app.get("/discHTML", (req, res) => { diff --git a/pageUpdater.js b/pageUpdater.js index fbdf822..6824cc7 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": `

Socials

`, - "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 } diff --git a/static/main.js b/static/main.js index ad3cc34..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" } @@ -176,11 +177,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 diff --git a/static/root.css b/static/root.css index bf00327..bd6ba5c 100644 --- a/static/root.css +++ b/static/root.css @@ -65,6 +65,17 @@ display: inline-block; } +.emoji { + 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) { width: 100%; max-width: 168px; diff --git a/static/socials/index.html b/static/socials/index.html index 33d6575..fc22499 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

Chat

Matrix: @bingus_violet:​matrix.violets-purgatory.dev - Discord: {DISCORD_USER} + Discord: bingus_violet Revolt: Bingus{Violet}#5573
@@ -60,6 +61,7 @@

Games

Steam: {Violet} + Roblox: @bingus_violet