From 0c76b852eb24e814c461e266673ba2ac8157f9f3 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 | 8 +-------
app/views/about.ejs | 2 +-
app/views/add.ejs | 5 +++--
app/views/auth.ejs | 33 ---------------------------------
app/views/edit.ejs | 5 +++--
app/views/error.ejs | 5 ++++-
app/views/index.ejs | 5 ++++-
samples/app.conf.sample | 3 ++-
server.js | 7 +++----
src/javascript/add.js | 4 ++--
src/javascript/edit.js | 8 ++++----
src/javascript/error.js | 4 ++--
src/javascript/index.js | 8 ++++----
14 files changed, 38 insertions(+), 64 deletions(-)
delete mode 100644 app/views/auth.ejs
diff --git a/app/routes/private_routes.js b/app/routes/private_routes.js
index 897592a..1b934ca 100644
--- a/app/routes/private_routes.js
+++ b/app/routes/private_routes.js
@@ -14,6 +14,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,
@@ -182,6 +183,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"),
column_options: JSON.stringify(column_options),
@@ -249,6 +251,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"),
column_options: JSON.stringify(column_options),
@@ -297,6 +300,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"),
table_header: table_header,
@@ -315,6 +319,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 2c4e015..0bed904 100644
--- a/app/routes/public_routes.js
+++ b/app/routes/public_routes.js
@@ -11,13 +11,7 @@ router.use(app_conf.paths.js.web, express.static(path.join(path.dirname(require.
* Main endpoint - might implement authentication step here...
*/
router.get("/", (req, res) => {
- res.render("auth", {
- page_title: app_conf.name,
- 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 9c9afdc..5872830 100644
--- a/app/views/add.ejs
+++ b/app/views/add.ejs
@@ -16,6 +16,7 @@
@@ -35,12 +36,12 @@
<%- table_data %>
diff --git a/app/views/auth.ejs b/app/views/auth.ejs
deleted file mode 100644
index a7b2fe1..0000000
--- a/app/views/auth.ejs
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-