Announcements are properly implemented (yay)
This commit is contained in:
parent
8e703ecd3f
commit
312089c58d
4 changed files with 12 additions and 2 deletions
5
index.js
5
index.js
|
@ -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, () => {
|
||||||
|
|
|
@ -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("}{") + "} "
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
<div id="activityHtml">
|
<div id="activityHtml">
|
||||||
{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>
|
||||||
|
@ -82,6 +84,8 @@
|
||||||
<br>
|
<br>
|
||||||
<h1><hr>FAQ</h1>
|
<h1><hr>FAQ</h1>
|
||||||
{PATH_FAQ}
|
{PATH_FAQ}
|
||||||
|
|
||||||
|
{SELECTED_VIDEO}
|
||||||
|
|
||||||
{PATH_STATS}
|
{PATH_STATS}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ function socketeer() {
|
||||||
} else if (data.op == 0) {
|
} else if (data.op == 0) {
|
||||||
var discFetch = await (await fetch("/discHTML")).text()
|
var discFetch = await (await fetch("/discHTML")).text()
|
||||||
document.querySelector("#activityHtml").innerHTML = discFetch
|
document.querySelector("#activityHtml").innerHTML = discFetch
|
||||||
}else if (data.op == 3) {
|
} else if (data.op == 3) {
|
||||||
lastPong = Date.now()
|
lastPong = Date.now()
|
||||||
} else {
|
} else {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
|
Loading…
Reference in a new issue