Allow paths in server URL query param

This commit is contained in:
Simon Ser 2020-07-01 12:25:57 +02:00
parent db13f34a40
commit c309d3cff6
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -67,17 +67,24 @@ export default class App extends Component {
} else {
var params = parseQueryString();
if (params.server) {
this.state.connectParams.serverURL = params.server;
} else {
var host = window.location.host || "localhost:8080";
var proto = "wss:";
if (window.location.protocol != "https:") {
proto = "ws:";
}
this.state.connectParams.serverURL = proto + "//" + host + "/socket";
var host = window.location.host || "localhost:8080";
var proto = "wss:";
if (window.location.protocol != "https:") {
proto = "ws:";
}
var serverURL;
if (params.server) {
if (params.server.startsWith("/")) {
serverURL = proto + "//" + host + params.server;
} else {
serverURL = params.server;
}
} else {
serverURL = proto + "//" + host + "/socket";
}
this.state.connectParams.serverURL = serverURL;
if (params.channels) {
this.state.connectParams.autojoin = params.channels.split(",");
}