Commit Graph

271 Commits

Author SHA1 Message Date
Jesper Alf Dam
09de4b8349 Don't compact the receive buffer unless we've actually run out of space
Previously, we would compact the buffer (moving unread data to the
start of the buffer) as follows:

- after processing a message, if there are zero unread bytes, just reset
  the indices for first and last unread byte to zero
- else, if at least 1/8th of the buffer is used, copy remaining data to the beginning of the buffer

The second option is never actually necessary, as before inserting new data
into the array, we already check if there's enough free space, and
compact the buffer first if necessary. So we've been doing a lot of
copies that weren't actually needed. Let's not do that any more.
2021-03-29 11:45:00 +03:00
Jesper Alf Dam
d4747a8c80 Avoid recursion in Alt check on Firefox
The Firefox workaround which checks for missing Alt key events may
synthesise new KeyboardEvents. On these events, checkAlt should not be
recursively triggered. Otherwise, we get "too much recursion" errors
whenever the Alt key is pressed.
2021-03-29 11:44:49 +03:00
Pierre Ossman
5b73c1ca23 Fix trivial lint issues in translation tools
Indentation, missing semicolon, etc.
2021-03-29 11:44:42 +03:00
Pierre Ossman
f21fb95bb9 Remove unused import from module loader 2021-03-29 11:44:23 +03:00
Pierre Ossman
7b02f3d8b8 Avoid deprecated called.once from sinon-chai
It's been removed in newer versions and will break eventually.
2021-03-29 11:44:04 +03:00
Samuel Mannehed
03a333fb18 Add missing parentheses for arrow func arg
Our lint tests expect this when an arrow functino has a body with
curly braces.
2021-03-29 11:43:15 +03:00
Samuel Mannehed
54253efaa0 Add documentation for the option showDotCursor
This is not only a property, it's also a parameter to the constructor.
2021-03-29 11:43:09 +03:00
Samuel Mannehed
8b859f4598 Remove the default value of wsProtocols
Using the 'binary' protocol by default is very non-standard.
2021-03-29 11:42:58 +03:00
Shira Maximov
8c5b5f17eb Add support in websocket sub-protocols 2021-03-29 11:42:28 +03:00
Juanjo Diaz
71fa476514 Add version number to UI 2021-03-29 11:40:55 +03:00
Samuel Mannehed
4fd1f19f3b Update link to websock.js API 2021-03-29 11:40:48 +03:00
Lee Yarwood
257aabecb0 launch.sh: Check for a local websockify directory
Previously launch.sh would check both for the existence of a local
websockify file and /websockify/run file.

This initial check should really be for a local websockify directory
as in packaged environments a file could very well be the actual
executable leading to launch.sh incorrectly attempting to use a local
version of websockify.
2021-03-29 11:40:40 +03:00
Pierre Ossman
74161066af Add support for separate key file in launch script 2021-03-29 11:40:25 +03:00
Samuel Mannehed
e2d86788ba Revert "Fullscreen from iframe (#1236)" (#1247)
This reverts commit 19cdc15aa314760446866a1bcc2db99a80479683.
2021-03-29 11:39:56 +03:00
Pierre Ossman
4c635f65d3 Remove server pixel format warnings
These are harmless and really only for debugging. So remove them
as they tend to trick people in to thinking something is wrong.
We already print the entire server pixel format earlier anyway in
case we need the details.
2021-03-29 11:39:47 +03:00
Ján Jockusch
1d4ada6815 Fullscreen from iframe (#1236)
* First attempt to make the fullscreen button work inside an iframe.

* Cleaner distinction between document element and document.

* Scoping corrections. Auto-detect correct iframe.

* Added comments to the relevant sections.

* IE issue fixed.

* Same source issue solved. fullscreenToggle now checks if it is permitted to inspect other iframes.
2021-03-29 11:39:32 +03:00
Samuel Mannehed
d3ec2aa4d1 noVNC 1.1.0 2021-03-29 11:39:20 +03:00
Samuel Mannehed
10c334303a Update generated JS files for translations 2021-03-29 11:39:13 +03:00
Samuel Mannehed
c4987024ef Update Dutch translations
Co-authored-by: Arend Lapere <arend.lapere@gmail.com>
2021-03-29 11:39:04 +03:00
Samuel Mannehed
04d7bef2ae Update Swedish translations 2021-03-29 11:38:58 +03:00
Samuel Mannehed
12565dc4ac Allow autoscale() with zero height or width
Commit 6e7e6f9 stopped the function from running if width or height was
zero, this commit reverts that change. This commit also makes the
resulting canvas 0x0 if autoscale is called with zero. By adding this
special case we can avoid division by zero in the calculations.
2021-03-29 11:38:52 +03:00
Pierre Ossman
46b7d1db95 Fix up errors and warnings in vnc_playback.html
Remove the styling, as it isn't really needed, and fix some minor
things that the w3c validator complains about.
2021-03-29 11:38:25 +03:00
Samuel Mannehed
0045f07965 Remove invalid HTML attributes from textarea 2021-03-29 11:37:52 +03:00
Samuel Mannehed
d1fdb877ef Fix invalid input type 'input' 2021-03-29 11:37:36 +03:00
Samuel Mannehed
e62e12fbfe Input type image is not allowed to have values 2021-03-29 11:37:18 +03:00
Samuel Mannehed
50183c7caa Add default language 2021-03-29 11:36:20 +03:00
Samuel Mannehed
79ab05192b Add check for bad values for Display.autoscale() 2021-03-29 11:36:08 +03:00
Juanjo Diaz
c6c278f9d5 Replace unnecessary function supportsCursorURIs by a constant variable 2021-03-29 11:35:44 +03:00
Juanjo Diaz
37c17ddbf9 Move support check from display to browser 2021-03-29 11:35:38 +03:00
Dmitriy Shweew
c755008d15 Add Russian translation (#1211)
By Dmitriy Shweew (shweew)
2021-03-29 11:35:31 +03:00
Juanjo Diaz
075eed5cbb Convert DES into a class 2021-03-29 11:35:23 +03:00
Juanjo Diaz
7b7295fd4e Use default argument for base64 2021-03-29 11:35:16 +03:00
Juanjo Diaz
5964156a6f Remove unnecessary context from eventtarget 2021-03-29 11:35:11 +03:00
Juanjo Diaz
1ff792cf4b Remove unnecessary constructor parameter from Cursor 2021-03-29 11:35:06 +03:00
Juanjo Diaz
3043216b63 Remove intermediate variable from mouse 2021-03-29 11:34:56 +03:00
Pierre Ossman
499b251716 Remove error handling in clientCutText()
It is not necessary as Websock.flush() is guaranteed to succeed and
give us some space. It also remove the call to _fail(), which was
invalid at this place as clientCutText() is not a method on RFB.
2021-03-29 11:34:50 +03:00
Pierre Ossman
d20f751441 Throw correct Error object
We've already defined the name Error as a logging function, so we
need to be more explicit when we want to refer to the exception
class.
2021-03-29 11:34:45 +03:00
Pierre Ossman
915901848d Send data one byte at a time in tests
This makes sure we don't have code assuming that everything is
neatly packaged in a single WebSocket message.
2021-03-29 11:34:38 +03:00
Pierre Ossman
ee2423ed2b Clean up RFB._rfb_auth_schema assignment 2021-03-29 11:34:29 +03:00
Pierre Ossman
ce6d66f030 Fix security failure reason handling of slow data
Things would break if the security result and security reason did
not arrive in the same WebSocket message.
2021-03-29 11:34:21 +03:00
Pierre Ossman
41e6fedba6 Fix version handshake to handle slow data 2021-03-29 11:34:08 +03:00
Pierre Ossman
642a67f76f Use arrow function to avoid bind 2021-03-29 11:34:00 +03:00
Pierre Ossman
d7198cbe5d Consume data properly in Hextile decoder
We accidentally removed the code updating the data index in 8a189a6,
resulting in the decoder newer consuming any data. So the data would
be parsed as the next rect, causing weird errors.
2021-03-29 11:33:25 +03:00
lhchavez
25b8e64adb Add support for notifying clients about pointer movements
This change adds support for the VMware Mouse Position
pseudo-encoding[1], which is used to notify VNC clients when X11 clients
call `XWarpPointer()`[2]. This function is called by SDL (and other
similar libraries)  when they detect that the server does not support
native relative motion, like some RFB clients.

With this, RFB clients can choose to adjust the local cursor position
under certain circumstances to match what the server has set. For
instance, if pointer lock has been enabled on the client's machine and
the cursor is not being drawn locally, the local position of the cursor
is irrelevant, so the RFB client can use what the server sends as the
canonical absolute position of the cursor. This ultimately enables the
possibility of games (especially FPS games) to behave how users expect
(if the clients implement the corresponding change).

Part of: #619

1: https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#vmware-cursor-position-pseudo-encoding
2: https://tronche.com/gui/x/xlib/input/XWarpPointer.html
3: https://hg.libsdl.org/SDL/file/28e3b60e2131/src/events/SDL_mouse.c#l804
2021-03-29 11:27:54 +03:00
Pierre Ossman
d8caab699d Add missing headers for TCP_CORK
We didn't include the proper headers to get the correct define, so
corking was never enabled.
2021-03-29 11:04:00 +03:00
Pierre Ossman
da83ecf86a Drop other selection on ownership change
Otherwise we might end up owners of something we cannot deliver data on,
which can hang applications.
2021-03-29 11:03:38 +03:00
Pierre Ossman
189f503b98 Fix handling of bad update requests
We computed a safe area if a client gave us a bogus one, but we didn't
actually use it. Fix this properly and make sure we don't pass on bad
coordinates further.
2021-03-29 11:00:41 +03:00
Pierre Ossman
f54dc7829a Update keycode maps to latest version
Mainly fixes for Japanese and Korean keyboard layouts.
2021-03-29 10:57:41 +03:00
Pierre Ossman
fde088ce65 Improved bandwidth monitoring
Now measures over an entire update, which should hopefully give us more
stable values. They are still small values for fast networks though so
increase precision in the values we keep.
2021-03-29 10:52:51 +03:00
Pierre Ossman
a55f142c98 Don't shuffle input buffer unless actually needed 2021-03-29 10:50:16 +03:00