From 312089c58dd03eb9a55368e6623ec755c4e8cc5e Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Mon, 20 May 2024 10:45:24 -0500 Subject: [PATCH] Announcements are properly implemented (yay) --- index.js | 5 +++++ pageUpdater.js | 3 ++- static/index.html | 4 ++++ static/main.js | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 045b9df..25eb585 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ const assetPath = path.join(__dirname, "assets") const configPath = path.join(__dirname, 'config') const configFile = path.join(configPath, "config.json") +const announcementFile = path.join(configPath, "announcement.html") if (!fs.existsSync(configPath)) { fs.mkdirSync(configPath) @@ -23,6 +24,10 @@ if (!fs.existsSync(configFile)) { fs.writeFileSync(configFile, fs.readFileSync(path.join(assetPath, "defaults/config.json"))) } +if (!fs.existsSync(announcementFile)) { + fs.writeFileSync(announcementFile, ``) +} + var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json'))) app.listen(PORT, () => { diff --git a/pageUpdater.js b/pageUpdater.js index b44ea5c..b319cdf 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -111,7 +111,8 @@ function converter(html, query) { "UPTIME": timeFormatter((Date.now() - uptime) / 1000), "RELOAD_COUNT": reloads, "WEATHER_MODIFIER": "", - "WEATHER_TEXT": "" + "WEATHER_TEXT": "", + "ANNOUNCEMENT": fs.readFileSync(path.join(__dirname, "config/announcement.html")) } replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} " diff --git a/static/index.html b/static/index.html index d858c8c..550c5e9 100644 --- a/static/index.html +++ b/static/index.html @@ -68,6 +68,8 @@
{ACTIVITIES}
+ + {ANNOUNCEMENT}


Services

List of services for public use hosted on Violet's Purgatory.

@@ -82,6 +84,8 @@


FAQ

{PATH_FAQ} + + {SELECTED_VIDEO} {PATH_STATS} diff --git a/static/main.js b/static/main.js index 8070e05..a5c162a 100644 --- a/static/main.js +++ b/static/main.js @@ -116,7 +116,7 @@ function socketeer() { } else if (data.op == 0) { var discFetch = await (await fetch("/discHTML")).text() document.querySelector("#activityHtml").innerHTML = discFetch - }else if (data.op == 3) { + } else if (data.op == 3) { lastPong = Date.now() } else { console.log(data)