Compare commits

..

8 commits

Author SHA1 Message Date
0692b176ea oops 2024-06-29 18:38:02 -05:00
22031c270b Fix Youtube Highlight 2024-06-29 18:36:59 -05:00
de40bbc179 End only support 2024-06-29 18:36:27 -05:00
53acf3a9e4 OOPS 2024-06-29 18:23:21 -05:00
97c2fc6c9f New activity UI 2024-06-29 17:34:54 -05:00
498c7ae1d9 git commit count properly 2024-06-29 16:19:02 -05:00
dcf99afbe6 Spin Counter fixes 2024-06-29 16:13:49 -05:00
50ea2225a6 Optimize slightly by removing js file 2024-06-29 16:08:25 -05:00
8 changed files with 421 additions and 103 deletions

View file

@ -73,7 +73,7 @@
"name": "bingus_violet@floofy.city", "name": "bingus_violet@floofy.city",
"url": "https://floofy.city/@bingus_violet" "url": "https://floofy.city/@bingus_violet"
}, },
"Youtube": { "YouTube": {
"name": "Violet's Fiasco", "name": "Violet's Fiasco",
"url": "https://www.youtube.com/channel/UChcrBJNJLZucy3TPyGyAY2g" "url": "https://www.youtube.com/channel/UChcrBJNJLZucy3TPyGyAY2g"
}, },
@ -177,8 +177,9 @@
"enby": { "enby": {
"color": "rgb(252, 244, 52)" "color": "rgb(252, 244, 52)"
}, },
"Youtube": { "YouTube": {
"color": "rgb(255, 0, 0)" "color": "rgb(255, 0, 0)",
"caseInsensitive": true
}, },
"Fedi": { "Fedi": {
"color": "rgb(175, 125, 200)" "color": "rgb(175, 125, 200)"

View file

@ -33,7 +33,7 @@ function makeCompat(string) {
} }
function timeFormatter(seconds) { function timeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds / 1000)
var minutes = Math.floor(seconds / 60) var minutes = Math.floor(seconds / 60)
if (seconds % 60 < 10) { if (seconds % 60 < 10) {
@ -44,7 +44,7 @@ function timeFormatter(seconds) {
} }
function gameTimeFormatter(seconds) { function gameTimeFormatter(seconds) {
seconds = Math.ceil(seconds) seconds = Math.ceil(seconds / 1000)
var minutes = Math.ceil(seconds / 60) var minutes = Math.ceil(seconds / 60)
var hours = Math.floor(minutes / 60) var hours = Math.floor(minutes / 60)
if (seconds <= 60) { if (seconds <= 60) {
@ -87,46 +87,20 @@ module.exports = {
continue continue
} }
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) return "https://cache.violets-purgatory.dev/cached/" + get_img_url(activity, size)
} }
function songStats() { function activityTime() {
var html = `` if (activity.timestamps) {
if (activity.timestamps.start) {
if (activity.assets && activity.assets.large_text != activity.details && activity.details.length + activity.state.length + activity.assets.large_text.length < 100) { if (activity.timestamps.end) {
html += `
<br> Album: ${makeCompat(activity.assets.large_text || " ")}
<br> Artist: ${makeCompat(activity.state || " ")}
`
} else {
html += "<br>"
if (activity.state.includes(";"))
{ html += "Artists: " }
else { html += "Artist: " }
html += `${makeCompat(activity.state || " ")}`
}
return html
}
if (activity.type == 2) {
var timeLeft = Math.round((activity.timestamps.end - Date.now()) / 1000) var timeLeft = Math.round((activity.timestamps.end - Date.now()) / 1000)
var currentPercent = (Date.now() - activity.timestamps.start) / (activity.timestamps.end - activity.timestamps.start) * 100 var currentPercent = (Date.now() - activity.timestamps.start) / (activity.timestamps.end - activity.timestamps.start) * 100
addedHTML += ` return `
<div class="chip activity grid-child">
<img src="${get_img(activity)}" title="${activity.assets.large_text || activity.assets.small_text || activity.state || ""}">
<p>
Listening to ${activity.name}
<br> Song: ${makeCompat(activity.details || " ")}
${songStats()}
<br> <br>
<span class="lengthBar lengthBar${index}"><span></span></span> <span style="text-align: center;"><span class="lengthBar lengthBar${index}"><span></span></span><span class="durationBarFormatter" data-start="${activity.timestamps.start}" data-end="${activity.timestamps.end}">${timeFormatter((Date.now() - activity.timestamps.start))}/${timeFormatter((activity.timestamps.end - activity.timestamps.start))}</span></span>
${timeFormatter((activity.timestamps.end - activity.timestamps.start) / 1000)}
</p>
</div>
<style> <style>
.lengthBar${index} > span { .lengthBar${index} > span {
animation-name: songSlider${index}; animation-name: songSlider${index};
animation-duration: ${timeLeft}s; animation-duration: ${timeLeft}s;
@ -143,36 +117,21 @@ module.exports = {
} }
</style> </style>
` `
} else if (activity.type == 0 && activity.assets) { } else {
var time = activity.created_at return `
if (activity.timestamps) { <span class="timeEstimate" data-start="${activity.timestamps.start}">${gameTimeFormatter((Date.now() - activity.timestamps.start))}</span>
time = activity.timestamps.start
}
if (!activity.assets) {
activity.assets = { "large_text": " ", "small_text": " " }
}
function smch() {
if (get_img_url(activity, "small_image")) {
return `<img class="smallimg" src="${get_img(activity, "small_image")}" title="${activity.assets.small_text}">`
}
return ""
}
addedHTML += `
<div class="chip activity grid-child">
<img src="${get_img(activity)}" title="${activity.assets.large_text}">
${smch()}
<p>
Playing ${activity.name}
${onlyIfExists("<br>" + (activity.details || activity.assets.large_text), activity.details || activity.assets.large_text)}
${onlyIfExists("<br>" + (activity.state || activity.assets.small_text), activity.state || activity.assets.small_text)}
<br> ${gameTimeFormatter((Date.now() - time) / 1000)}
</p>
</div>
` `
} else if (activity.type != 4 && activity.assets) { }
} else if (activity.timestamps.end) {
return `
<span class="endEstimate" data-end="${activity.timestamps.end}">${timeFormatter((activity.timestamps.end - Date.now()))}</span> left
`
}
}
}
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
@ -181,14 +140,19 @@ module.exports = {
activity.assets = { "large_text": " ", "small_text": " " } activity.assets = { "large_text": " ", "small_text": " " }
} }
var text1 = onlyIfExists("<br><span style='font-size: 1.3rem;'>" + activity.song + "</span>", activity.song) || activity.details || activity.assets.large_text
var text2 = onlyIfExists("By: " + activity.artist, activity.artist) || activity.state || activity.assets.small_text
var text3 = onlyIfExists("On: " + activity.album, activity.album)
addedHTML += ` addedHTML += `
<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}"> <img src="${get_img(activity)}" title="${activity.assets.large_text || activity.assets.small_text}">
<p> <p style="text-align: left; font-size: 1.15rem;">
<span style="color: rgb(225, 200, 255);">${activity.name}</span> <span style="font-size: 1.6rem;">${activity.name}</span>
<br> ${(activity.details || activity.assets.large_text || " ")} ${onlyIfExists("<br>" + text1, text1)}
<br> ${(activity.state || activity.assets.small_text || " ")} ${onlyIfExists("<br>" + text2, text2)}
<br> ${gameTimeFormatter((Date.now() - time) / 1000)} ${onlyIfExists("<br>" + text3, text3)}
${onlyIfExists("<br>" + activityTime(), activityTime())}
</p> </p>
</div> </div>
` `

308
package-lock.json generated
View file

@ -12,6 +12,7 @@
"@node-minify/core": "^8.0.6", "@node-minify/core": "^8.0.6",
"@node-minify/uglify-js": "^8.0.6", "@node-minify/uglify-js": "^8.0.6",
"express": "^4.18.2", "express": "^4.18.2",
"git-commit-count": "^1.1.3",
"glob": "^10.4.2", "glob": "^10.4.2",
"himalaya": "^1.1.0", "himalaya": "^1.1.0",
"minify-html": "^0.0.2", "minify-html": "^0.0.2",
@ -431,6 +432,84 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/execa": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.6.3.tgz",
"integrity": "sha512-/teX3MDLFBdYUhRk8WCBYboIMUmqeizu0m9Z3YF3JWrbEh/SlZg00vLJSaAGWw3wrZ9tE0buNw79eaAPYhUuvg==",
"license": "MIT",
"dependencies": {
"cross-spawn": "^5.0.1",
"get-stream": "^3.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/execa/node_modules/cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==",
"license": "MIT",
"dependencies": {
"lru-cache": "^4.0.1",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
},
"node_modules/execa/node_modules/lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"license": "ISC",
"dependencies": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"node_modules/execa/node_modules/shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
"license": "MIT",
"dependencies": {
"shebang-regex": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/execa/node_modules/shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/execa/node_modules/signal-exit": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"license": "ISC"
},
"node_modules/execa/node_modules/which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"which": "bin/which"
}
},
"node_modules/express": { "node_modules/express": {
"version": "4.19.2", "version": "4.19.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
@ -553,6 +632,26 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/get-stream": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/git-commit-count": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/git-commit-count/-/git-commit-count-1.1.3.tgz",
"integrity": "sha512-w8BUANhsOvvEYUFmTBLL5vsSIwJ4/gnWouumdH1hljr9dTYoNGF80cyb5Dag22PF+v0yQSCBuQ24iMYs/gzrZQ==",
"license": "MIT",
"dependencies": {
"execa": "^0.6.1",
"is-git-repository": "^1.0.1",
"path-is-absolute": "^1.0.1"
}
},
"node_modules/glob": { "node_modules/glob": {
"version": "10.4.2", "version": "10.4.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz",
@ -700,6 +799,25 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/is-git-repository": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-git-repository/-/is-git-repository-1.1.1.tgz",
"integrity": "sha512-hxLpJytJnIZ5Og5QsxSkzmb8Qx8rGau9bio1JN/QtXcGEFuSsQYau0IiqlsCwftsfVYjF1mOq6uLdmwNSspgpA==",
"license": "MIT",
"dependencies": {
"execa": "^0.6.1",
"path-is-absolute": "^1.0.1"
}
},
"node_modules/is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@ -853,6 +971,27 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/npm-run-path": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
"integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==",
"license": "MIT",
"dependencies": {
"path-key": "^2.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/npm-run-path/node_modules/path-key": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
"integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/object-inspect": { "node_modules/object-inspect": {
"version": "1.13.1", "version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
@ -872,6 +1011,15 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/package-json-from-dist": { "node_modules/package-json-from-dist": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz",
@ -886,6 +1034,15 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/path-key": { "node_modules/path-key": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
@ -928,6 +1085,12 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==",
"license": "ISC"
},
"node_modules/qs": { "node_modules/qs": {
"version": "6.11.0", "version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
@ -1213,6 +1376,15 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/strip-eof": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/toidentifier": { "node_modules/toidentifier": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@ -1433,6 +1605,12 @@
} }
} }
}, },
"node_modules/yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==",
"license": "ISC"
},
"node_modules/youtubei.js": { "node_modules/youtubei.js": {
"version": "9.0.2", "version": "9.0.2",
"resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-9.0.2.tgz", "resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-9.0.2.tgz",
@ -1733,6 +1911,67 @@
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="
}, },
"execa": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.6.3.tgz",
"integrity": "sha512-/teX3MDLFBdYUhRk8WCBYboIMUmqeizu0m9Z3YF3JWrbEh/SlZg00vLJSaAGWw3wrZ9tE0buNw79eaAPYhUuvg==",
"requires": {
"cross-spawn": "^5.0.1",
"get-stream": "^3.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
},
"dependencies": {
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==",
"requires": {
"lru-cache": "^4.0.1",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
},
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
"requires": {
"shebang-regex": "^1.0.0"
}
},
"shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ=="
},
"signal-exit": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"requires": {
"isexe": "^2.0.0"
}
}
}
},
"express": { "express": {
"version": "4.19.2", "version": "4.19.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
@ -1826,6 +2065,21 @@
"hasown": "^2.0.0" "hasown": "^2.0.0"
} }
}, },
"get-stream": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ=="
},
"git-commit-count": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/git-commit-count/-/git-commit-count-1.1.3.tgz",
"integrity": "sha512-w8BUANhsOvvEYUFmTBLL5vsSIwJ4/gnWouumdH1hljr9dTYoNGF80cyb5Dag22PF+v0yQSCBuQ24iMYs/gzrZQ==",
"requires": {
"execa": "^0.6.1",
"is-git-repository": "^1.0.1",
"path-is-absolute": "^1.0.1"
}
},
"glob": { "glob": {
"version": "10.4.2", "version": "10.4.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz",
@ -1921,6 +2175,20 @@
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
}, },
"is-git-repository": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-git-repository/-/is-git-repository-1.1.1.tgz",
"integrity": "sha512-hxLpJytJnIZ5Og5QsxSkzmb8Qx8rGau9bio1JN/QtXcGEFuSsQYau0IiqlsCwftsfVYjF1mOq6uLdmwNSspgpA==",
"requires": {
"execa": "^0.6.1",
"path-is-absolute": "^1.0.1"
}
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ=="
},
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@ -2018,6 +2286,21 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
}, },
"npm-run-path": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
"integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==",
"requires": {
"path-key": "^2.0.0"
},
"dependencies": {
"path-key": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
"integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw=="
}
}
},
"object-inspect": { "object-inspect": {
"version": "1.13.1", "version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
@ -2031,6 +2314,11 @@
"ee-first": "1.1.1" "ee-first": "1.1.1"
} }
}, },
"p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow=="
},
"package-json-from-dist": { "package-json-from-dist": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz",
@ -2041,6 +2329,11 @@
"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-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="
},
"path-key": { "path-key": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
@ -2069,6 +2362,11 @@
"ipaddr.js": "1.9.1" "ipaddr.js": "1.9.1"
} }
}, },
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ=="
},
"qs": { "qs": {
"version": "6.11.0", "version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
@ -2261,6 +2559,11 @@
} }
} }
}, },
"strip-eof": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q=="
},
"toidentifier": { "toidentifier": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@ -2396,6 +2699,11 @@
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"requires": {} "requires": {}
}, },
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A=="
},
"youtubei.js": { "youtubei.js": {
"version": "9.0.2", "version": "9.0.2",
"resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-9.0.2.tgz", "resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-9.0.2.tgz",

View file

@ -20,6 +20,7 @@
"@node-minify/core": "^8.0.6", "@node-minify/core": "^8.0.6",
"@node-minify/uglify-js": "^8.0.6", "@node-minify/uglify-js": "^8.0.6",
"express": "^4.18.2", "express": "^4.18.2",
"git-commit-count": "^1.1.3",
"glob": "^10.4.2", "glob": "^10.4.2",
"himalaya": "^1.1.0", "himalaya": "^1.1.0",
"minify-html": "^0.0.2", "minify-html": "^0.0.2",

View file

@ -7,7 +7,8 @@ const path = require('path'),
randomThemer = require("./randomThemer.js"), randomThemer = require("./randomThemer.js"),
himalaya = require("himalaya"), himalaya = require("himalaya"),
glob = require("glob"), glob = require("glob"),
api = require("./api.js") api = require("./api.js"),
gitCommitCount = require("git-commit-count")
var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json'))) var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json')))
@ -15,8 +16,6 @@ var highlightedWords = constants.highlightedWords
var quotes = constants.quotes var quotes = constants.quotes
var titles = constants.titles var titles = constants.titles
var globalSpins = 0
var commitCount = "600+" var commitCount = "600+"
var uptime = Date.now() var uptime = Date.now()
@ -267,7 +266,7 @@ function converter(html, dynamic = true) {
var realtimeReplacers = { var realtimeReplacers = {
"API_CONNECTED": api.connected.toString(), "API_CONNECTED": api.connected.toString(),
"ACTIVITIES": activityToHTML.activitiesToHTML(api.lanyard), "ACTIVITIES": activityToHTML.activitiesToHTML(api.lanyard),
"SPINCOUNT": globalSpins, "SPINCOUNT": api.spins.toString(),
"UPTIME": timeFormatter((Date.now() - uptime) / 1000), "UPTIME": timeFormatter((Date.now() - uptime) / 1000),
"LAST_LANYARD": timeFormatter((Date.now() - api.lastLanyardUpdate) / 1000), "LAST_LANYARD": timeFormatter((Date.now() - api.lastLanyardUpdate) / 1000),
"RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)], "RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)],
@ -371,10 +370,12 @@ module.exports = {
} }
async function updateCommits() { async function updateCommits() {
var siteResponse = await (await fetch(`https://git.violets-purgatory.dev/bingus_violet/violets-purgatory/src/branch/${process.env.BRANCH || "origin"}`)).text() var commits = gitCommitCount()
var commits = siteResponse.substring(0, siteResponse.indexOf("Commits"))
commits = commits.substring(commits.lastIndexOf("<b>") + 3, commits.lastIndexOf("</b>")) // var siteResponse = await (await fetch(`https://git.violets-purgatory.dev/bingus_violet/violets-purgatory/src/branch/${process.env.BRANCH || "origin"}`)).text()
// var commits = siteResponse.substring(0, siteResponse.indexOf("Commits"))
// commits = commits.substring(commits.lastIndexOf("<b>") + 3, commits.lastIndexOf("</b>"))
// ^ this works for Forgejo (basically everything i use that isnt Github, E.G. Codeberg) // ^ this works for Forgejo (basically everything i use that isnt Github, E.G. Codeberg)
// commits = commits.substring(commits.lastIndexOf(">") + 1) // commits = commits.substring(commits.lastIndexOf(">") + 1)

View file

@ -114,7 +114,7 @@ function purpleMagic() {
} }
function code() { function code() {
return '<link rel="stylesheet" type="text/css" href="/themes/code/style.css"> <script src="/themes/code/script.js"></script>' return '<link rel="stylesheet" type="text/css" href="/themes/code/style.css">' // <script src="/themes/code/script.js"></script>'
} }
var events = [ var events = [

View file

@ -61,7 +61,32 @@ function lerp(a, b, t) {
return a * (1 - t) + b * t return a * (1 - t) + b * t
} }
function spinLoop() { function gameTimeFormatter(seconds) {
seconds = Math.ceil(seconds / 1000)
var minutes = Math.ceil(seconds / 60)
var hours = Math.floor(minutes / 60)
if (seconds <= 60) {
return 'about ' + seconds + ' seconds'
} else if (minutes < 60) {
return `${minutes} Minutes`
}
return `${hours} hours and ${minutes % 60} minutes`
}
function timeFormatter(seconds) {
seconds = Math.ceil(seconds / 1000)
var minutes = Math.floor(seconds / 60)
if (seconds % 60 < 10) {
return `${minutes}:0${seconds % 60}`
} else {
return `${minutes}:${seconds % 60}`
}
}
function loop() {
spinWaiting = true spinWaiting = true
setTimeout(() => { setTimeout(() => {
spinWaiting = false spinWaiting = false
@ -78,7 +103,8 @@ function spinLoop() {
} }
spins += 1/spinSpeed / spinFactor spins += 1/spinSpeed / spinFactor
if (Math.floor(spins) != lastSent && sock && sock.OPEN) { if (Math.floor(spins) != lastSent && sock && sock.OPEN) {
$(".globalSpins").innerHTML = globalSpins + 1 console.log("RAH")
$(".globalSpins").text(globalSpins + 1)
lastSent = Math.floor(spins) lastSent = Math.floor(spins)
// resetPFP() // resetPFP()
sock.send(`{"op": 4}`) sock.send(`{"op": 4}`)
@ -99,7 +125,23 @@ function spinLoop() {
spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3) spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3)
} }
$(".pfp").css("rotate", (spins * 360) + "deg") $(".pfp").css("rotate", (spins * 360) + "deg")
spinLoop()
$(".durationBarFormatter").each((_, item) => {
item = $(item)
item.text(`${timeFormatter((Date.now() - item.attr("data-start")))}/${timeFormatter((item.attr("data-end") - item.attr("data-start")))}`)
})
$(".timeEstimate").each((_, item) => {
item = $(item)
item.text(gameTimeFormatter(Date.now() - item.attr("data-start")))
})
$(".endEstimate").each((_, item) => {
item = $(item)
item.text(timeFormatter((item.attr("data-end") - Date.now())))
})
loop()
}, 1/spinSpeed * 1000); }, 1/spinSpeed * 1000);
} }
@ -112,7 +154,7 @@ window.onload = function () {
pfp = $(".pfp") pfp = $(".pfp")
spinLoop() loop()
pfp.on("mousedown", () => { pfp.on("mousedown", () => {
// if (!spinWaiting) { // if (!spinWaiting) {

View file

@ -182,7 +182,7 @@ br {
margin: 3px 0; margin: 3px 0;
} }
@media screen and (min-width: 850px) { @media screen and (min-width: 1000px) {
.activity-container { .activity-container {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -268,7 +268,8 @@ li {
.lengthBar { .lengthBar {
background-color: rgb(50, 40, 60); background-color: rgb(50, 40, 60);
display: inline-block; display: inline-block;
width: 80%; margin: auto;
width: 65%;
height: 10px; height: 10px;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;