|
1 | 1 | import { HOSTED_CAPTUN_HOSTNAME, isLoopbackHostname, RESERVED_TUNNEL_NAMES } from "../routing.js"; |
2 | 2 | import { WWW_BROWSER_MODULE } from "./browser-module.generated.js"; |
3 | 3 |
|
4 | | -declare const createCaptunTunnel: typeof import("../index").createCaptunTunnel; |
| 4 | +declare const createCaptunTunnel: typeof import("../index.js").createCaptunTunnel; |
5 | 5 |
|
6 | 6 | declare function runtimeImport<T = unknown>(specifier: string): Promise<T>; |
7 | 7 |
|
@@ -120,23 +120,21 @@ function chatRoomDemoSource() { |
120 | 120 |
|
121 | 121 | const messages = window.chatMessages.join("\n").replace(/[^\w\s-,.'"!?():]/g, ""); |
122 | 122 |
|
123 | | - return new Response( |
124 | | - String(` |
125 | | - <script> |
126 | | - let username = document.cookie.match(/username=([^;]+)/)?.[1]; |
127 | | - username ||= 'user' + Math.random().toString().slice(2, 8); |
128 | | - document.cookie = 'username=' + username + '; Path=/; Secure'; |
129 | | - function send(form) { |
130 | | - fetch('/', { method: 'POST', body: username + ': ' + form.m.value }).then(() => location.reload()); |
131 | | - } |
132 | | - </script> |
133 | | - <pre>${messages}</pre> |
134 | | - <form onsubmit="send(this); return false"> |
135 | | - <input name="m" style="font-size:16px" autofocus><button>send</button> |
136 | | - </form> |
137 | | - `), |
138 | | - { headers: { "content-type": "text/html; charset=utf-8" } }, |
139 | | - ); |
| 123 | + const html = ` |
| 124 | + <script> |
| 125 | + let username = document.cookie.match(/username=([^;]+)/)?.[1]; |
| 126 | + username ||= 'user' + Math.random().toString().slice(2, 8); |
| 127 | + document.cookie = 'username=' + username + '; Path=/; Secure'; |
| 128 | + function send(form) { |
| 129 | + fetch('/', { method: 'POST', body: username + ': ' + form.msg.value }).then(() => location.reload()); |
| 130 | + } |
| 131 | + </script> |
| 132 | + <pre>${messages}</pre> |
| 133 | + <form onsubmit="send(this); return false"> |
| 134 | + <input name="msg" style="font-size:16px" autofocus><button>send</button> |
| 135 | + </form> |
| 136 | + `; |
| 137 | + return new Response(html, { headers: { "content-type": "text/html; charset=utf-8" } }); |
140 | 138 | }, |
141 | 139 | }); |
142 | 140 | } |
|
0 commit comments