Commit count!

This commit is contained in:
Bingus_Violet 2024-02-04 15:03:54 -06:00
parent c863ea1363
commit c10ee88e74
3 changed files with 20 additions and 6 deletions

View file

@ -45,6 +45,8 @@ if (!fs.existsSync(path.join(staticpath, 'cached'))) {
var randomQuotes = config.quotes var randomQuotes = config.quotes
var commitCount = "300+"
function get_img_url(activity, size = "large_image") { function get_img_url(activity, size = "large_image") {
if ("assets" in activity) { 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 var currentPercent = (Date.now() - activity.timestamps.start) / (activity.timestamps.end - activity.timestamps.start) * 100
addedHTML += ` addedHTML += `
<div class="chip activity col-md-6 testing"> <div class="chip activity col-md-6 testing">
<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 || activity.state || ""}">
<p> <p>
Listening to <span style="color: limegreen;">${activity.name}</span> Listening to <span style="color: limegreen;">${activity.name}</span>
<br> Song: ${activity.details || " "} <br> Song: ${activity.details || " "}
@ -364,6 +366,8 @@ async function pageUpdate() {
html = html.replace("{OPPOSITE_BRANCH}", "Beta") html = html.replace("{OPPOSITE_BRANCH}", "Beta")
} }
html = html.replace("{COMMIT_COUNT}", commitCount)
html = html.replace("{UPTIME}", gameTimeFormatter((Date.now() - uptime) / 1000)) html = html.replace("{UPTIME}", gameTimeFormatter((Date.now() - uptime) / 1000))
html = html.replace("{LAST_LANYARD}", gameTimeFormatter((Date.now() - lastLanyardUpdate) / 1000) + ' ago') html = html.replace("{LAST_LANYARD}", gameTimeFormatter((Date.now() - lastLanyardUpdate) / 1000) + ' ago')
html = html.replace("{QUOTE_COUNT}", randomQuotes.length) html = html.replace("{QUOTE_COUNT}", randomQuotes.length)
@ -450,3 +454,12 @@ app.use((req, res, next) => {
<p>Uh oh... I think your lost? There's nothing here :P</p> <p>Uh oh... I think your lost? There's nothing here :P</p>
`) `)
}) })
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("<b>") + 3, commits.lastIndexOf("</b>"))
commitCount = commits
}
updateCommits()

View file

@ -22,6 +22,7 @@
<body> <body>
<h1>Welcome to Violet's Purgatory</h1> <h1>Welcome to Violet's Purgatory</h1>
<p style="white-space: pre-wrap;">{RANDOM_QUOTE}</p> <p style="white-space: pre-wrap;">{RANDOM_QUOTE}</p>
<p style="">{COMMIT_COUNT} Commits</p>
<div class="fadediv"> <div class="fadediv">
<div class="container-fluid row" id="card"> <div class="container-fluid row" id="card">
<h2>Violet</h2> <h2>Violet</h2>

View file

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