aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-07-22 00:08:17 +0200
committerMinteck <contact@minteck.org>2022-07-22 00:08:17 +0200
commit0b2213ab8dbc211a6e1982f7572646735df17689 (patch)
tree610eb10a8ea4199cbb66b81b03655a4153435838
parent6c05c2dfe3f929e62e8d3eea7823d972e55f4f39 (diff)
downloadvaportrail-0b2213ab8dbc211a6e1982f7572646735df17689.tar.gz
vaportrail-0b2213ab8dbc211a6e1982f7572646735df17689.tar.bz2
vaportrail-0b2213ab8dbc211a6e1982f7572646735df17689.zip
Small changes
-rw-r--r--.DS_Storebin6148 -> 6148 bytes
-rw-r--r--index.js4
-rw-r--r--public/assets/custom.css4
-rw-r--r--public/assets/plurality.css81
-rw-r--r--public/assets/servers.js132
-rw-r--r--refresh/servers.js2
-rw-r--r--views/about.ejs5
-rw-r--r--views/partials/header.ejs1
-rw-r--r--views/plurality.ejs51
-rw-r--r--views/projects.ejs13
-rw-r--r--views/servers.ejs10
11 files changed, 155 insertions, 148 deletions
diff --git a/.DS_Store b/.DS_Store
index 13b98e0..435ea7c 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/index.js b/index.js
index ef033bc..73a35c3 100644
--- a/index.js
+++ b/index.js
@@ -31,7 +31,7 @@ const fs = require('fs');
const app = express();
// Get version and build numbers
-const version = (fs.existsSync("./.git/refs/heads/mane") ? fs.readFileSync("./.git/refs/heads/mane").toString().trim().substring(0, 8) : (fs.existsSync("../.git/refs/heads/mane") ? fs.readFileSync("../.git/refs/heads/mane").toString().trim().substring(0, 8) : (fs.existsSync("./version.txt") ? fs.readFileSync("./version.txt").toString().trim() : (fs.existsSync("../version.txt") ? fs.readFileSync("../version.txt").toString().trim() : "live"))));
+const version = (fs.existsSync("./.git/refs/heads/mane") ? fs.readFileSync("./.git/refs/heads/mane").toString().trim().substring(0, 8) : (fs.existsSync("../.git/refs/heads/mane") ? fs.readFileSync("../.git/refs/heads/mane").toString().trim().substring(0, 8) : (fs.existsSync("./version.txt") ? fs.readFileSync("./version.txt").toString().trim() : (fs.existsSync("../version.txt") ? fs.readFileSync("../version.txt").toString().trim().substring(0, 8) : "live"))));
const build = (fs.existsSync("./build.txt") ? fs.readFileSync("./build.txt").toString().trim() : (fs.existsSync("../build.txt") ? fs.readFileSync("../build.txt").toString().trim() : "dev"));
// Restart manager
@@ -54,7 +54,7 @@ app.get('/servers', (req, res) => {
});
app.get("/plurality", (req, res) => {
- res.render("plurality", { version, build });
+ res.render("plurality", { pluralCache, version, build });
});
app.get("/about", (req, res) => {
diff --git a/public/assets/custom.css b/public/assets/custom.css
index fac1ef7..487bd25 100644
--- a/public/assets/custom.css
+++ b/public/assets/custom.css
@@ -107,13 +107,11 @@ html, body {
margin-top: 56px;
}
-.server {
+.server, .plural-member {
border-style: solid;
border-color: #303030;
border-radius: 10px;
-
background-color: #333333;
-
padding: 5px;
margin: 5px;
}
diff --git a/public/assets/plurality.css b/public/assets/plurality.css
new file mode 100644
index 0000000..3f522eb
--- /dev/null
+++ b/public/assets/plurality.css
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ *
+ */
+
+#systems {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ grid-gap: 20px;
+}
+
+.system-name {
+ text-align: center;
+}
+
+.system-icon {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+ height: 96px;
+}
+
+.plural-member {
+ display: block;
+ color: white !important;
+ text-decoration: none;
+ cursor: pointer;
+}
+
+.plural-member-picture {
+ width: 32px;
+ height: 32px;
+ vertical-align: middle;
+ border-radius: 999px;
+ background: #444;
+}
+
+.plural-member-name {
+ vertical-align: middle;
+ margin-left: 5px;
+}
+
+.plural-member-prefix {
+ float: right;
+ margin-top: 5px;
+ font-family: monospace;
+}
+
+.plural-member:hover {
+ opacity: .75;
+}
+
+.plural-member:active, .plural-member:focus {
+ opacity: .5;
+}
+
+.system-description {
+ text-align: center;
+ margin-top: 5px;
+ margin-bottom: 20px;
+} \ No newline at end of file
diff --git a/public/assets/servers.js b/public/assets/servers.js
deleted file mode 100644
index 6099eee..0000000
--- a/public/assets/servers.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- *
- */
-const SERVER_API = "/api/servers";
-
-const idsToReadable = {
- "data-cpu": "CPU",
- "data-cpu-processors": "Processor Count",
- "data-cpu-model": "Model",
- "data-cpu-cores": "Core Count",
- "data-cpu-speed": "Clock Speed",
- "data-cpu-temperature": "Temperature",
- "data-cpu-load": "Usage",
- "data-processes": "Processes",
- "data-processes-total": "Total",
- "data-processes-running": "Running",
- "data-processes-sleeping": "Sleeping",
- "data-processes-blocked": "Blocked",
- "data-processes-unknown": "Unknown",
- "data-swapmemory": "Swap RAM",
- "data-swapmemory-used": "Used",
- "data-swapmemory-free": "Free",
- "data-swapmemory-total": "Total",
- "data-physicalmemory": "Physical RAM",
- "data-physicalmemory-used": "Used",
- "data-physicalmemory-free": "Free",
- "data-physicalmemory-total": "Total",
- "data-os": "OS",
- "data-os-name": "Name",
- "data-os-version": "Version"
-}
-
-function isObject(obj) {
- return obj === Object(obj);
-}
-
-function iterateAndSetData(data, previous, element, server) {
- for(var key in data) {
- console.log(key);
- console.log("iterateAndSetData: "+previous.join("-"));
- if(isObject(data[key])) {
- // Call self again but with this object as the input
- console.log("iterateAndSetData: Calling self!")
- let newPrevious = previous.join("-").split("-");
- newPrevious.push(key);
-
- console.log(newPrevious.join("-"));
-
- let category = document.createElement("div");
- category.classList.add("category");
- category.classList.add(key);
-
- let title = document.createElement("h4");
- title.classList.add("name");
- title.innerHTML = idsToReadable[newPrevious.join("-")];
-
- category.appendChild(title);
- server.appendChild(category);
-
- iterateAndSetData(data[key], newPrevious, category, server);
- } else {
- // We're at a value, we can set stuff
- if(key == "online") continue;
-
- console.log("interateAndSetData: Setting data!");
-
- console.log(previous.join("-")+"-"+key);
- let value = data[key];
- if(value == null || value == undefined) value = "No Data";
-
- let item = document.createElement("div");
- item.classList.add("item");
-
- let title = document.createElement("p");
- title.innerHTML = idsToReadable[previous.join("-")+"-"+key];
-
- let content = document.createElement("span");
- content.innerHTML = value;
-
- item.appendChild(title);
- item.appendChild(content);
-
- element.appendChild(item);
-
- //document.getElementById(server).getElementsByClassName(previous.join("-")+"-"+key)[0].innerHTML = value;
- }
- }
-}
-
-// apparently document.onload is never called???
-function a() {
- console.log("a");
- fetch(SERVER_API)
- .then(data => data = data.json())
- .then(data => {
- console.log(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";
- document.getElementById(server).getElementsByTagName("p")[0].style = "color:#ff4444;";
- continue;
- }
- document.getElementById(server).getElementsByClassName("data-uptime")[0].innerHTML = data[server].uptime;
- delete data[server].uptime;
- iterateAndSetData(data[server], ["data"], null, document.getElementById(server).getElementsByClassName("category-container")[0]);
- }
- });
-}
-
-a(); \ No newline at end of file
diff --git a/refresh/servers.js b/refresh/servers.js
index 39c8af4..97bdfe8 100644
--- a/refresh/servers.js
+++ b/refresh/servers.js
@@ -75,11 +75,9 @@ module.exports = () => {
return new Promise(async (res) => {
let servers = {
canterlot: [await resolveDNSAsync("canterlot.equestria.dev"), 52937],
- ponyville: [await resolveDNSAsync("ponyville-ipv4.equestria.dev"), 52937],
bridlewood: [await resolveDNSAsync("bridlewood.equestria.dev"), 52937],
zephyrheights: [await resolveDNSAsync("zephyrheights-ipv4.equestria.dev"), 52938],
maretimebay: [await resolveDNSAsync("maretimebay-ipv4.equestria.dev"), 52937],
- everfree: [await resolveDNSAsync("everfree.equestria.dev"), 52939]
}
let stats = {}
diff --git a/views/about.ejs b/views/about.ejs
index bb01120..1dfb4b0 100644
--- a/views/about.ejs
+++ b/views/about.ejs
@@ -23,4 +23,9 @@
~
-->
<%- include("./partials/header.ejs", {title: "About Us"}) %>
+
+<div id="navbar-skipper">
+ Content here!
+</div>
+
<%- include("./partials/footer.ejs") %> \ No newline at end of file
diff --git a/views/partials/header.ejs b/views/partials/header.ejs
index f26fb32..431be60 100644
--- a/views/partials/header.ejs
+++ b/views/partials/header.ejs
@@ -31,6 +31,7 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/bootstrap/styles.css">
<link rel="stylesheet" href="/assets/custom.css">
+ <link rel="stylesheet" href="/assets/plurality.css">
<script src="/bootstrap/script.js"></script>
<title><%= title %> - The Cuties</title>
</head>
diff --git a/views/plurality.ejs b/views/plurality.ejs
index db8e17a..412906e 100644
--- a/views/plurality.ejs
+++ b/views/plurality.ejs
@@ -23,4 +23,55 @@
~
-->
<%- include("./partials/header.ejs", {title: "Plurality"}) %>
+<%
+
+// noinspection JSUnresolvedVariable
+let cloudburst = pluralCache["ynmuc"];
+
+// noinspection JSUnresolvedVariable
+let raindrops = pluralCache["gdapd"];
+
+let frontersCloudburst = cloudburst['fronters']['members'].map((i) => { return i['id']; });
+let frontersRaindrops = raindrops['fronters']['members'].map((i) => { return i['id']; });
+
+%>
+
+<div id="navbar-skipper">
+ <div class="container">
+ <br>
+ <h2 style="text-align: center;">We are plural.</h2>
+
+ <div id="systems">
+ <div>
+ <img id="system-cloudburst-icon" class="system-icon" alt="" src="<%= cloudburst["general"]["avatar_url"] %>">
+ <h3 id="system-cloudburst-name" class="system-name">Cloudburst System</h3>
+ <p id="system-cloudburst-description" class="system-description">Plural system of <%= cloudburst["members"].length - 1 %> ponies!</p>
+
+ <% for (let member of cloudburst["members"]) { if (member.name !== "unknown") { %>
+ <a href="https://ponies.equestria.horse/Cloudburst:<%= member['display_name'] ?? member['name'] %>" target="_blank" class="plural-member" id="plural-member-<%= member['id'] %>">
+ <img src="<%= member['avatar_url'] ?? cloudburst['general']['avatar_url'] %>" alt="" class="plural-member-picture" id="plural-member-<%= member['id'] %>-picture">
+ <span class="plural-member-name" id="plural-member-<%= member['id'] %>-name"><%= member['display_name'] ?? member['name'] %><% if (member['name'] === "twilight") { %>&nbsp;<span class="badge rounded-pill bg-success">Host</span><% } %><% if (frontersCloudburst.includes(member['id'])) { %>&nbsp;<span class="badge rounded-pill bg-primary">Front</span><% } %></span>
+ <span class="plural-member-prefix" id="plural-member-<%= member['id'] %>-prefix"><%= member['proxy_tags'][0]['prefix'] ?? "{...}" %></span>
+ </a>
+ <% }} %>
+ </div>
+ <div>
+ <img id="system-raindrops-icon" class="system-icon" alt="" src="<%= raindrops["general"]["avatar_url"] %>">
+ <h3 id="system-raindrops-name" class="system-name">Raindrops System</h3>
+ <p id="system-raindrops-description" class="system-description">Plural system of <%= raindrops["members"].length - 1 %> ponies!</p>
+
+ <% for (let member of raindrops["members"]) { if (member.name !== "unknown") { %>
+ <a href="https://ponies.equestria.horse/Raindrops:<%= member['display_name'] ?? member['name'] %>" target="_blank" class="plural-member" id="plural-member-<%= member['id'] %>">
+ <img src="<%= member['avatar_url'] ?? raindrops['general']['avatar_url'] %>" alt="" class="plural-member-picture" id="plural-member-<%= member['id'] %>-picture">
+ <span class="plural-member-name" id="plural-member-<%= member['id'] %>-name"><%= member['display_name'] ?? member['name'] %><% if (member['name'] === "scootaloo") { %>&nbsp;<span class="badge rounded-pill bg-success">Host</span><% } %><% if (frontersRaindrops.includes(member['id'])) { %>&nbsp;<span class="badge rounded-pill bg-primary">Front</span><% } %></span>
+ <span class="plural-member-prefix" id="plural-member-<%= member['id'] %>-prefix"><%= member['proxy_tags'][0]['prefix'] ?? "{...}" %></span>
+ </a>
+ <% }} %>
+ </div>
+ </div>
+ </div>
+ <hr>
+ <pre><%= JSON.stringify(pluralCache, null, 4) %></pre>
+</div>
+
<%- include("./partials/footer.ejs") %> \ No newline at end of file
diff --git a/views/projects.ejs b/views/projects.ejs
index b6d3dd1..2e31af1 100644
--- a/views/projects.ejs
+++ b/views/projects.ejs
@@ -23,4 +23,17 @@
~
-->
<%- include("./partials/header.ejs", {title: "Projects"}) %>
+
+<div id="navbar-skipper">
+ <br>
+ <div class="projects-container container">
+ <% for (let project of Object.keys(projectCache)) { %>
+ <div class="project" id="project-<%= project %>">
+ <% let data = projectCache[project]; %>>
+ <h3 class="name"><%= data.name %>></h3>
+ </div>
+ <% } %>
+ </div>
+</div>
+
<%- include("./partials/footer.ejs") %> \ No newline at end of file
diff --git a/views/servers.ejs b/views/servers.ejs
index 3b37942..1367bfe 100644
--- a/views/servers.ejs
+++ b/views/servers.ejs
@@ -28,7 +28,7 @@
<br>
<div class="server-container container">
<% for (let server of Object.keys(serverCache)) { %>
- <div class="server" id="canterlot">
+ <div class="server" id="server-<%= server %>">
<h3 class="name"><%
let commonName;
let data = serverCache[server];
@@ -50,14 +50,6 @@
commonName = "Canterlot"
break;
- case "ponyville":
- commonName = "Ponyville"
- break;
-
- case "everfree":
- commonName = "Everfree"
- break;
-
default:
commonName = server;
break;