add eslint and prettier to enforce consistency
This commit is contained in:
parent
e1f696084c
commit
7a1b4bbbfd
10 changed files with 2378 additions and 76 deletions
3
.eslintignore
Normal file
3
.eslintignore
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
static
|
||||||
|
ssl
|
||||||
|
node_modules
|
||||||
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -1,42 +1,48 @@
|
||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us improve
|
about: Create a report to help us improve
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Issue tracker is **ONLY** used for reporting bugs. New features should be discussed on our Discord server.
|
Issue tracker is **ONLY** used for reporting bugs. New features should be discussed on our Discord server.
|
||||||
|
|
||||||
|
|
||||||
<!--- Provide a general summary of the issue in the Title above -->
|
<!--- Provide a general summary of the issue in the Title above -->
|
||||||
|
|
||||||
## Expected Behavior
|
## Expected Behavior
|
||||||
|
|
||||||
<!--- Tell us what should happen -->
|
<!--- Tell us what should happen -->
|
||||||
|
|
||||||
## Current Behavior
|
## Current Behavior
|
||||||
|
|
||||||
<!--- Tell us what happens instead of the expected behavior -->
|
<!--- Tell us what happens instead of the expected behavior -->
|
||||||
|
|
||||||
## Possible Solution
|
## Possible Solution
|
||||||
|
|
||||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||||
|
|
||||||
## Steps to Reproduce
|
## Steps to Reproduce
|
||||||
|
|
||||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||||
|
|
||||||
1.
|
1.
|
||||||
2.
|
2.
|
||||||
3.
|
3.
|
||||||
4.
|
4.
|
||||||
|
|
||||||
## Context (Environment)
|
## Context (Environment)
|
||||||
|
|
||||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||||
|
|
||||||
<!--- Provide a general summary of the issue in the Title above -->
|
<!--- Provide a general summary of the issue in the Title above -->
|
||||||
|
|
||||||
## Detailed Description
|
## Detailed Description
|
||||||
|
|
||||||
<!--- Provide a detailed description of the change or addition you are proposing -->
|
<!--- Provide a detailed description of the change or addition you are proposing -->
|
||||||
|
|
||||||
## Possible Implementation
|
## Possible Implementation
|
||||||
|
|
||||||
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
|
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
|
||||||
|
|
|
||||||
16
.github/ISSUE_TEMPLATE/config.yml
vendored
16
.github/ISSUE_TEMPLATE/config.yml
vendored
|
|
@ -1,8 +1,8 @@
|
||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Community Support
|
- name: Community Support
|
||||||
url: https://discord.gg/unblock
|
url: https://discord.gg/unblock
|
||||||
about: Please ask and answer questions here.
|
about: Please ask and answer questions here.
|
||||||
- name: Heroku, Repl.it, Blocked site issues
|
- name: Heroku, Repl.it, Blocked site issues
|
||||||
url: https://www.youtube.com/watch?v=BLUkgRAy_Vo
|
url: https://www.youtube.com/watch?v=BLUkgRAy_Vo
|
||||||
about: Do not create issues for these.
|
about: Do not create issues for these.
|
||||||
|
|
|
||||||
3
.prettierignore
Normal file
3
.prettierignore
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
static
|
||||||
|
ssl
|
||||||
|
node_modules
|
||||||
59
README.md
59
README.md
|
|
@ -6,6 +6,7 @@
|
||||||
<p align="center">The deployable version of Ultraviolet, a highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!<br><br></p>
|
<p align="center">The deployable version of Ultraviolet, a highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!<br><br></p>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- CAPTCHA support along with hCAPTCHA support
|
- CAPTCHA support along with hCAPTCHA support
|
||||||
- URL encoding settings to further hide activity when using Ultraviolet
|
- URL encoding settings to further hide activity when using Ultraviolet
|
||||||
- Configuration all done on the client-side via service-workers
|
- Configuration all done on the client-side via service-workers
|
||||||
|
|
@ -15,6 +16,7 @@
|
||||||
- Frequent updates to improve site support or fix security issues
|
- Frequent updates to improve site support or fix security issues
|
||||||
|
|
||||||
## Supported Sites
|
## Supported Sites
|
||||||
|
|
||||||
- [Youtube](https://www.youtube.com)
|
- [Youtube](https://www.youtube.com)
|
||||||
- [CAPTCHA/hCAPTCHA](https://www.captcha.net)
|
- [CAPTCHA/hCAPTCHA](https://www.captcha.net)
|
||||||
- [Spotify](https://spotify.com)
|
- [Spotify](https://spotify.com)
|
||||||
|
|
@ -24,17 +26,20 @@
|
||||||
- And more!
|
- And more!
|
||||||
|
|
||||||
## Technologies Used
|
## Technologies Used
|
||||||
|
|
||||||
- Service Workers
|
- Service Workers
|
||||||
- HTML, JS, CSS rewriting
|
- HTML, JS, CSS rewriting
|
||||||
- Parse5
|
- Parse5
|
||||||
- Acorn.js
|
- Acorn.js
|
||||||
|
|
||||||
## Used by
|
## Used by
|
||||||
|
|
||||||
- [Incognito](https://github.com/caracal-js/Incognito), a popular web proxy service with focus on privacy
|
- [Incognito](https://github.com/caracal-js/Incognito), a popular web proxy service with focus on privacy
|
||||||
- [Holy-Unblocker](https://github.com/titaniumnetwork-dev/Holy-Unblocker), a popular web proxy service focusing on bypassing web filters and more
|
- [Holy-Unblocker](https://github.com/titaniumnetwork-dev/Holy-Unblocker), a popular web proxy service focusing on bypassing web filters and more
|
||||||
- [Hypertabs](titaniumnetwork.org/), a web proxy service using a PWA browser as its frontend
|
- [Hypertabs](titaniumnetwork.org/), a web proxy service using a PWA browser as its frontend
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
- [Installation And Setup](#installation-and-setup)
|
- [Installation And Setup](#installation-and-setup)
|
||||||
- [Basic Guide](#basic-guide)
|
- [Basic Guide](#basic-guide)
|
||||||
- [Replit Setup Guide](#replit-setup-guide)
|
- [Replit Setup Guide](#replit-setup-guide)
|
||||||
|
|
@ -100,38 +105,39 @@ Finally, to start Ultraviolet, run the following command:
|
||||||
$ npm start
|
$ npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then find Ultraviolet on `http://127.0.0.1:8080`. If you would like to change the port UV will be running on, edit the last line in `index.mjs`.
|
You can then find Ultraviolet on `http://127.0.0.1:8080`. If you would like to change the port UV will be running on, edit the last line in `index.mjs`.
|
||||||
|
|
||||||
Please note that UV will not function without HTTPS. If you are hosting on Replit or Heroku, this won't be a problem as they provide you with SSL/TLS by default and will automatically apply it to your instance, however if you are attempting to host UV on a different platform, such as a personal server, you **WILL** need to use HTTPS.
|
Please note that UV will not function without HTTPS. If you are hosting on Replit or Heroku, this won't be a problem as they provide you with SSL/TLS by default and will automatically apply it to your instance, however if you are attempting to host UV on a different platform, such as a personal server, you **WILL** need to use HTTPS.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Configuring Ultraviolet is very simple. Simple descriptions of each configurable option are provided as a comment in the block below. More detailed documentation can be found just below mentioned block.
|
Configuring Ultraviolet is very simple. Simple descriptions of each configurable option are provided as a comment in the block below. More detailed documentation can be found just below mentioned block.
|
||||||
|
|
||||||
`uv.config.js`
|
`uv.config.js`
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
self.__uv$config = {
|
self.__uv$config = {
|
||||||
prefix: '/sw/', // Proxy url prefix
|
prefix: "/sw/", // Proxy url prefix
|
||||||
bare: '/bare/', // Bare server location
|
bare: "/bare/", // Bare server location
|
||||||
encodeUrl: Ultraviolet.codec.xor.encode, // URL Encoding function
|
encodeUrl: Ultraviolet.codec.xor.encode, // URL Encoding function
|
||||||
decodeUrl: Ultraviolet.codec.xor.decode, // Decode URL function
|
decodeUrl: Ultraviolet.codec.xor.decode, // Decode URL function
|
||||||
handler: '/uv.handler.js', // Handler script
|
handler: "/uv.handler.js", // Handler script
|
||||||
bundle: '/uv.bundle.js', // Bundled script
|
bundle: "/uv.bundle.js", // Bundled script
|
||||||
config: '/uv.config.js', // Configuration script
|
config: "/uv.config.js", // Configuration script
|
||||||
sw: '/uv.sw.js', // Service Worker Script
|
sw: "/uv.sw.js", // Service Worker Script
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
| Configuration | Options and Explanation |
|
| Configuration | Options and Explanation |
|
||||||
| ------------- | ----------------------- |
|
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| Prefix | The prefix is the prefix that you want users to see. Ex: `https://example.com/service.` The default prefix is `service`. |
|
| Prefix | The prefix is the prefix that you want users to see. Ex: `https://example.com/service.` The default prefix is `service`. |
|
||||||
| Bare | Bare Servers can run on directories. For example, if the directory was /bare/ then the bare origin would look like `http://example.org/bare/`. The bare origin is passed to clients. |
|
| Bare | Bare Servers can run on directories. For example, if the directory was /bare/ then the bare origin would look like `http://example.org/bare/`. The bare origin is passed to clients. |
|
||||||
| encodeUrl| EncodeUrl is how you want the URL a proxy site's visitors has to be encoded. Options include `Ultraviolet.codec.base64.encode`, `Ultraviolet.codec.plain.encode`, or `Ultraviolet.codec.xor.encode`. It is recommended that you use `xor` or `base64` as it hides the queries your visitors are searching and visiting.
|
| encodeUrl | EncodeUrl is how you want the URL a proxy site's visitors has to be encoded. Options include `Ultraviolet.codec.base64.encode`, `Ultraviolet.codec.plain.encode`, or `Ultraviolet.codec.xor.encode`. It is recommended that you use `xor` or `base64` as it hides the queries your visitors are searching and visiting. |
|
||||||
| decodeURL | DecodeUrl is how you want the url to be decoded. It is recommended you keep it the same as `encodeUrl`. |
|
| decodeURL | DecodeUrl is how you want the url to be decoded. It is recommended you keep it the same as `encodeUrl`. |
|
||||||
| Handler | Handler is the path to the UV handler. The default name and path to this file is `static/uv/uv.handler.js`. |
|
| Handler | Handler is the path to the UV handler. The default name and path to this file is `static/uv/uv.handler.js`. |
|
||||||
| Bundle | Bundle is the path to the UV bundle file. The default name and path to this file is `static/uv/uv.bundle.js`. |
|
| Bundle | Bundle is the path to the UV bundle file. The default name and path to this file is `static/uv/uv.bundle.js`. |
|
||||||
| Config | Config is the path to the UV config file. The default name and path to this file is `static/uv/uv.bundle.js`. |
|
| Config | Config is the path to the UV config file. The default name and path to this file is `static/uv/uv.bundle.js`. |
|
||||||
| SW | SW is the path to the UV Service Worker script. The default name and path to this file is `static/uv/uv.sw.js`. |
|
| SW | SW is the path to the UV Service Worker script. The default name and path to this file is `static/uv/uv.sw.js`. |
|
||||||
|
|
||||||
## Static Files
|
## Static Files
|
||||||
|
|
||||||
|
|
@ -146,11 +152,11 @@ Static files is the frontend for Ultraviolet. A standalone repository for it can
|
||||||
The client-hooking & service worker scripts required for UV are located in [ultraviolet-scripts](https://github.com/titaniumnetwork-dev/ultraviolet-scripts)
|
The client-hooking & service worker scripts required for UV are located in [ultraviolet-scripts](https://github.com/titaniumnetwork-dev/ultraviolet-scripts)
|
||||||
|
|
||||||
- Scripts
|
- Scripts
|
||||||
- `uv.sw.js` Service worker gateway
|
- `uv.sw.js` Service worker gateway
|
||||||
- `uv.sw-handler.js` - Service worker handler
|
- `uv.sw-handler.js` - Service worker handler
|
||||||
- `uv.bundle.js` Webpack compiled Ultraviolet rewriter
|
- `uv.bundle.js` Webpack compiled Ultraviolet rewriter
|
||||||
- `uv.handler.js` Client-side hooking
|
- `uv.handler.js` Client-side hooking
|
||||||
- `uv.config.js` Configuration
|
- `uv.config.js` Configuration
|
||||||
|
|
||||||
# Authors
|
# Authors
|
||||||
|
|
||||||
|
|
@ -158,6 +164,5 @@ The client-hooking & service worker scripts required for UV are located in [ultr
|
||||||
- Divide (Creator of TOMP)
|
- Divide (Creator of TOMP)
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
|
|
||||||
- https://github.com/tomphttp
|
- https://github.com/tomphttp
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
10
app.json
10
app.json
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Ultraviolet App",
|
"name": "Ultraviolet App",
|
||||||
"description": "Node.js Ultraviolet instance",
|
"description": "Node.js Ultraviolet instance",
|
||||||
"repository": "https://github.com/titaniumnetwork-dev/ultraviolet-web-app",
|
"repository": "https://github.com/titaniumnetwork-dev/ultraviolet-web-app",
|
||||||
"logo": "https://github.com/titaniumnetwork-dev/Ultraviolet/blob/main/uv.png?raw=true",
|
"logo": "https://github.com/titaniumnetwork-dev/Ultraviolet/blob/main/uv.png?raw=true",
|
||||||
"keywords": ["tomp", "ultraviolet"]
|
"keywords": ["tomp", "ultraviolet"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2281
package-lock.json
generated
2281
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -16,5 +16,9 @@
|
||||||
"proxy"
|
"proxy"
|
||||||
],
|
],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "GPL-3.0-or-later"
|
"license": "GPL-3.0-or-later",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^8.23.0",
|
||||||
|
"prettier": "^2.7.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
(async() => {
|
(async () => {
|
||||||
await import('./index.mjs');
|
await import("./index.mjs");
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,38 @@
|
||||||
import createServer from '@tomphttp/bare-server-node';
|
import createServer from "@tomphttp/bare-server-node";
|
||||||
import {fileURLToPath} from 'url';
|
import { fileURLToPath } from "url";
|
||||||
import {dirname, join} from 'path';
|
import { dirname, join } from "path";
|
||||||
import http from 'http';
|
import http from "http";
|
||||||
import serveStatic from 'serve-static';
|
import serveStatic from "serve-static";
|
||||||
|
|
||||||
const bare = createServer('/bare/');
|
const bare = createServer("/bare/");
|
||||||
const serve = serveStatic(join(
|
const serve = serveStatic(
|
||||||
dirname(fileURLToPath(import.meta.url)),
|
join(dirname(fileURLToPath(import.meta.url)), "static/"),
|
||||||
'static/'
|
{ fallthrough: false }
|
||||||
), {fallthrough: false});
|
);
|
||||||
|
|
||||||
const server = http.createServer();
|
const server = http.createServer();
|
||||||
|
|
||||||
server.on('request', (req, res) => {
|
server.on("request", (req, res) => {
|
||||||
if (bare.shouldRoute(req)) {
|
if (bare.shouldRoute(req)) {
|
||||||
bare.routeRequest(req, res);
|
bare.routeRequest(req, res);
|
||||||
} else {
|
} else {
|
||||||
serve(req, res, err => {
|
serve(req, res, (err) => {
|
||||||
res.writeHead(err?.statusCode || 500, null, {
|
res.writeHead(err?.statusCode || 500, null, {
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain",
|
||||||
})
|
});
|
||||||
res.end(err?.stack)
|
res.end(err?.stack);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('upgrade', (req, socket, head) => {
|
server.on("upgrade", (req, socket, head) => {
|
||||||
if (bare.shouldRoute(req, socket, head)) {
|
if (bare.shouldRoute(req, socket, head)) {
|
||||||
bare.routeUpgrade(req, socket, head);
|
bare.routeUpgrade(req, socket, head);
|
||||||
}else{
|
} else {
|
||||||
socket.end();
|
socket.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen({
|
server.listen({
|
||||||
port: process.env.PORT || 8080,
|
port: process.env.PORT || 8080,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue