From 49ead013d986bbc105e3a401ecd37202cb8ca034 Mon Sep 17 00:00:00 2001 From: pommicket Date: Fri, 9 Aug 2024 16:11:01 -0400 Subject: beter url --- game.js | 4 ++-- server/src/main.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/game.js b/game.js index 1110027..48b0560 100644 --- a/game.js +++ b/game.js @@ -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> { #[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, -- cgit v1.2.3