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.

This commit is contained in:
Dave 2021-01-27 23:22:56 +00:00
parent 7c3908f1fa
commit fafbb3c23f
1 changed files with 8 additions and 1 deletions

View File

@ -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);