KASM-5409 unique control channel per session
This commit is contained in:
parent
91d579bd7a
commit
7cca8f5475
|
@ -25,8 +25,8 @@ window.updateSetting = (name, value) => {
|
|||
}
|
||||
}
|
||||
|
||||
import "core-js/stable";
|
||||
import "regenerator-runtime/runtime";
|
||||
//import "core-js/stable";
|
||||
//import "regenerator-runtime/runtime";
|
||||
import * as Log from '../core/util/logging.js';
|
||||
import _, { l10n } from './localization.js';
|
||||
import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock }
|
||||
|
|
|
@ -104,7 +104,7 @@ const UI = {
|
|||
|
||||
if (UI.supportsBroadcastChannel) {
|
||||
console.log('add event listener')
|
||||
UI.controlChannel = new BroadcastChannel("registrationChannel");
|
||||
UI.controlChannel = new BroadcastChannel(UI.rfb.connectionID);
|
||||
UI.controlChannel.addEventListener('message', UI.handleControlMessage)
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ export default class Display {
|
|||
// ===== PROPERTIES =====
|
||||
|
||||
get screens() { return this._screens; }
|
||||
get screenId() { return this._screenID; }
|
||||
get screenID() { return this._screenID; }
|
||||
get screenIndex() {
|
||||
// A secondary screen should not have a screen index of 0, but it will be 0 until registration is complete
|
||||
// returning a -1 lets the caller know the screen has not been registered yet
|
||||
|
|
12
core/rfb.js
12
core/rfb.js
|
@ -123,7 +123,7 @@ export default class RFB extends EventTargetMixin {
|
|||
this._supportsContinuousUpdates = false;
|
||||
this._enabledContinuousUpdates = false;
|
||||
this._supportsSetDesktopSize = false;
|
||||
this._screenID = uuidv4();
|
||||
this._connectionID = window.location.href.split('?')[0].match(/^(.+)(\/)/)[0];
|
||||
this._screenIndex = 0;
|
||||
this._screenFlags = 0;
|
||||
this._qemuExtKeyEventSupported = false;
|
||||
|
@ -220,7 +220,7 @@ export default class RFB extends EventTargetMixin {
|
|||
this._secondaryDisplays = {};
|
||||
this._supportsBroadcastChannel = (typeof BroadcastChannel !== "undefined");
|
||||
if (this._supportsBroadcastChannel) {
|
||||
this._controlChannel = new BroadcastChannel("registrationChannel");
|
||||
this._controlChannel = new BroadcastChannel(this._connectionID);
|
||||
this._controlChannel.addEventListener('message', this._handleControlMessage.bind(this));
|
||||
Log.Debug("Attached to registrationChannel for secondary displays.")
|
||||
|
||||
|
@ -331,6 +331,8 @@ export default class RFB extends EventTargetMixin {
|
|||
}
|
||||
|
||||
// ===== PROPERTIES =====
|
||||
|
||||
get connectionID() { return this._connectionID; }
|
||||
|
||||
get translateShortcuts() { return this._keyboard.translateShortcuts; }
|
||||
set translateShortcuts(value) {
|
||||
|
@ -1375,7 +1377,7 @@ export default class RFB extends EventTargetMixin {
|
|||
this._sock.close();
|
||||
} else {
|
||||
if (this._primaryDisplayChannel) {
|
||||
this._primaryDisplayChannel.postMessage({eventType: 'unregister', screenID: this._screenID})
|
||||
this._primaryDisplayChannel.postMessage({eventType: 'unregister', screenID: this._display.screenID})
|
||||
this._primaryDisplayChannel.removeEventListener('message', this._handleSecondaryDisplayMessage);
|
||||
this._primaryDisplayChannel.close();
|
||||
this._primaryDisplayChannel = null;
|
||||
|
@ -1713,7 +1715,7 @@ export default class RFB extends EventTargetMixin {
|
|||
let message = {
|
||||
eventType: messageType,
|
||||
args: data,
|
||||
screenId: this._display.screenId,
|
||||
screenID: this._display.screenID,
|
||||
screenIndex: this._display.screenIndex,
|
||||
mouseLastScreenIndex: this._mouseLastScreenIndex,
|
||||
}
|
||||
|
@ -1834,7 +1836,7 @@ export default class RFB extends EventTargetMixin {
|
|||
if (!this._isPrimaryDisplay){
|
||||
let message = {
|
||||
eventType: 'unregister',
|
||||
screenID: this._display.screenId
|
||||
screenID: this._display.screenID
|
||||
}
|
||||
this._controlChannel.postMessage(message);
|
||||
}
|
||||
|
|
4
vnc.html
4
vnc.html
|
@ -50,7 +50,7 @@
|
|||
<script src="vendor/interact.min.js"></script>
|
||||
|
||||
<!-- Stylesheets -->
|
||||
<!--link rel="stylesheet" href="app/styles/base.css">
|
||||
<link rel="stylesheet" href="app/styles/base.css">
|
||||
|
||||
<script src="app/error-handler.js"></script>
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<script type="module" crossorigin="use-credentials" src="app/ui.js"></script-->
|
||||
<script type="module" crossorigin="use-credentials" src="app/ui.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue