Compare commits

...

19 commits

Author SHA1 Message Date
57852731e4 FIX < SYMBOLS! 2024-06-02 18:31:08 -05:00
90334a68b3 make mobile formatting on wider screens a little prettier 2024-06-02 00:21:13 -05:00
93755b74b1 I may be dumb 2024-06-02 00:19:50 -05:00
8b564d00b1 Change {COMMIT_COUNT} to "500" 2024-06-02 00:17:36 -05:00
3fe2266e3e Use Cache Server 2024-06-01 13:45:12 -05:00
134d4e4380 Add Violet's Cache 2024-06-01 12:43:28 -05:00
0372cdcf6f Minor changes, {Keywords} use the old method for performance. 2024-05-31 15:24:40 -05:00
9ea5be1777 Only check body if body actually exists, apply conversions to Rich Presence 2024-05-31 01:28:48 -05:00
afcc9a4e2d More constants! 2024-05-31 01:22:43 -05:00
52f308e044 Only check the body 2024-05-31 01:16:50 -05:00
221b63b7cf New highlighting system 2024-05-31 01:05:50 -05:00
6cf0541b72 Add space 2024-05-30 22:32:30 -05:00
726dc3a439 Bold text 2024-05-30 22:31:16 -05:00
633c7fc523 Tiny gaps for readability 2024-05-30 21:59:08 -05:00
7b9281057c Change "Artist" to "Artists" depending on song, Remove Album if too long. 2024-05-30 21:50:08 -05:00
633076e52a Fix Activities not changing with size on socials page 2024-05-30 21:44:24 -05:00
ec6faac33e Remove debug lines 2024-05-30 21:43:33 -05:00
9bcaf4de5f Remove gap from statuses, make CSS link non-relative 2024-05-30 21:42:30 -05:00
62606fa9f6 MinifyJS, theming system WIP 2024-05-28 18:33:32 -05:00
14 changed files with 2752 additions and 186 deletions

Binary file not shown.

View file

@ -1,8 +1,4 @@
{ {
"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",
@ -24,7 +20,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 {COMMIT_COUNT} commits!", "Happy <s>400</s> 500 commits!",
"Play Cave Story!", "Play Cave Story!",
"Cave Story+ Sucks!", "Cave Story+ Sucks!",
"World's Worst Developer", "World's Worst Developer",
@ -54,17 +50,21 @@
"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,6 +79,8 @@
"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"
} }
} }

2153
output.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,10 @@ 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)
@ -37,7 +41,6 @@ function timeFormatter(seconds) {
} else { } else {
return `${minutes}:${seconds % 60}` return `${minutes}:${seconds % 60}`
} }
} }
function gameTimeFormatter(seconds) { function gameTimeFormatter(seconds) {
@ -54,6 +57,14 @@ 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
@ -83,26 +94,23 @@ module.exports = {
function get_img(activity, size = "large_image") { function get_img(activity, size = "large_image") {
if (cachedImages[get_img_url(activity, size)]) { return "https://cache.violets-purgatory.dev/cached/" + 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) { if (activity.assets && activity.assets.large_text != activity.details && activity.state.length + activity.assets.large_text.length < 100) {
html += ` html += `
<br> Album: ${activity.assets.large_text || " "} <br> Album: ${makeCompat(activity.assets.large_text || " ")}
<br> Artist: ${activity.state || " "} <br> Artist: ${makeCompat(activity.state || " ")}
` `
} else { } else {
html += `<br> Artist: ${activity.state || " "}` html += "<br>"
if (activity.state.includes(";"))
{ html += "Artists: " }
else { html += "Artist: " }
html += `${makeCompat(activity.state || " ")}`
} }
return html return html
@ -114,8 +122,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 <span style="color: limegreen;">${activity.name}</span> Listening to ${activity.name}
<br> Song: ${activity.details || " "} <br> Song: ${makeCompat(activity.details || " ")}
${songStats()} ${songStats()}
<br> <br>
<span class="lengthBar lengthBar${index}"><span></span></span> <span class="lengthBar lengthBar${index}"><span></span></span>
@ -140,7 +148,7 @@ module.exports = {
} }
</style> </style>
` `
} else if (activity.type == 0) { } else if (activity.type == 0 && activity.assets) {
var time = activity.created_at var time = activity.created_at
if (activity.timestamps) { if (activity.timestamps) {
time = activity.timestamps.start time = activity.timestamps.start
@ -162,14 +170,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 <span style="color: rgb(255, 100, 150);">${activity.name}</span> Playing ${activity.name}
<br> ${(activity.details || activity.assets.large_text || " ")} ${onlyIfExists("<br>" + (activity.details || activity.assets.large_text), activity.details || activity.assets.large_text)}
<br> ${(activity.state || activity.assets.small_text || " ")} ${onlyIfExists("<br>" + (activity.state || activity.assets.small_text), 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) { } else if (activity.type != 4 && activity.assets) {
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,7 +9,10 @@
"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"
@ -23,6 +26,45 @@
"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",
@ -51,6 +93,12 @@
"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",
@ -74,6 +122,15 @@
"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",
@ -100,6 +157,18 @@
"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",
@ -173,6 +242,12 @@
"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",
@ -292,6 +367,12 @@
"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",
@ -318,6 +399,24 @@
"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",
@ -329,6 +428,21 @@
"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",
@ -373,6 +487,12 @@
"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",
@ -423,6 +543,15 @@
"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",
@ -483,15 +612,40 @@
"uglify-es": "3.x.x" "uglify-es": "3.x.x"
} }
}, },
"node_modules/minify-html/node_modules/clean-css": { "node_modules/minimatch": {
"version": "4.2.4", "version": "8.0.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
"integrity": "sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==", "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
"license": "ISC",
"dependencies": { "dependencies": {
"source-map": "~0.6.0" "brace-expansion": "^2.0.1"
}, },
"engines": { "engines": {
"node": ">= 4.0" "node": ">=16 || 14 >=14.17"
},
"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": {
@ -534,6 +688,31 @@
"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",
@ -753,6 +932,18 @@
"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",
@ -828,6 +1019,33 @@
"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",
@ -847,6 +1065,11 @@
"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",
@ -866,6 +1089,14 @@
"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",
@ -883,6 +1114,14 @@
"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",
@ -934,6 +1173,11 @@
"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",
@ -1029,6 +1273,11 @@
"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",
@ -1046,6 +1295,17 @@
"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",
@ -1054,6 +1314,14 @@
"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",
@ -1080,6 +1348,11 @@
"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",
@ -1118,6 +1391,11 @@
"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",
@ -1158,18 +1436,26 @@
"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",
@ -1198,6 +1484,22 @@
"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",
@ -1358,6 +1660,11 @@
} }
} }
}, },
"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,7 +17,10 @@
"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,10 +1,12 @@
const path = require('path'), const path = require('path'),
fs = require('fs'), fs = require('fs'),
WebSocket = require('ws'), WebSocket = require('ws'),
minify = require('minify-html'), minify = require('@node-minify/core'),
activityToHTML = require("./overcomplicatedStatuses.js") uglifyJs = require("@node-minify/uglify-js"),
htmlMinifier = require("minify-html"),
// weatherGenerator = require("./weatherGenerator") activityToHTML = require("./overcomplicatedStatuses.js"),
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')))
@ -19,16 +21,11 @@ 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)
@ -43,22 +40,12 @@ function timeFormatter(seconds) {
} }
function converter(html, query) { function converter(html) {
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 = ""
@ -67,7 +54,7 @@ function converter(html, query) {
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
@ -92,31 +79,43 @@ function converter(html, query) {
"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 src="${config.dailyVideoURL}"></video>` <video controls="true" src="${config.dailyVideoURL}"></video>`
} }
return `` return ``
}, },
"SPINCOUNT": globalSpins, "SPINCOUNT": globalSpins,
"UPTIME": timeFormatter((Date.now() - uptime) / 1000), "UPTIME": timeFormatter((Date.now() - uptime) / 1000),
"RELOAD_COUNT": reloads, "WEATHER_MODIFIER": randomThemer.returnTheme(),
"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++) {
@ -124,21 +123,47 @@ function converter(html, query) {
html = html.replaceAll(`{${text}}`, replacers[text]) html = html.replaceAll(`{${text}}`, replacers[text])
} }
var bodyHTML = html.substring(html.indexOf("<body>") + 6, html.lastIndexOf("</body>")) if (html.includes("<body>")) {
var highTable = Object.keys(highlightedWords) var bodyHTML = htmlMinifier.minify(html.substring(html.indexOf("<body>") + 6, html.lastIndexOf("</body>")))
var parsedHTML = himalaya.parse(bodyHTML)
for (let index = 0; index < highTable.length; index++) { } else {
var term = highTable[index]; var parsedHTML = himalaya.parse(html)
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}`)
} }
bodyHTML = bodyHTML.replaceAll("{ACTIVITIES}", activityToHTML.activitiesToHTML(lanyardData, cachedImages)) function highlighter(json) {
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)
html = html.substring(0, html.indexOf("<body>")) + bodyHTML + html.substring(html.indexOf("</body>") + 7) for (let index = 0; index < highTable.length; index++) {
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")
@ -147,10 +172,10 @@ function converter(html, query) {
module.exports = { module.exports = {
getActivities: function () { getActivities: function () {
return minify.minify(activityToHTML.activitiesToHTML(lanyardData, cachedImages)) return htmlMinifier.minify(converter(activityToHTML.activitiesToHTML(lanyardData)))
}, },
middleWare: function (req, res, next) { middleWare: async function (req, res, next) {
var filePath = (req.baseUrl + req.path).trim() var filePath = (req.baseUrl + req.path).trim()
@ -168,18 +193,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 = minify.minify(data) data = htmlMinifier.minify(data)
} else {
data = await minify({
compressor: uglifyJs,
content: data
})
} }
res.send(data) res.send(data)
@ -216,37 +241,10 @@ 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)
}) })
@ -282,38 +280,6 @@ 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
} }

75
randomThemer.js Normal file
View file

@ -0,0 +1,75 @@
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,3 +7,7 @@
.noscript { .noscript {
display: initial; display: initial;
} }
.scriptEnabled {
display: none;
}

View file

@ -71,22 +71,6 @@ 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">Codeberg: bingus_violet</a> <a class="chip" href="https://codeberg.org/Bingus_violet">{Code}berg: 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,13 +37,7 @@
<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>Total reloads: {RELOAD_COUNT} <sup>*1</sup></li> <li>Cached Images: {CACHED_IMAGES}</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,6 +9,14 @@
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';
@ -168,6 +176,26 @@ 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 {
@ -179,6 +207,7 @@ h2 {
display: flex; display: flex;
position: relative; position: relative;
z-index: 3; z-index: 3;
max-width: 650px;
/* max-height: 200px; */ /* max-height: 200px; */
} }
@ -298,3 +327,11 @@ 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;
}

33
static/themes/rain.css Normal file
View file

@ -0,0 +1,33 @@
#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);
}