From c79e5cb2c3eff0eed70a32a72fcb4d4e91cb6b35 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Thu, 23 Feb 2023 19:45:36 +0100
Subject: Escape role in websocket connection.

---
 public/common/play.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'public')

diff --git a/public/common/play.js b/public/common/play.js
index 02a415d..0ad8765 100644
--- a/public/common/play.js
+++ b/public/common/play.js
@@ -387,7 +387,7 @@ function connect_play() {
 
 	let protocol = (window.location.protocol === "http:") ? "ws" : "wss"
 	let seen = document.getElementById("log").children.length
-	let url = `${protocol}://${window.location.host}/play-socket?title=${params.title_id}&game=${params.game_id}&role=${params.role}&seen=${seen}`
+	let url = `${protocol}://${window.location.host}/play-socket?title=${params.title_id}&game=${params.game_id}&role=${encodeURIComponent(params.role)}&seen=${seen}`
 
 	console.log("CONNECTING", url)
 	document.getElementById("prompt").textContent = "Connecting... "
-- 
cgit v1.2.3