Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {
host,
port,
path,
encrypt,
resizeSession,
scaleViewport,
viewOnly,
shared,
credentials,
repeaterID,
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) {
componentDidMount() {
const {
host,
port,
path,
encrypt,
resizeSession,
viewOnly,
shared,
credentials,
repeaterID,
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
const {
host,
port,
path,
encrypt,
resizeSession,
scaleViewport,
viewOnly,
shared,
credentials,
repeaterID,
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) {