|
15 | 15 | <script src="../libcurl/index.js"></script> |
16 | 16 | <script src="../baremux/index.js" defer></script> |
17 | 17 | <script> |
18 | | - (async () => { |
19 | | - if ('serviceWorker' in navigator) { |
20 | | - await navigator.serviceWorker.register('/sw.js', { |
21 | | - scope: '/sw/', |
22 | | - }).then(async () => { |
23 | | - const connection = new BareMux.BareMuxConnection("/baremux/worker.js") |
24 | | - let transport = localStorage.getItem('transport') || "/epoxy/index.mjs" |
25 | | - // Feel free to remove this, its just for skids to stop making issues on it |
26 | | - if (window.location.origin.includes('.pages.dev')) { |
27 | | - console.log('your static hosting, using TOMP Wisp Server.') |
28 | | - let wispserver = "wss://tomp.app/wisp" |
29 | | - await connection.setTransport(transport, [{ wisp: wispserver }]); |
30 | | - } else { |
31 | | - console.log('Using Backend Wisp Server, if your static hosting just delete these lines bellow and uncomment out the text bellow') |
32 | | - //let wispserver = "wss://tomp.app/wisp" Uncomment if static hosting |
33 | | - let wispserver = `${window.location.origin.replace(/^https?:\/\//, 'ws://')}/wisp/` |
34 | | - await connection.setTransport(transport, [{ wisp: wispserver }]); |
35 | | - } |
36 | | - }); |
| 18 | + window.addEventListener("load", async () => { |
| 19 | + if ('serviceWorker' in navigator) { |
| 20 | + await navigator.serviceWorker.register('/sw.js', { |
| 21 | + scope: '/sw/', |
| 22 | + }).then(async () => { |
| 23 | + const connection = new BareMux.BareMuxConnection("/baremux/worker.js") |
| 24 | + let transport = localStorage.getItem('transport') || "/epoxy/index.mjs" |
| 25 | + // Feel free to remove this, its just for skids to stop making issues on it |
| 26 | + if (window.location.origin.includes('.pages.dev')) { |
| 27 | + console.log('your static hosting, using TOMP Wisp Server.') |
| 28 | + let wispserver = "wss://tomp.app/wisp" |
| 29 | + await connection.setTransport(transport, [{ wisp: wispserver }]); |
| 30 | + } else { |
| 31 | + console.log('Using Backend Wisp Server, if your static hosting just delete these lines bellow and uncomment out the text bellow') |
| 32 | + //let wispserver = "wss://tomp.app/wisp" Uncomment if static hosting |
| 33 | + let wispserver = `${window.location.origin.replace(/^https?:\/\//, 'ws://')}/wisp/` |
| 34 | + await connection.setTransport(transport, [{ wisp: wispserver }]); |
| 35 | + } |
| 36 | + }); |
37 | 37 |
|
38 | | - await navigator.serviceWorker.register('/dynsw.js', { |
39 | | - scope: '/dyn/', |
40 | | - }); |
| 38 | + await navigator.serviceWorker.register('/dynsw.js', { |
| 39 | + scope: '/dyn/', |
| 40 | + }); |
41 | 41 | } |
42 | 42 |
|
43 | 43 | if (!localStorage.getItem('HTfirstRun')) { |
44 | 44 | console.log('kongsole') |
45 | 45 | localStorage.setItem('HTfirstRun', false) |
46 | 46 | window.location.reload() |
47 | 47 | } |
48 | | - })(); |
| 48 | + }) |
49 | 49 |
|
50 | 50 | // check custom functions |
51 | 51 | document.addEventListener('keydown', key => { |
|
0 commit comments