Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clipboard support #1

Conversation

snickell
Copy link

This PR is a continuation of @juanjoDiaz 's hard work here: novnc#1347

At the moment, its identical to novnc#1347, but with the merge conflict relative to noVNC:master resolved.

Please close this PR if its not helpful, but I don't think the other PR can be continued without @juanjoDiaz being involved, so it seemed like a new PR was necessary to fix novnc#1511

He explained it better than I can:

juanjoDiaz commented on Dec 18, 2019
This PR adds support for automatic copy-pasting.
So when you are focused on the canvas and paste text it's pasted in the server and when you copy something in the server > it's automatically copied to your local keyboard.

I've seen novnc#1301 and novnc#1174. But this takes a very different approach since it adds support for copy-pasting to noVNC's core. > And I think that it's quite cleaner.

I've tested it in Safari, Firefox, and Chrome.
Unfortunately, the Clipboard API is only supported by Chrome and the paste event is broken (see https://bugs.chromium.org/p/chromium/issues/detail?id=634426).
So it just does nothing in Safari and Firefox, while in Chrome the copying of data works but not the pasting.

CendioOssman and others added 30 commits May 5, 2020 12:43
This was done a bit arbitrarily before which could easily miss things,
end up in the wrong state and not trigger animations correctly.

This reverts commit c12e5b2 and fixes
things in a different way.
Previous attempt in c958269 had a number of issues, this is a full
rewrite, complete with improved unit tests.

Fixes github issue novnc#1402
The code that used these were removed in the following commits:

* 9ff86fb (RFB._mouse_arr)
* bb6965f (old_requestAnimationFrame)
* 490d471 (Display._c_forceCanvas)
It is only used there so no need for it to be in the general
Display class.
The forth byte of a pixel is undefined in most encodings, so make sure
the decoders don't leak that through as an alpha channel.
Keep everything simpler by always blitting in the same pixel format.
It's up to the decoders to convert if they need to.
This is what the browser wants so it avoids having to spend time
converting everything. Unfortunately it usually means the server instead
needs to convert it for us, but we assume it has more power than we do.
It takes forever and just messes up the output.
Some code relies on the clock having a somewhat sane value, so let's not
start at 0.
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.
CendioOssman and others added 29 commits December 30, 2020 16:13
We want users to use the templates so we don't miss any relevant
information.
So that people can easily find it and not file bug reports for
things that are just questions.
It's listed with the issue templates, so make sure it follows the same
style in phrasing.
Some people have longer passwords than 256 characters (hooray for
password managers!). Server implementations also allow longer passwords:
TigerVNC allows up to 1024 characters.
This work is originally by Ryan Castner <castner.rr@gmail.com> and
submitted as a PR here novnc#1362

Architecturally it is much the same except it doesn't rename a lot
of variables to make this more reviewable. It also avoids unrelated
changes such as replacing .onclose with an event listener, which
caused numerous test failures.

It also adds in ppoffice's fix to initialise the buffers.

Like the original author I don't have enough time available to
refactor this project to the new style event listeners.

Review cleanup for RTCDataChannel support (see below)

* More descriptive error when url or channel not set.
* Moved websocket property check to WebSock.
  This had unintended consequences in the tests that required some
  fixup. Mostly due to some tests not always passing FakeWebsocket.
  FakeWebsocket also needs to set the listeners to null to be compatible
  with what is in thw browser and expected by the property check code.
  The property check code now also takes into account class prototypes
  for test compatibility.
* Removed unreachable code.
* Reverted comment.
* Cleanup raw channel reference in rfb on websock close.
* Use readyState to check whether a socket is open rather than assuming.
* Updated RFB constructor documentation

Removed an unused boolean passed to attach
Most places that check for the presence / absence of credentials compare
them against `undefined`, except the one for Plain authentication.

This change makes the very last place to use the same pattern (instead
of checking for falsiness) for consistency. Additionally, there are ways
to configure PAM to accept empty passwords, so it's possible for a user
to legitimately send an empty string as password.
This change adds tests for the VeNCrypt Plain authentication. In doing
that, this also fixes a typo that was introduced in a recent change.
This is an error that presents itself with RTCDataChannel's, I suspect this could not
happen with a pre-existing WebSocket.

If the remote connection creates a data channel then the local (VNC) side gets a channel
created callback. It may also be the case that in that very same tick the socket is also
opened and buffered data received. This meant that (in my tests) about 1/3 of the time
noVNC would fail to respond to the initial message from the server because it was received
and subsequently not handled during that initial tick.

Also made the documentation reflect this new behaviour and document the existing behaviour.
…l-race-condition

Fixed a race condition when attaching to an existing socket
This reverts commit ef27628. By
bypassing setTimeout() it creates other race conditions so this is not
the proper fix for the issue.
These are internal and we should be testing the externally observable
behaviour.
Avoid cluttering up the RFB constructor.
It mainly reports the state of the underlying object in consistent
manner.
We can't do anything useful with them anyway.
We don't know if the caller is prepared to receive those events right
now as normally they would get them on a fresh new stack later. We also
can't delay delivery since then we might deliver the event after any
pending "message" events.

Better to push the problem one layer up to the caller, which now needs
to be more aware of the state of the WebSocket object it is trying to
use.
We need to do this in order to safely attach to existing WebSocket
objects. There may be message events already pending so we must set up
our event handlers before returning.

This means we will now throw errors instead of generating "disconnect"
events on problems as the caller no longer has the opportunity to set up
event handlers.

This might have been the correct approach from the start as it mimics
how e.g. the WebSocket constructor works.
Update Spanish Translation.

Added missing translations. Fixed some typos.
Also, some changes were made to use a more formal and international spanish.
Co-Authored-By: Adam Young <ayoung@redhat.com>
add Man page for launch.sh and rename to novnc_proxy
@snickell snickell closed this Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.