mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
Implement file:// URI resource support in client.
This commit is contained in:
@@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<!-- Download-facilitating iframe -->
|
||||||
|
<iframe id="download"/>
|
||||||
|
|
||||||
<!-- Menu -->
|
<!-- Menu -->
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@ var GuacamoleUI = {
|
|||||||
"touchMenu" : document.getElementById("touchMenu"),
|
"touchMenu" : document.getElementById("touchMenu"),
|
||||||
"logo" : document.getElementById("status-logo"),
|
"logo" : document.getElementById("status-logo"),
|
||||||
"eventTarget" : document.getElementById("eventTarget"),
|
"eventTarget" : document.getElementById("eventTarget"),
|
||||||
|
"download" : document.getElementById("download"),
|
||||||
|
|
||||||
"buttons": {
|
"buttons": {
|
||||||
|
|
||||||
@@ -757,6 +758,59 @@ GuacamoleUI.attach = function(guac) {
|
|||||||
GuacamoleUI.touchClipboard.value = data;
|
GuacamoleUI.touchClipboard.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Resource handler
|
||||||
|
guac.onresource = function(index, uri, mimetypes) {
|
||||||
|
|
||||||
|
// Get tunnel UUID
|
||||||
|
var uuid = guac.getTunnel().getUUID();
|
||||||
|
|
||||||
|
// If UUID not defined, there is currently no way to get resource
|
||||||
|
// content. Reject the resource.
|
||||||
|
if (!uuid) {
|
||||||
|
guac.rejectResource(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// File resource
|
||||||
|
if (uri.substring(0, 7) == "file://") {
|
||||||
|
|
||||||
|
// Get name from URI
|
||||||
|
var name = uri.substring(7);
|
||||||
|
|
||||||
|
// Prompt user for download
|
||||||
|
var download = window.confirm(
|
||||||
|
"The remote desktop you are connected to is offering to send "
|
||||||
|
+ "a file (" + name + "). Would you like to accept and "
|
||||||
|
+ "download it?"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Accept file
|
||||||
|
if (download) {
|
||||||
|
|
||||||
|
// Accept file resource
|
||||||
|
guac.acceptResource(index, mimetypes[0]);
|
||||||
|
|
||||||
|
// Start download
|
||||||
|
GuacamoleUI.download.src =
|
||||||
|
"resource?index=" + index
|
||||||
|
+ "&name=" + name
|
||||||
|
+ "&uuid=" + uuid;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// User rejected resource
|
||||||
|
else
|
||||||
|
guac.rejectResource(index);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, reject (unknown URI)
|
||||||
|
else
|
||||||
|
guac.rejectResource(index);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
GuacamoleUI.keyboard.onkeydown = function(keysym) {
|
GuacamoleUI.keyboard.onkeydown = function(keysym) {
|
||||||
guac.sendKeyEvent(1, keysym);
|
guac.sendKeyEvent(1, keysym);
|
||||||
};
|
};
|
||||||
|
@@ -298,3 +298,6 @@ div#touchClipboardDiv textarea {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iframe#download {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user