From f668495a801d18074f462e2ec8feb440457a5c5b Mon Sep 17 00:00:00 2001 From: Sui Gn Date: Wed, 13 Mar 2024 12:30:07 -0500 Subject: [PATCH] - - --- index.js | 9 +- package.json | 2 +- src/Gateway.js | 5 +- src/config/domains.json | 25 ++-- src/ejsApp/views/domainList.ejs | 148 +++++++++++++----------- src/ejsApp/views/partials/addDomain.ejs | 9 ++ src/netget.js | 24 ++++ src/routes/routes.js | 15 +-- 8 files changed, 135 insertions(+), 102 deletions(-) create mode 100644 src/ejsApp/views/partials/addDomain.ejs create mode 100644 src/netget.js diff --git a/index.js b/index.js index 1f21339..5a9d143 100644 --- a/index.js +++ b/index.js @@ -5,9 +5,6 @@ */ // Log the successful loading of NetGet -console.log("NetGet Loaded Successfully."); -/** - * Gateway class for handling domain-based routing and server initialization. - * @see Gateway - */ -export { default as Gateway } from './src/Gateway.js'; \ No newline at end of file +import NetGet from './src/netget.js'; +console.log("NetGet Loaded."); +export default NetGet; \ No newline at end of file diff --git a/package.json b/package.json index a0faf86..886f917 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netget", - "version": "2.3.31", + "version": "2.3.33", "description": "Rette Adepto/ Recibido Directamente.", "type": "module", "main": "index.js", diff --git a/src/Gateway.js b/src/Gateway.js index 15b4d82..74a90fd 100644 --- a/src/Gateway.js +++ b/src/Gateway.js @@ -36,8 +36,9 @@ class Gateway { * Initializes the server setup including static file serving, view engine setup, and domain routing. */ async initialize() { - // Calculate the base directory for the gateway, assuming the gateway class is in 'src' - const baseDir = path.dirname(fileURLToPath(import.meta.url)); + const baseDir = path.dirname(fileURLToPath(import.meta.url)); // Calculate the base directory for the gateway, assuming the gateway class is in 'src' + this.app.use(express.urlencoded({ extended: true })); // Parse URL-encoded bodies (as sent by HTML forms) + this.app.use(express.json()); // Parse JSON bodies (as sent by API clients) this.app.use(express.static(path.join(baseDir, 'ejsApp', 'public'))); this.app.set('view engine', 'ejs'); this.app.set('views', path.join(baseDir, 'ejsApp', 'views')); diff --git a/src/config/domains.json b/src/config/domains.json index 7782a95..ee9cd36 100644 --- a/src/config/domains.json +++ b/src/config/domains.json @@ -1,20 +1,15 @@ { - "name": "DefaultDomains", + "name": "DefaultDomains", "domains": { "cleaker.me": {"handler": "cleakerHandler", "state": "Active"}, "neurons.me": {"handler": "neuronsHandler", "state": "Active"}, - "mlearning.me": {"handler": "mlearningHandler", "state": "Maintenance"} - }, - "domains2": { - "cleaker.me": "cleakerHandler", - "neurons.me": "neuronsHandler", - "mlearning.me": "mlearningHandler", - "mlearning.com": "mlearningHandler", - "mlearning.studio": "mlearningHandler", - "mdrn.me": "mdrnHandler", - "monadlisa.me": "monadlisaHandler", - "monadlisa.com": "monadlisaHandler", - "netget.me": "netgetHandler", - "orgboat.me": "orgboatHandler" - } + "mlearning.me": {"handler": "mlearningHandler", "state": "Maintenance"}, + "mlearning.com": {"handler": "mlearningHandler", "state": "Active"}, + "mlearning.studio": {"handler": "mlearningHandler", "state": "Active"}, + "mdrn.me": {"handler": "mdrnHandler", "state": "Active"}, + "monadlisa.me": {"handler": "monadlisaHandler", "state": "Active"}, + "monadlisa.com": {"handler": "monadlisaHandler", "state": "Active"}, + "netget.me": {"handler": "netgetHandler", "state": "Active"}, + "orgboat.me": {"handler": "orgboatHandler", "state": "Active"} + } } \ No newline at end of file diff --git a/src/ejsApp/views/domainList.ejs b/src/ejsApp/views/domainList.ejs index 980ec4b..14f3519 100644 --- a/src/ejsApp/views/domainList.ejs +++ b/src/ejsApp/views/domainList.ejs @@ -3,111 +3,123 @@ - Domain Configuration List - + Domain Configuration - Interactive View +
-

Domain Configuration List

+

Domain Configuration

+ <% for(const domain in domains) { %> +
+ <%= domain %> +
+ <%= domains[domain].handler %> + + + +
+ <% } %> - Go Back
- - - - - - - - <% for(const domain in domains) { %> - - - - - - <% } %> -
Domain NameHandlerState
<%= domain %><%= domains[domain].handler %><%= domains[domain].state %>
- - -