diff options
author | pommicket <pommicket@gmail.com> | 2024-08-09 16:11:01 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2024-08-09 16:11:01 -0400 |
commit | 49ead013d986bbc105e3a401ecd37202cb8ca034 (patch) | |
tree | da59e4a5f5db0892baad3251c4a991de85d0503a | |
parent | 359603fbfe4e1405b0e98f1efa34768fc38805be (diff) |
beter url
-rw-r--r-- | game.js | 4 | ||||
-rw-r--r-- | server/src/main.rs | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -1,6 +1,6 @@ 'use strict'; window.addEventListener('load', function () { - const socket = new WebSocket("ws://localhost:3000"); + const socket = new WebSocket(`${location.protocol === "file:" || location.hostname === "localhost" ? "ws://localhost:54472" : "wss://jigsaw.pommicket.com"}`); const searchParams = new URL(location.href).searchParams; socket.binaryType = "arraybuffer"; let imageUrl = searchParams.get('image');//"https://upload.wikimedia.org/wikipedia/commons/0/09/Croatia_Opatija_Maiden_with_the_Seagull_BW_2014-10-10_10-35-13.jpg"; @@ -22,7 +22,7 @@ window.addEventListener('load', function () { if (imageUrl.startsWith('http')) { // make sure we use https let url = new URL(imageUrl); - url.protocol = 'https'; + url.protocol = 'https:'; imageUrl = url.href; } const image = new Image(); diff --git a/server/src/main.rs b/server/src/main.rs index 4e397f1..059ce44 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -266,7 +266,7 @@ fn read_to_lines(path: &str) -> std::io::Result<Vec<String>> { #[tokio::main] async fn main() { - let port = 3000; + let port = 54472; let host_addr = SocketAddr::from(([127, 0, 0, 1], port)); let listener = match tokio::net::TcpListener::bind(host_addr).await { Ok(l) => l, |