diff --git a/constants.json b/constants.json index 6a75428..9cc3409 100644 --- a/constants.json +++ b/constants.json @@ -73,7 +73,7 @@ "name": "bingus_violet@floofy.city", "url": "https://floofy.city/@bingus_violet" }, - "YouTube": { + "Youtube": { "name": "Violet's Fiasco", "url": "https://www.youtube.com/channel/UChcrBJNJLZucy3TPyGyAY2g" }, @@ -177,9 +177,8 @@ "enby": { "color": "rgb(252, 244, 52)" }, - "YouTube": { - "color": "rgb(255, 0, 0)", - "caseInsensitive": true + "Youtube": { + "color": "rgb(255, 0, 0)" }, "Fedi": { "color": "rgb(175, 125, 200)" diff --git a/overcomplicatedStatuses.js b/overcomplicatedStatuses.js index 44045aa..a429db7 100644 --- a/overcomplicatedStatuses.js +++ b/overcomplicatedStatuses.js @@ -1,5 +1,5 @@ const path = require("path"), - fs = require("fs") +fs = require("fs") var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json'))) @@ -33,7 +33,7 @@ function makeCompat(string) { } function timeFormatter(seconds) { - seconds = Math.ceil(seconds / 1000) + seconds = Math.ceil(seconds) var minutes = Math.floor(seconds / 60) if (seconds % 60 < 10) { @@ -44,7 +44,7 @@ function timeFormatter(seconds) { } function gameTimeFormatter(seconds) { - seconds = Math.ceil(seconds / 1000) + seconds = Math.ceil(seconds) var minutes = Math.ceil(seconds / 60) var hours = Math.floor(minutes / 60) if (seconds <= 60) { @@ -87,51 +87,63 @@ module.exports = { continue } + function get_img(activity, size = "large_image") { return "https://cache.violets-purgatory.dev/cached/" + get_img_url(activity, size) } - function activityTime() { - if (activity.timestamps) { - if (activity.timestamps.start) { - if (activity.timestamps.end) { - var timeLeft = Math.round((activity.timestamps.end - Date.now()) / 1000) - var currentPercent = (Date.now() - activity.timestamps.start) / (activity.timestamps.end - activity.timestamps.start) * 100 - return ` -
- ${timeFormatter((Date.now() - activity.timestamps.start))}/${timeFormatter((activity.timestamps.end - activity.timestamps.start))} - - ` - } else { - return ` - ${gameTimeFormatter((Date.now() - activity.timestamps.start))} - ` - } - } else if (activity.timestamps.end) { - return ` - ${timeFormatter((activity.timestamps.end - Date.now()))} left - ` + if (activity.assets && activity.assets.large_text != activity.details && activity.details.length + activity.state.length + activity.assets.large_text.length < 100) { + html += ` +
Album: ${makeCompat(activity.assets.large_text || " ")} +
Artist: ${makeCompat(activity.state || " ")} + ` + } else { + html += "
" + 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 currentPercent = (Date.now() - activity.timestamps.start) / (activity.timestamps.end - activity.timestamps.start) * 100 + addedHTML += ` +
+ +

+ Listening to ${activity.name} +
Song: ${makeCompat(activity.details || " ")} + ${songStats()} +
+ + ${timeFormatter((activity.timestamps.end - activity.timestamps.start) / 1000)} +

+
+ + ` + } else if (activity.type == 0 && activity.assets) { var time = activity.created_at if (activity.timestamps) { time = activity.timestamps.start @@ -140,19 +152,43 @@ module.exports = { activity.assets = { "large_text": " ", "small_text": " " } } - var text1 = onlyIfExists("
" + activity.song + "", 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) + function smch() { + if (get_img_url(activity, "small_image")) { + return `` + } + return "" + } + + + addedHTML += ` +
+ + ${smch()} +

+ Playing ${activity.name} + ${onlyIfExists("
" + (activity.details || activity.assets.large_text), activity.details || activity.assets.large_text)} + ${onlyIfExists("
" + (activity.state || activity.assets.small_text), activity.state || activity.assets.small_text)} +
${gameTimeFormatter((Date.now() - time) / 1000)} +

+
+ ` + } else if (activity.type != 4 && activity.assets) { + var time = activity.created_at + if (activity.timestamps) { + time = activity.timestamps.start + } + if (!activity.assets) { + activity.assets = { "large_text": " ", "small_text": " " } + } addedHTML += `
-

- ${activity.name} - ${onlyIfExists("
" + text1, text1)} - ${onlyIfExists("
" + text2, text2)} - ${onlyIfExists("
" + text3, text3)} - ${onlyIfExists("
" + activityTime(), activityTime())} +

+ ${activity.name} +
${(activity.details || activity.assets.large_text || " ")} +
${(activity.state || activity.assets.small_text || " ")} +
${gameTimeFormatter((Date.now() - time) / 1000)}

` diff --git a/package-lock.json b/package-lock.json index 86c401b..9522d31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "@node-minify/core": "^8.0.6", "@node-minify/uglify-js": "^8.0.6", "express": "^4.18.2", - "git-commit-count": "^1.1.3", "glob": "^10.4.2", "himalaya": "^1.1.0", "minify-html": "^0.0.2", @@ -432,84 +431,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": { "version": "4.19.2", "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", @@ -632,26 +553,6 @@ "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": { "version": "10.4.2", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", @@ -799,25 +700,6 @@ "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": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -971,27 +853,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": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", @@ -1011,15 +872,6 @@ "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": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", @@ -1034,15 +886,6 @@ "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": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -1085,12 +928,6 @@ "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": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -1376,15 +1213,6 @@ "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": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -1605,12 +1433,6 @@ } } }, - "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": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-9.0.2.tgz", @@ -1911,67 +1733,6 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "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": { "version": "4.19.2", "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", @@ -2065,21 +1826,6 @@ "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": { "version": "10.4.2", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", @@ -2175,20 +1921,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "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": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2286,21 +2018,6 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "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": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", @@ -2314,11 +2031,6 @@ "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": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", @@ -2329,11 +2041,6 @@ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "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": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -2362,11 +2069,6 @@ "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": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -2559,11 +2261,6 @@ } } }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==" - }, "toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -2699,11 +2396,6 @@ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "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": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/youtubei.js/-/youtubei.js-9.0.2.tgz", diff --git a/package.json b/package.json index 023cbff..887168d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "@node-minify/core": "^8.0.6", "@node-minify/uglify-js": "^8.0.6", "express": "^4.18.2", - "git-commit-count": "^1.1.3", "glob": "^10.4.2", "himalaya": "^1.1.0", "minify-html": "^0.0.2", diff --git a/pageUpdater.js b/pageUpdater.js index d0b2505..1e6a7a6 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -7,8 +7,7 @@ const path = require('path'), randomThemer = require("./randomThemer.js"), himalaya = require("himalaya"), glob = require("glob"), - api = require("./api.js"), - gitCommitCount = require("git-commit-count") + api = require("./api.js") var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json'))) @@ -16,6 +15,8 @@ var highlightedWords = constants.highlightedWords var quotes = constants.quotes var titles = constants.titles +var globalSpins = 0 + var commitCount = "600+" var uptime = Date.now() @@ -266,7 +267,7 @@ function converter(html, dynamic = true) { var realtimeReplacers = { "API_CONNECTED": api.connected.toString(), "ACTIVITIES": activityToHTML.activitiesToHTML(api.lanyard), - "SPINCOUNT": api.spins.toString(), + "SPINCOUNT": globalSpins, "UPTIME": timeFormatter((Date.now() - uptime) / 1000), "LAST_LANYARD": timeFormatter((Date.now() - api.lastLanyardUpdate) / 1000), "RANDOM_TITLE": titles[Math.floor(Math.random() * titles.length)], @@ -370,12 +371,10 @@ module.exports = { } async function updateCommits() { - var commits = gitCommitCount() + 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")) - // 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("") + 3, commits.lastIndexOf("")) + commits = commits.substring(commits.lastIndexOf("") + 3, commits.lastIndexOf("")) // ^ this works for Forgejo (basically everything i use that isnt Github, E.G. Codeberg) // commits = commits.substring(commits.lastIndexOf(">") + 1) diff --git a/randomThemer.js b/randomThemer.js index d81a231..d701aac 100644 --- a/randomThemer.js +++ b/randomThemer.js @@ -114,7 +114,7 @@ function purpleMagic() { } function code() { - return '' // ' + return ' ' } var events = [ diff --git a/static/main.js b/static/main.js index 1b48300..9b1708f 100644 --- a/static/main.js +++ b/static/main.js @@ -61,32 +61,7 @@ function lerp(a, b, t) { return a * (1 - t) + b * t } -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() { +function spinLoop() { spinWaiting = true setTimeout(() => { spinWaiting = false @@ -103,8 +78,7 @@ function loop() { } spins += 1/spinSpeed / spinFactor if (Math.floor(spins) != lastSent && sock && sock.OPEN) { - console.log("RAH") - $(".globalSpins").text(globalSpins + 1) + $(".globalSpins").innerHTML = globalSpins + 1 lastSent = Math.floor(spins) // resetPFP() sock.send(`{"op": 4}`) @@ -125,23 +99,7 @@ function loop() { spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3) } $(".pfp").css("rotate", (spins * 360) + "deg") - - $(".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() + spinLoop() }, 1/spinSpeed * 1000); } @@ -154,7 +112,7 @@ window.onload = function () { pfp = $(".pfp") - loop() + spinLoop() pfp.on("mousedown", () => { // if (!spinWaiting) { diff --git a/static/style.css b/static/style.css index e13d160..ef86bed 100644 --- a/static/style.css +++ b/static/style.css @@ -182,7 +182,7 @@ br { margin: 3px 0; } -@media screen and (min-width: 1000px) { +@media screen and (min-width: 850px) { .activity-container { display: flex; flex-wrap: wrap; @@ -268,8 +268,7 @@ li { .lengthBar { background-color: rgb(50, 40, 60); display: inline-block; - margin: auto; - width: 65%; + width: 80%; height: 10px; padding: 0; overflow: hidden;