Commit Graph

179 Commits

Author SHA1 Message Date
Pierre Ossman c01eb5e74d Drop support for Internet Explorer 2020-10-15 18:53:51 +02:00
Pierre Ossman 0630352e19 Merge branch 'rgbx' of https://github.com/CendioOssman/noVNC 2020-09-04 13:40:23 +02:00
Pierre Ossman 50cde2faab Move mouse event handling to RFB class
Move the last remaining bits to the RFB class to keep things simple, as
the Mouse class no longer provides any real value.
2020-06-12 14:36:10 +02:00
Pierre Ossman 88589a44f7 Increase wheel step threshold
The previous value made the detection too sensitive and it was very
difficult to scroll precisely. A value of 50 pixels should give similar
behaviour to systems that don't do fine grained scrolling.
2020-06-12 09:18:46 +02:00
Pierre Ossman f84bc57bda Move wheel event handling to RFB class
The Mouse class does very little now so it mostly just obfuscate things.
Move everything directly in to the RFB class instead.
2020-06-12 09:18:46 +02:00
Pierre Ossman 8be924c9d9 Add touch gestures for mouse emulation
Add several single and multitouch gestures to simulate various mouse
actions that would otherwise be impossible to perform.

This replaces the old system where you could select which mouse button
a single touch would generate.
2020-06-12 09:18:46 +02:00
Pierre Ossman 440ec8a0b6 Start fake test clock at real clock time
Some code relies on the clock having a somewhat sane value, so let's not
start at 0.
2020-06-11 16:50:08 +02:00
Pierre Ossman 0a6aec3578 Avoid printing the Websock buffer in tests
It takes forever and just messes up the output.
2020-06-11 16:50:08 +02:00
Pierre Ossman 111225fa41 Split decoder tests to separate files 2020-06-08 07:46:42 +02:00
Pierre Ossman f694c32fd5 Merge branch 'camelcase' of https://github.com/samhed/noVNC 2020-06-05 09:41:25 +02:00
Samuel Mannehed cfb824ed03 Add camelCase rule to eslint 2020-05-31 23:37:29 +02:00
Samuel Mannehed ea858bfa27 Standardize on camelCase in Websock 2020-05-31 23:21:35 +02:00
Samuel Mannehed 95632e413d Standardize on camelCase in tests 2020-05-31 23:21:35 +02:00
Samuel Mannehed 80187d158c Standardize on camelCase in RFB 2020-05-31 23:21:35 +02:00
Samuel Mannehed 150596be83 Properly limit mouse moves to once every 17 ms
Previous attempt in c958269 had a number of issues, this is a full
rewrite, complete with improved unit tests.

Fixes github issue #1402
2020-05-31 00:53:15 +02:00
Samuel Mannehed 11a22dbf0c Stop send mouse clicks while dragging in view only 2020-05-31 00:53:15 +02:00
Samuel Mannehed 006743857b Standardize on camelCase for functions in RFB 2020-05-31 00:53:15 +02:00
Samuel Mannehed e7dec5270e Standardize on camelCase for variables in RFB 2020-05-31 00:53:15 +02:00
Samuel Mannehed 479d8cefd1 Add ability to set compression level
Fixes github issue #1382.
2020-05-01 20:47:36 +02:00
Andrey Trebler efd1f8a4f2 adds qualityLevel property to RFB class for updating JPEG quality level encoding on the fly 2020-02-28 13:14:19 +01:00
Alex Tanskanen ceb8ef4ec1 Fix crash with too large clipboard data
If too much text is copied in the session, String.fromCharCode.apply()
would crash in Safari on macOS and Chrome on Linux. This commit fixes
this issue by avoiding apply() altogether. Also added test to cover this
issue.
2020-02-21 09:39:31 +01:00
Pierre Ossman 384232fb56 Merge branch 'clipboard_unicode' of https://github.com/CendioNiko/noVNC 2020-02-18 09:46:10 +01:00
Niko Lehto f73fdc3ed3 Add extended clipboard Pseudo-Encoding
Add extended clipboard pseudo-encoding to allow the use of unicode
characters in the clipboard.
2020-02-18 09:32:36 +01:00
Niko Lehto 3b562e8a0f Make clipBoardPasteFrom() test more specific
Don't rely on clientCutText() to test clipboardPasteFrom().
2020-02-17 09:34:44 +01:00
Samuel Mannehed 71bb3fdfa5 Fix color channels for VMware alpha cursors
The red and blue channels were incorrectly swapped.
2020-01-30 11:48:17 +01:00
Samuel Mannehed 3055307d3d
Merge pull request #1299 from CendioNiko/vmwarecursor
Add support for VMware cursor encoding
2019-09-25 14:45:29 +02:00
Niko Lehto 296ba51f49 Add support for VMware cursor encoding
Supports both classic cursor type and alpha cursor type. In classic
mode the server can send 'inverted' pixels for the cursor, our code
does not support this but handles these pixels as opaque black.

Co-authored-by: Samuel Mannehed <samuel@cendio.se>
2019-09-24 10:26:30 +02:00
Niko Lehto 8d6f686b59 Test unicode desktop names 2019-09-04 14:47:40 +02:00
Niko Lehto ce66b46986 Add support for DesktopName extension
This extension allows session name to be changed during runtime.
2019-09-04 14:23:37 +02:00
Pierre Ossman c9765e5066 Upgrade to latest sinon and chai 2019-08-15 15:58:09 +02:00
Pierre Ossman b875486db8 Avoid deprecated called.once from sinon-chai
It's been removed in newer versions and will break eventually.
2019-08-15 15:58:09 +02:00
Pierre Ossman 70e6795829 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.
2019-02-15 10:26:27 +01:00
Juanjo Diaz 8a189a6291 Add getters/setter to websock 2018-12-08 17:31:20 +02:00
Pierre Ossman d105040581 Add tests for Cursor encoding 2018-09-18 11:36:32 +02:00
Pierre Ossman 2c5491e131 Enforce space after function name 2018-09-06 17:34:15 +02:00
Pierre Ossman d80d9d3731 Enforce function call spacing 2018-09-06 16:46:38 +02:00
Pierre Ossman 6786fd8719 Enforce comma spacing 2018-09-06 16:43:31 +02:00
Pierre Ossman 7b536961b2 Enforce indentation 2018-09-06 16:37:38 +02:00
Pierre Ossman ae2e1ff7bd Move sinon to karma framework
This frees us from manual imports, and makes things less magical
as those aren't ES modules even if the code suggest that the are.
2018-07-13 15:57:24 +02:00
Juanjo Diaz 885363a373 Use the classic `function foo() { ... }` for top level functions or functions that depend on the scope 2018-07-12 19:06:57 +02:00
Juanjo Diaz 651c23ece3 Use fat arrow functions `const foo = () => { ... };` for callbacks
and any other function that is passed around and it's not a top level function
2018-07-12 19:06:57 +02:00
Juanjo Diaz 0e4808bf6f Use ES6 classes
Always use the shorthand notation if the function is a method of an object or class `{ foo() { ... } }` or `class bar { foo() { ... } }`
unless it's a callback in which case you a fat arrow function should be used `{ cb: () => { ... } }`
2018-07-12 19:06:57 +02:00
Pierre Ossman 8f47bd296c Work around Siemens touch panel authentication bug
Siemens' touch panels support Tight authentication as well as NOTUNNEL,
but they fail to advertise the latter. Work around this issue by detecting
a Siemens device (through their custom tunnel types) and assume NOTUNNEL
support even if not advertised.
2018-06-07 15:03:34 +02:00
Juanjo Diaz 2b5f94fa6a Prefer const/let over var 2018-05-24 00:27:09 +03:00
Juanjo Diaz 8727f598c2 Add eslint and fix reported issues 2018-05-24 00:25:44 +03:00
Samuel Mannehed 2bb8b28d78 Handle sending large clipboards
Pasting clipboard texts that were larger than 10240 bytes didnt work and
caused a crash in noVNC. This commit fixes the crash and adds handling
for sending large clipboard texts. Fixes issue #1065.
2018-05-07 13:02:51 +02:00
Juanjo Diaz 9e1bd410aa Remove jshint comments 2018-01-31 07:38:29 -08:00
Pierre Ossman 9b84f51685 Move resize handling in to RFB object
Makes the API simpler and makes it easier for other frontends to
get this functionality.
2017-12-06 11:29:57 +01:00
Pierre Ossman bb25d3d6c5 Forced cleanup of RFB objects in tests
We need to make sure RFB objects are properly disposed or they
might have event listeners and other stuff hanging around that can
influence subsequent tests.
2017-11-30 16:15:38 +01:00
Samuel Mannehed d472f3f19e Abstract RFB errors to avoid sending strings
The API allowed strings to be passed from the RFB module to the
application using the disconnect reason. This caused problems since
the application didn't have control over translations for these
strings.

Most of the information being passed using this string was very
technical and not helpful to the end user. One exception to this was
the security result information regarding for example authentication
failures. The protocol allows the VNC server to pass a string
directly to the user in the security result.

So the disconnect reason is replaced by a boolean saying if the
disconnection was clean or not. And for the security result information
from the server, a new event has been added.
2017-11-14 15:36:12 +01:00
Samuel Mannehed ee5cae9fee Replace updatestate event with connect
Instead of exposing all the internal connection states, the RFB module
will now only send events on connect and on disconnect. This makes it
simpler for the application and gets rid of the double events that were
being sent on disconnect (previously updatestate and disconnect).
2017-11-14 14:10:36 +01:00
Samuel Mannehed 5b20d338ce Remove RFB.notification()
This interface was a band aid for poor design. The two cases where it
was used was replaced by logging.
2017-11-11 02:10:12 +01:00
Pierre Ossman e89eef94aa Use standard EventTarget interface for events 2017-11-09 13:14:16 +01:00
Pierre Ossman 2f4516f293 Integrate connect() in to constructor
An RFB object represents a single connection so it doesn't make
sense to have one without it trying to connect right away. Matches
the behaviour of other APIs, e.g. WebSocket.
2017-11-09 13:13:41 +01:00
Pierre Ossman 057b8fec7a Clean up beforeEach() code in RFB tests
There was a lot of redundancy that could be removed.
2017-11-09 13:13:41 +01:00
Pierre Ossman 4a36995363 Remove redundant setup of fake timer handling
We already set this up globally, so no need for these extra ones.
2017-11-09 13:13:41 +01:00
Pierre Ossman 68e09edcdc Remove disconnectTimeout property
Callers should not need to modify this timeout.
2017-11-09 13:13:41 +01:00
Pierre Ossman 0460e5fdbe Improve naming for viewport properties 2017-11-09 13:13:41 +01:00
Pierre Ossman 747b462337 Use standard JavaScript properties
Use normal properties with JavaScript setters and getters instead of
our homegrown stuff.

This also changes the properties to follow normal naming conventions.
2017-11-09 13:03:32 +01:00
Pierre Ossman 3d7bb02036 Change some attributes to arguments
Some attributes are better suited as arguments, primarily because they
are associated with a specific method and cannot be changed later.
2017-11-09 12:52:05 +01:00
Pierre Ossman ebf1c0f991 Always include ID marker in repeater protocol
This makes sure we're always following the protocol, and the caller
doesn't have to care about the details.
2017-11-09 12:52:05 +01:00
Pierre Ossman facf0b7027 Fix duplicate beforeEach() hook 2017-11-09 12:52:05 +01:00
Pierre Ossman 5b4e5d016e Switch to URL for connect()
This is more in line with how other JavaScript APIs work.
2017-11-09 12:52:05 +01:00
Pierre Ossman 3a0010a3d0 Avoid code duplication in RFB test preparation 2017-11-09 12:52:05 +01:00
Pierre Ossman c7d08d721f Tidy up variable initialisation
Sort things by category, and organise everything in the same place.
We don't support reuse of RFB objects so we can safely init everything
in the constructor.
2017-11-09 12:52:05 +01:00
Pierre Ossman 30691b668e Remove onFBU* callbacks
They are internal mechanisms that callers should be isolated from.
2017-11-09 12:52:03 +01:00
Pierre Ossman 832be2625b Add resize as a capability
Makes the API more transparent than piggybacking on completion
of the first framebuffer update.
2017-11-09 12:51:15 +01:00
Pierre Ossman cd523e8f28 Make power API generic
Decouple it from XVP and make it a generic API.
2017-11-09 12:47:21 +01:00
Pierre Ossman 430f00d6fe Allow other credentials than just password
Makes the XVP authentication mechanism more general.
2017-11-09 12:45:05 +01:00
Samuel Mannehed aa5b3a3528 Recieve challange before expecting callback
After commit abfe5b7a37 we expect a
challange before sending the callback to the UI. Fixes tests.
2017-10-17 12:29:43 +02:00
Pierre Ossman 69411b9ea3 Add tests for Intel AMT compatible mode 2017-10-06 13:16:36 +02:00
Samuel Mannehed 4a818a7ddd Merge pull request #893 from CendioOssman/amt
Basic support for Intel AMT
2017-10-05 16:59:53 +02:00
Pierre Ossman 8290d3f271 Merge branch 'optional-port' of https://github.com/bkylerussell/noVNC 2017-09-29 16:26:02 +02:00
Samuel Mannehed 13d9108f91 Setup chai extensions centrally
They have global effects so make that clear by doing the setup in a
single place.
2017-09-28 14:10:19 +02:00
Samuel Mannehed 0aaf59c2f9 Upgrade and fix sinon.js
Converted version downloaded from sinonjs.org. Fixed version that
doesn't register itself on the global object. This forces all modules to
do a proper import.
2017-09-28 14:05:20 +02:00
Pierre Ossman c7c6cb196d Remove rect arguments onFBUComplete callback
This callback is for an entire FBU, so it's not really relevant
to include info about just a single of the included rects.
2017-09-22 15:17:56 +02:00
Pierre Ossman 49a8183757 Clean up encoding handling
Allow things to be more explicit and dynamic. Makes it easier to read
and allows us to have more flexible selection of encodings in the future.
2017-09-22 15:17:56 +02:00
Pierre Ossman 91d5c62589 Merge resize handling to single method
It also fits better in the core RFB object rather than as a helper
for the encoding handlers.
2017-09-07 17:18:25 +02:00
Pierre Ossman be70fe0a3d Only send QEMU Extended Key Event if we have a scan code
Servers will assume that a scan code is present if this message type
is used, so fall back to the standard key event message if we don't
know the scan code.
2017-07-07 15:06:13 +02:00
Samuel Mannehed afb621d577 Add missing semicolon 2017-05-13 01:56:35 +02:00
Pierre Ossman 26586b9ddf Remove colour map support
It was broken and unused. Remove it so we can simplify the code.
2017-05-04 15:13:33 +02:00
Pierre Ossman 545442afc3 Merge branch 'keyboard' of https://github.com/CendioOssman/noVNC 2017-05-04 12:18:55 +02:00
Pierre Ossman d0703d1bde Simplify keyboard event API
No need for an object for three static fields.
2017-05-04 12:13:47 +02:00
Pierre Ossman 94f5cf05f3 Send keyboard events from single place
This makes it easier to handle any needed variations, like different
types of messages.
2017-05-04 12:13:47 +02:00
Samuel Mannehed 0613d18894 Fix panning test for high DPI devices
There is a drag-threshold in the panning code which the tests didn't
account for. This caused the tests to fail when window.devicePixelRatio
was higher than 1.
2017-04-21 15:23:18 +02:00
Pierre Ossman 524d67f283 Remove keysym names from keysymdef.js
They were incomplete and turned off in most cases so they served
little use besides adding complexity.
2017-03-24 11:16:53 +01:00
Solly Ross dfae3209eb Update tests to work with new structure
This updates the tests to work with the new structure, and removes the
old `utils/run_from_console.js` files in favor of just using Karma
directly.  The Karma debug page now displays the normal mocha HTML, so
we can use that instead of the HTML generation functionality of the old
test runner.

Note that PhantomJS does not work at the moment (PhantomJS 1.5 should
make it possible to test on PhantomJS again).
2017-03-21 17:39:07 -04:00
Pierre Ossman 0ee5ca6ebe Fix tests after changing auth negotiation
PhantomJS has a very basic implementation of Uint8Array, so we
need to help it out a bit.
2017-02-13 15:00:32 +01:00
Samuel Mannehed c01b2f0259 Merge pull request #699 from CendioOssman/double
Display double buffering
2016-12-13 12:42:22 +01:00
Pierre Ossman 2ba767a7fe Use double buffering for the display
Do all rendering to a hidden canvas and then copy over the finished
frame to the visible canvas once everything is done. This simplifies
things and solves some bugs as we can retain a copy of the entire
frame buffer.
2016-12-09 09:20:50 +01:00
Pierre Ossman 02329ab19c Don't violate Display abstraction
Use the normal API as much as possible instead of poking around in
internals that might change.
2016-12-09 09:20:50 +01:00
Kyle Russell 1a50f6809f rfb: Allow port to be optionally appended to URI
Supports server configurations that might prefer wss:// connections
on the default port, then proxies them through the web server to the
VNC server.

This proxy configuration is helpful on servers using self-signed
certificates.  Accessing the https://host/vnc_auto.html page and
adding an exception for that host is sufficient to also satisfy the
wss://host/ request, unlike requests to wss://host:port/ which
may require an extra certificate exception.
2016-11-24 06:14:31 -06:00
Samuel Mannehed 67cd2072ab Allow specifying details when calling RFB._fail()
RFB's _fail function logs the error, disconnects the session and sets
disconnect_reason. The disconnect_reason is upon disconnection sent to
the user interface. It is thus not suitable for including error details
that aren't user friendly. The idea is that you will look in the
browser console for a full log with details of the error.
2016-11-10 15:17:37 +01:00
Samuel Mannehed b2e961d48d Ensure proper connection state transitions
Makes the state machine more rubust and clear.
2016-11-10 15:17:31 +01:00
Samuel Mannehed b45905ab86 Handle server-side disconnections
Don't handle socket-close events when connected as errors. You could
for example, in the VNC session run 'vncconfig -disconnect'.
2016-11-10 14:33:29 +01:00
Pierre Ossman 9535539bb2 Process entire WebSocket message at once
setTimeout() causes too much delay to be useful. Also, we
already handle all rects in a message at once, so this shouldn't
be too much of a change.
2016-10-24 14:42:08 +02:00
Samuel Mannehed 3bb12056b1 Remove unnecessary substates of disconnected
The states 'loaded', 'failed' and 'fatal' were all variations of the
'disconnected' state. Removing these states allows us to get rid of
many ugly workarounds and special cases. Error messages to the UI can
now instead be delivered via a new onDisconnected callback.
2016-10-01 01:34:25 +02:00
Samuel Mannehed c2a4d3ef86 Improve the connection state names
Names such as 'disconnect' and 'disconnected' are inconsistent in the
way that one describes an action and the other a state. The state that
was called 'normal' didn't fit in with the others because the other
names describe a connection state. The new names are: 'disconnecting',
'connecting' and 'connected'
2016-10-01 01:30:02 +02:00
Samuel Mannehed c00ee156b9 Separate out init state from page state
This makes the state machine simpler as we don't have to confuse
protocol states with visual states.
2016-10-01 01:30:02 +02:00
Samuel Mannehed 159c50c009 Clean up special state handling for 'failed' 2016-10-01 01:30:02 +02:00