mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
more organization + add websocket rewriting
This commit is contained in:
parent
30adf894aa
commit
0456e994ba
4 changed files with 19 additions and 2 deletions
|
@ -3,8 +3,9 @@ import "./trustedTypes.ts";
|
||||||
import "./eval.ts";
|
import "./eval.ts";
|
||||||
import "./storage";
|
import "./storage";
|
||||||
import "./element.ts";
|
import "./element.ts";
|
||||||
import "./fetch.ts";
|
import "./requests/fetch.ts";
|
||||||
import "./xmlhttprequest.ts";
|
import "./requests/xmlhttprequest.ts";
|
||||||
|
import "./requests/websocket.ts"
|
||||||
import "./css.ts";
|
import "./css.ts";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|
16
src/client/requests/websocket.ts
Normal file
16
src/client/requests/websocket.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { BareClient } from "@mercuryworkshop/bare-mux"
|
||||||
|
const client = new BareClient()
|
||||||
|
const RealWebSocket = WebSocket
|
||||||
|
WebSocket = new Proxy(WebSocket, {
|
||||||
|
construct(_target, args) {
|
||||||
|
return client.createWebSocket(
|
||||||
|
args[0],
|
||||||
|
args[1],
|
||||||
|
RealWebSocket,
|
||||||
|
{
|
||||||
|
"User-Agent": navigator.userAgent
|
||||||
|
},
|
||||||
|
ArrayBuffer.prototype
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue