Skip to content

Commit 3be0ded

Browse files
committed
backport changes from main
1 parent c963d45 commit 3be0ded

12 files changed

Lines changed: 104 additions & 82 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# v3.0.1
2+
3+
- This version of Ultraviolet upgrades [bare-mux](https://www.npmjs.com/package/@mercuryworkshop/bare-mux). This solves an issue with websockets not being opened properly.
4+
- This version of Ultraviolet allows error messages to be iframed on cross origin isolated pages.
5+
6+
# v3.0.0
7+
8+
- This version of Ultraviolet has support for using [bare-mux](https://github.com/MercuryWorkshop/bare-mux) transports, allowing for use for other implementations like [EpoxyTransport](https://github.com/MercuryWorkshop/EpoxyTransport), [CurlTransport](https://github.com/MercuryWorkshop/CurlTransport), and the existing implementation [Bare-Client](https://github.com/MercuryWorkshop/Bare-as-module3).
9+
110
# v2.0.0
211

312
- This version of Ultraviolet has support for Bare server v3
@@ -65,4 +74,4 @@ self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event)));
6574

6675
- This is the first official release of the Ultraviolet library.
6776
- The `uv.bundle.js` script is built using Webpack, allowing users to easily bundle their own scripts and dependencies with Ultraviolet.
68-
- This project is still under active development, and future releases will include new features and improvements.
77+
- This project is still under active development, and future releases will include new features and improvements.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ Some of the popular websites that Ultraviolet supports include:
2424

2525
## Used by
2626

27+
- [Alu](https://github.com/titaniumnetwork-dev/Alu)
28+
- [AnuraOS](https://github.com/MercuryWorkshop/anuraOS)
29+
- [Nebula](https://github.com/NebulaServices/Nebula)
2730
- [Holy Unblocker](https://github.com/holy-unblocker/website)
28-
- [Hypertabs](https://hypertabs.cc/)
2931
- [Terbium](https://github.com/TerbiumOS/webOS)
3032
- [Incognito](https://github.com/caracal-js/Incognito)
31-
- [Nebula](https://github.com/NebulaServices/Nebula)
32-
- [Noctura](https://github.com/NebulaServices/Noctura)
3333
- [Metallic](https://github.com/Metallic-Web/Metallic)
3434

3535
## Upgrading
3636

37-
A guide for updating from v1 to v2 can be found [here](./docs/V2-UPGRADE-GUIDE.md).
37+
A guide for updating from any version to v3 can be found [here](https://github.com/titaniumnetwork-dev/Ultraviolet/wiki/Upgrading).
3838

39-
## Older Bare servers
39+
## Older Ultraviolet versions
4040

41-
Starting from v2, Ultraviolet only supports Bare servers v3+.
41+
Starting from v3, Ultraviolet uses [bare-mux](https://github.com/MercuryWorkshop/bare-mux), a library that allows you to switch out your Bare client.
4242

43-
If you operate an outdated Bare server, we encourage you to update. If you're using an outdated Bare server, we encourage you to find an updated Bare server or host your own.
43+
If you operate using an older Ultraviolet, we encourage you to update.
4444

4545
If you're too lazy to do either of the above, you can install an outdated and unsupported version of Ultraviolet.
4646

@@ -58,4 +58,4 @@ This repository can be built, but it can't be deployed to any services. See [Ult
5858

5959
## Documentation
6060

61-
Documentation can be found in the [wiki](https://github.com/titaniumnetwork-dev/Ultraviolet/wiki).
61+
Documentation can be found in the [wiki](https://github.com/titaniumnetwork-dev/Ultraviolet/wiki).

build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ await build({
3131
),
3232
},
3333
bundle: true,
34+
logLevel: 'info',
3435
outdir: 'dist/',
3536
});

docs/V2-UPGRADE-GUIDE.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

package-lock.json

Lines changed: 54 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@titaniumnetwork-dev/ultraviolet",
3-
"version": "2.0.0",
3+
"version": "3.1.0",
44
"description": "Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!",
55
"main": "lib/index.cjs",
66
"license": "MIT",
@@ -18,10 +18,12 @@
1818
"scripts": {
1919
"build": "node build.js",
2020
"dev": "node build.js --dev",
21-
"prepack": "npm run build"
21+
"prepack": "npm run build",
22+
"publish": "npm run build && npm publish --access public",
23+
"pack": "npm run build && npm pack"
2224
},
2325
"devDependencies": {
24-
"@tomphttp/bare-client": "^2.2.0-alpha",
26+
"@mercuryworkshop/bare-mux": "^1.0.7",
2527
"css-tree": "^2.3.1",
2628
"esbuild": "^0.18.11",
2729
"eslint": "^8.28.0",

src/client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class UVClient extends EventEmitter {
3434
/**
3535
*
3636
* @param {typeof globalThis} window
37-
* @param {import('@tomphttp/bare-client').BareClient} bareClient
37+
* @param {import('@mercuryworkshop/bare-mux').BareClient} bareClient
3838
* @param {boolean} worker
3939
*/
4040
constructor(window = self, bareClient, worker = !window.window) {

src/rewrite/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
wrapEval,
3535
} from './rewrite.script.js';
3636
import { openDB } from 'idb';
37-
import { BareClient } from '@tomphttp/bare-client';
37+
import { BareClient } from '@mercuryworkshop/bare-mux';
3838
import EventEmitter from 'events';
3939

4040
/**

src/uv.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/*global Ultraviolet*/
22
self.__uv$config = {
33
prefix: '/service/',
4-
bare: '/bare/',
54
encodeUrl: Ultraviolet.codec.xor.encode,
65
decodeUrl: Ultraviolet.codec.xor.decode,
76
handler: '/uv.handler.js',

src/uv.handler.js

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const UVClient = self.UVClient;
1414
const __uv$config = self.__uv$config;
1515

1616
/**
17-
* @type {import('@tomphttp/bare-client').BareManifest}
17+
* @type {import('@mercuryworkshop/bare-mux').BareManifest}
1818
*/
1919
const __uv$bareData = self.__uv$bareData;
2020

@@ -63,7 +63,7 @@ function __uvHook(window) {
6363
}*/
6464

6565
// websockets
66-
const bareClient = new Ultraviolet.BareClient(__uv$bareURL, __uv$bareData);
66+
const bareClient = new Ultraviolet.BareClient();
6767

6868
const client = new UVClient(window, bareClient, worker);
6969
const {
@@ -1023,28 +1023,12 @@ function __uvHook(window) {
10231023
if (cookieStr !== '') requestHeaders['Cookie'] = cookieStr.toString();
10241024

10251025
event.respondWith(
1026-
bareClient.createWebSocket(event.data.args[0], event.data.args[1], {
1027-
headers: requestHeaders,
1028-
readyStateHook: (socket, getReadyState) => {
1029-
socket.__uv$getReadyState = getReadyState;
1030-
},
1031-
sendErrorHook: (socket, getSendError) => {
1032-
socket.__uv$getSendError = getSendError;
1033-
},
1034-
urlHook: (socket, url) => {
1035-
socket.__uv$socketUrl = url;
1036-
},
1037-
protocolHook: (socket, getProtocol) => {
1038-
socket.__uv$getProtocol = getProtocol;
1039-
},
1040-
setCookiesCallback: (setCookies) => {
1041-
// document.cookie is hooked
1042-
// so we can just call it
1043-
for (const cookie of setCookies)
1044-
window.document.cookie = cookie;
1045-
},
1046-
webSocketImpl: event.target,
1047-
})
1026+
bareClient.createWebSocket(
1027+
event.data.args[0],
1028+
event.data.args[1],
1029+
event.target,
1030+
requestHeaders,
1031+
)
10481032
);
10491033
});
10501034

0 commit comments

Comments
 (0)