diff options
-rw-r--r-- | Caddyfile | 19 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | src/main.ts | 4 |
3 files changed, 25 insertions, 3 deletions
diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..ac42b03 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,19 @@ +http://127.0.0.1, https://localhost { + file_server /* { + root build/ + } + + reverse_proxy /api* { + to http://localhost:8000 + } + + reverse_proxy /api/ws { + to 127.0.0.1:8001 + } +} + +ws://localhost { + reverse_proxy * { + to localhost:8001 + } +} @@ -9,4 +9,7 @@ copy: cp src/main.css build/ clean: - rm -r build
\ No newline at end of file + rm -r build + +run: build + caddy run
\ No newline at end of file diff --git a/src/main.ts b/src/main.ts index c6ec627..f3a0461 100644 --- a/src/main.ts +++ b/src/main.ts @@ -487,7 +487,7 @@ function sleep(ms) { async function ws_connect(t: number): Promise<WebSocket> { await sleep(t * 1000); - return new WebSocket('ws://localhost:8001') + return new WebSocket('wss://' + location.host + "/api/ws") } function ws_setup(t: number = 0) { @@ -512,7 +512,7 @@ function ws_setup(t: number = 0) { }); socket.addEventListener('open', (event) => { - get_newest_messages(); + // get_newest_messages(); }); }) |