Always parse autojoin channels from URL params
Even if connection parameters were previously saved to local storage.
This commit is contained in:
parent
ac5bbafdc3
commit
08678ba57e
1 changed files with 23 additions and 18 deletions
|
@ -194,15 +194,6 @@ export default class App extends Component {
|
||||||
|
|
||||||
this.saveReceipts = debounce(this.saveReceipts.bind(this), 500);
|
this.saveReceipts = debounce(this.saveReceipts.bind(this), 500);
|
||||||
|
|
||||||
var connectParams = store.autoconnect.load();
|
|
||||||
if (connectParams) {
|
|
||||||
this.state.connectParams = {
|
|
||||||
...this.state.connectParams,
|
|
||||||
...connectParams,
|
|
||||||
autoconnect: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
this.receipts = store.receipts.load();
|
this.receipts = store.receipts.load();
|
||||||
|
|
||||||
configPromise.then((config) => {
|
configPromise.then((config) => {
|
||||||
|
@ -211,12 +202,17 @@ export default class App extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle configuration data and populate the connection parameters.
|
||||||
|
*
|
||||||
|
* The priority order is:
|
||||||
|
*
|
||||||
|
* - URL params
|
||||||
|
* - Saved parameters in local storage
|
||||||
|
* - Configuration data (fetched from the config.json file)
|
||||||
|
* - Default server URL constructed from the current URL location
|
||||||
|
*/
|
||||||
handleConfig(config) {
|
handleConfig(config) {
|
||||||
if (this.state.connectParams.autoconnect) {
|
|
||||||
// Connection params have already been loaded from local storage
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var host = window.location.host || "localhost:8080";
|
var host = window.location.host || "localhost:8080";
|
||||||
var proto = "wss:";
|
var proto = "wss:";
|
||||||
if (window.location.protocol != "https:") {
|
if (window.location.protocol != "https:") {
|
||||||
|
@ -240,6 +236,15 @@ export default class App extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var autoconnect = store.autoconnect.load();
|
||||||
|
if (autoconnect) {
|
||||||
|
connectParams = {
|
||||||
|
...connectParams,
|
||||||
|
...autoconnect,
|
||||||
|
autoconnect: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var queryParams = parseQueryString();
|
var queryParams = parseQueryString();
|
||||||
if (queryParams.server) {
|
if (queryParams.server) {
|
||||||
if (queryParams.server.startsWith("/")) {
|
if (queryParams.server.startsWith("/")) {
|
||||||
|
@ -259,6 +264,10 @@ export default class App extends Component {
|
||||||
this.setState((state) => {
|
this.setState((state) => {
|
||||||
return { connectParams: { ...state.connectParams, ...connectParams } };
|
return { connectParams: { ...state.connectParams, ...connectParams } };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (connectParams.autoconnect) {
|
||||||
|
this.connect(connectParams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dismissError(event) {
|
dismissError(event) {
|
||||||
|
@ -1100,10 +1109,6 @@ export default class App extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.state.connectParams.autoconnect) {
|
|
||||||
this.connect(this.state.connectParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
setupKeybindings(this);
|
setupKeybindings(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue