Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
vncLogging,
onInitFailed,
} = this.props
NovncLog.init_logging(vncLogging)
try {
const protocol = encrypt ? 'wss' : 'ws'
const url = `${protocol}://${host}:${port}/${path}`
const options = {
repeaterID,
shared,
credentials,
}
this.rfb = new RFB(this.novncElem, url, options)
this.addEventListeners()
this.rfb.viewOnly = viewOnly
this.rfb.scaleViewport = scaleViewport // if the remote session is smaller than HTML container, the view will be centered
this.rfb.resizeSession = resizeSession
} catch (e) {
onInitFailed && onInitFailed(e)
this.rfb = undefined
}
}
vncLogging,
onInitFailed
} = this.props;
NovncLog.init_logging(vncLogging);
try {
const protocol = encrypt ? 'wss' : 'ws';
const url = `${protocol}://${host}:${port}/${path}`;
const options = {
repeaterID,
shared,
credentials
};
this.rfb = new RFB(this.novncElem, url, options);
this.rfb.addEventListener('connect', this.onConnected);
this.rfb.addEventListener('disconnect', this.onDisconnected);
this.rfb.addEventListener('securityfailure', this.onSecurityFailure);
this.rfb.viewOnly = viewOnly;
this.rfb.scaleViewport = false; // if the remote session is smaller than HTML container, the view will be centered
this.rfb.resizeSession = resizeSession;
} catch (e) {
onInitFailed && onInitFailed(e);
this.rfb = undefined;
}
}
createRFB(link, port, session, secure) {
const rfb = new RFB(this.canvas, `${secure ? "wss" : "ws"}://${link.hostname}:${port}/ws/vnc/${session}`, {
credentials: {
password: "selenoid",
},
});
rfb.addEventListener("connect", this.onVNCConnect);
rfb.addEventListener("disconnect", this.onVNCDisconnect);
rfb.scaleViewport = true;
rfb.resizeSession = true;
rfb.viewOnly = true;
return rfb;
}
$(document).on('ContentLoad', () => {
const vncScreen = $('#noVNC_screen');
if (vncScreen.length) {
$('#sendCtrlAltDelButton').on('click', sendCtrlAltDel);
const protocol = $('#vnc').data('encrypt') ? 'wss' : 'ws';
const host = window.location.hostname;
const port = $('#vnc').attr('data-port');
const url = `${protocol}://${host}:${port}`;
const password = $('#vnc').attr('data-password');
rfb = new RFB(vncScreen.get(0), url, {
credentials: {
password,
},
});
rfb.addEventListener('connect', connectFinished);
rfb.addEventListener('disconnect', disconnectFinished);
rfb.addEventListener('securityfailure', securityFailed);
showStatus('disconnected', __('Loading...'));
}
});
vncLogging,
onInitFailed
} = this.props;
NovncLog.init_logging(vncLogging);
try {
const protocol = encrypt ? 'wss' : 'ws';
const url = `${protocol}://${host}:${port}/${path}`;
const options = {
repeaterID,
shared,
credentials
};
this.rfb = new RFB(this.novncElem, url, options);
this.addEventListeners();
this.rfb.viewOnly = viewOnly;
this.rfb.scaleViewport = scaleViewport;
this.rfb.resizeSession = resizeSession;
} catch (e) {
onInitFailed && onInitFailed(e);
this.rfb = undefined;
}
}
connect = () => {
if (this.canvasId != null && this.socketUrl != null) {
const rfb = new RFB(document.getElementById(this.canvasId), this.socketUrl);
rfb.addEventListener('connect', this.onConnect);
rfb.addEventListener('disconnect', (e) => {
const error = e.detail.clean ? undefined : t('Something went wrong, connection is closed');
if (this.disconnected != null) {
this.disconnected(error);
}
});
rfb.addEventListener('credentialsrequired',
() => {
if (this.askPassword != null) {
this.askPassword().then(password => rfb.sendCredentials({ password }));
}
});
rfb.scaleViewport = false;
rfb.resizeSession = false;
this.rfb = rfb;