Commit Graph

98 Commits

Author SHA1 Message Date
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