Compare commits

..

10 commits

7 changed files with 79 additions and 32 deletions

1
.gitignore vendored
View file

@ -134,3 +134,4 @@ dist
static/cached static/cached
cached cached
config config
emojis

View file

@ -150,6 +150,20 @@
"Risk of Rain 2": { "Risk of Rain 2": {
"color": "rgb(150, 220, 255)", "color": "rgb(150, 220, 255)",
"caseInsensitive": true "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
} }
} }
} }

View file

@ -39,14 +39,14 @@ app.use("/cached", express.static(cachePath))
app.use("/imgs", express.static(path.join(assetPath, "Images"))) app.use("/imgs", express.static(path.join(assetPath, "Images")))
app.use("/snds", express.static(path.join(assetPath, "Sounds"))) app.use("/snds", express.static(path.join(assetPath, "Sounds")))
app.use("/emojis", express.static(path.join(cachePath, "emojis")))
if (!fs.existsSync(cachePath)) { if (!fs.existsSync(cachePath)) {
fs.mkdirSync(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) => { app.get("/discHTML", (req, res) => {

View file

@ -49,18 +49,6 @@ function converter(html) {
var statusText = "" 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 = `<hr/><p>${lanyardData.activities[0].state}</p>`
}
} else {
var statusData = constants.discStatuses.offline
var username = "bingus_violet"
}
var bnchName = "Beta" var bnchName = "Beta"
var bnchSub = "beta." var bnchSub = "beta."
@ -79,12 +67,27 @@ function converter(html) {
"QUOTE_COUNT": quotes.length, "QUOTE_COUNT": quotes.length,
"RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)], "RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)],
"DISCORD_STATUS": "DISCORD_STATUS":
`<span style="color: ${statusData.color};" class="statusColor">${statusData.text}</span>` + `<span style="color: ${constants.discStatuses[lanyardData.discord_status].color};" class="statusColor">${constants.discStatuses[lanyardData.discord_status].text}</span>` +
`<style>.pfp { border-color: ${statusData.color} }</style>`, `<style>.pfp { border-color: ${constants.discStatuses[lanyardData.discord_status].color} }</style>`,
"UPTIME": uptime, "UPTIME": uptime,
"TOPBAR": `<div id="topbar"><h3><a href="/socials">Socials</a></h3></div>`, "TOPBAR": `<div id="topbar"><h3><a href="/socials">Socials</a></h3></div>`,
"DISCORD_USER": username, "CUSTOM_STATUS": () => {
"CUSTOM_STATUS": statusText, if (lanyardData && lanyardData.activities[0] && lanyardData.activities[0].type == 4) {
var status = lanyardData.activities[0]
var addedHTML = "<hr/><p>"
if (status.emoji) {
if (status.emoji.id) {
addedHTML += `<img src="/emojis/${status.emoji.id}" title="${status.emoji.name}" class="emoji"/>`
} else {
addedHTML += status.emoji.name + " "
}
}
addedHTML += status.state
addedHTML += "</p>"
return addedHTML
}
return ""
},
"SELECTED_VIDEO": () => { "SELECTED_VIDEO": () => {
if (config.dailyVideoURL) { if (config.dailyVideoURL) {
return `<h2><hr/>Random video!</h2><p>I would call it random <em>daily</em> video but its not at all daily...</p> return `<h2><hr/>Random video!</h2><p>I would call it random <em>daily</em> video but its not at all daily...</p>
@ -309,6 +312,21 @@ function socketeer() {
} else if (data.op == 0) { } else if (data.op == 0) {
lanyardData = data.d lanyardData = data.d
lastLanyardUpdate = Date.now() 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) { } else if (data.op == 4) {
globalSpins = data.spins globalSpins = data.spins
} }

View file

@ -60,7 +60,6 @@ function spinLoop() {
document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1); document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1);
} }
spins += 1/spinSpeed / 3 spins += 1/spinSpeed / 3
document.querySelector(".pfp").style.rotate = (spins * 360) + "deg"
if (Math.floor(spins) != lastSent && sock && sock.OPEN) { if (Math.floor(spins) != lastSent && sock && sock.OPEN) {
document.querySelector(".globalSpins").innerHTML = globalSpins + 1 document.querySelector(".globalSpins").innerHTML = globalSpins + 1
lastSent = Math.floor(spins) lastSent = Math.floor(spins)
@ -71,7 +70,9 @@ function spinLoop() {
} else { } else {
music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed) music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed)
music.volume = lerp(music.volume, 0, 1/spinSpeed * 4) 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() spinLoop()
}, 1/spinSpeed * 1000); }, 1/spinSpeed * 1000);
} }
@ -110,7 +111,7 @@ window.onload = function () {
spinning = false 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" pfp.style.scale = "1"
} }
@ -176,11 +177,11 @@ function socketeer() {
resetPFP() resetPFP()
} }
if (lanyard.activities[0] && lanyard.activities[0].type == 4) { // if (lanyard.activities[0] && lanyard.activities[0].type == 4) {
document.querySelector(".customStatus").innerHTML = `<hr><p>${lanyard.activities[0].state}</p>` // document.querySelector(".customStatus").innerHTML = `<hr><img src=""><p>${lanyard.activities[0].state}</p>`
} else { // } else {
document.querySelector(".customStatus").innerHTML = "" // document.querySelector(".customStatus").innerHTML = ""
} // }
var discFetch = await (await fetch("/discHTML")).text() var discFetch = await (await fetch("/discHTML")).text()
document.querySelector("#activityHtml").innerHTML = discFetch document.querySelector("#activityHtml").innerHTML = discFetch

View file

@ -65,6 +65,17 @@
display: inline-block; 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) { img:not(.project-inner > div > img):not(.activity>img) {
width: 100%; width: 100%;
max-width: 168px; max-width: 168px;

View file

@ -36,14 +36,15 @@
<h3>Social Media</h3> <h3>Social Media</h3>
<a class="chip" href="https://floofy.city/@bingus_violet" rel="me">Fedi: bingus_violet&ZeroWidthSpace;@floofy.city</a> <a class="chip" href="https://floofy.city/@bingus_violet" rel="me">Fedi: bingus_violet&ZeroWidthSpace;@floofy.city</a>
<a class="chip" href="https://www.youtube.com/channel/UChcrBJNJLZucy3TPyGyAY2g">Youtube: {Violet}'s Fiasco</a> <a class="chip" href="https://www.youtube.com/channel/UChcrBJNJLZucy3TPyGyAY2g">Youtube: {Violet}'s Fiasco</a>
<a class="chip" href="https://ko-fi.com/bingus_violet">Ko-fi: Bingus_{Violet}</a> <!-- <a class="chip" href="https://ko-fi.com/bingus_violet">Ko-fi: Bingus_{Violet}</a> -->
<a class="chip" href="https://en.liberapay.com/bingus_violet/">Liberapay: bingus_violet</a>
</div> </div>
</div> </div>
<div class="grid-child"> <div class="grid-child">
<div> <div>
<h3>Chat</h3> <h3>Chat</h3>
<a class="chip" href="https://matrix.to/#/@bingus_violet:matrix.violets-purgatory.dev">Matrix: @bingus_violet:&ZeroWidthSpace;matrix.violets-purgatory.dev</a> <a class="chip" href="https://matrix.to/#/@bingus_violet:matrix.violets-purgatory.dev">Matrix: @bingus_violet:&ZeroWidthSpace;matrix.violets-purgatory.dev</a>
<a class="chip">Discord: {DISCORD_USER}</a> <a class="chip">Discord: bingus_violet</a>
<a class="chip">Revolt: Bingus{Violet}#5573</a> <a class="chip">Revolt: Bingus{Violet}#5573</a>
</div> </div>
</div> </div>
@ -60,6 +61,7 @@
<div> <div>
<h3>Games</h3> <h3>Games</h3>
<a class="chip" href="https://steamcommunity.com/id/violet-The-Thigh-high-obtainer/">Steam: {Violet}</a> <a class="chip" href="https://steamcommunity.com/id/violet-The-Thigh-high-obtainer/">Steam: {Violet}</a>
<a class="chip" href="https://www.roblox.com/users/28347789/profile">Roblox: @bingus_violet</a>
</div> </div>
</div> </div>
</div> </div>