diff --git a/.gitignore b/.gitignore index 8a9acf7..17398b6 100644 --- a/.gitignore +++ b/.gitignore @@ -133,5 +133,4 @@ dist # Violet's Purgatory static/cached cached -config -emojis \ No newline at end of file +config \ No newline at end of file diff --git a/constants.json b/constants.json index e7bafbb..3943f93 100644 --- a/constants.json +++ b/constants.json @@ -150,20 +150,6 @@ "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 e83a605..25eb585 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) -} - -if (!fs.existsSync(path.join(cachePath, "emojis"))) { - fs.mkdirSync(path.join(cachePath, "emojis")) +} 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 6824cc7..fbdf822 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -49,6 +49,18 @@ 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." @@ -67,27 +79,12 @@ function converter(html) { "QUOTE_COUNT": quotes.length, "RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)], "DISCORD_STATUS": - `${constants.discStatuses[lanyardData.discord_status].text}` + - ``, + `${statusData.text}` + + ``, "UPTIME": uptime, "TOPBAR": ``, - "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 += "
I would call it random daily video but its not at all daily...
@@ -312,21 +309,6 @@ 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 a8648c4..ad3cc34 100644 --- a/static/main.js +++ b/static/main.js @@ -60,6 +60,7 @@ 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) @@ -70,9 +71,7 @@ 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); } @@ -111,7 +110,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" } @@ -177,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 diff --git a/static/root.css b/static/root.css index bd6ba5c..bf00327 100644 --- a/static/root.css +++ b/static/root.css @@ -65,17 +65,6 @@ 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 fc22499..33d6575 100644 --- a/static/socials/index.html +++ b/static/socials/index.html @@ -36,15 +36,14 @@