|
1 | 1 | import { ScramjetFrame } from "@/controller/frame"; |
| 2 | +import initEpoxy, { |
| 3 | + EpoxyClient, |
| 4 | + EpoxyClientOptions, |
| 5 | + EpoxyHandlers, |
| 6 | + info as epoxyInfo, |
| 7 | +} from "@mercuryworkshop/epoxy-tls"; |
2 | 8 | import { SCRAMJETCLIENT, SCRAMJETFRAME } from "@/symbols"; |
3 | 9 | import { createDocumentProxy } from "@client/document"; |
4 | 10 | import { createGlobalProxy } from "@client/global"; |
5 | 11 | import { getOwnPropertyDescriptorHandler } from "@client/helpers"; |
6 | 12 | import { createLocationProxy } from "@client/location"; |
7 | 13 | import { nativeGetOwnPropertyDescriptor } from "@client/natives"; |
8 | | -import { |
9 | | - BareClient, |
10 | | - type BareClient as BareClientType, |
11 | | -} from "@mercuryworkshop/bare-mux"; |
12 | 14 | import { createWrapFn } from "@client/shared/wrap"; |
13 | 15 | import { NavigateEvent } from "@client/events"; |
14 | 16 | import { rewriteUrl, unrewriteUrl, type URLMeta } from "@rewriters/url"; |
@@ -72,7 +74,7 @@ export class ScramjetClient { |
72 | 74 | globalProxy: any; |
73 | 75 | locationProxy: any; |
74 | 76 | serviceWorker: ServiceWorkerContainer; |
75 | | - bare: BareClientType; |
| 77 | + epoxy: EpoxyClient; |
76 | 78 |
|
77 | 79 | natives: NativeStore; |
78 | 80 | descriptors: DescriptorStore; |
@@ -102,22 +104,29 @@ export class ScramjetClient { |
102 | 104 | throw new Error(); |
103 | 105 | } |
104 | 106 |
|
| 107 | + initEpoxy().then(() => { |
| 108 | + let options = new EpoxyClientOptions(); |
| 109 | + options.user_agent = navigator.userAgent; |
| 110 | + this.epoxy = new EpoxyClient(config.wisp, options); |
| 111 | + }); |
| 112 | + |
105 | 113 | if (iswindow) { |
106 | | - this.bare = new BareClient(); |
| 114 | + // this.bare = new EpoxyClient(); |
| 115 | + // this.bare = new BareClient(); |
107 | 116 | } else { |
108 | | - this.bare = new BareClient( |
109 | | - new Promise((resolve) => { |
110 | | - addEventListener("message", ({ data }) => { |
111 | | - if (typeof data !== "object") return; |
112 | | - if ( |
113 | | - "$scramjet$type" in data && |
114 | | - data.$scramjet$type === "baremuxinit" |
115 | | - ) { |
116 | | - resolve(data.port); |
117 | | - } |
118 | | - }); |
119 | | - }) |
120 | | - ); |
| 117 | + // this.bare = new BareClient( |
| 118 | + // new Promise((resolve) => { |
| 119 | + // addEventListener("message", ({ data }) => { |
| 120 | + // if (typeof data !== "object") return; |
| 121 | + // if ( |
| 122 | + // "$scramjet$type" in data && |
| 123 | + // data.$scramjet$type === "baremuxinit" |
| 124 | + // ) { |
| 125 | + // resolve(data.port); |
| 126 | + // } |
| 127 | + // }); |
| 128 | + // }) |
| 129 | + // ); |
121 | 130 | } |
122 | 131 |
|
123 | 132 | this.serviceWorker = this.global.navigator.serviceWorker; |
|
0 commit comments