diff --git a/index.js b/index.js index 12c3b62..d930662 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,7 @@ var lanyardData = undefined var discData = null const activityImages = { - "ULTRAKILL": "https://thumbor-production-0e82.up.railway.app/unsafe/512x512/https://fs.violets-purgatory.dev/ULTRAKILL/etc/DiscordIcon.webp" + "ULTRAKILL": "https://fs.violets-purgatory.dev/ULTRAKILL/etc/DiscordIcon.webp" } var mastoData = { @@ -72,7 +72,11 @@ function pageUpdate() { var status = lanyardData.activities[0] addedHTML += "

" if (status.emoji) { - addedHTML += ` ` + if (status.emoji.id) { + addedHTML += ` ` + } else { + addedHTML += status.emoji.name + } } if (status.state) { addedHTML += `"` @@ -87,19 +91,6 @@ function pageUpdate() { addedHTML = "" - if (lanyardData) { - for (let index = 0; index < lanyardData.activities.length; index++) { - const activity = lanyardData.activities[index]; - if (activity.type == 4) { - addedHTML += `

"${lanyardData.activities[0].state}" - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}

` - } - } - } - - html = html.replace("{LANYARD_SPOTIFY}", addedHTML) - - addedHTML = "" - var debounce = false if (lanyardData && lanyardData.activities.length > 0) { @@ -148,6 +139,7 @@ function pageUpdate() { return decodeURIComponent(activityImages[activity.name]) } else { return decodeURIComponent(`https://cdn.discordapp.com/app-assets/680748054038577165/680775885317472448.png`) + // This was supposed to be temporary but it kinda stuck honestly lol (It's an ultrakill icon) } } } @@ -168,7 +160,7 @@ function pageUpdate() { if (activity.type == 2) { addedHTML += `
- +

Listening to ${activity.name}
Song: ${activity.details || " "} @@ -187,7 +179,7 @@ function pageUpdate() { addedHTML += `

- +

Playing ${activity.name}
${activity.details || activity.assets.large_text || " "} diff --git a/resources/mainPage.html b/resources/mainPage.html index aa2e63f..1306c41 100644 --- a/resources/mainPage.html +++ b/resources/mainPage.html @@ -25,7 +25,7 @@

Violet

- +

They/Them

Developer

@@ -34,9 +34,10 @@

-

Pronouns

+

Status

Socials

Projects

+

Extras


Blog

FAQ

diff --git a/static/extras/discord/index.html b/static/extras/discord/index.html new file mode 100644 index 0000000..6a38921 --- /dev/null +++ b/static/extras/discord/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + Discord Status - Violet's Purgatory + + + + Home +
+ +

Discord Status (W.I.P)

+

This is a more fleshed out version of the main discord status on my site, issue being, it requires Javascript. So, I choose not to use it, though it coulda been cool...

+

I still am tempted to add something like it to the main page, and just make it compatible without javascript, but I worry that'd upset people.

+ +
+

Violet

+
+ +
+

Developer

+

Offline

+
+
+
+

+
+
+
+ + + \ No newline at end of file diff --git a/static/extras/discord/index.js b/static/extras/discord/index.js new file mode 100644 index 0000000..7053ede --- /dev/null +++ b/static/extras/discord/index.js @@ -0,0 +1,74 @@ +var lanyard = new WebSocket('wss://api.lanyard.rest/socket') + +var statuses = { + "online": { + "text": "Online", + "color": "rgb(100, 255, 100)" + }, + "dnd": { + "text": "DND", + "color": "rgb(255, 100, 100)" + }, + "idle": { + "text": "Idle", + "color": "rgb(255, 255, 75)" + }, + "offline": { + "text": "Offline", + "color": "rgb(125, 125, 125)" + } +} + +function beat(dur) { + lanyard.send(JSON.stringify({ + op: 3 + })) + setTimeout(() => { + beat(dur) + }, dur); +} + +lanyard.addEventListener("message", (res) => { + var data = JSON.parse(res.data) + if (data.op == 1) { + beat(data.d.heartbeat_interval) + lanyard.send(JSON.stringify({ + op: 2, + d: { + subscribe_to_id: "534132311781015564" + } + })) + } else if (data.op == 0) { + var lanyardData = data.d + // $("*").text(JSON.stringify(lanyardData)) + + + var statusData = statuses[lanyardData.discord_status] + + $("#discStatus").text(statusData.text) + $("#discStatus").css("color", statusData.color) + $(".pfp").css("border-color", statusData.color) + + if (lanyardData) { + $("#discQuote").html("") + for (let index = 0; index < lanyardData.activities.length; index++) { + const activity = lanyardData.activities[index]; + var status = lanyardData.activities[0] + var addedHTML = "" + addedHTML += "
" + + if (activity.type == 4) { + if (status.emoji) { + if (status.emoji.id) { + addedHTML += ` ` + } else { + addedHTML += status.emoji.name + } + } + addedHTML += `"${lanyardData.activities[0].state}" - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}` + $("#discQuote").html(addedHTML) + } + } + } + } +}) \ No newline at end of file diff --git a/static/extras/index.html b/static/extras/index.html new file mode 100644 index 0000000..9c5aefb --- /dev/null +++ b/static/extras/index.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + Extras - Violet's Purgatory + + + + Home +


Extras

+

Just some fun things that really don't have use on the main page but exist anyway!

+ + + + \ No newline at end of file