Commit Graph

289 Commits

Author SHA1 Message Date
Pierre Ossman f2d42dc357 Never show drag icon if clipping is disabled
Toggling the enabled state is a remnant from an earlier version
of the code where we could determine if the the session is actually
clipped, and not just that the setting is enabled.

Right now we only change things based on the setting, so let's
completely hide the button when clipping is disabled.
2019-10-14 10:15:19 +02:00
Samuel Mannehed 412d93060d Update copyright to 2019 for modified files 2019-09-30 15:35:33 +02:00
Niko Lehto c90245da25 Restore page name after disconnect 2019-09-04 15:05:14 +02:00
Pierre Ossman 6aed0b4dd2 Deprecate showDotCursor option for RFB constructor
It is not relevant for the connection stage so it should not have
been a constructor argument to begin with. Ship with a warning for
a release before we remove it.
2019-08-23 14:00:20 +02:00
Samuel Mannehed 897b465b87 Add missing parentheses for arrow func arg
Our lint tests expect this when an arrow functino has a body with
curly braces.
2019-07-23 16:12:22 +02:00
Juanjo Diaz 15c7b7a619 Add version number to UI 2019-07-23 10:25:59 +03:00
nnn1590 7ded517823 Add Japanese translation 2019-06-12 04:30:56 +09:00
Samuel Mannehed 32e081950c
Revert "Fullscreen from iframe (#1236)" (#1247)
This reverts commit 19cdc15aa3.
2019-05-25 02:51:38 +02:00
Ján Jockusch 19cdc15aa3 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.
2019-05-13 15:06:32 +02:00
Samuel Mannehed 9a823732a0
Merge pull request #1204 from juanjoDiaz/small_improvements
Small improvements
2019-03-04 09:32:11 +01:00
Juanjo Diaz 1c9b904d1a Remove callbacks from UI in favour of promises 2019-02-27 10:18:59 +02:00
Dmitriy Shweew d917ccdaf7 Add Russian translation (#1211)
By Dmitriy Shweew (shweew)
2019-02-27 01:24:22 +01:00
Baw_Appie 823daa8002 Add Korean translation 2019-01-16 10:43:49 +01:00
Samuel Mannehed ef64917a90 Only disable scrollbars on Android and iOS
Previously scrollbars were disabled on all touch devices. This meant
that they were disabled on Windows when touch was detected. Windows does
in fact have useful scrollbars even in touch mode. Fixes Issue #1172
2019-01-09 14:59:22 +01:00
Samuel Mannehed 47b3eac82b Move UI.isSafari into core/util/browser.js
This is where the rest of these kinds of functions are.
2019-01-09 14:58:03 +01:00
Sebastian Safari 3e835a5d37 Add Windows Key Feature 2019-01-08 06:57:12 -08:00
Samuel Mannehed cffb42ee8f Dont reset touch mouse button state for view-only
Fixes bug introduced in 61f93180c8.
2018-11-01 11:22:19 +01:00
Petr 56c82ecd35 Czech translation 2018-10-19 13:01:39 +02:00
Solly Ross 84586c0f17 Change copyright header (#1138)
* Change copyright header

This updates the copyright header to say "The noVNC Authors".  People
who previously had copyright listings are now under the AUTHORS file.
2018-10-09 12:15:35 +02:00
Pierre Ossman 9881899e7b Merge branch 'style' of https://github.com/CendioOssman/noVNC 2018-09-17 13:54:04 +02:00
Alexander E. Patrakov 4c38179d15 Show dot when there is no visible cursor
Disabled by default.
2018-09-14 20:31:59 +05:00
Pierre Ossman 4a16dc51a8 Enforce no trailing whitespace 2018-09-06 17:12:45 +02:00
Pierre Ossman 35068204f4 Enforce keyword spacing 2018-09-06 17:08:19 +02:00
Pierre Ossman 942a312779 Enforce object key spacing 2018-09-06 17:07:11 +02:00
Pierre Ossman 6786fd8719 Enforce comma spacing 2018-09-06 16:43:31 +02:00
Pierre Ossman a98881151f Enforce brace style 2018-09-06 15:39:26 +02:00
Samuel Mannehed c995c0863e Revert "Handle if desktopName isn't set.."
This reverts commit 22000b93d5. The
'desktopname' and the 'connect' events are dispatched by us in RFB and
are thus serial.
2018-08-16 15:52:21 +02:00
Samuel Mannehed 22000b93d5 Handle if desktopName isn't set when connected
We can't guarantee that the desktopName event has been fired before the
connect event.
2018-08-16 13:33:35 +02:00
Samuel Mannehed a793df3d6d
Merge pull request #1118 from novnc/disabledragwhilescale
Turn off view drag when scaling
2018-08-16 10:31:09 +02:00
Samuel Mannehed 4ddcc7537f Merge enableDisableViewClip and updateViewClip
Makes the code easier to follow and makes sure that viewDrag is
properly disabled when scaling. Fixes #1110.
2018-08-16 10:29:01 +02:00
Samuel Mannehed 3b7c47417e Move dragThreshold definition to util/
In order to avoid multiple declarations that has to be updated in the
case of future updates.
2018-08-10 11:24:09 +02:00
Samuel Mannehed 2bbd15ccaf Remove setViewDrag function
Unnecessary function only used in the toggle function above.
2018-07-30 10:46:41 +02:00
Samuel Mannehed 0b903af296 Remove unnecessary code
The enableDisableViewClip call in the fullscreen code didn't have any
effect and should have been removed when the special case for clipping
in IE and Safari fullscreen was removed in b18ef81.

The setViewDrag call claimed to disable view drag on UI state change.
The UI states are:

 init, connecting, connected, reconnecting, disconnecting, disconnected

The only state where the called function didn't immediately return was
"connected" and that's the only state where enabling view drag is
possible. Thus it could never have been enabled when changing to the
"connected" state.
2018-07-30 10:29:35 +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
Samuel Mannehed 11715f2092 Properly force clipping on touch
It shouldn't depend on what's saved in webstorage nor save the forced
value to webstorage.

Includes a revert of 0342e4f489
2018-06-07 15:58:31 +02:00
Samuel Mannehed 0342e4f489 Clipping should be enabled on touch
This was always the intention and the main use case of 'clipping'. It
seems like it got lost somewhere along the way.
2018-06-04 21:41:45 +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
CUI Wei dcee7c5e91 Add translation in zh_CN
Signed-off-by: CUI Wei <ghostplant@qq.com>
2018-04-07 06:16:00 -04:00
Pierre Ossman 3328675b44 Clarify which Chinese translation we have
Chinese has several writing systems so we need to be clear which one
our translation covers. The one we currently have is for Traditional
Chinese so make sure it uses the matching language tag.
2018-04-03 14:51:12 +02:00
Samuel Mannehed 06309160ee Only disable animation when element is displayed
The transitionend event will not fire when display=none. This can
prevent the initial animation for hiding the controlbar in some cases.
2018-03-08 16:52:53 +01:00
Andrew Webster 8ad8f15cf6 Move writeSetting from updateSetting to initSetting
initSetting was the only place that supplied a 'value' to
updateSetting.  So move it to clean up updateSetting.
2018-02-13 10:22:36 -05:00
Andrew Webster e0750f9b2c Use localstorage only to initialize settings map
This only reads from localstorage in order to initialize the settings
map.  After initializaton, reads will return the value from the map.

When writing a value, the settings map and the local storage
are updated, unless the setting is a default value or derived from
the query string.

This has a few advantages:
 1. Saved settings will not be overridden by settings specified in
the query string.  This means a setting could be temporarily changed
using the query string, but once removed from the query string, the
setting would return back to what the user selected.
 2. Default values will not be saved.  If a user has always used
the default value for a setting, then they can move to a new version
with different defaults without clearing localstorage.
 3. Changes made to localstorage in a session running in a different
window will not affect the settings in the current window (until
the page is refreshed).

Regarding eraseSetting:

It is possible that another tab could change the value, leading
to an unexpected value change in the tab that deletes.  However,
this function is currently unused, so this will be evaluted if
and when it used.
2018-02-13 10:22:21 -05:00
Pierre Ossman 7c332ad930 Don't crash on translation errors
A non-translated interface is better than no interface at all.
2018-02-07 09:23:45 +01: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
Ömer ÇAKMAK 690d07baba Add Turkish translation 2018-02-01 16:28:39 +01: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
Juanjo Diaz 7b73dbd4dd Add Spanish translation 2018-01-30 19:17:55 -08:00
Juanjo Diaz 59ef29163e Move browser checks to browser.js 2018-01-30 08:35:47 -08:00
Pierre Ossman d1aeb43551 Drop UI.rfb reference on all disconnects
We can be disconnected because of server reasons, not just because
someone clicked the disconnect button. Make sure we clean up the
reference and get a proper state in those cases as well.
2018-01-25 15:32:22 +01:00
Samuel Mannehed 61f93180c8 Show/hide mouse button selector in updateViewOnly
Before this commit, the mouse button selector was hidden when the user
clicked it in view only..
2018-01-12 01:45:26 +01:00
Samuel Mannehed f3763a010c Update interface on view only toggle
Instead of waiting for updateVisualState() to be called in order for the
interface to update, we can call it directly in updateViewOnly(). This
is a better placement logically as well. Another upside of this is that
we can call updateVisualState() earlier on connect, that allows for the
"connecting"-throbber to be shown quicker.
2018-01-12 01:45:15 +01:00
Peter Dave Hello 03d829f170 Add Chinese (Traditional) translation 2018-01-10 00:59:27 +08:00
Deni42 37c609359a Fix view_only setting with autoconnect (#985)
updateVisualState() and updateViewOnly() requires an initiated UI.rfb reference, the calls in connect() was made too early.
2018-01-05 12:05:17 +01:00
Samuel Mannehed a4822c3a86 Only connect if we don't have an rfb object
Each connection creates a new RFB object. Fixes #978.
2017-12-14 12:16:45 +01:00
Samuel Mannehed 75e1161434 Throw away the reference to RFB on disconnect 2017-12-14 12:15:56 +01:00
Samuel Mannehed 7f1049c0ee Make error more specific at connection failure
The UI does after all have enough information to determine if the
disconnection event was received before or after we were connected. If
we were never connected at all, we should adapt the error message to
reflect this.
2017-12-12 16:14:43 +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
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 689580381c Move UI.cancelReconnect() to related functions 2017-11-14 15:36:12 +01:00
Samuel Mannehed d623a029d6 Dont overwrite more severe visible statuses
And only show the first error. This means that if UI.showStatus() is
called for a new error while one error is already showing, the new
error will not be shown. However, if a warning was showing and a new
error comes up, the warning will be overwritten.
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 8317524cda Don't translate log messages 2017-11-11 02:12:45 +01:00
Samuel Mannehed 2592c24388 Translate user visible text
And make the log message a bit more detailed
2017-11-11 02:12:39 +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 a201bfc5eb Merge branch 'api' of https://github.com/CendioOssman/noVNC 2017-11-10 14:19:05 +01:00
Pierre Ossman a80b5fdaaf Prevent password form submission early
Otherwise it might reload the page if we run in to some kind of
error.
2017-11-09 13:14:16 +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 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 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 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 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
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 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 4c11755ce7 Merge branch 'focus' of https://github.com/CendioOssman/noVNC 2017-10-18 15:12:46 +02:00
Pierre Ossman 867daa98af Restore handling of key events for virtual keyboard
We broke handling of keydown/keyup when we moved the focus to the
canvas, as events from our input element would then no longer be
caught when they bubbled up to the document object (where we
previously caught events).

Restore the previous behaviour in a cleaner manner by creating a
second Keyboard object to handle this extra input variant.
2017-10-18 15:08:33 +02:00
Pierre Ossman 06fe4a3e1b Make sure control bar stays visible on Tab
Avoid the deprecated keypress event in favour of the keydown event.
It has the benefit of triggering for all keys, not just those that
produce symbols.
2017-10-18 15:08:33 +02:00
Pierre Ossman 2545a6c12e Stop giving host field default focus
It's a field that isn't shown by default and rarely changed.
2017-10-18 15:08:33 +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 a342ed703f Check if <audio>.play() returns a promise
It doesn't always. IE and Edge crashed when trying to play the bell due
to this. Fixes #929.
2017-10-17 12:16:38 +02:00
Samuel Mannehed 2e735160bf Save pw for reconnections when using query params 2017-10-16 11:06:40 +02:00
Mariusz Jamro a0513c87c7 Add polish translation 2017-10-10 15:37:31 +02:00
Giannis Kosmas 067accb8d9 autoconnect variable was used before it was defined. 2017-10-06 22:53:52 +03:00
Pierre Ossman d593483ecc Make port optional in ui.js as well
It is optional in the RFB object since 1a50f68, so we don't need it
at the UI layer either.
2017-10-06 10:07:47 +02:00
Samuel Mannehed a49ade5fa0 Rename setting_clip to setting_view_clip
Clarifies the purpose of the setting in order to avoid mix ups with
clipboard related things.
2017-09-07 09:01:52 +02:00
Samuel Mannehed 409b7fb97e Remove unused variable
The use of this variable was removed in b18ef8162e
2017-09-07 09:00:15 +02:00