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) => {
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 @@{RANDOM_QUOTE}
+{COMMIT_COUNT} Commits