Announcements are properly implemented (yay)

This commit is contained in:
bingus_violet 2024-05-20 10:45:24 -05:00
parent 8e703ecd3f
commit 312089c58d
4 changed files with 12 additions and 2 deletions

View file

@ -14,6 +14,7 @@ const assetPath = path.join(__dirname, "assets")
const configPath = path.join(__dirname, 'config') const configPath = path.join(__dirname, 'config')
const configFile = path.join(configPath, "config.json") const configFile = path.join(configPath, "config.json")
const announcementFile = path.join(configPath, "announcement.html")
if (!fs.existsSync(configPath)) { if (!fs.existsSync(configPath)) {
fs.mkdirSync(configPath) fs.mkdirSync(configPath)
@ -23,6 +24,10 @@ if (!fs.existsSync(configFile)) {
fs.writeFileSync(configFile, fs.readFileSync(path.join(assetPath, "defaults/config.json"))) 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'))) var constants = JSON.parse(fs.readFileSync(path.join(__dirname, 'constants.json')))
app.listen(PORT, () => { app.listen(PORT, () => {

View file

@ -111,7 +111,8 @@ function converter(html, query) {
"UPTIME": timeFormatter((Date.now() - uptime) / 1000), "UPTIME": timeFormatter((Date.now() - uptime) / 1000),
"RELOAD_COUNT": reloads, "RELOAD_COUNT": reloads,
"WEATHER_MODIFIER": "", "WEATHER_MODIFIER": "",
"WEATHER_TEXT": "" "WEATHER_TEXT": "",
"ANNOUNCEMENT": fs.readFileSync(path.join(__dirname, "config/announcement.html"))
} }
replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} " replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} "

View file

@ -69,6 +69,8 @@
{ACTIVITIES} {ACTIVITIES}
</div> </div>
{ANNOUNCEMENT}
<h2><hr>Services</h2> <h2><hr>Services</h2>
<p>List of services for public use hosted on Violet's Purgatory.</p> <p>List of services for public use hosted on Violet's Purgatory.</p>
<a href="https://sxng.violets-purgatory.dev" class="chip">SearXNG: sxng.violets-purgatory.dev</a> <a href="https://sxng.violets-purgatory.dev" class="chip">SearXNG: sxng.violets-purgatory.dev</a>
@ -83,6 +85,8 @@
<h1><hr>FAQ</h1> <h1><hr>FAQ</h1>
{PATH_FAQ} {PATH_FAQ}
{SELECTED_VIDEO}
{PATH_STATS} {PATH_STATS}
<p>{WEATHER_TEXT}</p> <p>{WEATHER_TEXT}</p>