Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- public/index.js +7 -3
public/index.js
CHANGED
|
@@ -6,7 +6,12 @@ async function initProxy() {
|
|
| 6 |
try {
|
| 7 |
const { BareMuxConnection } = await import('/baremux/index.mjs');
|
| 8 |
const connection = new BareMuxConnection("/baremux/worker.js");
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
console.log("BareMux transport initialized successfully.");
|
| 11 |
} catch (e) {
|
| 12 |
console.log("BareMux init error (safe to ignore if not breaking):", e);
|
|
@@ -33,11 +38,10 @@ form.addEventListener('submit', async (e) => {
|
|
| 33 |
}
|
| 34 |
|
| 35 |
try {
|
| 36 |
-
await navigator.serviceWorker.ready;
|
| 37 |
const encodedUrl = __uv$config.encodeUrl(url);
|
| 38 |
window.location.href = __uv$config.prefix + encodedUrl;
|
| 39 |
} catch (err) {
|
| 40 |
console.error(err);
|
| 41 |
-
alert('エラーが発生しました。
|
| 42 |
}
|
| 43 |
});
|
|
|
|
| 6 |
try {
|
| 7 |
const { BareMuxConnection } = await import('/baremux/index.mjs');
|
| 8 |
const connection = new BareMuxConnection("/baremux/worker.js");
|
| 9 |
+
|
| 10 |
+
// Use setManualTransport to bypass any constructor wrapper issues
|
| 11 |
+
await connection.setManualTransport(`
|
| 12 |
+
const { default: BareTransport } = await import("/bareclient/index.js");
|
| 13 |
+
return [BareTransport, ["/bare/"]];
|
| 14 |
+
`, [], []);
|
| 15 |
console.log("BareMux transport initialized successfully.");
|
| 16 |
} catch (e) {
|
| 17 |
console.log("BareMux init error (safe to ignore if not breaking):", e);
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
try {
|
|
|
|
| 41 |
const encodedUrl = __uv$config.encodeUrl(url);
|
| 42 |
window.location.href = __uv$config.prefix + encodedUrl;
|
| 43 |
} catch (err) {
|
| 44 |
console.error(err);
|
| 45 |
+
alert('エラーが発生しました。');
|
| 46 |
}
|
| 47 |
});
|