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('view_only', false);
|
||||||
UI.initSetting('path', 'websockify');
|
UI.initSetting('path', 'websockify');
|
||||||
UI.initSetting('repeaterID', '');
|
UI.initSetting('repeaterID', '');
|
||||||
|
UI.initSetting('token', '');
|
||||||
|
|
||||||
var autoconnect = WebUtil.getQueryVar('autoconnect', false);
|
var autoconnect = WebUtil.getQueryVar('autoconnect', false);
|
||||||
if (autoconnect === 'true' || autoconnect == '1') {
|
if (autoconnect === 'true' || autoconnect == '1') {
|
||||||
|
|
@ -519,6 +520,7 @@ var UI;
|
||||||
UI.connSettingsOpen = false;
|
UI.connSettingsOpen = false;
|
||||||
UI.saveSetting('host');
|
UI.saveSetting('host');
|
||||||
UI.saveSetting('port');
|
UI.saveSetting('port');
|
||||||
|
UI.saveSetting('token');
|
||||||
//UI.saveSetting('password');
|
//UI.saveSetting('password');
|
||||||
} else {
|
} else {
|
||||||
$D('noVNC_controls').style.display = "block";
|
$D('noVNC_controls').style.display = "block";
|
||||||
|
|
@ -810,7 +812,17 @@ var UI;
|
||||||
var host = $D('noVNC_host').value;
|
var host = $D('noVNC_host').value;
|
||||||
var port = $D('noVNC_port').value;
|
var port = $D('noVNC_port').value;
|
||||||
var password = $D('noVNC_password').value;
|
var password = $D('noVNC_password').value;
|
||||||
|
var token = $D('noVNC_token').value;
|
||||||
var path = $D('noVNC_path').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)) {
|
if ((!host) || (!port)) {
|
||||||
throw new Error("Must set host and 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>Host: </strong><input id="noVNC_host" /></label></li>
|
||||||
<li><label><strong>Port: </strong><input id="noVNC_port" /></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>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>
|
<li><input id="noVNC_connect_button" type="button" value="Connect"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -208,10 +208,13 @@
|
||||||
token = WebUtil.getQueryVar('token', null);
|
token = WebUtil.getQueryVar('token', null);
|
||||||
if (token) {
|
if (token) {
|
||||||
|
|
||||||
|
//if token is already present in the path we should use it
|
||||||
|
if (!(path.indexOf("token") > -1)){
|
||||||
if (path.indexOf("?") > -1)
|
if (path.indexOf("?") > -1)
|
||||||
path += "&token=" + token; //there is a query string already
|
path += "&token=" + token; //there is a query string already
|
||||||
else
|
else
|
||||||
path += "?token=" + token;
|
path += "?token=" + token;
|
||||||
|
}
|
||||||
|
|
||||||
WebUtil.createCookie('token', token, 1)
|
WebUtil.createCookie('token', token, 1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue