Browse Source

Open the URL of an uploaded file in the browser (testing)

timvisee 7 years ago
parent
commit
07ededbeef
3 changed files with 12 additions and 0 deletions
  1. 7 0
      Cargo.lock
  2. 1 0
      Cargo.toml
  3. 4 0
      src/main.rs

+ 7 - 0
Cargo.lock

@@ -126,6 +126,7 @@ dependencies = [
  "clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "hyper 0.11.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "mime_guess 2.0.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "reqwest 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -397,6 +398,11 @@ dependencies = [
  "libc 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "open"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
 [[package]]
 name = "openssl"
 version = "0.9.24"
@@ -951,6 +957,7 @@ dependencies = [
 "checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0"
 "checksum num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3c2bd9b9d21e48e956b763c9f37134dc62d9e95da6edb3f672cacb6caf3cd3"
 "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
+"checksum open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c281318d992e4432cfa799969467003d05921582a7489a8325e37f8a450d5113"
 "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985"
 "checksum openssl-sys 0.9.27 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdc5c4a02e69ce65046f1763a0181107038e02176233acb0b3351d7cc588f9"
 "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"

+ 1 - 0
Cargo.toml

@@ -8,6 +8,7 @@ base64 = "0.9"
 clap = "2.30"
 hyper = "0.11.9" # same as reqwest
 mime_guess = "2.0.0-alpha.2"
+open = "1"
 rand = "0.4"
 reqwest = "0.8"
 rust-crypto = "0.2"

+ 4 - 0
src/main.rs

@@ -3,6 +3,7 @@ extern crate clap;
 extern crate crypto;
 extern crate hyper;
 extern crate mime_guess;
+extern crate open;
 extern crate rand;
 extern crate reqwest;
 #[macro_use]
@@ -121,6 +122,9 @@ fn main() {
     println!("Response: {:#?}", upload_res);
     println!("Secret key: {}", base64_encode(&secret));
     println!("Download URL: {}", url);
+
+    // Open the URL in the browser
+    open::that(url);
 }
 
 fn hkdf<'a>(