This commit is contained in:
bingus_violet 2024-04-20 12:56:37 -05:00
parent 440865f91a
commit 980be6f21e
5 changed files with 57 additions and 13 deletions

View file

@ -1,7 +1,8 @@
const express = require('express'),
path = require('path'),
fs = require('fs'),
pageUpdater = require('./pageUpdater.js')
pageUpdater = require('./pageUpdater.js'),
WebSocket = require("ws")
var app = express()
@ -39,6 +40,42 @@ app.get("/discHTML", (req, res) => {
app.use(pageUpdater.middleWare)
var sockets = []
wsServer = WebSocket.Server;
let server = require('http').createServer()
wsServer = new wsServer({
server: server,
perMessageDeflate: false
})
server.on('request', app)
wsServer.on("connection", function connection(socket) {
socket.on('message', function message(data) {
data = JSON.parse(data)
if (data.op == 3) {
for (let index = 0; index < sockets.length; index++) {
const socketData = sockets[index];
if (socketData.socket == socket) {
sockets[index].lastPing = Date.now()
}
}
socket.send(`{"op": 3}`)
}
})
socket.send(JSON.stringify(lanyardData))
socket.send(`{ "op": 1 }`)
sockets.push({ socket, lastPing: Date.now() })
})
process.on('uncaughtException', (err, origin) => {
fs.writeSync(
process.stderr.fd,

14
package-lock.json generated
View file

@ -11,7 +11,7 @@
"dependencies": {
"express": "^4.18.2",
"minify-html": "^0.0.2",
"ws": "^8.14.2",
"ws": "^8.16.0",
"youtubei.js": "^9.0.2"
}
},
@ -699,9 +699,9 @@
}
},
"node_modules/ws": {
"version": "8.14.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
"integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==",
"version": "8.16.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
"integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
"engines": {
"node": ">=10.0.0"
},
@ -1235,9 +1235,9 @@
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="
},
"ws": {
"version": "8.14.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
"integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==",
"version": "8.16.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
"integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
"requires": {}
},
"youtubei.js": {

View file

@ -19,7 +19,7 @@
"dependencies": {
"express": "^4.18.2",
"minify-html": "^0.0.2",
"ws": "^8.14.2",
"ws": "^8.16.0",
"youtubei.js": "^9.0.2"
}
}

View file

@ -38,13 +38,15 @@
<div style="width: 50%;">
<div style="float: left;">
<p>They/Them</p>
<p class="spinnyCount">Developer</p>
<p>Developer</p>
<!-- <p>Dating Asahi &lt;3</p> -->
<p>{DISCORD_STATUS}</p>
<!-- <p>THIS TEXT IS THE EPIC EXTREME FILLER TO TEST THE SITE'S FORMATTING :fire:</p> -->
</div>
</div>
</div>
<p class="spinnyCount" style="display: none;"">You have spun Violet <span class="localSpins">4</span> times!<br>
Everyone has spun Violet <span class="globalSpins">3603250</span>+ times!</p>
<hr>
<div>
<p style="padding: 10px;">Hi! I'm Violet, a 15 year old web and game developer. I make server-sided dynamic websites, with no Javascript required! I'm currently making games in the Godot Engine, and my dynamic sites in NodeJS.</p>

View file

@ -3,6 +3,7 @@ var whipLash = new Audio("/snds/johnny-test-whip-crack.mp3")
catsOnMars.loop = true
var spins = 1
var globalSpins = 0
var spinWaiting = false
@ -12,8 +13,12 @@ function spinLoop() {
spinWaiting = false
var pfp = document.querySelector(".pfp")
if (!catsOnMars.paused) {
if (spins > 1) {
document.querySelector(".spinnyCount").style.display = "block"
document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1);
document.querySelector(".globalSpins").innerHTML = Math.ceil(spins - 1) + globalSpins;
}
spins += 0.5
document.querySelector(".spinnyCount").innerHTML = `Violet has spun ${Math.floor(spins)} times!` + pfp.style.animationDuration
spinLoop()
}
}, 1000);
@ -36,7 +41,7 @@ window.onload = function () {
pfp.style.animationName = "spinny"
pfp.style.scale = "1.2"
pfp.style.scale = "1.1"
})
document.body.onmouseup = () => {
@ -54,7 +59,7 @@ window.onload = function () {
}
function socketeer() {
var lanyard = new WebSocket('wss://api.violets-purgatory.dev')
var lanyard = new WebSocket('wss://beta.violets-purgatory.dev')
lanyard.onerror = (error) => {
console.log(error)