From fafbb3c23fa50453910d10d16625d8d4092c1fd5 Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 27 Jan 2021 23:22:56 +0000 Subject: [PATCH 1/3] adding a regex in to the join session method in Menu.vue, to check if a townsquare domain has been entered in to join dialog, if it finds one it will get the session id from the # query string instead of just taking the value directly from the dialog. --- src/components/Menu.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 79715a5..8ed2507 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -255,9 +255,16 @@ export default { }, joinSession() { if (this.session.sessionId) return this.leaveSession(); - const sessionId = prompt( + let sessionId = prompt( "Enter the channel number / name of the session you want to join" ); + if ( + sessionId.match( + /^https?:\/\/([^.]+\.github\.io|localhost|clocktower\.online|eddbra1nprivatetownsquare\.xyz)/i + ) + ) { + sessionId = sessionId.split("#")[1]; + } if (sessionId) { this.$store.commit("session/clearVoteHistory"); this.$store.commit("session/setSpectator", true); From 724a218b6f0a85cc127eb3a98117df9ed6385b64 Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 29 Jan 2021 14:55:19 +0000 Subject: [PATCH 2/3] simplified the regex on joining a session to only look for anything starting with http(s):// and parseing out the code. --- src/components/Menu.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 8ed2507..eb039d9 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -258,11 +258,7 @@ export default { let sessionId = prompt( "Enter the channel number / name of the session you want to join" ); - if ( - sessionId.match( - /^https?:\/\/([^.]+\.github\.io|localhost|clocktower\.online|eddbra1nprivatetownsquare\.xyz)/i - ) - ) { + if (sessionId.match(/^https?:\/\//i)) { sessionId = sessionId.split("#")[1]; } if (sessionId) { From 7f0d60c272b3454b68d5866e8e249c95ffea5fff Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 30 Jan 2021 12:50:09 +0000 Subject: [PATCH 3/3] changed code to grab session id from pasted domain in join dialog to be a pop, to avoid errors if the hash string is not present --- src/components/Menu.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index eb039d9..5160305 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -259,7 +259,7 @@ export default { "Enter the channel number / name of the session you want to join" ); if (sessionId.match(/^https?:\/\//i)) { - sessionId = sessionId.split("#")[1]; + sessionId = sessionId.split("#").pop(); } if (sessionId) { this.$store.commit("session/clearVoteHistory");