add default channel in connection dialog/connect

This commit is contained in:
encrypt 2020-03-15 20:50:54 +01:00
parent 3dda3d27fe
commit ac6e230c26
3 changed files with 16 additions and 3 deletions

View file

@ -9,7 +9,8 @@ window.mumbleWebConfig = {
'port': true,
'token': true,
'username': true,
'password': true
'password': true,
'channelName': false
},
// Default values for user settings
// You can see your current value by typing `localStorage.getItem('mumble.$setting')` in the web console.

View file

@ -52,6 +52,10 @@
<td>Password</td>
<td><input id="password" type="password" data-bind="value: password"></td>
</tr>
<tr data-bind="if: $root.config.connectDialog.channelName">
<td>Channel</td>
<td><input id="channelName" type="text" data-bind="value: channelName"></td>
</tr>
</table>
<div class="dialog-footer">
<input class="dialog-close" type="button" data-bind="click: hide" value="Cancel">

View file

@ -55,13 +55,14 @@ function ConnectDialog () {
self.token = ko.observable('')
self.username = ko.observable('')
self.password = ko.observable('')
self.channelName = ko.observable('')
self.joinOnly = ko.observable(false)
self.visible = ko.observable(true)
self.show = self.visible.bind(self.visible, true)
self.hide = self.visible.bind(self.visible, false)
self.connect = function () {
self.hide()
ui.connect(self.username(), self.address(), self.port(), self.token(), self.password())
ui.connect(self.username(), self.address(), self.port(), self.token(), self.password(), self.channelName())
}
}
@ -331,7 +332,7 @@ class GlobalBindings {
return '[' + new Date().toLocaleTimeString('en-US') + ']'
}
this.connect = (username, host, port, token, password) => {
this.connect = (username, host, port, token, password, channelName = "") => {
this.resetClient()
this.remoteHost(host)
@ -363,6 +364,10 @@ class GlobalBindings {
// Register all channels, recursively
const registerChannel = channel => {
this._newChannel(channel)
// join channel
if (channel.name === channelName) {
client.self.setChannel(channel)
}
channel.children.forEach(registerChannel)
}
registerChannel(client.root)
@ -901,6 +906,9 @@ window.onload = function () {
if (queryParams.password) {
ui.connectDialog.password(queryParams.password)
}
if (queryParams.channelName) {
ui.connectDialog.channelName(queryParams.channelName)
}
if (queryParams.avatarurl) {
// Download the avatar and upload it to the mumble server when connected
let url = queryParams.avatarurl