This PR changes the session to not return an error on the connection
stage. The `iron-remote-desktop` raises `TERMINATED` instead of `ERROR`,
because `ERROR` is now handled as non-critical and does not close the
session.
This resolves an issue with Unicode input that happens under Chrome.
where entering `Alt` codes results in broken modifier state and broken
input in general.
This happens because of how _Chrome_ handles `KeyboardEvent` key and
code in this particular case. For example, holding `Alt`, pressing 1, 2,
3 on a numpad, then releasing `Alt` will result in events with the
following key/code values being passed to `sendKeyboard`:
`{ "key": "Alt", "code": "AltLeft" ,"type": "keydown" }`
`{ "key": "1", "code": "Numpad1" ,"type": "keydown" }`
`{ "key": "1", "code": "Numpad1" ,"type": "keyup" }`
`{ "key": "2", "code": "Numpad2" ,"type": "keydown" }`
`{ "key": "2", "code": "Numpad2" ,"type": "keyup" }`
`{ "key": "3", "code": "Numpad3" ,"type": "keydown" }`
`{ "key": "3", "code": "Numpad3" ,"type": "keyup" }`
`{ "key": "{", "code": "AltLeft" ,"type": "keyup" }`
Without this fix, this will send Unicode `{` instead of plain `Alt` to
the RDP server, messing up the `Alt` code sequence and leaving `Al` in
pressed state.
For comparison, in _Firefox_ last event looks like this: `{ "key":
"Alt", "code": "AltLeft","type": "keyup" }`
Adds a general NegotiationFailure to IronErrorKind so that web embedders
can handle failures that occur during protocol negotiation, before
authentication.
Changes:
- RDP errors during the negotiation phase become
IronErrorKind.NegotiationError
- User-friendly RDP negotiation error messages to ironrdp-connector
- Update TypeScript definitions
Add support for chunking outbound WebSocket messages when they exceed a
configurable size limit. This helps avoid browser- or proxy-specific
WebSocket message size restrictions while maintaining wire
compatibility.
Changes:
- Add outbound_message_size_limit field to SessionBuilderInner
- Implement extension handler with safe f64->u32 casting and validation
- Update writer_task to chunk large messages when limit is set
- Add outboundMessageSizeLimit() helper function to JavaScript API
---------
Co-authored-by: Benoît Cortier <3809077+CBenoit@users.noreply.github.com>
Allows users to disable CredSSP/NLA, which is otherwise enabled by default.
This is necessary to connect to target hosts bound to AzureAD/Entra domains.
In this case, user authentication is handled in the interactive session.
The root cause of the bug is the incorrect keycodes-to-scancodes
mappings. These mappings translated the browser's key codes (like
"KeyA") to OS-specific scancode (OS where the browser runs). However,
that's not exactly what we need to do. We need to map the browser's key
codes to _Windows_ scancodes - the only format that is accepted by _VNC_
and _RDP_) modules.
Let's look at an example for a better understanding. _Safari_ browser
used _Linux_'s _Gecko) mappings as a fallback (because there were no
MacOS-specific mappings). For a given key, _iron-remote-desktop_ was
providing a scancode that did not correspond to the _Windows_ scancode
for that same key. As a result, the `IronVNC` module incorrectly mapped
this scancode to a `KeySym`, which resulted in an incorrect `KeySym` or
`NO_SYMBOL`.
When we receive clipboard update from the server and the browser window
is not in focus (for example, when the user copies some text directly on
the machine, not via the browser's VNC viewer), we got an error that
`navigator.clipboard.write` is not allowed when window is not in focus.
This PR adds a window check that the window has focus, and now
`clipboard.write` runs only when the window is in focus.
When the server sends the clipboard update, we write it to our
clipboard. But this new clipboard data was then processed as a new one,
so we sent it back to the server. This commit fixes this behavior by
tracking the data that we received from the server.