Merge pull request #62 from encrypt94/master

add channel option in connection dialog
This commit is contained in:
Jonas Herzig 2020-03-21 09:49:14 +01:00 committed by GitHub
commit 27b109539a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 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)
@ -361,11 +362,14 @@ class GlobalBindings {
window.matrixWidget.setAlwaysOnScreen(true)
// Register all channels, recursively
const registerChannel = channel => {
const registerChannel = (channel, channelPath) => {
this._newChannel(channel)
channel.children.forEach(registerChannel)
if(channelPath === channelName) {
client.self.setChannel(channel)
}
registerChannel(client.root)
channel.children.forEach(ch => registerChannel(ch, channelPath+"/"+ch.name))
}
registerChannel(client.root, "")
// Register all users
client.users.forEach(user => this._newUser(user))
@ -901,6 +905,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