Commit Graph

1775 Commits

Author SHA1 Message Date
Solly Ross d21cd6c164 Cleanup: Util code
File: util.js
Tests Added: True (partial -- for logging and array push methods)
Changes:
- Fixed JSHint Errors (indentation, semicolons, global "use strict")
- Made browser detection methods more readable
- added some newline characters when appropriate for readability
- throw Errors not strings!
- Removed conf_defaults, and added make_properties and set_defaults
  instead (see below)

The removal of conf_defaults and switch to make_properties and
set_defaults is to facilitate the switch over to normal Javascript
constructors instead of Crockford-style constructors.  Now, methods
are added to the objects prototype (and thus make properties is called
outside the constructor).
2014-09-15 16:46:02 -04:00
Solly Ross fb64ed2135 Cleanup: DES code
File: des.js
Tests Added: False
Changes:
- Fixed JSHint Errors
- Improved whitespace around operators
2014-09-15 16:46:02 -04:00
Solly Ross f8e9b9f1bf Cleanup and Test: base64.js
This is the first commit in a series of commits
which improve the readability of some of the code
and add tests.

File: base64.js
Tests Added: True
Changes:
- Improved indentation
- Fixed JSHint errors
- Moved loop variables to be declared in the loop for better readability
  (N.B. Javascript does not have block scoping, so the variables are
  still technically available outside the loop -- it just makes the code
  clearer to place them inside the loop, since they are only used there)
2014-09-15 16:46:02 -04:00
Solly Ross 95eb681bbb Support the "NOTUNNEL" tunnel type for TightVNC
Previously, tight auth was supported without any support for tunnels,
even the no-op tunnel.  No, the no-op tunnel type is supported.
2014-09-15 16:46:02 -04:00
Solly Ross 91127741be Support running all tests from the root directory
Previously, if you did not specify a tests file,
you had to be in the 'tests' directory for the
"run all tests" functionality to work.  Now it
will work in any directory.
2014-09-15 16:44:36 -04:00
samhed 960752ea53 fixes an error that was made in the merge with the last sync with websockify. 2014-08-19 13:49:55 +02:00
Solly Ross 9b731d3a58 Fix race condition in test runner
Previously, there would be a case where if your tests took
too long to run, the casper test runner would only report
on certain tests.  This has been fixed.
2014-06-03 17:42:28 -04:00
Solly Ross 93af721a27 Output error events from provider in test runner
Now, 'error' events from the test runner are output to stderr.
Additionally, when debug is enabled, debug output is logged to
stderr instead of stdout (as was the case previously).
2014-06-03 16:58:37 -04:00
Solly Ross 7187bc121f Fixed typo in run_from_console.js 2014-06-03 13:15:02 -04:00
Solly Ross d906dfc953 Add support for injecting test helper files
Now, the phrase `requires test modules: ` may be place in a comment
in a file to require modules local to the test directory, similarly
to the way the `require local modules: ` line may be used to inject
files in the 'include' directory.  This is useful for when common
fakes need to be injected into a test.
2014-06-03 11:17:33 -04:00
Solly Ross 4a4643c05d Support automatically opening test HTML in browser
When using the '-g' option with run_from_console.js, you can
now pass the '-o' option to automatically open the generated
HTML file in your default browser.  This relies on the 'open'
NPM module.
2014-06-03 11:17:29 -04:00
Samuel dd3a8a1b6d Merge pull request #363 from kosmasgiannis/query_parse
Better parsing of query string variables
2014-05-06 09:13:18 +02:00
Giannis Kosmas d8c0953567 Better parsing of query string variables 2014-05-05 23:23:48 +03:00
Solly Ross c77938efc9 Fix for scroll offset in Util.getPosition()
Previously, Util.getPosition didn't deal with scrolling
particularly well.  This fixes that by calculating the
scroll offset when dealing with getting mouse positions.

Credit to @erikgull and @emmar for the initial version of
the fix.  Credit to Brian Huismanfor the initial code.

Closes #295
Relevant to #258
2014-05-05 14:51:32 -04:00
samhed 082027dc87 Sync with websockify
Pull 90b519edf0c1857d
2014-04-14 14:45:15 +02:00
samhed 60a415ae1c Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).
Fix keyboard handling for IE10 (issue #352)
* Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
2014-04-14 13:26:52 +02:00
samhed 8f4a291b16 Updated the comment in vnc.html to reflect the changes made in last commit. 2014-04-07 16:58:59 +02:00
samhed eeda79d3c3 Changing the type of the keyboardinput element to textarea, fixes issue 356.
* The on-screen keyboard not closing when pressing Enter is more important than not having textsuggestions etc.
2014-04-07 16:41:25 +02:00
samhed 0bb6a8c50e Fixes issue 344 - problem with backspace on Android. 2014-04-04 17:45:04 +02:00
samhed de8edde4a0 Attempt to change the behavior of the enter/go-key on touch devices, we want it to be Enter.
* This code works in Firefox on Android and on Chrome and Safari on iOS.
* It does not work in Chrome on Android, the enter key is labled "Go" and closes the on screen keyboard when pressed.
2014-04-04 17:42:12 +02:00
samhed 74d3d75a4a Change type of keyboardinput to password to make sure that you can write parenthesis on iOS devices. 2014-04-04 17:36:17 +02:00
samhed b98fed2f69 Aim to disable text suggestions and the like 2014-04-04 17:28:44 +02:00
samhed df0ee70e36 Make sure that the default value of the hidden input field is a space. 2014-03-28 08:54:49 +01:00
Solly 7cad15425e Merge pull request #347 from dol/fix/better-ws-binarytype-detection
Improved websocket binary support detection
2014-03-26 10:58:11 -04:00
samhed 23817e1516 Added alt-values to the control-bar buttons.
* On slow servers where the button-images can be slowly loaded it can be useful to see some relevant text instead of "Submit query" on every button.
2014-03-26 15:24:50 +01:00
samhed 0fe30338a0 Add a prototype from MDN for indexOf to be used in browsers where it is not supported. 2014-03-26 15:22:45 +01:00
samhed 2fa1c0988a Removed unused code. 2014-03-26 11:18:48 +01:00
samhed 2db62a9528 Fixed typo in README. 2014-03-17 14:24:42 +01:00
samhed b7996b048b Added a wrapper for the UTF-8 decoding. 2014-03-14 15:18:05 +01:00
samhed 6227a91c01 Decode from UTF-8 to allow unicode characters in the connection name 2014-03-14 13:44:10 +01:00
Samuel f1e6daf3c8 Merge pull request #348 from Medical-Insight/fix-altgr-firefox
Fix altgr firefox
2014-03-12 16:51:20 +01:00
Jesper Dam 230784066c Better browser OS detection.
Apparently Firefox on Linux changed the value of navigator.appVersion,
causing our OS detection (used to determine how to interpret different
modifier keys) to fail.

Use navigator.platform instead, which should be more stable.

http://stackoverflow.com/a/19883965/33213
2014-03-12 11:19:57 +01:00
Jesper Dam c3f6052435 Better key identifiers
Previously we identified keys in keyboard events by the 'key' property
if it was set, and 'keyCode' otherwise.

This turns out to be problematic as Firefox no longer leaves 'key'
undefined (so we fall back to using 'keyCode'), but instead sets 'key'
to 'MozPrintableKey' for all printable keys.

This meant that when (printable) keys are released, we can't match it
against the corresponding keydown event, and instead just send a keyup
event for the last keydown received.

Now, if both 'key' and 'keyCode' are set, use the concatenation of both.
Otherwise prefer 'keyCode', as that is at least unique for every key.

This should let us release the right keys on keyup events.
2014-03-12 11:19:56 +01:00
Dominic Luechinger 97362c3980 Improved websocket binary support detection
A facke connection to 'wss://localhost:17523' (randomly chosen) to detect
the WebSocket binary support is not the best solution.
First of all, check of prototype has the property 'binaryType'. If not,
perform a dummy connection to 'wss://.' instead of 'wss://localhost:17523'.

This patch was inspired by the discussion and implementation of Modernizr:
https://github.com/Modernizr/Modernizr/issues/370
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
2014-03-11 14:29:58 +01:00
Solly c70000bac4 Merge pull request #338 from vatesfr/configurable-ws-protocols
WebSocket protocols are now configurable
2014-02-19 18:10:44 -05:00
Julien Fontanet c7fc3c082f WebSocket protocols are now configurable. 2014-02-19 19:29:06 +01:00
Solly e791b87572 Merge pull request #242 from Medical-Insight/use-wss-for-binary-detect
Use wss when creating localhost connection to detect binary support (closes #242)
2014-02-17 18:09:16 -05:00
Malcolm Scott fb35d50f6a Implement XVP UI in HTML 2014-02-17 17:55:28 -05:00
Malcolm Scott a856a051da Implement XVP extension (shutdown/reboot/reset) 2014-02-17 17:55:28 -05:00
Malcolm Scott 03ab251587 Implement XVP auth 2014-02-17 17:55:28 -05:00
Solly df6b7d7341 Merge pull request #327 from devicenull/master
Add support for connecting to TightVNC servers
2014-02-10 17:21:29 -05:00
Samuel afbeb98cfb Merge pull request #336 from samhed/removeConnectionTimeout
Remove the connection timeouts
2014-02-07 10:15:04 +01:00
samhed 20074a49eb Removes the connection timeouts to enable slower clients, connections or servers. 2014-02-06 16:08:00 +01:00
Brian Rak d86cc2d911 Add support for TightVNC auth type 2014-01-30 19:20:41 -05:00
Solly 98c1275d80 Merge pull request #329 from Medical-Insight/fix-shift-chars
Fixes #326: correct handling of shift key
2014-01-13 13:01:16 -08:00
Jesper Dam f6a1d98a3a Fix issue #326: correct handling of shift key
When shortcut modifiers (modifier keys such as CTRL, which do not participate in
composing character input) are pressed, we try to suppress the keypress
event, as browsers do not reliably generate it. This means that
subsequent key events are decoded only based on the keydown event.

Due to a type error (comparing a string to a number), shift was
mistakenly treated as a shortcut modifier, preventing text input which
relied on shift, such as _ and %, from being generated.
2014-01-06 13:59:25 +01:00
Solly Ross 85e8991664 Support 'requires' Line in Test Runner
If the files passed to the '-t' option are all '.js' files (or
the 'run all tests' option is used) and the '-i' option is not
passed, all tests will be search for the string
'require local modules: '.  Only the first instance of this string
will be used.  Following the colon should be a list of either local
modules (i.e. files in the '../include/' folder relative to the
test runner's directory, without the '.js' extension) or paths
to other Javascript files.  The list of modules and/or files should
be comma-separated.  These files will then be included in the generated
HTML file for the appropriate tests as if the '-i' option had been used.
2013-12-17 18:00:57 -05:00
Solly Ross d823e8956e Support Running All Tests
Now, if the '-t' option is passed but no tests are listed,
all tests in the same directory as the launcher will be run.
A file is considered a test if it matches the RegEx
/^test\.(\w|\.|-)+\.js$/ (for those who cannot read PCRE,
that's roughly 'test.*.js').
2013-12-17 18:00:45 -05:00
Solly Ross 8eb88937cc Support Skipped Tests and Fix JSHint Issues
The test runner now will not break when Mocha skips tests,
and will properly report them.  Additionally, several JSHint
warnings were fixed, and a `--debug` option was added to see
output from the provider.
2013-12-17 17:56:18 -05:00
jalf 466a09f0f3 Keyboard Handling [8/8]: Introduce substituteCodepoint() to replace code points which don't have a keysym with ones that do
For now, the only code points this is done for are {s, S, t, T} with comma below (used in Romanian),
 which are replaced by {s, S, t, T} Cedilla.
2013-12-05 12:31:50 -05:00