Merge pull request #62 from encrypt94/master
add channel option in connection dialog
This commit is contained in:
commit
27b109539a
|
@ -9,7 +9,8 @@ window.mumbleWebConfig = {
|
||||||
'port': true,
|
'port': true,
|
||||||
'token': true,
|
'token': true,
|
||||||
'username': true,
|
'username': true,
|
||||||
'password': true
|
'password': true,
|
||||||
|
'channelName': false
|
||||||
},
|
},
|
||||||
// Default values for user settings
|
// Default values for user settings
|
||||||
// You can see your current value by typing `localStorage.getItem('mumble.$setting')` in the web console.
|
// You can see your current value by typing `localStorage.getItem('mumble.$setting')` in the web console.
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
<td>Password</td>
|
<td>Password</td>
|
||||||
<td><input id="password" type="password" data-bind="value: password"></td>
|
<td><input id="password" type="password" data-bind="value: password"></td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<input class="dialog-close" type="button" data-bind="click: hide" value="Cancel">
|
<input class="dialog-close" type="button" data-bind="click: hide" value="Cancel">
|
||||||
|
|
17
app/index.js
17
app/index.js
|
@ -55,13 +55,14 @@ function ConnectDialog () {
|
||||||
self.token = ko.observable('')
|
self.token = ko.observable('')
|
||||||
self.username = ko.observable('')
|
self.username = ko.observable('')
|
||||||
self.password = ko.observable('')
|
self.password = ko.observable('')
|
||||||
|
self.channelName = ko.observable('')
|
||||||
self.joinOnly = ko.observable(false)
|
self.joinOnly = ko.observable(false)
|
||||||
self.visible = ko.observable(true)
|
self.visible = ko.observable(true)
|
||||||
self.show = self.visible.bind(self.visible, true)
|
self.show = self.visible.bind(self.visible, true)
|
||||||
self.hide = self.visible.bind(self.visible, false)
|
self.hide = self.visible.bind(self.visible, false)
|
||||||
self.connect = function () {
|
self.connect = function () {
|
||||||
self.hide()
|
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') + ']'
|
return '[' + new Date().toLocaleTimeString('en-US') + ']'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connect = (username, host, port, token, password) => {
|
this.connect = (username, host, port, token, password, channelName = "") => {
|
||||||
this.resetClient()
|
this.resetClient()
|
||||||
|
|
||||||
this.remoteHost(host)
|
this.remoteHost(host)
|
||||||
|
@ -361,11 +362,14 @@ class GlobalBindings {
|
||||||
window.matrixWidget.setAlwaysOnScreen(true)
|
window.matrixWidget.setAlwaysOnScreen(true)
|
||||||
|
|
||||||
// Register all channels, recursively
|
// Register all channels, recursively
|
||||||
const registerChannel = channel => {
|
const registerChannel = (channel, channelPath) => {
|
||||||
this._newChannel(channel)
|
this._newChannel(channel)
|
||||||
channel.children.forEach(registerChannel)
|
if(channelPath === channelName) {
|
||||||
|
client.self.setChannel(channel)
|
||||||
|
}
|
||||||
|
channel.children.forEach(ch => registerChannel(ch, channelPath+"/"+ch.name))
|
||||||
}
|
}
|
||||||
registerChannel(client.root)
|
registerChannel(client.root, "")
|
||||||
|
|
||||||
// Register all users
|
// Register all users
|
||||||
client.users.forEach(user => this._newUser(user))
|
client.users.forEach(user => this._newUser(user))
|
||||||
|
@ -901,6 +905,9 @@ window.onload = function () {
|
||||||
if (queryParams.password) {
|
if (queryParams.password) {
|
||||||
ui.connectDialog.password(queryParams.password)
|
ui.connectDialog.password(queryParams.password)
|
||||||
}
|
}
|
||||||
|
if (queryParams.channelName) {
|
||||||
|
ui.connectDialog.channelName(queryParams.channelName)
|
||||||
|
}
|
||||||
if (queryParams.avatarurl) {
|
if (queryParams.avatarurl) {
|
||||||
// Download the avatar and upload it to the mumble server when connected
|
// Download the avatar and upload it to the mumble server when connected
|
||||||
let url = queryParams.avatarurl
|
let url = queryParams.avatarurl
|
||||||
|
|
Loading…
Reference in a new issue