From 9475ffb8c69bfe415058f544ad53abe595dcd2ee Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 8 Nov 2021 13:01:54 +0100 Subject: [PATCH] Don't auto-join without prompting user --- components/app.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/components/app.js b/components/app.js index 471c974..661ba94 100644 --- a/components/app.js +++ b/components/app.js @@ -229,6 +229,8 @@ export default class App extends Component { }; } + let autojoin = []; + let queryParams = parseQueryString(); // Don't allow to silently override the server URL if there's one in // config.json, because this has security implications. But still allow @@ -245,19 +247,28 @@ export default class App extends Component { connectParams.nick = queryParams.nick; } if (typeof queryParams.channels === "string") { - connectParams.autojoin = queryParams.channels.split(","); + autojoin = queryParams.channels.split(","); } - if (typeof queryParams.open === "string") { this.autoOpenURL = irc.parseURL(queryParams.open); } if (window.location.hash) { - connectParams.autojoin = window.location.hash.split(","); + autojoin = window.location.hash.split(","); } this.config = config; + if (autojoin.length > 0) { + if (connectParams.autoconnect) { + // Ask the user whether they want to join that new channel. + // TODO: support multiple channels here + this.autoOpenURL = { host: "", entity: autojoin[0] }; + } else { + connectParams.autojoin = autojoin; + } + } + this.setState({ connectParams: connectParams }); if (connectParams.autoconnect) {