From 9efde976908fc2569a1ae1a021a4b4f26636ae98 Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Sat, 27 Jan 2024 12:11:36 -0600 Subject: [PATCH] Stats --- index.js | 10 +++++++++- resources/mainPage.html | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 632ad86..517e05f 100644 --- a/index.js +++ b/index.js @@ -21,6 +21,9 @@ var activityImages = config.activityImages var highlight = config.highlightedWords +var uptime = Date.now() +var lastLanyardUpdate = Date.now() + var thumbCount = 0 function getThumbor() { @@ -151,7 +154,7 @@ function pageUpdate() { } if (!debounce && activity.type != 4) { - addedHTML += `


What I'm up to:

` + addedHTML += `


What I'm up to:

` debounce = true } function get_img() { @@ -341,6 +344,10 @@ function pageUpdate() { html = html.replace("{OPPOSITE_BRANCH}", "Beta") } + html = html.replace("{UPTIME}", gameTimeFormatter((Date.now() - uptime) / 1000) + ' ago') + html = html.replace("{LAST_LANYARD}", gameTimeFormatter((Date.now() - lastLanyardUpdate) / 1000) + ' ago') + html = html.replace("{QUOTE_COUNT}", randomQuotes.length) + //fs.writeFileSync(path.join(__dirname, 'static/index.html'), html) return html } @@ -370,6 +377,7 @@ lanyard.addEventListener("message", (res) => { })) } else if (data.op == 0) { lanyardData = data.d + lastLanyardUpdate = Date.now() } }) diff --git a/resources/mainPage.html b/resources/mainPage.html index 3abe897..782f12c 100644 --- a/resources/mainPage.html +++ b/resources/mainPage.html @@ -59,8 +59,16 @@ server-side, so enjoy :D

Check out the source code on Codeberg

- {LANYARD_FULL} + +


Stats:

+

Just some funny stats for the site :3

+
    +
  • Uptime: {UPTIME}
  • +
  • Last Lanyard Update: {LAST_LANYARD}
  • +
  • Quotes: {QUOTE_COUNT}
  • +
+ {SOCIALS} {SEASONAL_EFFECT}