Commit Graph

21 Commits

Author SHA1 Message Date
Jonathan Bennett 3c9558444c Adds missed line from PR 597 2016-04-13 12:53:37 -05:00
Jonathan Bennett c8294760b1 Handle missing leading slash in elem.pathname
IE11 with compat mode turned off has been observed displaying this behavior.  This commit checks for and corrects this broken behavior.

Fixes #591
2016-04-12 11:00:28 -05:00
Miguel Xavier Penha Neto c55f05f619 Pass token into the path variable
If a token is already present in the path, the new variable
is ignored.  In order to properly manipulate the path,
a new method, `WebUtil.injectParamIfMissing` was introduced.

Fixes #536

[@directxman12: fix up path manipulation logic]
2016-01-06 15:56:28 -05:00
Ganesh Varadarajan 494b407a0a Add hash fragment as an optional method to supply config variables.
Any config variable like host, port, password, token may be
specified either in the query string (like now), or in the URL hash
fragment. In case a given variable is present in both, the value in the
fragment takes precedence. Supplying variables in the fragment avoids
leaking them to the web server hosting the noVNC viewer HTML.
2015-10-23 18:54:08 +05:30
Solly Ross ee7d4c61c6 Cleanup: Webutil code
File: webutil.js
Tests Added: False
Changes:
- Fixed JSHint Errors (global "use strict", spaces)
- added some newline characters when appropriate for readability
- moved variable declarations to the places they were actually used
  for readability
2014-09-15 16:46:02 -04:00
Giannis Kosmas d8c0953567 Better parsing of query string variables 2014-05-05 23:23:48 +03:00
Takashi Natsume ad941fadde Adds support for secure attribute on token cookie
This patch adds support for the secure attribute on token
cookies (sent by nova-novncproxy). If the https is used
to transfer the cookie, the secure attribute is set thus
restricting server requestes to secure conections only.
This should prevent man-in-the-middle attacks.
2013-10-29 10:41:51 +00:00
Joel Martin 1d728ace69 Change noVNC license to from LGPLv3 to MPL 2.0
The MPL 2.0 license is a "file-level" copyleft license vs the
"project-level" nature of the L/GPL. The intention of noVNC has
always been that it should be easy to incorporate into existing
projects and sites whether free/open or proprietary/commercial. The MPL
2.0 is designed for this sort of combination project but still
requires that any distributed modifications to noVNC source files must
also be published under the same license.

In addition, the MPL 2.0 allows the code to be used in L/GPL projects
(the secondary license clause). This means that any projects that are
already incorporating noVNC should not be impacted by this change and
in fact it should clarify the licensing situation (the exact
application of the L/GPL to web applications and interpreted code is
somewhat ambiguous).

The HTML, CSS, image and font files continue to be under more
permissive licenses (see LICENSE.txt). The included websockify python
code remains under a LGPLv3 license although the include/websock.js
file from the websockify component is now under MPL 2.0 as well.

Permission was received from other noVNC authors to make this change to their
code license on the following dates:

    - Chris Gordon (UI): Jun 24, 2012
    - Antoine Mercadal (DOM,*util.js): Oct 10, 2012
    - William Lightning (UltraVNC repeater): Oct 10, 2012
    - Mike Tinglof (tight encoding): Oct 15, 2012
2012-10-15 13:35:00 -05:00
Joel Martin d5fe15096b include/webutil.js: fix when 'chrome' global not present. 2012-09-17 17:18:44 -05:00
Joel Martin 2cde6e4380 include/vnc.js: dynamic load without document.write.
Instead of using document.write to load scripts, use createElement to
create and append script tags. document.write is problematic in a lot
of situation and in particular is not allowed in a Chrome
extension/packaged app.

Also, in webutil.js, instead of calling init_logging during parsing of
include/webutil.js, rely on the caller to do this. The problem is that
calling init_logging on parse tries to call Util logging functions and
the new model of dynamic load may not having Util loaded by the time
webutil is parsed.
2012-09-17 17:15:49 -05:00
Joel Martin 3af1c2751b webutil.js: add localStorage/chrome.storage settings.
Add routines to store/read settings in either localStorage or in
chrome.storage.sync (which is synchronized between browsers for
extensions/apps).

Before using chrome.storage.sync the initSettings routine must to
called setup the intermediate cache which speeds up access and allows
multiple setting changes to be coallesced to avoid hitting storage
change frequency limits/quotas.
2012-09-17 17:15:49 -05:00
Joel Martin fa5b334dcb webutil.js: use decodeURIComponent on getQueryVar values. 2012-08-21 09:46:11 -05:00
Joel Martin d58f8b5144 License clarification: HTML,CSS,images,fonts under permissive licenses.
Clarify in LICENSE.txt that the noVNC core library is the part that is
LGPLv3 licensed. The HTML, CSS, images and fonts are separate from the
core library and can be modified and distributed with the noVNC core
but under their own license conditions.

HTML and CSS: 2-Clause BSD
Fonts: SIL OFL 1.1
Images: CC BY SA 3.0

In other words, you can modify the layout and appearance of of noVNC
to integrate with an existing or new web site or application without
having to publish the source for those modifications under the LGPLv3.
However, use of and modification of the noVNC core library (i.e. the
core Javascript that makes up noVNC) must still be according to the
LGPLv3.

Chris Gordon was the other contributor to the HTML, CSS, and images
included with noVNC and gave permission for this license clarification
on June 23, 2012.
2012-06-24 16:29:44 -05:00
Joel Martin 9e6e6662c7 Set $D on window directly.
Addresses: https://github.com/kanaka/websockify/issues/29
2012-02-14 17:23:14 -06:00
Joel Martin ff4bfcb773 Linting.
Switched to using: http://www.jshint.com/
2012-01-12 12:38:55 -06:00
Joel Martin 0a92014700 include/webutil.js: fix dirObj undefined attribute. 2011-04-05 14:46:22 -05:00
Joel Martin d0c29bb679 Fix copyright year to 2011. 2011-04-05 14:44:47 -05:00
Joel Martin 1b097a63a3 Fix strict mode complaints in firefox 4. 2011-01-16 18:57:45 -06:00
Joel Martin e46719100c Make compatible with jQuery. Slight API change.
Rename the $() selector to $D() so that it doesn't collide with
the jQuery name.

The API change is that the 'target' option for Canvas and RFB objects
must now be a DOM Canvas element. A string is no longer accepted
because this requires that a DOM lookup is done and the Canvas and RFB
should have no UI code in them. Modularity.
2010-12-10 08:25:36 -06:00
Joel Martin a59f1cd269 webutil.js, util.js: split cleanup. 2010-09-29 15:05:27 -05:00
Antoine Mercadal 8d5d2c8230 Split util into two file:
- util.js that contains essential functions
 - webutils.js that contains the GUI utility function.js

this helps to include noVNC in other project, especially Cappuccino Application
i
2010-09-30 03:59:56 +08:00