From 5cf2e2ac2ee0ea4c12b3aa7e84ebd0a20698846f Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 16 Jun 2022 18:00:23 +0200 Subject: Other pages --- index.js | 18 +++++++++++++++--- views/about.ejs | 26 ++++++++++++++++++++++++++ views/index.ejs | 2 +- views/partials/footer.ejs | 4 ++++ views/projects.ejs | 26 ++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 views/about.ejs create mode 100644 views/projects.ejs diff --git a/index.js b/index.js index 0ae145f..ef033bc 100644 --- a/index.js +++ b/index.js @@ -30,6 +30,10 @@ const express = require('express'); 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 build = (fs.existsSync("./build.txt") ? fs.readFileSync("./build.txt").toString().trim() : (fs.existsSync("../build.txt") ? fs.readFileSync("../build.txt").toString().trim() : "dev")); + // Restart manager async function restartManager() { if (fs.existsSync("./RESTART")) { @@ -42,15 +46,23 @@ setInterval(restartManager, 500) // Public pages app.get('/', (req, res) => { - res.render("index"); + res.render("index", { version, build }); }); app.get('/servers', (req, res) => { - res.render("servers", { serverCache }); + res.render("servers", { serverCache, version, build }); }); app.get("/plurality", (req, res) => { - res.render("plurality"); + res.render("plurality", { version, build }); +}); + +app.get("/about", (req, res) => { + res.render("about", { version, build }); +}); + +app.get("/projects", (req, res) => { + res.render("projects", { version, build }); }); // API diff --git a/views/about.ejs b/views/about.ejs new file mode 100644 index 0000000..bb01120 --- /dev/null +++ b/views/about.ejs @@ -0,0 +1,26 @@ + +<%- include("./partials/header.ejs", {title: "About Us"}) %> +<%- include("./partials/footer.ejs") %> \ No newline at end of file diff --git a/views/index.ejs b/views/index.ejs index 1f1661e..5a62ac5 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -27,7 +27,7 @@
We are The Cuties!
-
The two pegasi making stuff with their wings
+
The two fluffy birb horses making stuff with their wings
diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs index 168dc25..33fb1a4 100644 --- a/views/partials/footer.ejs +++ b/views/partials/footer.ejs @@ -22,5 +22,9 @@ ~ SOFTWARE. ~ --> +version <%= version %> (build <%= build %>) +Project Vapor Trail +Not for production use. +Not for production use. \ No newline at end of file diff --git a/views/projects.ejs b/views/projects.ejs new file mode 100644 index 0000000..b6d3dd1 --- /dev/null +++ b/views/projects.ejs @@ -0,0 +1,26 @@ + +<%- include("./partials/header.ejs", {title: "Projects"}) %> +<%- include("./partials/footer.ejs") %> \ No newline at end of file -- cgit