From 472984f9e71cc949272daf5b6c395eb643bbc264 Mon Sep 17 00:00:00 2001 From: TheGreyDiamond Date: Wed, 25 Nov 2020 21:52:56 +0100 Subject: [PATCH] added stud --- index.js | 7 +++ lang/langs_v1.js | 6 +++ package-lock.json | 119 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 4 files changed, 133 insertions(+) create mode 100644 lang/langs_v1.js diff --git a/index.js b/index.js index 20678cf..9a41437 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ const { app, BrowserWindow, screen, ipcMain, BrowserView } = require("electron"); +var Config = require('config-js'); const fs = require("fs"); const { win32 } = require("path"); const sysInf = require("systeminformation"); @@ -179,6 +180,7 @@ function init() { networkInterfaces = data; }); + var langs = new Config('./lang/langs_v1.js'); sessionState = 0; // Init with no connection setTimeout(function(){ @@ -190,9 +192,14 @@ function init() { restApp.get('/', (req, res) => { res.send('Hello World! The RestFul API of Enlight is up and working!') }) + restApp.get('/api/v1/ping', (req, res) => { res.json({state:"Succes"}); }) + + restApp.get('/api/v1/session/info', (req, res) => { + res.json({state:"Succes", implementation: "Not yet implemted."}); + }) }, 20); // Handling sessioning diff --git a/lang/langs_v1.js b/lang/langs_v1.js new file mode 100644 index 0000000..4e44ccd --- /dev/null +++ b/lang/langs_v1.js @@ -0,0 +1,6 @@ +module.exports = { + + en: { + welcome: "Welcome to this file." + } +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0156be2..facb1e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -225,6 +225,47 @@ "proto-list": "~1.2.1" } }, + "config-js": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/config-js/-/config-js-1.1.14.tgz", + "integrity": "sha512-PrsVxS8zc3A4+al95+XqVqJeloF1e9Uhkldj3KTForzTjgn0W46BwEsb1i/YrYLWwpqX3TkUpI3S42AxFE7+mw==", + "requires": { + "const-obj": "^0.0.4", + "debug": "4.1.1", + "have": "0.4.0", + "is2": "2.0.4", + "lodash.merge": "4.6.2", + "property-path": "1.0.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "const-obj": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/const-obj/-/const-obj-0.0.4.tgz", + "integrity": "sha1-1KHQMj+Urc0rO+KuFT8a3YNhRy4=", + "requires": { + "is2": "0.0.12" + }, + "dependencies": { + "is2": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/is2/-/is2-0.0.12.tgz", + "integrity": "sha1-zriH9RakgtAn53EP21fA/9kp8Nc=", + "requires": { + "deep-is": "0.1.2" + } + } + } + }, "content-disposition": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", @@ -275,6 +316,11 @@ "mimic-response": "^1.0.0" } }, + "deep-is": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.2.tgz", + "integrity": "sha1-nO1l6gvAsJ9CptecGxkD+dkTzBg=" + }, "defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", @@ -588,6 +634,11 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "have": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/have/-/have-0.4.0.tgz", + "integrity": "sha1-5aNBESjFvChxA95UL5+UfBvHl/U=" + }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -631,11 +682,38 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "optional": true }, + "ip-regex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.2.0.tgz", + "integrity": "sha512-n5cDDeTWWRwK1EBoWwRti+8nP4NbytBBY0pldmnIkq6Z55KNFmWofh4rl9dPZpj+U/nVq7gweR3ylrvMt4YZ5A==" + }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-url": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", + "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==" + }, + "is2": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is2/-/is2-2.0.4.tgz", + "integrity": "sha512-7BQdwRMJRIMvcIltrz3VElmppIV7dL/s2nnZbhzcgyOBdZJcLYuEUG7H0icNvuCyjupXznJwjkDM30pgsNLwtg==", + "requires": { + "deep-is": "^0.1.3", + "ip-regex": "^4.1.0", + "is-url": "^1.2.4" + }, + "dependencies": { + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + } + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -685,6 +763,16 @@ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "optional": true }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -846,6 +934,37 @@ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" }, + "property-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/property-path/-/property-path-1.0.0.tgz", + "integrity": "sha512-q6XmVvqBc/4rY3NvZMK9z66ctkxY9SDekgMksKiHTgxELPdCrnB/J1loX95ei9cnPtyLwWNpEMXRvUiTjy77tQ==", + "requires": { + "is2": "2.0.1", + "lodash.filter": "4.6.0" + }, + "dependencies": { + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=" + }, + "is2": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is2/-/is2-2.0.1.tgz", + "integrity": "sha512-+WaJvnaA7aJySz2q/8sLjMb2Mw14KTplHmSwcSpZ/fWJPkUmqw3YTzSWbPJ7OAwRvdYTWF2Wg+yYJ1AdP5Z8CA==", + "requires": { + "deep-is": "^0.1.3", + "ip-regex": "^2.1.0", + "is-url": "^1.2.2" + } + } + } + }, "proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", diff --git a/package.json b/package.json index fed7717..41d371d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "homepage": "https://github.com/TheGreyDiamond/Enlight#readme", "dependencies": { + "config-js": "^1.1.14", "ejs": "^3.1.5", "electron": "^11.0.2", "express": "^4.17.1",