Commit Graph

266 Commits

Author SHA1 Message Date
Alexander Zeijlon 243d7fdd5f Disable setting showDotCursor in RFB constructor
This has been deprecated for around six years now. Let's remove the
deprecation warning and disable setting showDotCursor via the options
parameter.
2025-05-07 09:20:34 +02:00
Pierre Ossman 0b5e968e14 Better resize rate limiting
Be more aggressive with resizing, limiting it to once ever 100 ms
instead of after a 500 ms idle period. This gives a more responsive user
experience.
2025-02-05 16:59:22 +01:00
Adam Halim e081d1415a Add support for forward and back mouse buttons
This commit implements the extendedMouseButtons pseudo-encoding, which
makes it possible to use the forward and back mouse buttons.
2025-01-15 09:11:48 +01:00
Adam Halim 6383fa6384 Flush mouseMove when initiating viewport dragging
We want to flush pending mouse moves before we initiate viewport
dragging.

Before this commit, there were scenarios where the _mouseButtonMask
would track a released button as being down.
2025-01-14 12:32:51 +01:00
Adam Halim d1548c12ec Don't send mouse events when dragging viewport
We don't want to send any mouse events to the server when dragging the
viewport. Instead, we treat them as a client-only operation.
2025-01-14 12:14:59 +01:00
Adam Halim b9230cf23e Use MouseEvent.buttons for button state tracking
Instead of keeping track of button states ourselves by looking at
MouseEvent.button, we can use the MouseEvent.buttons which already
contains the state of all buttons.
2025-01-14 12:14:59 +01:00
Adam Halim c3934e0938 Move mouse move flushing to separate function 2025-01-14 12:14:34 +01:00
Samuel Mannehed 3193f808b5 Comment different resize functions in rfb.js 2024-12-27 14:48:20 +01:00
Samuel Mannehed e6e03a226f Fix resizes back to initial remote session size
Since the expected client size wasn't updated when the browser window
resized, noVNC didn't resize the canvas properly when going back to
the exact same dimensions.

Fixes issue #1903
2024-12-27 14:48:11 +01:00
Pierre Ossman 7f5b51acf3 Consistently use "sentence case" style
Try to be more consistent in how we capitalize things. Both the "Title
Case" and "Sentence case" styles are popular, so either would work.
Google and Mozilla both prefer "Sentence case", so let's follow them.
2024-11-27 14:40:40 +01:00
Pierre Ossman 047531e886 Merge branch 'webcodec-h264' of https://github.com/any1/noVNC 2024-08-29 16:59:25 +02:00
Andri Yngvason d106b7a6bb Add H.264 decoder
This adds an H.264 decoder based on WebCodecs.
2024-08-18 14:06:25 +00:00
Mark Peek c6c8e5e513 Add Zlib encoding 2024-08-16 09:12:43 -07:00
Kostiantyn Syrykh 9a1b1f0d06 Clipboard: handle multiple CR+LF 2024-03-25 17:35:28 +02:00
Pierre Ossman 85a465288b Merge branch 'qemu_ledstate_pseudo_encoding' of https://github.com/otthou/noVNC 2023-09-29 14:18:02 +02:00
Otto van Houten a0b7c0dac5 Add QEMU Led Pseudo encoding support
Previously, num-lock and caps-lock syncing was performed on a best effort basis by qemu.
Now, the syncing is performed by no-vnc instead. This allows the led state syncing to work
in cases where it previously couldn't, since no-vnc has with this extension knowledge of both
the remote and local capslock and numlock status, which QEMU doesn't have.
2023-09-29 13:58:55 +02:00
Pierre Ossman 370f21b117 Correctly handle legacy security rejections
The code comment of this code was entirely incorrect, but the commit
message for 5671072 when it was added was correct. I.e. there is a
result, but not a reason.

Adjust the unit tests to make sure this doesn't regress again.
2023-09-07 14:59:36 +02:00
Pierre Ossman 72f6810797 Correctly handle "none" auth on old servers
There is no security result for the "none" authentication until RFB 3.8.
This got broken by mistake in 5671072.
2023-09-07 14:38:04 +02:00
Pierre Ossman ccef89f556 Implicitly flush Websock if needed
Callers shouldn't have to deal with the internal buffering limits of
Websock, so implicitly flush the buffer if more room is needed.
2023-06-04 22:32:43 +02:00
Pierre Ossman f8b65f9fe1 Add Websock send queue helpers
Callers shouldn't be poking around directly in to the send queue, but
should use accessor functions like for the read queue.
2023-06-04 22:32:43 +02:00
Pierre Ossman 45cedea78f Don't send SetDesktopSize too early
We don't know the server layout yet, so we can't preserve the screen id
or flags yet at this point. Move it until after we've parsed everything.
2023-06-04 19:12:02 +02:00
Pierre Ossman 12d2e7832d Properly decode ExtendedDesktopSize fields
We are expected to preserve these and use them in our requests back to
the server. We can't do that if we don't actually decode them correctly.
2023-06-04 19:12:02 +02:00
Pierre Ossman 0ccc679d32 Return unsigned values from rQshift32()
This is what we almost always want, and this makes it consistent with
rQshift8() and rQshift16().
2023-06-04 19:12:02 +02:00
Pierre Ossman aaa4eb8c3c Use proper socket helpers for FBU header
Let's not duplicate this stuff when we have convenience functions.
2023-06-04 19:00:33 +02:00
Pierre Ossman 55ffe8fc51 Stop exposing Websock queue length
Callers should be using rQwait() to ensure sufficient data is present,
and not poke around in the internal buffering.
2023-06-04 19:00:33 +02:00
Pierre Ossman fb3c8f64e9 Switch Display.flush() to use a promise
That is the modern way to handle operations that cannot complete
immediately.
2023-06-04 19:00:33 +02:00
Pierre Ossman ae9b042df1 Change rQslice() to rQpeekBytes()
We don't need any full slice functionality, so let's change this to
better march rQpeek8() and rQshiftBytes().
2023-06-04 19:00:33 +02:00
Pierre Ossman afbb1da4d5 Remove custom RSA-AES event
We shouldn't add extra, undocumented, API just for the tests. They need
to figure out less invasive way to probe things.
2023-05-30 20:11:51 +02:00
Lew Ayotte b16f19f9ce Set _rfbVeNCryptState = 4 not == 4 2023-04-06 15:00:21 -05:00
pdlan f974b73137 Cleanup for the cryptographic algorithms that are not supported by SubtleCrypto 2023-01-20 05:54:00 -05:00
Pierre Ossman 7f4a9eebc8 Export clipping state externally
So that UI can reflect if it is currently possible to drag the viewport
or not.
2022-12-27 12:50:57 +01:00
Dinglan Peng b776e1495e Add MSLogonII security type 2022-12-21 15:52:31 -05:00
Pierre Ossman 6eb17b27a0 Correctly mask non-BMP clipboard characters
JavaScript strings use UTF-16 encoding under the hood, but we only want
a single '?' per character we replace. So we need to be more careful
which methods we use when iterating over the clipboard string.
2022-10-27 16:24:27 +02:00
Pierre Ossman 6b555f1f74 Mask unsupported clipboard characters
Add a more explicit '?' for characters that the clipboard cannot handle,
instead of getting random junk.
2022-10-27 16:03:22 +02:00
Frederik Fix edc7520e27 access to raw image data 2022-09-07 13:26:10 +02:00
Pierre Ossman df8d005de9 VeNCrypt should handle classical types
VeNCrypt is a superset of the original security types, so it should be
fine to send any of the classical values here as well.
2022-08-18 16:26:33 +02:00
Pierre Ossman 795494ade1 Prefer security types in the server's order
This is how TigerVNC has been behaving for years and has worked well
there, so let's follow them.
2022-08-18 16:26:27 +02:00
Pierre Ossman e1174e813b Use constants for security types
Makes everything much more readable.
2022-08-18 16:26:19 +02:00
Pierre Ossman 5671072dfe Expect security result for RFB 3.7
The cut off was wrong here. 3.7 will send a security result, but not a
security reason. It also fixes the issue that < 3.7 (e.g. 3.3) supports
VNC authentication as well.
2022-08-18 16:25:59 +02:00
Pierre Ossman 084030fe68 Handle connection init loop at the top
Avoid the mess of having lots of functions call back to _initMsg() just
because they might be able to continue right away. Instead loop at the
top level until we're either done, or we need more data.
2022-08-18 16:24:55 +02:00
Pierre Ossman 05d68e118d Abstract resuming the authentication
We now do this in multiple places, so make sure things are handled the
same way in all cases.
2022-08-18 16:24:45 +02:00
Pierre Ossman cdfb336651 Add warnings about insecure context
Most (all?) new APIs will require a "secure context", which generally
means served over TLS. We can expect crashes because of missing
functions if this requirement isn't fulfilled, so try to warn the user.
2022-05-12 15:48:46 +02:00
pdlan 19aa9ad6a3 Remove bigint-mod-arith.js 2022-04-05 02:40:47 -04:00
Pierre Ossman 42ec5f3321 Merge branch 'appleremotedesktop' of https://github.com/pauldumais/noVNC 2022-04-05 07:55:14 +02:00
Paul Dumais e21ed2e689 Added support for Apple Remote Desktop authentication
Fixed eslint warnings

Fixing tests that failed

Added unit tests for ARD authentication

Fixed an issue with the ARD rfb version number in the unit tests

Fixed issue with username/password lengths

Username and password lengths are now capped at 63 characters each.  Improved code for sign bit on public key bytes.

UTF Encoder username and password before packing it

Change UTF encoding to encode the username and password before packing it to prevent it from being expanded beyond the allowed size.  Public key is truncated to proper key length.

Replaced forge with web crypto for ARD authentication

Changed the way in which the async methods are handled, added unit tests to verify ARD encryption output.

Update .eslintignore
2022-04-04 11:40:19 -04:00
Pierre Ossman eac11d5799 Merge branch 'add-ra2ne-security-type' of https://github.com/pdlan/noVNC 2022-03-10 12:37:34 +01:00
pdlan a1709b999e Added support for RSA-AES Unencrypted Security Type 2022-03-08 13:24:26 -05:00
Samuel Mannehed 0ff0844a14 Ignore resize observation caused by server resizes
If we increase the remote screen size from the server in such a way that
it no longer fits the browser window, the browser will probably want to
show scrollbars. The same happens if you enable 'clipping' while the
remote is larger than the browser window. These scrollbars do, in turn,
decrease the available space in the browser window. This causes our
ResizeObserver to trigger.

If the resize observation triggers a requestRemoteResize() we will
overwrite the size and request a new one just because scrollbars have
appeared. We don't want that.

We can save the expected client size after resizing, and then compare
the current client size with the expected one. If there is no change
compared to the expected size, we shouldn't send the request.

Fixes issue #1616.
2021-12-13 11:20:14 +01:00
Samuel Mannehed a78a7bf8aa Update comment for scrollbar workaround
This is no longer an issue on Google Chrome, tested on Chrome 96 on
Fedora 34, Windows 10, macOS 12 and Android 12. It is however an issue
on Safari on macOS 12.

Without this workaround we get scrollbars when making the browser
window smaller, despite remote resize being enabled.
2021-12-13 10:07:16 +01:00
pdlan 7f84160147 Add RealVNC's JPEG encoding
Add support for RealVNC's JPEG encoding.

Add tests for JPEGDecoder. Fix the corner case of caching Huffman or quantization tables.
2021-11-26 03:59:19 -05:00