Commit Graph

280 Commits

Author SHA1 Message Date
Samuel Mannehed 4318c8cafd Use the correct slicing for rQshiftStr
This didn't result in any error however since slice() handles such
mistakes gracefully.
2018-06-15 11:56:56 +02:00
Samuel Mannehed db9daa98a5 Avoid big strings on the stack
Previous code resulted in RangeErrors by potentially creating big
strings.

Fixes issue #1065
2018-06-14 16:59:52 +02:00
Samuel Mannehed 362bd5e3a2 Call rQshiftBytes to avoid code duplication 2018-06-14 16:51:29 +02:00
Samuel Mannehed e87b645b56 Remove typedArrayToString
We don't use PhantomJS anymore
2018-06-14 16:43:48 +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
Pierre Ossman e6bad200e4 Add debug logging for Tight authentication
Makes it easier to diagnose user issues when we can see what the
server and noVNC are trying to negotiate.
2018-06-07 14:57:17 +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
Vlastimil Sadilek 5858f472e3 Fix: IE11 Numpad5 compatibility when numlock off
This fix Numpad5 in Internet Explorer 11 if numlock state of host differs with numlock state of
VNC console.
2018-05-16 13:52:56 +02: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
Vlastimil Sadilek f3e2fc58ec Fix: undefined err, undefined Exception 2018-05-04 14:23:02 +02:00
Pierre Ossman b475eed5fa Separate out cursor handling
Make cursor handling more generic in preparation for generic handling
of corner cases.
2018-03-15 17:22:21 +01:00
Pierre Ossman 35dd3c2299 Merge branches 'ffalt' and 'altgr' of https://github.com/CendioOssman/noVNC 2018-03-13 16:03:01 +01:00
Pierre Ossman 3a7c0c67c1 Work around broken Alt keyup in Firefox
Firefox no longer sends keyup events properly for the Alt keys. Try
to sniff out the state of the Alt key by monitoring other events that
include its state.
2018-03-13 16:01:38 +01:00
Pierre Ossman b22c9ef954 Better detection of AltGr on Windows
Try to properly detect the fake CtrlL+AltR sequence Windows sends
when pressing AltGr. This allows us to send more accurate key
events over to the server.
2018-03-09 12:14:23 +01:00
Pierre Ossman d6ae445773 Handle _keyDownList in _sendKeyEvent()
This makes sure it never gets out of sync with what we've actually
sent.
2018-03-09 12:13:21 +01:00
Pierre Ossman e1802cac7f Separate Tight PNG in stats output 2018-02-27 10:52:02 +01:00
Pierre Ossman 5bdcf5d31c Enforce Tight PNG restrictions
Tight PNG rects cannot use the basic compression variants, and PNG
cannot be used in a standard Tight rect.

This is a partial revert of 3e8b26a based on better understanding
of the encoding.
2018-02-27 10:50:13 +01:00
Leslie Qi Wang 2c813a33fe add encoding support for TightPNG 2018-02-23 10:38:17 -08:00
Solly Ross a4d51bd220
Merge pull request #1009 from juanjoDiaz/move_browser_checks
Move browser checks to browser.js
2018-02-01 10:33:28 -05:00
Solly Ross 096fcc4fa3
Merge pull request #1007 from juanjoDiaz/remove_jshints_comments
Remove jshint comments
2018-01-31 10:58:20 -05:00
Juanjo Diaz 9e1bd410aa Remove jshint comments 2018-01-31 07:38:29 -08:00
Solly Ross ca0644b252
Merge pull request #1008 from juanjoDiaz/remove_unnecesary_base64_dependency
Remove unnecessary base64 dependency
2018-01-30 13:41:28 -05:00
Juanjo Diaz a003535941 Remove console statements 2018-01-30 08:53:38 -08:00
Juanjo Diaz 24c99fbfd7 Remove unnecessary Log dependency in events.js 2018-01-30 08:38:46 -08:00
Juanjo Diaz 59ef29163e Move browser checks to browser.js 2018-01-30 08:35:47 -08:00
Juanjo Diaz 9dc0f4095b Remove unnecessary base64 dependency 2018-01-30 08:19:39 -08:00
Pierre Ossman 72abf78487 Merge branch 'master' of https://github.com/josiah2009/noVNC 2017-12-14 12:50:38 +01:00
Samuel Mannehed b245ec7038 Fix disconnect crash when screen doesn't exist
The function removeChild throws an exception when the element specified
doesn't exist. This can happen when opening the websocket throws an
exception during connect. Fixes issue #979
2017-12-12 18:25:20 +01:00
Pierre Ossman 4f4f62261a Merge branch 'resize' of https://github.com/CendioOssman/noVNC 2017-12-11 16:48:54 +01: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 898cd32c07 Don't send pointer event on end of drag
We should only send an event to the server if we didn't actually
end up dragging the viewport.
2017-11-30 16:15:42 +01:00
Josiah White baf822d3de Initalize cached 16x16 tile. 2017-11-30 03:17:02 -05:00
Pierre Ossman 7f39868158 Remove noisy websock debug logging
It generates too many log lines that it drowns out everything else.
2017-11-24 13:10:35 +01:00
Pierre Ossman ddcb60c3b3 Don't log WebSocket close by default
This is an expected event so it shouldn't be logged by default.
2017-11-20 15:21:59 +01:00
Samuel Mannehed db46e36eb9
Merge pull request #950 from samhed/disconnectapi
Abstract information from RFB to the UI
2017-11-17 11:01:11 +01:00
Samuel Mannehed 7279364c9a Move localization.js to app
Since it is no longer used in core. Also splits localization tests into
a separate file.
2017-11-14 15:36:12 +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
Pierre Ossman b8dfb983df Fix old focus on click references
The property was renamed when mergin the public API changes, but
a few references were overlooked.
2017-11-11 16:44:53 +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
Samuel Mannehed 4e1c5435b8 Add missing semicolons 2017-11-11 02:10:12 +01:00
Pierre Ossman a201bfc5eb Merge branch 'api' of https://github.com/CendioOssman/noVNC 2017-11-10 14:19:05 +01:00
Pierre Ossman e89eef94aa Use standard EventTarget interface for events 2017-11-09 13:14:16 +01:00
Pierre Ossman 65fdfeae13 Remove unused options argument in onnotification event handler 2017-11-09 13:13:41 +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 68e09edcdc Remove disconnectTimeout property
Callers should not need to modify this timeout.
2017-11-09 13:13:41 +01:00
Pierre Ossman 002907d2ce Remove "downscale only" mode
The normal scaling mode should be sufficient for most use cases, so
let's keep the interface simple.
2017-11-09 13:13:41 +01:00
Pierre Ossman 8d1f0a3de8 Remove local cursor setting
We have no reason to disable this except for touch devices, which
we can handle without having a setting for it.
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 a80aa41628 Change clippingDisplay() to a property
It fits much better as a property given that it only tells what the
current state of things are.
2017-11-09 13:13:41 +01:00
Pierre Ossman 15a6269510 Remove some unused return values 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 fdff59eeb4 Move cursor URI check to RFB object
Keeps the Display object simpler, and avoids having to abuse a
property to transfer the information.
2017-11-09 12:52:05 +01:00
Pierre Ossman 134ec26ee0 Remove non-JavaScript render code
It wasn't used anyway so simplify things.
2017-11-09 12:52:05 +01:00
Pierre Ossman 656858a6d6 Remove render_mode property
It can only have a single value these days, so it is no longer
useful.
2017-11-09 12:52:05 +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 dd0db4d460 Allow omitting configuration for properties 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 f8318361b1 Remove wsProtocols setting
It isn't in use anymore since we deprecated support for Base64 mode.
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 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 85b35fc0cc Add proper protocol encoder for XVP messages 2017-11-09 12:45:08 +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
Pierre Ossman 1d6ff4a3e9 Improved focus handling on touch input field
The previous method of retaining focus didn't work reliably when
the RFB object tried to move the focus to the canvas. Add a setting
to control "focus on click" behaviour instead of letting them try
to fight it out.
2017-11-02 15:30:36 +01:00
Pierre Ossman 233c8b6a53 Hide keyboard object from RFB callers 2017-10-27 13:58:12 +02:00
Pierre Ossman f976b5500e Hide mouse object from RFB callers 2017-10-27 13:58:12 +02:00
Pierre Ossman b9854a5ca5 Hide display object from RFB callers 2017-10-27 13:58:11 +02:00
Pierre Ossman 458086177c Let RFB object make sure canvas can have focus
Let's set up things properly ourselves instead of forcing everyone
to create their canvas element just like we want it.
2017-10-18 17:01:34 +02:00
Pierre Ossman 4c11755ce7 Merge branch 'focus' of https://github.com/CendioOssman/noVNC 2017-10-18 15:12:46 +02:00
Pierre Ossman 2afda54456 Only grab key events on canvas
Give the canvas proper focus handling. This avoids messy logic that
needs to disable and enable event handling when we want to interact
with other UI elements.

It also makes sure we can properly inhibit the browser from triggering
local actions on key presses.
2017-10-18 15:07:17 +02:00
Samuel Mannehed abfe5b7a37 Wait for challenge before asking for password
Fixes #928.
2017-10-16 15:39:10 +02:00
Samuel Mannehed cd23036314 Fix missing semicolons
Was missing in commit 49a8183757
2017-10-12 12:42:16 +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
Pierre Ossman 5a5f5ada58 Basic support for Intel AMT
This restores basic support for Intel AMT servers. They refuse clients
that request more than 16 bits per pixels, so implement a fallback
in just the "Raw" encoding.
2017-09-22 15:17:56 +02:00
Pierre Ossman cd74793b44 Always hide local cursor initally
We don't know if the server will support a client side cursor, so
we have to assume a server side one to start with.
2017-09-22 15:17:56 +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
Samuel Mannehed 28b004fd70 Combine small mouse wheel events
The VNC protocol can't handle different deltas or speeds for a mouse
wheel event. When using a device that sends a lot of small mouse wheel
events, instead of fewer larger steps, the effect was that mouse wheel
scrolling was way to sensitive.
This patch looks at the delta of wheel events and doesn't send events
until the combined delta has passed a threshold. Single events that
doesn't pass the threshold get sent after a timeout in order to not
loose any events.

Fixes #577.
2017-09-17 18:23:57 +02:00
Samuel Mannehed c1e2785fb6 Split devices.js into keyboard.js and mouse.js 2017-09-17 18:23:57 +02:00
Pierre Ossman c338622719 Build encoding stats array dynamically
Avoids having to hard code which encodings we might see.
2017-09-07 17:18:25 +02:00
Pierre Ossman f8ec2df2bb Add helper for encoding enumeration and names 2017-09-07 17:18:25 +02:00
Pierre Ossman 3e8b26ab58 Remove unused encoding handlers
These should never be sent by a server, so we don't need handlers
for them.
2017-09-07 17:18:25 +02:00
Pierre Ossman bc86b63c24 Remove unused helper for Tight encoding
It's already been inlined where used.
2017-09-07 17:18:25 +02:00
Pierre Ossman 910fd3afc9 Fix handling of ExtendedDesktopSize errors 2017-09-07 17:18:25 +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 1678bf860f Stop hiding exceptions in WebSock class
Let them application decide how to deal with such things and do not
enforce this particular model, which easily hides bugs.
2017-09-07 17:18:25 +02:00
shaneharris b5c982ea42 fix typscript error - the only one. (#837)
* fix typscript error TypeScript error: novnc/core/rfb.js(1012,17): Error TS7027: Unreachable code detected.

* Update rfb.js
2017-08-05 02:29:50 +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
Pierre Ossman 4093c37f28 Ignore compositing key
keyCode 229 is commonly used with virtual keyboards when the
system cannot map things to a specific key. As such we should
treat it as 'Unidentified'.
2017-07-07 15:04:44 +02:00
Pierre Ossman 8f8c1803ff Merge branch 'qemufix' of https://github.com/CendioOssman/noVNC 2017-07-06 13:07:19 +02:00
Pierre Ossman 2bf4cf5a20 try/catch guard for QEMU keyboard test
Safari on older iOS doesn't support creating KeyboardEvent objects,
so put a guard in to avoid crashes.
2017-07-06 13:00:00 +02:00
Pierre Ossman 7cac5c8e9f Fallback for missing keypress events
IE and Edge have some corner cases (e.g. Ctrl+key) where we get
insufficient information in the keydown event, and we never get
a keypress event. Try to make a guess of the key in those cases.
2017-07-06 13:00:00 +02:00
Pierre Ossman 7e79dfe425 Track keys using keyIdentifier
This is necessary on older iOS where code isn't provided.
2017-07-06 13:00:00 +02:00
Pierre Ossman e7c4d669f0 Handle iOS special keys 2017-06-21 14:02:24 +02:00
Pierre Ossman 9e99ce126c Fake key release for iOS hardware keyboards
iOS sends decent key down events, but junk key up events when a
hardware keyboard is used. This confuses the key tracking as a
corresponding release is then never detected. To work around this
we'll treat the hardware keyboard like the virtual ones and send
the key release right away.
2017-06-21 13:58:53 +02:00