diff --git a/app.js b/app.js index d65d184..e73bc69 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,40 @@ -(async() => { - await - import ('./app.mjs'); -})(); \ No newline at end of file +import createBareServer from '@tomphttp/bare-server-node'; +import http from 'http'; +import { fileURLToPath } from 'url'; +import { dirname, join } from 'path'; +import nodeStatic from 'node-static'; +import * as custombare from './static/customBare.mjs'; + +const PORT = process.env.PORT || 3000; +const bareServer = createBareServer('/bare/', { + logErrors: false, + localAddress: undefined +}); + +const serve = new nodeStatic.Server(join( + dirname(fileURLToPath(import.meta.url)), + 'static/' +)); + +const server = http.createServer(); + +server.on('request', (request, response) => { + if (custombare.route(request, response)) return true; + + if (bareServer.shouldRoute(request)) { + bareServer.routeRequest(request, response); + } else { + serve.serve(request, response); + } +}); +server.on('upgrade', (req, socket, head) => { + if (bareServer.shouldRoute(req)) { + bareServer.routeUpgrade(req, socket, head); + } else { + socket.end(); + } +}); + +server.listen(PORT); + +console.log(`Server running at http://localhost:${PORT}/.`); diff --git a/app.mjs b/app.mjs deleted file mode 100644 index b2d463d..0000000 --- a/app.mjs +++ /dev/null @@ -1,35 +0,0 @@ -import createBareServer from '@tomphttp/bare-server-node'; -import http from 'http'; -import nodeStatic from 'node-static'; -import * as custombare from './static/customBare.mjs'; - -const PORT = process.env.PORT || 3000; -const bareServer = createBareServer('/bare/', { - logErrors: false, - localAddress: undefined -}); - -const serve = new nodeStatic.Server('static/'); - -const server = http.createServer(); - -server.on('request', (request, response) => { - if (custombare.route(request, response)) return true; - - if (bareServer.shouldRoute(request)) { - bareServer.routeRequest(request, response); - } else { - serve.serve(request, response); - } -}); -server.on('upgrade', (req, socket, head) => { - if (bareServer.shouldRoute(req)) { - bareServer.routeUpgrade(req, socket, head); - } else { - socket.end(); - } -}); - -server.listen(PORT); - -console.log(`Server running at http://localhost:${PORT}/.`); diff --git a/docs/docs.md b/docs/docs.md index aa39082..5f2d66c 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -2,7 +2,7 @@ # Nebula - Documentation Hello and welcome to the Nebula Documentation! -[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/) +[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/) [![Build Passing](https://img.shields.io/badge/build-passing-brightgreen)]() [![docs status]( https://img.shields.io/badge/docs-20%25%20complete-yellow)]() diff --git a/docs/guides/PATREON.md b/docs/guides/PATREON.md index 4c9cdc7..93c57ae 100644 --- a/docs/guides/PATREON.md +++ b/docs/guides/PATREON.md @@ -1,19 +1,19 @@ -# How to access patreon links! +# How to access Patreon links! Welcome to this amazing guide :) ## Step 1 -**Become a patreon...** +**Become a patron...** -*To follow this tutorial, you must be a patreon, duh.* +*To follow this tutorial, you must be a patron, duh.* ## Step 2 -Find a supporter link in the patreon. Posts with links will have the `New links` tag, so just search for that. -Some links are expiramental and may not work as intended, but we will always tell you if it's expiramental. +Find a supporter link in Patreon. Posts with links will have the `New links` tag, so just search for that. +Some links are experimental and may not work as intended, but we will always tell you if it's experimental. ## Step 3 -Use the password from the patreon post *Same post you got the link from, duh* +Use the password from the Patreon post *Same post you got the link from, duh* ## Step 4 Enter the password and Start using Nebula @@ -30,4 +30,4 @@ If the password is incorrect: ## Appendix -This guide is 96% complete. If you are having any trouble accessing or using patreon/supporter only links, contact chloe@nebula.bio or GreenWorld#0001 on discord. +This guide is 96% complete. If you are having any trouble accessing or using Patreon/supporter only links, contact chloe@nebula.bio or GreenWorld#0001 on Discord. diff --git a/package-lock.json b/package-lock.json index 628919b..8da8f7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "nebulaweb", "version": "7.0.4", - "license": "Copyright Nebula Services. All Rights Reserved.", + "license": "MIT", "dependencies": { "@tomphttp/bare-server-node": "^1.0.2-beta-readme5", "bare-server-node": "github:tomphttp/bare-server-node", @@ -75,11 +75,11 @@ "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" }, "node_modules/css-tree": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.1.0.tgz", - "integrity": "sha512-PcysZRzToBbrpoUrZ9qfblRIRf8zbEAkU0AIpQFtgkFK0vSbzOmBCvdSAx2Zg7Xx5wiYJKUKk0NMP7kxevie/A==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", "dependencies": { - "mdn-data": "2.0.27", + "mdn-data": "2.0.28", "source-map-js": "^1.0.1" }, "engines": { @@ -170,9 +170,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/mdn-data": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.27.tgz", - "integrity": "sha512-kwqO0I0jtWr25KcfLm9pia8vLZ8qoAKhWZuZMbneJq3jjBD3gl5nZs8l8Tu3ZBlBAHVQtDur9rdDGyvtfVraHQ==" + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==" }, "node_modules/mime": { "version": "1.6.0", @@ -209,9 +209,9 @@ } }, "node_modules/node-fetch": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.9.tgz", - "integrity": "sha512-/2lI+DBecVvVm9tDhjziTVjo2wmTsSxSk58saUYP0P/fRJ3xxtfMDY24+CKTkfm0Dlhyn3CSXNL0SoRiCZ8Rzg==", + "version": "3.2.10", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", + "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -354,11 +354,11 @@ "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" }, "css-tree": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.1.0.tgz", - "integrity": "sha512-PcysZRzToBbrpoUrZ9qfblRIRf8zbEAkU0AIpQFtgkFK0vSbzOmBCvdSAx2Zg7Xx5wiYJKUKk0NMP7kxevie/A==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", "requires": { - "mdn-data": "2.0.27", + "mdn-data": "2.0.28", "source-map-js": "^1.0.1" } }, @@ -417,9 +417,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "mdn-data": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.27.tgz", - "integrity": "sha512-kwqO0I0jtWr25KcfLm9pia8vLZ8qoAKhWZuZMbneJq3jjBD3gl5nZs8l8Tu3ZBlBAHVQtDur9rdDGyvtfVraHQ==" + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==" }, "mime": { "version": "1.6.0", @@ -437,9 +437,9 @@ "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" }, "node-fetch": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.9.tgz", - "integrity": "sha512-/2lI+DBecVvVm9tDhjziTVjo2wmTsSxSk58saUYP0P/fRJ3xxtfMDY24+CKTkfm0Dlhyn3CSXNL0SoRiCZ8Rzg==", + "version": "3.2.10", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", + "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", "requires": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", diff --git a/package.json b/package.json index 7e96603..e23b789 100644 --- a/package.json +++ b/package.json @@ -7,13 +7,9 @@ "scripts": { "start": "node app.js" }, - "keywords": [ - "educational", - "math", - "science" - ], + "keywords": ["proxy"], "author": "Nebula Services", - "license": "Copyright Nebula Services. All Rights Reserved.", + "license": "MIT", "dependencies": { "@tomphttp/bare-server-node": "^1.0.2-beta-readme5", "bare-server-node": "github:tomphttp/bare-server-node",