Skip to content

Commit

Permalink
Several major changes: Added verification system, better loading scre…
Browse files Browse the repository at this point in the history
…en, added documentation, optimizations, cleanups, etc, and finally fixed Markdown.
  • Loading branch information
GreenyDEV committed Nov 14, 2022
1 parent bf0c2fb commit 38dde4e
Show file tree
Hide file tree
Showing 16 changed files with 4,372 additions and 4,628 deletions.
3 changes: 3 additions & 0 deletions .breakpoints
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"files": {}
}
65 changes: 36 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,31 @@
<div align=center>
<img src='https://nebulaproxy.nebula.bio/images/logo.png' width="100px" height="100px">
<h1> Nebula </h1>
Nebula Web is an official flagship of Nebula Services. Nebula Web is a stunning and sleak webproxy with support for hundreds of popular sites, and partial support for WebRTC, used in GfN. With Nebula Web, the sky is the limit. Enjoy.
NebulaWeb is an official flagship of Nebula Services and Nebula Developer Labs. NebulaWeb is a stunning, sleak, and functional web-proxy with support for thousands of popular sites. With NebulaWeb, the sky is the limit.
</div>


## Features

- Stunning UI with multiple themes
- Stunning highly functional UI with multiple themes
- XOR/b64 Encrypts all traffic sent from Nebula
- Hides your IP from sites
- [List of officially supported sites](https://github.com/NebulaServices/Nebula/blob/main/docs/officially-supported-sites.md)
- *limited* mobile support
- StealthMode (buffed `about:blank` cloaking)
- Advanced cloaking options
- **NEW** Deployment option - Email OTP Verification (tutorial can be found below)


# Deployment

### Self Hosting
```bash
$ git clone https://github.com/NebulaServices/Nebula.git
$ cd Nebula
$ npm ci
$ npm start
```

## Tech Stack

- HTML, JS, CSS
- Partical.JS
- UV Backend Proxy
- Osana Backend Proxy
- **Server:** Bare server on Node


## Support

For support, email chloe@nebula.bio or join our discord: discord.nebula.bio


## Demo

[Click here to see a demo of Nebula](https://tutorialread.beauty/)
Table of contents
- Quick & easy deployment
- how to use email OTP Verification mode
- Advanced Deployment

# Deployment

## Quick Deployment Options
## Quick & Easy Deployment Options
[![Deploy to Heroku](https://raw.githubusercontent.com/BinBashBanana/deploy-buttons/master/buttons/remade/heroku.svg)](https://heroku.com/deploy/?template=https://github.com/NebulaServices/Nebula)
<br>
[![Run on Replit](https://raw.githubusercontent.com/BinBashBanana/deploy-buttons/master/buttons/remade/replit.svg)](https://replit.com/github/NebulaServices/Nebula)
Expand All @@ -63,6 +44,13 @@ For support, email chloe@nebula.bio or join our discord: discord.nebula.bio
[![Deploy To Koyeb](https://binbashbanana.github.io/deploy-buttons/buttons/remade/koyeb.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/NebulaServices/Nebula&branch=main&name=NebulaProxy)

---
## how to use email OTP Verification mode
* change `"verification":false,` to `"verification":true,`
* Make an account with Sendgrid (https://app.sendgrid.com/)
* verify email
* get API key
* fill out information in `deployment.config.json`

## Advanced Deployment

### Initial configuration
Expand Down Expand Up @@ -112,6 +100,25 @@ sudo nohup PORT=80 node . &
*Note: Server will need to run` cd Nebula && sudo nohup PORT=80 node . &` on reboot*
(Nebula's license is now GNU AGPL V3 as of v7.10)


## Tech Stack

- HTML, JS, CSS
- Partical.JS
- UV Backend Proxy
- Osana Backend Proxy
- **Server:** Bare server on Node

## Support

For support, email chloe@nebula.bio or join our discord: discord.nebula.bio


## Demo

[Click here to see a demo of Nebula](https://tutorialread.beauty/)


## Acknowledgements

- [UV (one of the back-end proxy we use)](https://github.com/titaniumnetwork-dev/Ultraviolet)
Expand Down
156 changes: 122 additions & 34 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,142 @@
import createBareServer from '@tomphttp/bare-server-node';
import http from 'http';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import serveStatic from 'serve-static';

const PORT = process.env.PORT || 3000;
const bareServer = createBareServer('/bare/', {
import createBareServer from "@tomphttp/bare-server-node"
import http from "http"
import { fileURLToPath } from "url"
import { dirname, join } from "path"
import serveStatic from "serve-static"
import { createRequire } from "module"
const require = createRequire(import.meta.url)
const config = require("./deployment.config.json")
import fs from "fs"
var base64data
import sgTransport from "nodemailer-sendgrid-transport"
import nodemailer from "nodemailer"
const options = {
auth: {
api_key: config.api_key,
},
}
const mailerAgent = nodemailer.createTransport(sgTransport(options))
function sendVerificationEmail(UUID, mailTo, OTP) {
const email = {
to: mailTo,
from: `${config.sendFromEmail}`,
subject: `NebulaWEB personal access code ${OTP}`,
text: `
####### ACCESS CODE (OTP) ${OTP} #######
####### DO NOT SHARE THIS CODE! #######
(this message is automated)`,
html: `
####### ACCESS CODE (OTP) ${OTP} #######
####### DO NOT SHARE THIS CODE! #######
(this message is automated)
`,
}
if (config.verification == true) {
mailerAgent.sendMail(email, (err, res) => {
if (err) {
console.log(err)
}
console.log(res)
})
}
}

function getNewCode() {
var seq = (Math.floor(Math.random() * 10000) + 10000).toString().substring(1)
if (seq == "0") {
getNewCode()
}
return seq
}

const PORT = process.env.PORT || 3000
const bareServer = createBareServer("/bare/", {
logErrors: false,
localAddress: undefined
});
localAddress: undefined,
})

const serve = serveStatic(join(
dirname(fileURLToPath(import.meta.url)),
'static/'
), {
fallthrough: false,
maxAge: 5 * 60 * 1000
});
const serve = serveStatic(
join(dirname(fileURLToPath(import.meta.url)), "static/"),
{
fallthrough: false,
maxAge: 5 * 60 * 1000,
}
)

const server = http.createServer();
const server = http.createServer()

server.on('request', (request, response) => {
server.on("request", (request, response) => {
try {

if (bareServer.shouldRoute(request)) {
bareServer.routeRequest(request, response);
bareServer.routeRequest(request, response)
} else {
serve(request, response, err => {
response.writeHead(err?.statusCode || 500, null, {
"Content-Type": "text/plain"
let base64data
const url = request.url
if (url.startsWith("/sendNewCode")) {
const OTP = getNewCode()
fs.writeFile("./memory.txt", OTP, function (err) {
if (err) return console.log(err)
console.log(`Wrote OTP code to temp file`)
})

fs.readFile("./memory.txt", "utf8", (err, data) => {
if (err) {
console.error(err)
return
}
console.log(data)

sendVerificationEmail("10", config.email, data)
let buff = new Buffer(data)
base64data = buff.toString("base64")
console.log("302")
response.writeHead(302, {
location: "/unv.html?c=" + base64data,
})
response.end()
})
} else if (url.startsWith("/verification")) {
var body
if (config.verification == true) {
const body = "true"
response.writeHead(200, {
"Content-Length": Buffer.byteLength(body),
"Content-Type": "text/plain",
})
response.end(body)
} else {
const body = "false"
response.writeHead(200, {
"Content-Length": Buffer.byteLength(body),
"Content-Type": "text/plain",
})
response.end(body)
}
} else {
serve(request, response, (err) => {
response.writeHead(err?.statusCode || 500, null, {
"Content-Type": "text/plain",
})
response.end(err?.stack)
})
response.end(err?.stack)
});
}
}
} catch (e) {
response.writeHead(500, "Internal Server Error", {
"Content-Type": "text/plain"
"Content-Type": "text/plain",
})
response.end(e.stack)
}
});
server.on('upgrade', (req, socket, head) => {
})
server.on("upgrade", (req, socket, head) => {
if (bareServer.shouldRoute(req)) {
bareServer.routeUpgrade(req, socket, head);
bareServer.routeUpgrade(req, socket, head)
} else {
socket.end();
socket.end()
}
});
})

server.listen(PORT);
server.listen(PORT)

if (process.env.UNSAFE_CONTINUE)
process.on("uncaughtException", (err, origin) => {
Expand All @@ -58,4 +146,4 @@ if (process.env.UNSAFE_CONTINUE)
console.error()
})

console.log(`Server running at http://localhost:${PORT}/.`);
console.log(`Server running at http://localhost:${PORT}/.`)
7 changes: 7 additions & 0 deletions deployment.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"verification": false,
"api_key":"YOUR_SENDGRID_API_KEY",
"sendFromEmail":"THE EMAIL THE CODES WILL BE SENT FROM (MUST BE VERIFIED IN SENDGRID)",
"type": "code",
"email": "YOUR_EMAIL_HERE"
}
1 change: 1 addition & 0 deletions memory.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5003
Loading

0 comments on commit 38dde4e

Please sign in to comment.