Compare commits

..

No commits in common. "57852731e46e4c2ec979f2bc2cb59ad257b55b6d" and "c6eaf8e9d9636790bb00d4458f015334712b7eff" have entirely different histories.

14 changed files with 186 additions and 2752 deletions

View file

@ -1,4 +1,8 @@
{ {
"activityImages": {
"ULTRAKILL": "https://fs.violets-purgatory.dev/SiteActivityImages/ULTRAKILL.jpg",
"Phasmophobia": "https://fs.violets-purgatory.dev/SiteActivityImages/Phasmophobia.png"
},
"discStatuses": { "discStatuses": {
"online": { "online": {
"text": "Online", "text": "Online",
@ -20,7 +24,7 @@
"quotes": [ "quotes": [
"Remember the 14th commandment: Thou shalt always clean thy plate and not waste anything, whether thy stomach is full, or not.", "Remember the 14th commandment: Thou shalt always clean thy plate and not waste anything, whether thy stomach is full, or not.",
"I hate javascript!!!", "I hate javascript!!!",
"Happy <s>400</s> 500 commits!", "Happy {COMMIT_COUNT} commits!",
"Play Cave Story!", "Play Cave Story!",
"Cave Story+ Sucks!", "Cave Story+ Sucks!",
"World's Worst Developer", "World's Worst Developer",
@ -50,21 +54,17 @@
"Godot Engine": "#64B5F6", "Godot Engine": "#64B5F6",
"Javascript": "yellow", "Javascript": "yellow",
"NodeJS": "limegreen", "NodeJS": "limegreen",
"Violets-Purgatory": "rgb(200, 150, 255)",
"Violets-Cache": "rgb(200, 150, 255)",
"Violet's": "rgb(200, 150, 255)", "Violet's": "rgb(200, 150, 255)",
"Violets": "rgb(200, 150, 255)",
"Violet": "rgb(200, 150, 255)", "Violet": "rgb(200, 150, 255)",
"Purgatory": "rgb(200, 150, 255)",
"Asahi": "rgb(255, 175, 175)", "Asahi": "rgb(255, 175, 175)",
"Lunya": "rgb(255, 175, 175)", "Lunya": "rgb(255, 175, 175)",
"bisexual": "rgb(214, 2, 112)", "bisexual": "rgb(214, 2, 112)",
"enby": "rgb(252, 244, 52)", "enby": "rgb(252, 244, 52)",
"Purgatory": "rgb(200, 150, 255)",
"Youtube": "rgb(255, 0, 0)", "Youtube": "rgb(255, 0, 0)",
"Fedi": "rgb(175, 125, 200)", "Fedi": "rgb(175, 125, 200)",
"Matrix": "limegreen", "Matrix": "limegreen",
"Element": "rgb(100, 255, 200)", "Element": "rgb(100, 255, 200)",
"Code": "rgb(150, 175, 255)",
"Codeberg": "rgb(0, 255, 255)", "Codeberg": "rgb(0, 255, 255)",
"Docker": "blue", "Docker": "blue",
"Github": "gray", "Github": "gray",
@ -79,8 +79,6 @@
"Forgejo": "orange", "Forgejo": "orange",
"HTML": "orange", "HTML": "orange",
"CSS": "rgb(50, 200, 255)", "CSS": "rgb(50, 200, 255)",
"Thumbor": "rgb(225, 225, 255)", "Thumbor": "rgb(225, 225, 255)"
"Spotify": "limegreen",
"Ultrakill": "red"
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -28,10 +28,6 @@ function get_img_url(activity, size = "large_image") {
return null return null
} }
function makeCompat(string) {
return string.replaceAll("<", "&lt;").replaceAll(">", "&gt;")
}
function timeFormatter(seconds) { function timeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds)
var minutes = Math.floor(seconds / 60) var minutes = Math.floor(seconds / 60)
@ -41,6 +37,7 @@ function timeFormatter(seconds) {
} else { } else {
return `${minutes}:${seconds % 60}` return `${minutes}:${seconds % 60}`
} }
} }
function gameTimeFormatter(seconds) { function gameTimeFormatter(seconds) {
@ -57,14 +54,6 @@ function gameTimeFormatter(seconds) {
} }
function onlyIfExists(string, check) {
if (check) {
return string
} else {
return ""
}
}
module.exports = { module.exports = {
activitiesToHTML: (lanyardData, cachedImages) => { activitiesToHTML: (lanyardData, cachedImages) => {
var debounce = false var debounce = false
@ -94,23 +83,26 @@ module.exports = {
function get_img(activity, size = "large_image") { function get_img(activity, size = "large_image") {
return "https://cache.violets-purgatory.dev/cached/" + get_img_url(activity, size) if (cachedImages[get_img_url(activity, size)]) {
var fn = cachedImages[get_img_url(activity, size)]
var fp = path.join(__dirname, 'cached', fn)
} else {
return '/imgs/notFound.png'
}
return '/cached/' + fn
} }
function songStats() { function songStats() {
var html = `` var html = ``
if (activity.assets && activity.assets.large_text != activity.details && activity.state.length + activity.assets.large_text.length < 100) { if (activity.assets && activity.assets.large_text != activity.details) {
html += ` html += `
<br> Album: ${makeCompat(activity.assets.large_text || " ")} <br> Album: ${activity.assets.large_text || " "}
<br> Artist: ${makeCompat(activity.state || " ")} <br> Artist: ${activity.state || " "}
` `
} else { } else {
html += "<br>" html += `<br> Artist: ${activity.state || " "}`
if (activity.state.includes(";"))
{ html += "Artists: " }
else { html += "Artist: " }
html += `${makeCompat(activity.state || " ")}`
} }
return html return html
@ -122,8 +114,8 @@ module.exports = {
<div class="chip activity grid-child"> <div class="chip activity grid-child">
<img src="${get_img(activity)}" title="${activity.assets.large_text || activity.assets.small_text || activity.state || ""}"> <img src="${get_img(activity)}" title="${activity.assets.large_text || activity.assets.small_text || activity.state || ""}">
<p> <p>
Listening to ${activity.name} Listening to <span style="color: limegreen;">${activity.name}</span>
<br> Song: ${makeCompat(activity.details || " ")} <br> Song: ${activity.details || " "}
${songStats()} ${songStats()}
<br> <br>
<span class="lengthBar lengthBar${index}"><span></span></span> <span class="lengthBar lengthBar${index}"><span></span></span>
@ -148,7 +140,7 @@ module.exports = {
} }
</style> </style>
` `
} else if (activity.type == 0 && activity.assets) { } else if (activity.type == 0) {
var time = activity.created_at var time = activity.created_at
if (activity.timestamps) { if (activity.timestamps) {
time = activity.timestamps.start time = activity.timestamps.start
@ -170,14 +162,14 @@ module.exports = {
<img src="${get_img(activity)}" title="${activity.assets.large_text}"> <img src="${get_img(activity)}" title="${activity.assets.large_text}">
${smch()} ${smch()}
<p> <p>
Playing ${activity.name} Playing <span style="color: rgb(255, 100, 150);">${activity.name}</span>
${onlyIfExists("<br>" + (activity.details || activity.assets.large_text), activity.details || activity.assets.large_text)} <br> ${(activity.details || activity.assets.large_text || " ")}
${onlyIfExists("<br>" + (activity.state || activity.assets.small_text), activity.state || activity.assets.small_text)} <br> ${(activity.state || activity.assets.small_text || " ")}
<br> ${gameTimeFormatter((Date.now() - time) / 1000)} <br> ${gameTimeFormatter((Date.now() - time) / 1000)}
</p> </p>
</div> </div>
` `
} else if (activity.type != 4 && activity.assets) { } else if (activity.type != 4) {
var time = activity.created_at var time = activity.created_at
if (activity.timestamps) { if (activity.timestamps) {
time = activity.timestamps.start time = activity.timestamps.start

339
package-lock.json generated
View file

@ -9,10 +9,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@node-minify/core": "^8.0.6",
"@node-minify/uglify-js": "^8.0.6",
"express": "^4.18.2", "express": "^4.18.2",
"himalaya": "^1.1.0",
"minify-html": "^0.0.2", "minify-html": "^0.0.2",
"ws": "^8.16.0", "ws": "^8.16.0",
"youtubei.js": "^9.0.2" "youtubei.js": "^9.0.2"
@ -26,45 +23,6 @@
"node": ">=14" "node": ">=14"
} }
}, },
"node_modules/@node-minify/core": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/@node-minify/core/-/core-8.0.6.tgz",
"integrity": "sha512-/vxN46ieWDLU67CmgbArEvOb41zlYFOkOtr9QW9CnTrBLuTyGgkyNWC2y5+khvRw3Br58p2B5ZVSx/PxCTru6g==",
"license": "MIT",
"dependencies": {
"@node-minify/utils": "8.0.6",
"glob": "9.3.5",
"mkdirp": "1.0.4"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/@node-minify/uglify-js": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/@node-minify/uglify-js/-/uglify-js-8.0.6.tgz",
"integrity": "sha512-t6NNJwqnCwfFbbYOKv9bY3v43DcEkIUq4aaj4gtElJnx9tQaELiI0vsX9WuvQFrJlRI1xAwiNzYc+U05PWpscw==",
"license": "MIT",
"dependencies": {
"@node-minify/utils": "8.0.6",
"uglify-js": "3.17.4"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/@node-minify/utils": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/@node-minify/utils/-/utils-8.0.6.tgz",
"integrity": "sha512-csY4qcR7jUwiZmkreNTJhcypQfts2aY2CK+a+rXgXUImZiZiySh0FvwHjRnlqWKvg+y6ae9lHFzDRjBTmqlTIQ==",
"license": "MIT",
"dependencies": {
"gzip-size": "6.0.0"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/accepts": { "node_modules/accepts": {
"version": "1.3.8", "version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@ -93,12 +51,6 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
}, },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/body-parser": { "node_modules/body-parser": {
"version": "1.20.2", "version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
@ -122,15 +74,6 @@
"npm": "1.2.8000 || >= 1.4.16" "npm": "1.2.8000 || >= 1.4.16"
} }
}, },
"node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/bytes": { "node_modules/bytes": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@ -157,18 +100,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/clean-css": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
"integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==",
"license": "MIT",
"dependencies": {
"source-map": "~0.6.0"
},
"engines": {
"node": ">= 4.0"
}
},
"node_modules/content-disposition": { "node_modules/content-disposition": {
"version": "0.5.4", "version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@ -242,12 +173,6 @@
"npm": "1.2.8000 || >= 1.4.16" "npm": "1.2.8000 || >= 1.4.16"
} }
}, },
"node_modules/duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
"integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
"license": "MIT"
},
"node_modules/ee-first": { "node_modules/ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@ -367,12 +292,6 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"license": "ISC"
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@ -399,24 +318,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/glob": {
"version": "9.3.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
"integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
"minimatch": "^8.0.2",
"minipass": "^4.2.4",
"path-scurry": "^1.6.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/gopd": { "node_modules/gopd": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
@ -428,21 +329,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/gzip-size": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz",
"integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==",
"license": "MIT",
"dependencies": {
"duplexer": "^0.1.2"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/has-property-descriptors": { "node_modules/has-property-descriptors": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
@ -487,12 +373,6 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/himalaya": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/himalaya/-/himalaya-1.1.0.tgz",
"integrity": "sha512-LLase1dHCRMel68/HZTFft0N0wti0epHr3nNY7ynpLbyZpmrKMQ8YIpiOV77TM97cNpC8Wb2n6f66IRggwdWPw==",
"license": "ISC"
},
"node_modules/http-errors": { "node_modules/http-errors": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@ -543,15 +423,6 @@
"acorn": "^8.8.0" "acorn": "^8.8.0"
} }
}, },
"node_modules/lru-cache": {
"version": "10.2.2",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz",
"integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==",
"license": "ISC",
"engines": {
"node": "14 || >=16.14"
}
},
"node_modules/media-typer": { "node_modules/media-typer": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -612,40 +483,15 @@
"uglify-es": "3.x.x" "uglify-es": "3.x.x"
} }
}, },
"node_modules/minimatch": { "node_modules/minify-html/node_modules/clean-css": {
"version": "8.0.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==", "integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==",
"license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^2.0.1" "source-map": "~0.6.0"
}, },
"engines": { "engines": {
"node": ">=16 || 14 >=14.17" "node": ">= 4.0"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/minipass": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
"license": "ISC",
"engines": {
"node": ">=8"
}
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"license": "MIT",
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
} }
}, },
"node_modules/ms": { "node_modules/ms": {
@ -688,31 +534,6 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/path-scurry": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"license": "BlueOak-1.0.0",
"dependencies": {
"lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
},
"engines": {
"node": ">=16 || 14 >=14.18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/path-scurry/node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"license": "ISC",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/path-to-regexp": { "node_modules/path-to-regexp": {
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
@ -932,18 +753,6 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz",
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA=="
}, },
"node_modules/uglify-js": {
"version": "3.17.4",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
"integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
"license": "BSD-2-Clause",
"bin": {
"uglifyjs": "bin/uglifyjs"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/undici": { "node_modules/undici": {
"version": "5.28.4", "version": "5.28.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
@ -1019,33 +828,6 @@
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz",
"integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==" "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA=="
}, },
"@node-minify/core": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/@node-minify/core/-/core-8.0.6.tgz",
"integrity": "sha512-/vxN46ieWDLU67CmgbArEvOb41zlYFOkOtr9QW9CnTrBLuTyGgkyNWC2y5+khvRw3Br58p2B5ZVSx/PxCTru6g==",
"requires": {
"@node-minify/utils": "8.0.6",
"glob": "9.3.5",
"mkdirp": "1.0.4"
}
},
"@node-minify/uglify-js": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/@node-minify/uglify-js/-/uglify-js-8.0.6.tgz",
"integrity": "sha512-t6NNJwqnCwfFbbYOKv9bY3v43DcEkIUq4aaj4gtElJnx9tQaELiI0vsX9WuvQFrJlRI1xAwiNzYc+U05PWpscw==",
"requires": {
"@node-minify/utils": "8.0.6",
"uglify-js": "3.17.4"
}
},
"@node-minify/utils": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/@node-minify/utils/-/utils-8.0.6.tgz",
"integrity": "sha512-csY4qcR7jUwiZmkreNTJhcypQfts2aY2CK+a+rXgXUImZiZiySh0FvwHjRnlqWKvg+y6ae9lHFzDRjBTmqlTIQ==",
"requires": {
"gzip-size": "6.0.0"
}
},
"accepts": { "accepts": {
"version": "1.3.8", "version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@ -1065,11 +847,6 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
}, },
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"body-parser": { "body-parser": {
"version": "1.20.2", "version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
@ -1089,14 +866,6 @@
"unpipe": "1.0.0" "unpipe": "1.0.0"
} }
}, },
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"requires": {
"balanced-match": "^1.0.0"
}
},
"bytes": { "bytes": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@ -1114,14 +883,6 @@
"set-function-length": "^1.2.1" "set-function-length": "^1.2.1"
} }
}, },
"clean-css": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
"integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==",
"requires": {
"source-map": "~0.6.0"
}
},
"content-disposition": { "content-disposition": {
"version": "0.5.4", "version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@ -1173,11 +934,6 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
}, },
"duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
"integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg=="
},
"ee-first": { "ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@ -1273,11 +1029,6 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="
}, },
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"function-bind": { "function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@ -1295,17 +1046,6 @@
"hasown": "^2.0.0" "hasown": "^2.0.0"
} }
}, },
"glob": {
"version": "9.3.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
"integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
"requires": {
"fs.realpath": "^1.0.0",
"minimatch": "^8.0.2",
"minipass": "^4.2.4",
"path-scurry": "^1.6.1"
}
},
"gopd": { "gopd": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
@ -1314,14 +1054,6 @@
"get-intrinsic": "^1.1.3" "get-intrinsic": "^1.1.3"
} }
}, },
"gzip-size": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz",
"integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==",
"requires": {
"duplexer": "^0.1.2"
}
},
"has-property-descriptors": { "has-property-descriptors": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
@ -1348,11 +1080,6 @@
"function-bind": "^1.1.2" "function-bind": "^1.1.2"
} }
}, },
"himalaya": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/himalaya/-/himalaya-1.1.0.tgz",
"integrity": "sha512-LLase1dHCRMel68/HZTFft0N0wti0epHr3nNY7ynpLbyZpmrKMQ8YIpiOV77TM97cNpC8Wb2n6f66IRggwdWPw=="
},
"http-errors": { "http-errors": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@ -1391,11 +1118,6 @@
"acorn": "^8.8.0" "acorn": "^8.8.0"
} }
}, },
"lru-cache": {
"version": "10.2.2",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz",
"integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ=="
},
"media-typer": { "media-typer": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -1436,26 +1158,18 @@
"requires": { "requires": {
"clean-css": "4.x.x", "clean-css": "4.x.x",
"uglify-es": "3.x.x" "uglify-es": "3.x.x"
},
"dependencies": {
"clean-css": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
"integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==",
"requires": {
"source-map": "~0.6.0"
}
}
} }
}, },
"minimatch": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
"integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
"requires": {
"brace-expansion": "^2.0.1"
}
},
"minipass": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ=="
},
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"ms": { "ms": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@ -1484,22 +1198,6 @@
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
}, },
"path-scurry": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"requires": {
"lru-cache": "^10.2.0",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
},
"dependencies": {
"minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="
}
}
},
"path-to-regexp": { "path-to-regexp": {
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
@ -1660,11 +1358,6 @@
} }
} }
}, },
"uglify-js": {
"version": "3.17.4",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
"integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g=="
},
"undici": { "undici": {
"version": "5.28.4", "version": "5.28.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",

View file

@ -17,10 +17,7 @@
"author": "Violet <Violetbutagain@gmail.com>", "author": "Violet <Violetbutagain@gmail.com>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@node-minify/core": "^8.0.6",
"@node-minify/uglify-js": "^8.0.6",
"express": "^4.18.2", "express": "^4.18.2",
"himalaya": "^1.1.0",
"minify-html": "^0.0.2", "minify-html": "^0.0.2",
"ws": "^8.16.0", "ws": "^8.16.0",
"youtubei.js": "^9.0.2" "youtubei.js": "^9.0.2"

View file

@ -1,12 +1,10 @@
const path = require('path'), const path = require('path'),
fs = require('fs'), fs = require('fs'),
WebSocket = require('ws'), WebSocket = require('ws'),
minify = require('@node-minify/core'), minify = require('minify-html'),
uglifyJs = require("@node-minify/uglify-js"), activityToHTML = require("./overcomplicatedStatuses.js")
htmlMinifier = require("minify-html"),
activityToHTML = require("./overcomplicatedStatuses.js"), // weatherGenerator = require("./weatherGenerator")
randomThemer = require("./randomThemer.js"),
himalaya = require("himalaya")
var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json'))) var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json')))
@ -21,11 +19,16 @@ var commitCount = "500+"
var lanyardData = undefined var lanyardData = undefined
var uptime = Date.now() var uptime = Date.now()
var reloads = 0
function firstToUpper(str) { function firstToUpper(str) {
return str.charAt(0).toUpperCase() + str.slice(1) return str.charAt(0).toUpperCase() + str.slice(1)
} }
var thumborURL = "https://thumbor.violets-purgatory.dev/unsafe/"
var imgExtension = "png"
var thumborArgs = `filters:format(${imgExtension})/`
function timeFormatter(seconds) { function timeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds)
var minutes = Math.ceil(seconds / 60) var minutes = Math.ceil(seconds / 60)
@ -40,12 +43,22 @@ function timeFormatter(seconds) {
} }
function converter(html) { function converter(html, query) {
var startTime = Date.now() var startTime = Date.now()
html = html
var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/config.json'))) var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/config.json')))
reloads += 1
while (html.includes("{PATH_")) {
var pagePath = html.substring(html.indexOf("{PATH_"))
pagePath = pagePath.substring(6, pagePath.indexOf('}'))
var stringIndex = `{PATH_${pagePath}}`
pagePath = pagePath.toLowerCase()
var pageHTML = fs.readFileSync(path.join(__dirname, 'static', pagePath, 'index.html')).toString()
pageHTML = pageHTML.substring(pageHTML.indexOf('<main>') + 6, pageHTML.indexOf('</main>'))
html = html.replace(stringIndex, pageHTML)
}
var statusText = "" var statusText = ""
@ -54,7 +67,7 @@ function converter(html) {
var username = lanyardData.discord_user.username var username = lanyardData.discord_user.username
if (lanyardData.activities[0] && lanyardData.activities[0].type == 4) { if (lanyardData.activities[0] && lanyardData.activities[0].type == 4) {
var statusText = `<hr/><p>${lanyardData.activities[0].state}</p>` var statusText = `<hr><p>${lanyardData.activities[0].state}</p>`
} }
} else { } else {
var statusData = constants.discStatuses.offline var statusData = constants.discStatuses.offline
@ -79,43 +92,31 @@ 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: ${statusData.color};" class="statusColor">${statusData.text}</span>` +
`<style>.pfp { border-color: ${statusData.color} }</style>`, `<style>.pfp { border-color: ${statusData.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, "DISCORD_USER": username,
"CUSTOM_STATUS": statusText, "CUSTOM_STATUS": statusText,
"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>
<br/> <br>
<video controls="true" src="${config.dailyVideoURL}"></video>` <video controls src="${config.dailyVideoURL}"></video>`
} }
return `` return ``
}, },
"SPINCOUNT": globalSpins, "SPINCOUNT": globalSpins,
"UPTIME": timeFormatter((Date.now() - uptime) / 1000), "UPTIME": timeFormatter((Date.now() - uptime) / 1000),
"WEATHER_MODIFIER": randomThemer.returnTheme(), "RELOAD_COUNT": reloads,
"WEATHER_MODIFIER": "",
"WEATHER_TEXT": "", "WEATHER_TEXT": "",
"ANNOUNCEMENT": fs.readFileSync(path.join(__dirname, "config/announcement.html")), "ANNOUNCEMENT": fs.readFileSync(path.join(__dirname, "config/announcement.html")),
"CACHED_IMAGES": fs.readdirSync(path.join(__dirname, "cached")).length.toString(), "CACHED_IMAGES": fs.readdirSync(path.join(__dirname, "cached")).length.toString()
"ACTIVITIES": activityToHTML.activitiesToHTML(lanyardData)
} }
replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} " replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} "
while (html.includes("{PATH_")) {
var pagePath = html.substring(html.indexOf("{PATH_"))
pagePath = pagePath.substring(6, pagePath.indexOf('}'))
var stringIndex = `{PATH_${pagePath}}`
pagePath = pagePath.toLowerCase()
var pageHTML = fs.readFileSync(path.join(__dirname, 'static', pagePath, 'index.html')).toString()
pageHTML = pageHTML.substring(pageHTML.indexOf('<main>') + 6, pageHTML.indexOf('</main>'))
html = html.replaceAll(stringIndex, pageHTML)
}
var rpTable = Object.keys(replacers) var rpTable = Object.keys(replacers)
for (let index = 0; index < rpTable.length; index++) { for (let index = 0; index < rpTable.length; index++) {
@ -123,47 +124,21 @@ function converter(html) {
html = html.replaceAll(`{${text}}`, replacers[text]) html = html.replaceAll(`{${text}}`, replacers[text])
} }
if (html.includes("<body>")) { var bodyHTML = html.substring(html.indexOf("<body>") + 6, html.lastIndexOf("</body>"))
var bodyHTML = htmlMinifier.minify(html.substring(html.indexOf("<body>") + 6, html.lastIndexOf("</body>"))) var highTable = Object.keys(highlightedWords)
var parsedHTML = himalaya.parse(bodyHTML)
} else { for (let index = 0; index < highTable.length; index++) {
var parsedHTML = himalaya.parse(html) var term = highTable[index];
var replacement = `<span style="color: ${highlightedWords[term]}">${term}</span>`
bodyHTML = bodyHTML.replaceAll(`{${term}}`, "TEMPORARY_REPLACE")
bodyHTML = bodyHTML.replaceAll(term, replacement)
bodyHTML = bodyHTML.replaceAll("TEMPORARY_REPLACE", `${term}`)
} }
function highlighter(json) { bodyHTML = bodyHTML.replaceAll("{ACTIVITIES}", activityToHTML.activitiesToHTML(lanyardData, cachedImages))
for (var i = 0; i < json.length; i++) {
var element = json[i]
if (element.type == "element") {
if (element.children.length > 0) {
element.children = highlighter(element.children)
}
} else if (element.type == "text") {
var highTable = Object.keys(highlightedWords)
for (let index = 0; index < highTable.length; index++) { html = html.substring(0, html.indexOf("<body>")) + bodyHTML + html.substring(html.indexOf("</body>") + 7)
var term = highTable[index];
var replacement = `<span style="color: ${highlightedWords[term]}">${term}</span>`
element.content = element.content.replaceAll(`{${term}}`, "TEMPORARY_REPLACE")
element.content = element.content.replaceAll(term, replacement)
element.content = element.content.replaceAll("TEMPORARY_REPLACE", `${term}`)
}
}
}
return json
}
parsedHTML = highlighter(parsedHTML)
parsedHTML = himalaya.stringify(parsedHTML)
if (html.includes("<body>")) {
html = html.substring(0, html.indexOf("<body>")) + parsedHTML + html.substring(html.indexOf("</body>") + 7)
} else {
html = parsedHTML
}
html = html.replaceAll("{LOAD_TIME}", (Date.now() - startTime).toString() + "ms") html = html.replaceAll("{LOAD_TIME}", (Date.now() - startTime).toString() + "ms")
@ -172,10 +147,10 @@ function converter(html) {
module.exports = { module.exports = {
getActivities: function () { getActivities: function () {
return htmlMinifier.minify(converter(activityToHTML.activitiesToHTML(lanyardData))) return minify.minify(activityToHTML.activitiesToHTML(lanyardData, cachedImages))
}, },
middleWare: async function (req, res, next) { middleWare: function (req, res, next) {
var filePath = (req.baseUrl + req.path).trim() var filePath = (req.baseUrl + req.path).trim()
@ -193,18 +168,18 @@ module.exports = {
res.contentType(path.basename(filePath)) res.contentType(path.basename(filePath))
// if (req.path.includes(".css")) {
// res.setHeader("Content-Type", "text/css")
// } else if (!req.path.includes(".woff2")) {
// data = converter(data, req.query)
// }
if (filePath.includes(".html")) { if (filePath.includes(".html")) {
data = converter(data, req.query) data = converter(data, req.query)
} }
if (!filePath.includes(".js")) { if (!filePath.includes(".js")) {
data = htmlMinifier.minify(data) data = minify.minify(data)
} else {
data = await minify({
compressor: uglifyJs,
content: data
})
} }
res.send(data) res.send(data)
@ -241,10 +216,37 @@ updateCommits()
var lastLanyardUpdate = Date.now() var lastLanyardUpdate = Date.now()
var lastPong = 0 var lastPong = 0
var activityImages = constants.activityImages
var cachedImages = {}
function get_img_url(activity, size = "large_image") {
if ("assets" in activity) {
var image = activity.assets[size]
if (image) {
if (image.includes("https/")) {
return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length))
} else if (image.includes("spotify")) {
return decodeURIComponent('https://i.scdn.co/image/' + image.substr(image.indexOf('spotify:') + 8, image.length))
} else {
return decodeURIComponent('https://cdn.discordapp.com/app-assets/' + activity.application_id + "/" + image + ".png")
}
}
}
if (!image && size == "large_image") {
if (activity.name in activityImages) {
return decodeURIComponent(activityImages[activity.name])
}
}
return null
}
function socketeer() { function socketeer() {
var lanyard = new WebSocket('https://api.violets-purgatory.dev') var lanyard = new WebSocket('https://api.violets-purgatory.dev')
lanyard.on("error", (error) => { lanyard.on("error", (error) =>{
console.log(error) console.log(error)
}) })
@ -280,6 +282,38 @@ 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 (let index = 0; index < lanyardData.activities.length; index++) {
const activity = lanyardData.activities[index];
if (get_img_url(activity)) {
var url = get_img_url(activity)
var fn = Math.ceil(Math.random() * 100_000_000_000).toString() + "." + imgExtension
var fp = path.join(__dirname, 'cached', fn)
if (!cachedImages[url]) {
const response = await (await fetch(thumborURL + "200x200/" + thumborArgs + url)).arrayBuffer()
fs.writeFileSync(fp, Buffer.from(response))
cachedImages[url] = fn
}
}
if (get_img_url(activity, "small_image")) {
var url = get_img_url(activity, "small_image")
var fn = Math.ceil(Math.random() * 100_000_000_000).toString() + "." + imgExtension
var fp = path.join(__dirname, 'cached', fn)
if (!cachedImages[url]) {
const response = await (await fetch(thumborURL + "64x64/" + thumborArgs + url)).arrayBuffer()
fs.writeFileSync(fp, Buffer.from(response))
cachedImages[url] = fn
}
}
}
} else if (data.op == 4) { } else if (data.op == 4) {
globalSpins = data.spins globalSpins = data.spins
} }

View file

@ -1,75 +0,0 @@
function rain() {
var html = ""
html += `<div class="rainStuff"><div class="rainContainer">`
html += `<link rel="stylesheet" type="text/css" href="/themes/rain.css">`
var amount = 7
for (let index = 0; index < amount; index++) {
html += `<div class="rainDrop"></div>`
}
html += "<style>"
for (let index = 0; index < amount; index++) {
html += `
.rainDrop:nth-of-type(${index + 1}) {
animation: rainAnim${index} ${(Math.random() * 0.3) + (2)}s linear;
animation-iteration-count: infinite;
animation-delay: ${Math.round(Math.random() * 100) / 100}s;
}
`
var randos = []
for (let index = 0; index < 11; index++) {
randos.push(Math.round(Math.random() * 100))
}
html += `@keyframes rainAnim${index} { `
for (let index = 0; index < 5; index++) {
html += `
${index * 3}0% {
top: 110vh;
right: ${randos[index]}%;
visibility: hidden;
}
${index * 3}0.1% {
top: -10vh;
right: ${randos[index + 1]}%;
visibility: hidden;
}
${index * 3}0.2% {
visibility: visible;
}
`
}
// console.log(html)
html += `90.3% { visibility: hidden; }`
html += `}`
}
html += "</style>"
html += "</div></div>"
return html
}
function night() {
}
var events = [
rain(),
"",
]
module.exports = {
returnTheme: function() {
var time = new Date()
return events[time.getUTCDay() % events.length]
},
}

View file

@ -7,7 +7,3 @@
.noscript { .noscript {
display: initial; display: initial;
} }
.scriptEnabled {
display: none;
}

View file

@ -71,6 +71,22 @@ img:not(.project-inner > div > img):not(.activity>img) {
transition: all 2s cubic-bezier(0.075, 0.82, 0.165, 1); transition: all 2s cubic-bezier(0.075, 0.82, 0.165, 1);
} }
@media screen and (min-width: 850px) {
.activity-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.activity {
flex: 0 0 49%;
margin: auto;
padding: 0;
margin: 0;
align-content: center;
}
}
@keyframes spinny { @keyframes spinny {
0% { 0% {
rotate: 0deg; rotate: 0deg;

View file

@ -51,7 +51,7 @@
<div> <div>
<h3>Coding</h3> <h3>Coding</h3>
<a class="chip" href="https://git.violets-purgatory.dev/bingus_violet/">Forgejo: bingus_violet (git.violets-purgatory.dev)</a> <a class="chip" href="https://git.violets-purgatory.dev/bingus_violet/">Forgejo: bingus_violet (git.violets-purgatory.dev)</a>
<a class="chip" href="https://codeberg.org/Bingus_violet">{Code}berg: bingus_violet</a> <a class="chip" href="https://codeberg.org/Bingus_violet">Codeberg: bingus_violet</a>
<a class="chip" href="https://hub.docker.com/u/bingusviolet">Docker: bingusviolet</a> <a class="chip" href="https://hub.docker.com/u/bingusviolet">Docker: bingusviolet</a>
<a class="chip" href="https://github.com/violets-puragtory">Github: violets-puragtory</a> <a class="chip" href="https://github.com/violets-puragtory">Github: violets-puragtory</a>
</div> </div>

View file

@ -37,7 +37,13 @@
<ul> <ul>
<li>Page generation time: {LOAD_TIME}</li> <li>Page generation time: {LOAD_TIME}</li>
<li>Uptime: {UPTIME}</li> <li>Uptime: {UPTIME}</li>
<li>Cached Images: {CACHED_IMAGES}</li> <li>Total reloads: {RELOAD_COUNT} <sup>*1</sup></li>
<li>Cached Images: {CACHED_IMAGES} <sup>*2</sup></li>
</ul>
<br><br><br>
<ol class="noteList">
<li>Increments by 1 <em>EVERY</em> time <em>ANY</em> page is loaded.</li>
<li>Cached Images are cleared on server restart.</li>
</ul> </ul>
</main> </main>
</div> </div>

View file

@ -9,14 +9,6 @@
color-scheme: dark; color-scheme: dark;
} }
@font-face {
font-display: swap;
font-family: 'RubikBold';
font-style: bold;
font-weight: 600;
src: url('./fonts/rubik-v28-latin-600.woff2') format('woff2');
}
@font-face { @font-face {
font-display: swap; font-display: swap;
font-family: 'Rubik'; font-family: 'Rubik';
@ -176,26 +168,6 @@ h2 {
text-decoration-color: white; text-decoration-color: white;
} }
br {
display: block;
margin: 3px 0;
}
@media screen and (min-width: 850px) {
.activity-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.activity {
flex: 0 0 49%;
margin: auto;
padding: 0;
margin: 0;
align-content: center;
}
}
.activity { .activity {
@ -207,7 +179,6 @@ br {
display: flex; display: flex;
position: relative; position: relative;
z-index: 3; z-index: 3;
max-width: 650px;
/* max-height: 200px; */ /* max-height: 200px; */
} }
@ -327,11 +298,3 @@ sup {
em, b, s { em, b, s {
color: inherit; color: inherit;
} }
b, b > *, .activityTitle, .activityTitle > * {
font-family: "RubikBold", Verdana, Geneva, Tahoma, sans-serif;
}
.activityTitle {
text-decoration: underline;
}

View file

@ -1,33 +0,0 @@
#card {
background-color: rgba(50, 0, 90, 0.5);
backdrop-filter: blur(5px);
}
.rainStuff {
position: sticky;
top: 0;
height: 0;
z-index: -5;
}
.rainContainer {
height: 100vh;
width: 80vw;
top: 0px;
left: 10vw;
position: absolute;
overflow: hidden;
}
.rainDrop {
position: absolute;
width: 5px;
backdrop-filter: blur(5px);
background-color: rgba(0, 0, 255, 0.2);
height: 10vh;
visibility: hidden;
}
body {
background: linear-gradient(rgb(10, 10, 75), black);
}