Added new token variable in vnc.html and ui.js
If token is already present in path the new variable is ignored.
This commit is contained in:
parent
3f3ef04515
commit
12831204cf
|
|
@ -96,6 +96,7 @@ var UI;
|
|||
UI.initSetting('view_only', false);
|
||||
UI.initSetting('path', 'websockify');
|
||||
UI.initSetting('repeaterID', '');
|
||||
UI.initSetting('token', '');
|
||||
|
||||
var autoconnect = WebUtil.getQueryVar('autoconnect', false);
|
||||
if (autoconnect === 'true' || autoconnect == '1') {
|
||||
|
|
@ -519,6 +520,7 @@ var UI;
|
|||
UI.connSettingsOpen = false;
|
||||
UI.saveSetting('host');
|
||||
UI.saveSetting('port');
|
||||
UI.saveSetting('token');
|
||||
//UI.saveSetting('password');
|
||||
} else {
|
||||
$D('noVNC_controls').style.display = "block";
|
||||
|
|
@ -810,7 +812,17 @@ var UI;
|
|||
var host = $D('noVNC_host').value;
|
||||
var port = $D('noVNC_port').value;
|
||||
var password = $D('noVNC_password').value;
|
||||
var token = $D('noVNC_token').value;
|
||||
var path = $D('noVNC_path').value;
|
||||
|
||||
//if token is in path then ignore the new token variable
|
||||
if (token && !(path.indexOf("token") > -1)){
|
||||
if (path.indexOf("?") > -1)
|
||||
path += "&token=" + token; //there is a query string already
|
||||
else
|
||||
path += "?token=" + token;
|
||||
}
|
||||
|
||||
if ((!host) || (!port)) {
|
||||
throw new Error("Must set host and port");
|
||||
}
|
||||
|
|
|
|||
1
vnc.html
1
vnc.html
|
|
@ -197,6 +197,7 @@
|
|||
<li><label><strong>Host: </strong><input id="noVNC_host" /></label></li>
|
||||
<li><label><strong>Port: </strong><input id="noVNC_port" /></label></li>
|
||||
<li><label><strong>Password: </strong><input id="noVNC_password" type="password" /></label></li>
|
||||
<li><label><strong>Token: </strong><input id="noVNC_token"/></label></li>
|
||||
<li><input id="noVNC_connect_button" type="button" value="Connect"></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -208,11 +208,14 @@
|
|||
token = WebUtil.getQueryVar('token', null);
|
||||
if (token) {
|
||||
|
||||
if (path.indexOf("?") > -1)
|
||||
path += "&token=" + token; //there is a query string already
|
||||
else
|
||||
path += "?token=" + token;
|
||||
|
||||
//if token is already present in the path we should use it
|
||||
if (!(path.indexOf("token") > -1)){
|
||||
if (path.indexOf("?") > -1)
|
||||
path += "&token=" + token; //there is a query string already
|
||||
else
|
||||
path += "?token=" + token;
|
||||
}
|
||||
|
||||
WebUtil.createCookie('token', token, 1)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue