aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCloudburstSys <us@conep.one>2022-05-26 10:20:53 +0100
committerCloudburstSys <us@conep.one>2022-05-26 10:20:53 +0100
commitdfd7f291f1d3c14a883cd412aff55f0f525b6dec (patch)
treedc8c7d395480518d4e89792936319c99d3c42863
parent006aaff302a0e4027f7daff5f5fa732b2dae686e (diff)
downloadvaportrail-dfd7f291f1d3c14a883cd412aff55f0f525b6dec.tar.gz
vaportrail-dfd7f291f1d3c14a883cd412aff55f0f525b6dec.tar.bz2
vaportrail-dfd7f291f1d3c14a883cd412aff55f0f525b6dec.zip
Create base for Plurality page.
---------------------------------- Velvet Cascade - Cloudburst System
-rw-r--r--index.js8
-rw-r--r--public/assets/plurality.js25
-rw-r--r--public/assets/servers.js4
-rw-r--r--refresh/servers.js9
-rw-r--r--views/plurality.ejs28
5 files changed, 69 insertions, 5 deletions
diff --git a/index.js b/index.js
index 7c54827..ce139ea 100644
--- a/index.js
+++ b/index.js
@@ -49,6 +49,10 @@ app.get('/servers', (req, res) => {
res.render("servers");
});
+app.get("/plurality", (req, res) => {
+ res.render("plurality");
+});
+
// API
let serverCache = {};
let pluralCache = {};
@@ -57,6 +61,10 @@ app.get("/api/servers", (req, res) => {
res.json(serverCache);
});
+app.get("/api/plural", (req, res) => {
+ res.json(pluralCache);
+});
+
// Refresh handling
const refresh = require('./refresh/servers');
const pkRefresh = require('./refresh/pluralkit');
diff --git a/public/assets/plurality.js b/public/assets/plurality.js
new file mode 100644
index 0000000..745e149
--- /dev/null
+++ b/public/assets/plurality.js
@@ -0,0 +1,25 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022- Equestria.dev Developers
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
diff --git a/public/assets/servers.js b/public/assets/servers.js
index 566acde..6099eee 100644
--- a/public/assets/servers.js
+++ b/public/assets/servers.js
@@ -62,7 +62,7 @@ function iterateAndSetData(data, previous, element, server) {
if(isObject(data[key])) {
// Call self again but with this object as the input
console.log("iterateAndSetData: Calling self!")
- newPrevious = previous.join("-").split("-");
+ let newPrevious = previous.join("-").split("-");
newPrevious.push(key);
console.log(newPrevious.join("-"));
@@ -115,7 +115,7 @@ function a() {
.then(data => data = data.json())
.then(data => {
console.log(data);
- for(var server in data) {
+ for(let server in data) {
if(data[server] == null) {
document.getElementById(server).getElementsByClassName("category-container")[0].remove();
document.getElementById(server).getElementsByTagName("p")[0].innerHTML = "Server Offline";
diff --git a/refresh/servers.js b/refresh/servers.js
index 8bbdbd5..d46355f 100644
--- a/refresh/servers.js
+++ b/refresh/servers.js
@@ -53,18 +53,21 @@ function createReadableUptime(timestamp) {
let daysString = " Day";
if(days == 0) daysString = "";
if(days > 1) daysString = daysString + "s";
- if(days != 0 && hours != 0) daysString = days + daysString + ", ";
+ if(days != 0) daysString = days + daysString + ", ";
let hoursString = " Hour";
if(hours == 0) hoursString = "";
if(hours > 1) hoursString = hoursString + "s";
- if(hours != 0) hoursString = hours + hoursString + ", and ";
+ if(hours != 0) hoursString = hours + hoursString + ", ";
+
+ let andString = "";
+ if((hours != 0) || (days != 0)) andString = "and ";
let minutesString = " Minute";
if(minutes == 0) minutesString = "";
if(minutes > 1) minutesString = minutes + minutesString + "s";
- return daysString + hoursString + minutesString;
+ return daysString + hoursString + andString + minutesString;
}
module.exports = () => {
diff --git a/views/plurality.ejs b/views/plurality.ejs
new file mode 100644
index 0000000..02f2af0
--- /dev/null
+++ b/views/plurality.ejs
@@ -0,0 +1,28 @@
+<!--
+ ~ MIT License
+ ~
+ ~ Copyright (c) 2022- Equestria.dev Developers
+ ~
+ ~ Permission is hereby granted, free of charge, to any person obtaining a copy
+ ~ of this software and associated documentation files (the "Software"), to deal
+ ~ in the Software without restriction, including without limitation the rights
+ ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ ~ copies of the Software, and to permit persons to whom the Software is
+ ~ furnished to do so, subject to the following conditions:
+ ~
+ ~ The above copyright notice and this permission notice shall be included in all
+ ~ copies or substantial portions of the Software.
+ ~
+ ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ ~ SOFTWARE.
+ ~
+ -->
+<%- include("./partials/header.ejs", {title: "Home"}) %>
+
+<script src="/assets/plurality.js"></script>
+<%- include("./partials/footer.ejs") %> \ No newline at end of file