From 9081853a6fea2c81ee19523d7105f4ff804b61de Mon Sep 17 00:00:00 2001
From: Kwstas Drakontidis
Date: Mon, 9 Jun 2025 08:53:29 +0200
Subject: [PATCH] General refactor
---
app/routes/private_routes.js | 5 +++++
app/routes/public_routes.js | 10 +---------
app/views/about.ejs | 2 +-
app/views/add.ejs | 6 +++---
app/views/auth.ejs | 33 ---------------------------------
app/views/edit.ejs | 6 +++---
app/views/error.ejs | 5 ++++-
app/views/index.ejs | 5 ++++-
samples/app.conf.sample | 3 ++-
samples/map.conf.sample | 3 ++-
server.js | 5 ++---
src/javascript/add.js | 4 ++--
src/javascript/edit.js | 14 +++++++-------
src/javascript/error.js | 4 ++--
src/javascript/index.js | 10 +++++-----
15 files changed, 43 insertions(+), 72 deletions(-)
delete mode 100644 app/views/auth.ejs
diff --git a/app/routes/private_routes.js b/app/routes/private_routes.js
index e2159a4..3925ba9 100644
--- a/app/routes/private_routes.js
+++ b/app/routes/private_routes.js
@@ -15,6 +15,7 @@ function errorPageRenderer(res, emoji, message) {
res.render("error", {
page_title: app_conf.name,
program: app_conf.program,
+ app_url: app_conf.app_url,
css_path: path.join(app_conf.paths.css.web, "stylesheet.css"),
js_path: path.join(app_conf.paths.js.web, "error.js"),
error_emoji: emoji,
@@ -124,6 +125,7 @@ router.get("/add", async (req, res) => {
res.render("add", {
page_title: app_conf.name,
program: app_conf.program,
+ app_url: app_conf.app_url,
css_path: path.join(app_conf.paths.css.web, "stylesheet.css"),
js_path: path.join(app_conf.paths.js.web, "add.js"),
chartjs: app_conf.paths.chartjs.web + "/chart.umd.js",
@@ -143,6 +145,7 @@ router.get("/edit", async (req, res) => {
res.render("edit", {
page_title: app_conf.name,
program: app_conf.program,
+ app_url: app_conf.app_url,
css_path: path.join(app_conf.paths.css.web, "stylesheet.css"),
js_path: path.join(app_conf.paths.js.web, "edit.js"),
chartjs: app_conf.paths.chartjs.web + "/chart.umd.js",
@@ -203,6 +206,7 @@ router.get("/", async (req, res) => {
res.render("index", {
page_title: app_conf.name,
program: app_conf.program,
+ app_url: app_conf.app_url,
css_path: path.join(app_conf.paths.css.web, "stylesheet.css"),
js_path: path.join(app_conf.paths.js.web, "index.js"),
map_name_msg: (selected_map_name != "" ? "Using: " + selected_map_name : ""),
@@ -222,6 +226,7 @@ router.get("/about", (req, res) => {
res.render("about", {
page_title: app_conf.name,
program: app_conf.program,
+ app_url: app_conf.app_url,
css_path: path.join(app_conf.paths.css.web, "stylesheet.css"),
version: app_conf.version
});
diff --git a/app/routes/public_routes.js b/app/routes/public_routes.js
index ae5a7d9..ad716ec 100644
--- a/app/routes/public_routes.js
+++ b/app/routes/public_routes.js
@@ -12,15 +12,7 @@ router.use(app_conf.paths.chartjs.web, express.static(path.join(path.dirname(req
* Main endpoint - might implement authentication step here...
*/
router.get("/", (req, res) => {
- res.render("auth", {
- page_title: app_conf.name,
-
- program: app_conf.program,
- css_path: path.join(app_conf.paths.css.web, "stylesheet.css"),
- protocol: app_conf.protocol,
- host: app_conf.host,
- port: app_conf.port
- });
+ res.redirect(`${app_conf.protocol}://${app_conf.host}:${app_conf.port}${app_conf.app_url}`);
});
module.exports = router;
\ No newline at end of file
diff --git a/app/views/about.ejs b/app/views/about.ejs
index c020fa0..0da6861 100644
--- a/app/views/about.ejs
+++ b/app/views/about.ejs
@@ -30,7 +30,7 @@
style="font-size: 150%;">GitHub
- 🢀 Return
+ 🢀 Return
-
-
-
-
-
-
-
Enter
-
-
-
diff --git a/app/views/add.ejs b/app/views/add.ejs
index 71ff5b0..f285c58 100644
--- a/app/views/add.ejs
+++ b/app/views/add.ejs
@@ -16,7 +16,7 @@
@@ -55,12 +55,12 @@
diff --git a/app/views/auth.ejs b/app/views/auth.ejs
deleted file mode 100644
index 7ee1d1d..0000000
--- a/app/views/auth.ejs
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-