Commit Graph

31 Commits

Author SHA1 Message Date
Joel Martin f7ec5b2cb6 Rename default_controls.js to ui.js.
And DefaultControls to UI.
2010-11-10 16:02:19 -06:00
Joel Martin e66f3f89f2 Add Chrome Frame support. Close requests in web.py.
- Add meta tag to vnc.html and vnc_auto.html so that if Chrome Frame
  is installed, it is used.

- Add detection to default_controls.js that shows a message with
  a Chrome Frame install link if the user is using a version of IE
  without Canvas support.

- Fix web.py so that requests have their connection closed after they
  are completed.  This has been a bug for a while but it prevents
  Chrome Frame from working because Chrome Frame doesn't activate
  until the initial request connection closes.
2010-11-09 12:06:03 -06:00
Joel Martin 5f409eeeeb License header cleanup. 2010-09-08 15:06:34 -05:00
Joel Martin d595e65685 JSLint. 2010-09-08 10:11:11 -05:00
Joel Martin 8db09746b7 New API. Refactor Canvas and RFB objects.
New API:

To use the RFB object, you now must instantiate it (this allows more
than one instance of it on the same page).

    rfb = new RFB(settings);

The 'settings' variable is a namespace that contains initial default
settings. These can also be set and read using 'rfb.set_FOO()' and
'rfb.get_FOO()' where FOO is the setting name. The current settings
are (and defaults) are:
    - target: the DOM Canvas element to use ('VNC_canvas').
    - encrypt: whether to encrypt the connection (false)
    - true_color: true_color or palette (true)
    - b64encode: base64 encode the WebSockets data (true)
    - local_cursor: use local cursor rendering (true if supported)
    - connectTimeout: milliseconds to wait for connect (2000)
    - updateState: callback when RFB state changes (none)
    - clipboardReceive: callback when clipboard data received (none)

The parameters to the updateState callback have also changed. The
function spec is now updateState(rfb, state, oldstate, msg):
    - rfb: the RFB object that this state change is for.
    - state: the new state
    - oldstate: the previous state
    - msg: a message associate with the state (not always set).

The clipboardReceive spec is clipboardReceive(rfb, text):
    - rfb: the RFB object that this text is from.
    - text: the clipboard text received.

Changes:

- The RFB and Canvas namespaces are now more proper objects. Private
  implementation is no longer exposed and the public API has been made
  explicit. Also, instantiation allows more than one VNC connection
  on the same page (to complete this, DefaultControls will also need
  this same refactoring).

- Added 'none' logging level.

- Removed automatic stylesheet selection workaround in util.js and
  move it to defaultcontrols so that it doesn't interfere with
  intergration.

- Also, some major JSLinting.

- Fix input, canvas, and cursor tests to work with new model.
2010-08-02 17:07:27 -05:00
Joel Martin da6dd8932e API changes. Client cursor and settings menu.
The following API changes may affect integrators:

    - Settings have been moved out of the RFB.connect() call. Each
      setting now has it's own setter function: setEncrypt, setBase64,
      setTrueColor, setCursor.

    - Encrypt and cursor settings now default to on.

    - CSS changes:
        - VNC_status_bar for input buttons switched to a element class.

        - VNC_buttons split into VNC_buttons_right and
          VNC_buttons_left

        - New id styles for VNC_settings_menu and VNC_setting

Note: the encrypt, true_color and cursor, logging setting can all be
  set on load using query string variables (in addition to host, port
  and password).

Client cursor (cursor pseudo-encoding) support has been polished and
activated.

The RFB settings are now presented as radio button list items in
a drop-down "Settings" menu when using the default controls.

Also, in the settings menu is the ability to select between alternate
style-sheets.

Cookie and stylesheet selection support added to util.js.
2010-07-21 20:34:23 -05:00
Joel Martin 7c81747b52 Make black.css an alternate stylesheet. 2010-07-15 19:58:33 -05:00
Joel Martin a93c955538 Opera works! Fix message event drops/reorders.
Instead of relying on FABridge AS -> JS event delivery, we just use
the events to notify JS of pending data. The message handler then
calls the AS readSocketData routine which sends back an array of
the pending WebSocket frames.

There is still a minor bug somewhere that happens after the first
connect where the web-socket-js throws an "INVALID_STATE_ERR: Web
Socket connection has not been established". But, Opera is now usable
and we should be able to drop the packet sequence numbering and
re-ordering code.

Another minor issue to better support Opera is to move JS script
includes to the <head> of the page instead of after the body.
2010-07-01 09:53:38 -05:00
Joel Martin d93d3e09ab Various cross-browser fixes.
Now working under Arora 0.5.

But not Konqueror 4.2.2 (WebSockets never connects).

IE support with excanvas still pending.
2010-06-23 16:08:36 -05:00
Joel Martin 96a6eaadbc Move vnc.js into include directory.
Also, allow 'include/' to be overridden in VNC_uri_prefix.
2010-06-14 14:56:19 -05:00
Joel Martin 913083993b Direct example. Move all DOM code default_controls.js.
Move DOM manipulation into include/default_controls.js and update
vnc.html to use it.

Add an example vnc_auto.html which automatically connects using
parameters from the query string and doesn't use default_controls.js.

Reorder functions in vnc.js to put external interface functions at the
top of the RFB namespace.
2010-06-02 17:08:25 -05:00
Joel Martin 8fe2c2f915 Fix web-socket-js loading issue. 2010-05-17 17:11:13 -05:00
Joel Martin ded9dfae10 Styling/integration refactoring.
- Instead of onload override, move to RFB.load function that takes
  a parameter for the target DOM ID. This allows the user to have
  their own onload function.

- Add "VNC_" prefix to all element ID names. Only create DOM elements
  if they don't already exist on the page, otherwise use the existing
  elements.

- Move all styling to separate stylesheet.

- Use list model for control styling.
2010-05-11 16:13:52 -05:00
Joel Martin 97bfe5ba25 Move controls to vnc.js, make vnc.html very simple. 2010-05-06 17:08:53 -05:00
Joel Martin adfe6ac166 Support for SSL/TLS ('wss://') on both sides.
On the client side, this adds the as3crypto library to web-socket-js
so that the WebSocket 'wss://' scheme is supported which is WebSocket
over SSL/TLS.

Couple of downsides to the fall-back method:

    - This balloons the size of the web-socket-js object from about 12K to 172K.

    - Getting it working required disabling RFC2718 web proxy support
      in web-socket-js.

    - It makes the web-socket-js fallback even slower with the
      encryption overhead.

The server side (wsproxy.py) uses python SSL support. The proxy
automatically detects the type of incoming connection whether flash
policy request, SSL/TLS handshake ('wss://') or plain socket
('ws://').

Also added a check-box to the web page to enable/disabled 'wss://'
encryption.
2010-04-30 16:41:09 -05:00
Joel Martin 7b99f70bd0 Don't erase failed state error messages on disconnect. 2010-04-19 10:46:48 -05:00
Joel Martin 07287cfd89 Send seq nums and b64 encode based on query string.
Query string variable 'b64encode' determine if wsproxy b64 encodes the
results. Variable 'seq_num' determines if sequence numbers are
prepended. This way, sequence numbers are only used with the flash
WebSocket proxy.
2010-04-18 20:35:43 -05:00
Joel Martin 8759ea6f90 Status/error refactor. Fix firefox bugs.
- All state/status updates go through updateState routine which
  updates the status line also.

- Old firefox (and opera) don't support canvas createImageData, so use
  getImageData as replacement.

- Add console.warn and console.error stubs so that firefox without
  firebug doesn't crap out.

- If no WebSockets then error if no flash or if URL is location (flash
  will refuse to load the object for security reasons).
2010-04-18 18:43:03 -05:00
Joel Martin 5d8e7ec068 Add web-socket-js support with packet re-ordering.
- web-socket-js is from http://github.com/gimite/web-socket-js. It is
  a flash object that emultates WebSockets.

Unfortunately, events (or packets) from the web-socket-js object can
get re-ordered so we need to know the packet order.

- So wsproxy.py prepends the sequence number of the packet when
  sending.

- If the client receives packets out of order it queues them up and
  scans the queue for the sequence number it's looking for until
  things are back on track. Gross, but hey: It works!

- Also, add packet sequence checking to wstest.*
2010-04-17 17:24:14 -05:00
Joel Martin 14b665f1da Remove uneeded mootools functions and used compressed version. 2010-04-15 12:28:53 -05:00
Joel Martin 30059bdf24 Add cut and paste support.
- A textarea below the VNC area represents the state of the current
  VNC clipboard. If there is a server cut event, the textarea will be
  updated. If the user updates the contents of the textarea, the new
  data will be sent as a client paste (cut) event.

- One important change was to detect if the clipboard is focused and
  allow the user to type in the clipboard instead of in the VNC area.
2010-04-15 01:40:03 -05:00
Joel Martin 2bcb2d5b15 Remove event handlers on disconnect. 2010-04-13 09:39:29 -05:00
Joel Martin b7ec54870a Switch to much faster console.log and separate utils into util.js. 2010-04-13 09:28:53 -05:00
Joel Martin 85b7a7d411 Handle undefined URL values correctly. 2010-04-10 15:52:08 -04:00
Joel Martin cc0410a39b Cleanup of files and vnc.js namespace.
- Trim unused code in base64.js
2010-04-06 16:44:45 -05:00
Joel Martin 532a9fd92e Better interface, support user provided VNC password.
- host, port and password input boxes (populated by URL values).
- clear canvas on disconnect.
- Dotted border around VNC area.
- mirror bits for VNC password.
2010-04-06 13:49:49 -05:00
Joel Martin 8580b98979 Got DES encryption of password working and colors corrected.
- DES encryption for VNC bit mirrors every bytes of the password. This
  commit has a hard-coded mirrored password. Need to ask user and bit
  mirror it.

- With image data across the wire it's Blue,Green,Red, so twiddle
  things around a bit.
2010-04-06 10:35:25 -05:00
Joel Martin 64ab5c4ded Working with Raw rectangles and capital letter keys. 2010-04-05 23:54:30 -05:00
Joel Martin c8460b0310 Cleanup canvas and vnc code so they can be used together. 2010-04-04 16:08:55 -05:00
Joel Martin 489d167643 Do base64 encode/decode of stream. Send SetEncoding and FB update request. 2010-04-02 19:17:46 -05:00
Joel Martin 65e27ddd4c First RFB protocol stub implementation.
- Requires wsproxy to proxy to the VNC server.
2010-04-01 11:36:22 -05:00