diff --git a/favicon.ico b/favicon.ico
deleted file mode 120000
index 45399c8c..00000000
--- a/favicon.ico
+++ /dev/null
@@ -1 +0,0 @@
-images/favicon.ico
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 00000000..c999634f
Binary files /dev/null and b/favicon.ico differ
diff --git a/include/input.js b/include/input.js
index fa6ba44a..9f6a4d2d 100644
--- a/include/input.js
+++ b/include/input.js
@@ -338,14 +338,13 @@ var Keyboard, Mouse;
Util.addEvent(window, 'touchend', this._eventHandlers.mouseup);
Util.addEvent(c, 'touchend', this._eventHandlers.mouseup);
Util.addEvent(c, 'touchmove', this._eventHandlers.mousemove);
- } else {
- Util.addEvent(c, 'mousedown', this._eventHandlers.mousedown);
- Util.addEvent(window, 'mouseup', this._eventHandlers.mouseup);
- Util.addEvent(c, 'mouseup', this._eventHandlers.mouseup);
- Util.addEvent(c, 'mousemove', this._eventHandlers.mousemove);
- Util.addEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
- this._eventHandlers.mousewheel);
}
+ Util.addEvent(c, 'mousedown', this._eventHandlers.mousedown);
+ Util.addEvent(window, 'mouseup', this._eventHandlers.mouseup);
+ Util.addEvent(c, 'mouseup', this._eventHandlers.mouseup);
+ Util.addEvent(c, 'mousemove', this._eventHandlers.mousemove);
+ Util.addEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
+ this._eventHandlers.mousewheel);
/* Work around right and middle click browser behaviors */
Util.addEvent(document, 'click', this._eventHandlers.mousedisable);
@@ -360,14 +359,13 @@ var Keyboard, Mouse;
Util.removeEvent(window, 'touchend', this._eventHandlers.mouseup);
Util.removeEvent(c, 'touchend', this._eventHandlers.mouseup);
Util.removeEvent(c, 'touchmove', this._eventHandlers.mousemove);
- } else {
- Util.removeEvent(c, 'mousedown', this._eventHandlers.mousedown);
- Util.removeEvent(window, 'mouseup', this._eventHandlers.mouseup);
- Util.removeEvent(c, 'mouseup', this._eventHandlers.mouseup);
- Util.removeEvent(c, 'mousemove', this._eventHandlers.mousemove);
- Util.removeEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
- this._eventHandlers.mousewheel);
}
+ Util.removeEvent(c, 'mousedown', this._eventHandlers.mousedown);
+ Util.removeEvent(window, 'mouseup', this._eventHandlers.mouseup);
+ Util.removeEvent(c, 'mouseup', this._eventHandlers.mouseup);
+ Util.removeEvent(c, 'mousemove', this._eventHandlers.mousemove);
+ Util.removeEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
+ this._eventHandlers.mousewheel);
/* Work around right and middle click browser behaviors */
Util.removeEvent(document, 'click', this._eventHandlers.mousedisable);
diff --git a/vnc_auto.html b/vnc_auto.html
index 1425c550..5994f735 100644
--- a/vnc_auto.html
+++ b/vnc_auto.html
@@ -36,7 +36,7 @@
-
+
+
+
@@ -83,6 +109,15 @@
+
+
+
+
+ | VNC Host: | |
+ | VNC Password: | |
+
@@ -185,7 +220,7 @@
var xvpbuttons;
xvpbuttons = $D('noVNC_xvp_buttons');
if (ver >= 1) {
- xvpbuttons.style.display = 'inline';yakpal.setClipboard
+ xvpbuttons.style.display = 'inline';
} else {
xvpbuttons.style.display = 'none';
}
@@ -193,13 +228,26 @@
function onClipboard(rfb, text){
$D('copyBox').value = text
- if(window.yakpal && window.yakpal.setClipboard){
+ if(window['yakpal'] && window.yakpal.setClipboard){
yakpal.setClipboard(text);
}
}
window.onscriptsload = function () {
- var host, port, password, path, token, lastClipboard;
+ var host, port, password, path, token, lastClipboard, tok;
+
+ // Expire any old (>4h) entries from localStorage
+ Object.keys(localStorage)
+ .filter((x)=>x.indexOf('coyote-url-') === 0)
+ .map((x)=>[x, JSON.parse(localStorage.getItem(x))])
+ .filter((x)=>!x[1].timestamp || (new Date() - new Date(x[1].timestamp)) > 1000 * 3600 * 4)
+ .map((x)=>localStorage.removeItem(x[0]));
+
+ // If we have an RID, try to load the real URL from session storage
+ var rid = WebUtil.getConfigVar('rid', '');
+ var url = JSON.parse(localStorage.getItem('coyote-url-' + rid));
+ if (rid && url)
+ window.history.replaceState({}, document.title, url.url);
//$D('sendCtrlAltDelButton').style.display = "inline";
//$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
@@ -217,7 +265,7 @@
$D('copyBox').addEventListener('paste', updateClipboard);
setInterval(function(){
- if(!window.yakpal || !window.yakpal.getClipboard) return;
+ if(!window['yakpal'] || !window.yakpal.getClipboard) return;
//hide use-yakpal if they have it
try{
document.getElementById('use-yakpal').style.display = 'none';
@@ -248,8 +296,10 @@
}
}
+ tok = WebUtil.getConfigVar('tok', '');
password = WebUtil.getConfigVar('password', '');
path = WebUtil.getConfigVar('path', 'websockify');
+ var vncPort = WebUtil.getConfigVar('vncport', '');
// If a token variable is passed in, set the parameter in a cookie.
// This is used by nova-novncproxy.
@@ -287,6 +337,41 @@
return; // don't continue trying to connect
}
+ var coyoteName = WebUtil.getConfigVar('name', '');
+ var elm = document.getElementById('zn-download-link');
+ elm.href = '/download/' + coyoteName;
+ elm.style.display = '';
+
+ // Scrub the query params from the URL so that it can be safely copy/pasted
+ // However, to support F5 or Ctrl-Shift-T, save the real URL in localstorage
+ // under a magic ID. The credentials are only valid for ~30 minutes after
+ // the user disconnects anyway, so this isn't a huge security issue.
+ console.log("Pushing new URL. Original: " + window.location.href);
+ if (!rid) {
+ rid = ("" + Math.random()).replace("0.", "");
+ localStorage.setItem("coyote-url-" + rid, JSON.stringify({url: window.location.href, timestamp: new Date()}));
+ }
+ window.history.replaceState({}, document.title, window.location.pathname + "?rid=" + rid);
+
+ document.getElementById('zn-vncurl').href = "vnc://:" + password + "@" + window.location.hostname + ":" +vncPort;
+ document.getElementById('zn-creds-host').innerHTML = window.location.hostname + ":" + vncPort;
+ document.getElementById('zn-creds-password').innerHTML = password;
+ document.getElementById('zn-show-creds').addEventListener('click', function() {
+ document.getElementById('zn-creds').style.display = "block";
+ });
+ document.getElementById('zn-close').addEventListener('click', function() {
+ fetch('/acmd', {
+ method: 'POST',
+ headers: {
+ 'Content-type': 'application/json',
+ },
+ body: JSON.stringify({
+ 'cmd': 'stop',
+ 'tok': tok,
+ }),
+ }).then(r=>r.json()).then(d=>console.log(d)).catch(console.error);
+ });
+
rfb.connect(host, port, password, path);
//disconnect if idle