summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2024-08-09 16:11:01 -0400
committerpommicket <pommicket@gmail.com>2024-08-09 16:11:01 -0400
commit49ead013d986bbc105e3a401ecd37202cb8ca034 (patch)
treeda59e4a5f5db0892baad3251c4a991de85d0503a
parent359603fbfe4e1405b0e98f1efa34768fc38805be (diff)
beter url
-rw-r--r--game.js4
-rw-r--r--server/src/main.rs2
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<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,