moar stuff :D
This commit is contained in:
parent
e839a329ab
commit
5a87559533
2 changed files with 46 additions and 33 deletions
70
index.js
70
index.js
|
@ -1,7 +1,7 @@
|
||||||
const express = require('express'),
|
const express = require('express'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
WebSocket = require('ws')
|
WebSocket = require('ws')
|
||||||
|
|
||||||
var app = express()
|
var app = express()
|
||||||
|
|
||||||
|
@ -24,34 +24,46 @@ app.listen(PORT, () => {
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
var html = fs.readFileSync(mainpage).toString()
|
var html = fs.readFileSync(mainpage).toString()
|
||||||
|
|
||||||
var addedHTML = "<p>"
|
var addedHTML = ""
|
||||||
|
|
||||||
if (lanyardData && (lanyardData.spotify != null || lanyardData.activities[0] != undefined)) {
|
if (lanyardData) {
|
||||||
addedHTML += `Discord Status: ${lanyardData.spotify || '"' + lanyardData.activities[0].state + '"' || ""}`
|
for (let index = 0; index < lanyardData.activities.length; index++) {
|
||||||
}
|
const activity = lanyardData.activities[index];
|
||||||
|
console.log(activity)
|
||||||
var statuses = {
|
if (activity.type == 2) {
|
||||||
"online": {
|
addedHTML += `<p>Listening to on <span style="color: limegreen">${activity.name}</span>: ${activity.details} (by ${activity.state})</p>`
|
||||||
"text": "Online",
|
} else if (activity.type == 4) {
|
||||||
"color": "rgb(100, 255, 100)"
|
addedHTML += `<p><em><span style="color: lightgray">"${lanyardData.activities[0].state}"</span> - ${lanyardData.discord_user.display_name} ${new Date(Date.now()).getFullYear()}</em></p>`
|
||||||
},
|
} else if (activity.type == 0) {
|
||||||
"dnd": {
|
addedHTML += `<p>Playing: ${activity.name}</p>`
|
||||||
"text": "DND",
|
}
|
||||||
"color": "rgb(255, 100, 100)"
|
|
||||||
},
|
|
||||||
"idle": {
|
|
||||||
"text": "Idle",
|
|
||||||
"color": "rgb(255, 255, 75)"
|
|
||||||
},
|
|
||||||
"offline": {
|
|
||||||
"text": "Offline",
|
|
||||||
"color": "rgb(125, 125, 125)"
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
var statusData = statuses[lanyardData.discord_status]
|
|
||||||
|
|
||||||
addedHTML += `<br><span style="color: ${statusData.color}">${statusData.text}</span>`
|
var statuses = {
|
||||||
addedHTML += `<style>.pfp { border-color: ${statusData.color} !important }</style>`
|
"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)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var statusData = statuses[lanyardData.discord_status]
|
||||||
|
|
||||||
|
addedHTML += `<p style="color: ${statusData.color}">${statusData.text}</p>`
|
||||||
|
addedHTML += `<style>.pfp { border-color: ${statusData.color} !important }</style>`
|
||||||
|
|
||||||
|
console.log(lanyardData.activities)
|
||||||
|
}
|
||||||
|
|
||||||
html = html.replace("{LANYARD}", addedHTML + "</p>")
|
html = html.replace("{LANYARD}", addedHTML + "</p>")
|
||||||
|
|
||||||
|
@ -71,7 +83,7 @@ function beat(dur) {
|
||||||
}, dur);
|
}, dur);
|
||||||
}
|
}
|
||||||
|
|
||||||
lanyard.addEventListener("message", (res)=>{
|
lanyard.addEventListener("message", (res) => {
|
||||||
var data = JSON.parse(res.data)
|
var data = JSON.parse(res.data)
|
||||||
if (data.op == 1) {
|
if (data.op == 1) {
|
||||||
beat(data.d.heartbeat_interval)
|
beat(data.d.heartbeat_interval)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
||||||
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="./style.css">
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
|
||||||
<title>Violet's Purgatory</title>
|
<title>Violet's Purgatory</title>
|
||||||
|
|
||||||
|
@ -34,16 +34,17 @@
|
||||||
<p>Game & web developer</p>
|
<p>Game & web developer</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h2>Warning: Not all services are up. Check <a href="/hosted">hosting</a> for more info.</h2>
|
<hr>
|
||||||
|
<p>Warning: Not all services are up. Check <a href="/hosted">hosting</a> for more info.</p>
|
||||||
<p class="chip"><a href="/hosted">Stuff i'm hosting!</a></p>
|
<p class="chip"><a href="/hosted">Stuff i'm hosting!</a></p>
|
||||||
<p class="chip"><a href="/socials">Socials</a></p>
|
<p class="chip"><a href="/socials">Socials</a></p>
|
||||||
<p class="chip"><a href="/pronouns">Pronouns</a></p>
|
<p class="chip"><a href="/pronouns">Pronouns</a></p>
|
||||||
<br>
|
<br>
|
||||||
<p class="d-sm-inline-block d-none">Fediverse: <a rel="me"
|
<!-- <p class="d-sm-inline-block d-none">Fediverse: <a rel="me"
|
||||||
href="https://tech.lgbt/@Bingus_Violet">@Bingus_Violet@tech.lgbt</a></p>
|
href="https://tech.lgbt/@Bingus_Violet">@Bingus_Violet@tech.lgbt</a></p>
|
||||||
<p class="d-sm-inline-block d-none" style="border-color: red;">Ko-Fi: <a
|
<p class="d-sm-inline-block d-none" style="border-color: red;">Ko-Fi: <a
|
||||||
href="https://ko-fi.com/bingus_violet" style="color: rgb(255, 0, 0)">bingus_violet</a> - Please
|
href="https://ko-fi.com/bingus_violet" style="color: rgb(255, 0, 0)">bingus_violet</a> - Please
|
||||||
donate!</p>
|
donate!</p> -->
|
||||||
{LANYARD}
|
{LANYARD}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue