mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
feature #4145: Add vnc button to open in an external tab with pass
(cherry picked from commit 940b21b71269ab312b168a286e5bda8e88eeb613)
This commit is contained in:
parent
ebc8b986c3
commit
f5779ce4d6
@ -29,19 +29,31 @@ define(function(require) {
|
||||
require('vnc-keysym');
|
||||
|
||||
var rfb;
|
||||
var encrypt = WebUtil.getQueryVar('encrypt', (window.location.protocol === "https:"));
|
||||
var repeaterID = WebUtil.getQueryVar('repeaterID', '');
|
||||
var true_color = WebUtil.getQueryVar('true_color', true);
|
||||
var local_cursor = WebUtil.getQueryVar('cursor', true);
|
||||
var shared = WebUtil.getQueryVar('shared', true);
|
||||
var view_only = WebUtil.getQueryVar('view_only', false);
|
||||
var host = WebUtil.getQueryVar('host', window.location.hostname);
|
||||
var port = WebUtil.getQueryVar('port', window.location.port);
|
||||
var token = WebUtil.getQueryVar('token', null);
|
||||
var path = WebUtil.getQueryVar('path', 'websockify');
|
||||
|
||||
function passwordRequired(rfb) {
|
||||
var msg;
|
||||
msg = '<form onsubmit="return setPassword();"';
|
||||
msg = '<form id="setPasswordForm"';
|
||||
msg += ' style="margin-bottom: 0px">';
|
||||
msg += 'Password Required: ';
|
||||
msg += '<input type=password size=10 id="password_input" class="noVNC_status">';
|
||||
msg += '<\/form>';
|
||||
$D('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
|
||||
$D('noVNC_status').innerHTML = msg;
|
||||
document.getElementById("setPasswordForm").addEventListener("submit", setPassword);
|
||||
}
|
||||
function setPassword() {
|
||||
function setPassword(event) {
|
||||
rfb.sendPassword($D('password_input').value);
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
function sendCtrlAltDel() {
|
||||
@ -108,8 +120,6 @@ define(function(require) {
|
||||
WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn'));
|
||||
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
|
||||
// By default, use the host and port of server that served this file
|
||||
host = WebUtil.getQueryVar('host', window.location.hostname);
|
||||
port = WebUtil.getQueryVar('port', window.location.port);
|
||||
|
||||
// if port == 80 (or 443) then it won't be present and should be
|
||||
// set manually
|
||||
@ -123,14 +133,10 @@ define(function(require) {
|
||||
|
||||
// If a token variable is passed in, set the parameter in a cookie.
|
||||
// This is used by nova-novncproxy.
|
||||
token = WebUtil.getQueryVar('token', null);
|
||||
if (token) {
|
||||
WebUtil.createCookie('token', token, 1)
|
||||
}
|
||||
|
||||
password = WebUtil.getQueryVar('password', '');
|
||||
path = WebUtil.getQueryVar('path', 'websockify');
|
||||
|
||||
if ((!host) || (!port)) {
|
||||
updateState('failed',
|
||||
"Must specify host and port in URL");
|
||||
@ -138,16 +144,15 @@ define(function(require) {
|
||||
}
|
||||
|
||||
rfb = new RFB({'target': $D('noVNC_canvas'),
|
||||
'encrypt': WebUtil.getQueryVar('encrypt',
|
||||
(window.location.protocol === "https:")),
|
||||
'repeaterID': WebUtil.getQueryVar('repeaterID', ''),
|
||||
'true_color': WebUtil.getQueryVar('true_color', true),
|
||||
'local_cursor': WebUtil.getQueryVar('cursor', true),
|
||||
'shared': WebUtil.getQueryVar('shared', true),
|
||||
'view_only': WebUtil.getQueryVar('view_only', false),
|
||||
'encrypt': encrypt,
|
||||
'repeaterID': repeaterID,
|
||||
'true_color': true_color,
|
||||
'local_cursor': local_cursor,
|
||||
'shared': shared,
|
||||
'view_only': view_only,
|
||||
'onUpdateState': updateState,
|
||||
'onXvpInit': xvpInit,
|
||||
'onPasswordRequired': passwordRequired});
|
||||
|
||||
rfb.connect(host, port, password, path + "?token=" + token);
|
||||
rfb.connect(host, port, undefined, path + "?token=" + token);
|
||||
})
|
||||
|
@ -13,22 +13,29 @@
|
||||
{{! See the License for the specific language governing permissions and }}
|
||||
{{! limitations under the License. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div id="{{dialogId}}" class="reveal-modal large max-height" style="width:auto; max-width:70%" data-reveal >
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h3 class="subheader" id="vnc_dialog">
|
||||
<span class="subheader" id="vnc_dialog">
|
||||
{{tr "VNC"}}
|
||||
<span id="VNC_status">{{tr "Loading"}}</span>
|
||||
<a id="open_in_a_new_window" href="" target="_blank" title="{{tr "Open in a new window"}}"> <i class="fa fa-external-link detach-vnc-icon"/></a>
|
||||
<span id="VNC_buttons" class="right">
|
||||
<input type="button" value="Send CtrlAltDel" id="sendCtrlAltDelButton"></span>
|
||||
</h3>
|
||||
<a id="open_in_a_new_window" href="" target="_blank" title="{{tr "Open in a new window"}}">
|
||||
<span class="fa-stack fa-fw detach-vnc-icon"> <i class="fa fa-external-link fa-stack-2x"></i> <i class="fa fa-stack-1x"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a id="open_in_a_new_window_without_pass" href="" target="_blank" title="{{tr "Open in a new window and request password"}}">
|
||||
<span class="fa-stack fa-fw detach-vnc-icon">
|
||||
<i class="fa fa-external-link fa-stack-2x"></i>
|
||||
<i class="fa fa-lock fa-stack-1x"></i>
|
||||
</span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="reveal-body" style="width:100%; overflow-x:overlay">
|
||||
<canvas id="VNC_canvas" width="640px">{{tr "Canvas not supported."}}</canvas>
|
||||
<div id="VNC_status_bar" class="VNC_status_bar"></div>
|
||||
</div>
|
||||
<input type="button" value="Send CtrlAltDel" id="sendCtrlAltDelButton">
|
||||
<a class="close-reveal-modal">×</a>
|
||||
</div>
|
||||
</div>
|
@ -74,11 +74,11 @@ define(function(require) {
|
||||
url += "host=" + proxy_host;
|
||||
url += "&port=" + proxy_port;
|
||||
url += "&token=" + token;
|
||||
url += "&password=" + pw;
|
||||
url += "&encrypt=" + Config.vncWSS;
|
||||
url += "&title=" + vm_name;
|
||||
|
||||
$("#open_in_a_new_window").attr('href', url)
|
||||
$("#open_in_a_new_window_without_pass").attr('href', url);
|
||||
$("#open_in_a_new_window").attr('href', url + "&password=" + pw);
|
||||
_rfb.connect(proxy_host, proxy_port, pw, path);
|
||||
}
|
||||
|
||||
|
@ -1325,4 +1325,13 @@ hr {
|
||||
|
||||
.custom_tags td {
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
|
||||
#vnc_dialog {
|
||||
a {
|
||||
margin-right: 5px;
|
||||
margin-left: 5px;
|
||||
margin-top: -3px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user