mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-04-21 16:01:56 +00:00
Open external
This commit is contained in:
parent
f5a6f912b4
commit
3088d1a839
3 changed files with 36 additions and 0 deletions
17
Cargo.lock
generated
17
Cargo.lock
generated
|
|
@ -331,6 +331,22 @@ version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "open"
|
||||||
|
version = "1.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dcea7a30d6b81a2423cc59c43554880feff7b57d12916f231a79f8d6d9470201"
|
||||||
|
dependencies = [
|
||||||
|
"pathdiff",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pathdiff"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "877630b3de15c0b64cc52f659345724fbf6bdad9bd9566699fc53688f3c34a34"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plotters"
|
name = "plotters"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
|
@ -489,6 +505,7 @@ dependencies = [
|
||||||
"native-windows-derive",
|
"native-windows-derive",
|
||||||
"native-windows-gui",
|
"native-windows-gui",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"open",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"structopt",
|
"structopt",
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ mpv = "0.2.3"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
structopt = "0.3"
|
structopt = "0.3"
|
||||||
|
open = "1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
embed-resource = "1.3"
|
embed-resource = "1.3"
|
||||||
|
|
@ -182,6 +182,24 @@ impl MainWindow {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"open-external" => {
|
||||||
|
if args.len() > 1 {
|
||||||
|
if let Some(arg) = args[1].as_str() {
|
||||||
|
// FIXME: THIS IS NOT SAFE BY ANY MEANS
|
||||||
|
// open::that("calc").ok(); does exactly that
|
||||||
|
let arg_lc = arg.to_lowercase();
|
||||||
|
if arg_lc.starts_with("http://")
|
||||||
|
|| arg_lc.starts_with("https://")
|
||||||
|
|| arg_lc.starts_with("rtp://")
|
||||||
|
|| arg_lc.starts_with("rtps://")
|
||||||
|
|| arg_lc.starts_with("ftp://")
|
||||||
|
|| arg_lc.starts_with("ipfs://")
|
||||||
|
{
|
||||||
|
open::that(arg).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => eprintln!("Unsupported command {:?}", args),
|
_ => eprintln!("Unsupported command {:?}", args),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue