This commit is contained in:
parent
a2890fa548
commit
673986d045
@ -1037,3 +1037,33 @@ pub fn get_installed_version() -> String {
|
|||||||
}
|
}
|
||||||
"".to_owned()
|
"".to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn create_shortcut(id: &str) -> ResultType<()> {
|
||||||
|
let exe = std::env::current_exe()?.to_str().unwrap_or("").to_owned();
|
||||||
|
let shortcut = write_cmds(
|
||||||
|
format!(
|
||||||
|
"
|
||||||
|
Set oWS = WScript.CreateObject(\"WScript.Shell\")
|
||||||
|
strDesktop = oWS.SpecialFolders(\"Desktop\")
|
||||||
|
Set objFSO = CreateObject(\"Scripting.FileSystemObject\")
|
||||||
|
sLinkFile = objFSO.BuildPath(strDesktop, \"{id}.lnk\")
|
||||||
|
Set oLink = oWS.CreateShortcut(sLinkFile)
|
||||||
|
oLink.TargetPath = \"{exe}\"
|
||||||
|
oLink.Arguments = \"--connect {id}\"
|
||||||
|
oLink.Save
|
||||||
|
",
|
||||||
|
exe = exe,
|
||||||
|
id = id,
|
||||||
|
),
|
||||||
|
"vbs",
|
||||||
|
)?
|
||||||
|
.to_str()
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned();
|
||||||
|
std::process::Command::new("cscript")
|
||||||
|
.arg(&shortcut)
|
||||||
|
.output()?;
|
||||||
|
allow_err!(std::fs::remove_file(shortcut));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
@ -486,6 +486,11 @@ impl UI {
|
|||||||
format!("{}.{}", p.to_string_lossy(), self.get_software_ext())
|
format!("{}.{}", p.to_string_lossy(), self.get_software_ext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_shortcut(&self, id: String) {
|
||||||
|
#[cfg(windows)]
|
||||||
|
crate::platform::windows::create_shortcut(&id).ok();
|
||||||
|
}
|
||||||
|
|
||||||
fn open_url(&self, url: String) {
|
fn open_url(&self, url: String) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
let p = "explorer";
|
let p = "explorer";
|
||||||
@ -541,6 +546,7 @@ impl sciter::EventHandler for UI {
|
|||||||
fn get_software_store_path();
|
fn get_software_store_path();
|
||||||
fn get_software_ext();
|
fn get_software_ext();
|
||||||
fn open_url(String);
|
fn open_url(String);
|
||||||
|
fn create_shortcut(String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,22 +9,9 @@
|
|||||||
include "common.tis";
|
include "common.tis";
|
||||||
include "index.tis";
|
include "index.tis";
|
||||||
</script>
|
</script>
|
||||||
<popup>
|
|
||||||
<menu.context #remote-context>
|
|
||||||
<li #connect>Connect</li>
|
|
||||||
<li #transfer>Transfer File</li>
|
|
||||||
<li #tunnel>TCP Tunneling</li>
|
|
||||||
<li #rdp>RDP</li>
|
|
||||||
<li #remove>Remove</li>
|
|
||||||
</menu>
|
|
||||||
</popup>
|
|
||||||
<popup><menu.context #edit-password-context>
|
|
||||||
<li #refresh-password>Refresh random password</li>
|
|
||||||
<li #set-password>Set your own password</li>
|
|
||||||
</menu></popup>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -103,6 +103,8 @@ event click $(menu#remote-context li) (evt, me) {
|
|||||||
} else if (action == "remove") {
|
} else if (action == "remove") {
|
||||||
handler.remove_peer(id);
|
handler.remove_peer(id);
|
||||||
app.recent_sessions.update();
|
app.recent_sessions.update();
|
||||||
|
} else if (action == "shortcut") {
|
||||||
|
handler.create_shortcut(id);
|
||||||
} else if (action == "rdp") {
|
} else if (action == "rdp") {
|
||||||
createNewConnect(id, "rdp");
|
createNewConnect(id, "rdp");
|
||||||
} else if (action == "tunnel") {
|
} else if (action == "tunnel") {
|
||||||
@ -310,6 +312,22 @@ class App: Reactor.Component
|
|||||||
var is_can_screen_recording = handler.is_can_screen_recording(false);
|
var is_can_screen_recording = handler.is_can_screen_recording(false);
|
||||||
return
|
return
|
||||||
<div .app>
|
<div .app>
|
||||||
|
<popup>
|
||||||
|
<menu.context #remote-context>
|
||||||
|
<li #connect>Connect</li>
|
||||||
|
<li #transfer>Transfer File</li>
|
||||||
|
<li #tunnel>TCP Tunneling</li>
|
||||||
|
<li #rdp>RDP</li>
|
||||||
|
<li #remove>Remove</li>
|
||||||
|
{is_win && <li #shortcut>Create Desktop Shortcut</li>}
|
||||||
|
</menu>
|
||||||
|
</popup>
|
||||||
|
<popup>
|
||||||
|
<menu.context #edit-password-context>
|
||||||
|
<li #refresh-password>Refresh random password</li>
|
||||||
|
<li #set-password>Set your own password</li>
|
||||||
|
</menu>
|
||||||
|
</popup>
|
||||||
<div .left-pane>
|
<div .left-pane>
|
||||||
<div>
|
<div>
|
||||||
<div .title>Your Desktop</div>
|
<div .title>Your Desktop</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user