From c10ee88e749e3addb023b9ac88cc5e57f3b9619d Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Sun, 4 Feb 2024 15:03:54 -0600 Subject: [PATCH] Commit count! --- index.js | 17 +++++++++++++++-- resources/mainPage.html | 1 + static/style.css | 8 ++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 4da34d3..340bf89 100644 --- a/index.js +++ b/index.js @@ -45,6 +45,8 @@ if (!fs.existsSync(path.join(staticpath, 'cached'))) { var randomQuotes = config.quotes +var commitCount = "300+" + function get_img_url(activity, size = "large_image") { if ("assets" in activity) { @@ -225,7 +227,7 @@ async function pageUpdate() { var currentPercent = (Date.now() - activity.timestamps.start) / (activity.timestamps.end - activity.timestamps.start) * 100 addedHTML += `
- +

Listening to ${activity.name}
Song: ${activity.details || " "} @@ -364,6 +366,8 @@ async function pageUpdate() { html = html.replace("{OPPOSITE_BRANCH}", "Beta") } + html = html.replace("{COMMIT_COUNT}", commitCount) + html = html.replace("{UPTIME}", gameTimeFormatter((Date.now() - uptime) / 1000)) html = html.replace("{LAST_LANYARD}", gameTimeFormatter((Date.now() - lastLanyardUpdate) / 1000) + ' ago') html = html.replace("{QUOTE_COUNT}", randomQuotes.length) @@ -449,4 +453,13 @@ app.use((req, res, next) => {

404

Uh oh... I think your lost? There's nothing here :P

`) -}) \ No newline at end of file +}) + +async function updateCommits() { + var codebergResponse = await (await fetch(`https://codeberg.org/Bingus_Violet/Violets-Purgatory/src/branch/${process.env.BRANCH || "origin"}`)).text() + var commits = codebergResponse.substring(0, codebergResponse.indexOf("Commits")) + commits = commits.substring(commits.lastIndexOf("") + 3, commits.lastIndexOf("")) + commitCount = commits +} + +updateCommits() \ No newline at end of file diff --git a/resources/mainPage.html b/resources/mainPage.html index ec1873e..811877c 100644 --- a/resources/mainPage.html +++ b/resources/mainPage.html @@ -22,6 +22,7 @@

Welcome to Violet's Purgatory

{RANDOM_QUOTE}

+

{COMMIT_COUNT} Commits

Violet

diff --git a/static/style.css b/static/style.css index 9146003..dd5a9e4 100644 --- a/static/style.css +++ b/static/style.css @@ -93,7 +93,7 @@ a { } .chip:hover { - background-color: rgb(65, 28, 101); + background-color: rgb(10, 0, 25); transform: scale(1); /* font-size: 1.35rem; */ border-color: white; @@ -101,7 +101,7 @@ a { } .chip:hover > .smallimg { - background-color: rgb(65, 28, 101); + background-color: rgb(10, 0, 25); } .activity { @@ -131,12 +131,12 @@ a { height: 64px; position: absolute; bottom: 0px; - left: 74px; + left: 72px; border-radius: 50px; background: black; padding: 5px; /* border: 2px gray solid; */ - transform: scale(0.8); + transform: scale(0.9); } .activity>.smallimg:hover {