From b528b77f77893d98bbbf194bb0fd83b7c6fdd18f Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 14:03:56 -0700 Subject: [PATCH 01/69] Rocket Hello World --- Cargo.lock | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 10 ++++ 3 files changed, 154 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 6c3509e..03a0471 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -175,6 +175,17 @@ dependencies = [ "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cookie" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "core-foundation" version = "0.2.3" @@ -308,6 +319,35 @@ dependencies = [ "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "derive_utils" +version = "0.1.0" +source = "git+https://github.com/SergioBenitez/derive-utils?rev=62f361f#62f361fe78b3b19dac5348e1a91c4960ec4dcb60" +dependencies = [ + "derive_utils_codegen 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", + "derive_utils_core 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", +] + +[[package]] +name = "derive_utils_codegen" +version = "0.1.0" +source = "git+https://github.com/SergioBenitez/derive-utils?rev=62f361f#62f361fe78b3b19dac5348e1a91c4960ec4dcb60" +dependencies = [ + "derive_utils_core 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "derive_utils_core" +version = "0.1.0" +source = "git+https://github.com/SergioBenitez/derive-utils?rev=62f361f#62f361fe78b3b19dac5348e1a91c4960ec4dcb60" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "diesel" version = "1.3.3" @@ -724,6 +764,17 @@ dependencies = [ "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "isatty" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" @@ -1326,6 +1377,26 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pear" +version = "0.1.0" +source = "git+http://github.com/SergioBenitez/Pear?rev=00b9af5#00b9af5456932533c876cdb227eb123701b142f6" +dependencies = [ + "pear_codegen 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)", +] + +[[package]] +name = "pear_codegen" +version = "0.1.0" +source = "git+http://github.com/SergioBenitez/Pear?rev=00b9af5#00b9af5456932533c876cdb227eb123701b142f6" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -1425,6 +1496,7 @@ dependencies = [ "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", "router 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1646,6 +1718,55 @@ dependencies = [ "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rocket" +version = "0.4.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket#556206e8b381b07c2c74f64fd88a762f5323fd70" +dependencies = [ + "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pear 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)", + "rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", + "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", + "state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rocket_codegen" +version = "0.4.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket#556206e8b381b07c2c74f64fd88a762f5323fd70" +dependencies = [ + "derive_utils 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", + "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rocket_http" +version = "0.4.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket#556206e8b381b07c2c74f64fd88a762f5323fd70" +dependencies = [ + "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pear 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "route-recognizer" version = "0.1.12" @@ -1928,6 +2049,11 @@ name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "state" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "staticfile" version = "0.5.0" @@ -2516,6 +2642,11 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "yansi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" "checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" @@ -2540,6 +2671,7 @@ dependencies = [ "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" "checksum cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "746858cae4eae40fff37e1998320068df317bc247dc91a67c6cfa053afdc2abb" +"checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf" "checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67" "checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d" @@ -2555,6 +2687,9 @@ dependencies = [ "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum derive_builder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c998e6ab02a828dd9735c18f154e14100e674ed08cb4e1938f0e4177543f439" "checksum derive_builder_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "735e24ee9e5fa8e16b86da5007856e97d592e11867e45d76e0c0d0a164a0b757" +"checksum derive_utils 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)" = "" +"checksum derive_utils_codegen 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)" = "" +"checksum derive_utils_core 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)" = "" "checksum diesel 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "164080ac16a4d1d80a50f0a623e4ddef41cb2779eee85bcc76907d340dfc98cc" "checksum diesel_derives 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03bcaf77491f53e400d5ee3bdd57142ea4e1c47fe9217b3361ff9a76ca0e3d37" "checksum diesel_migrations 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b42c35d1ce9e8d57a3e7001b4127f2bc1b073a89708bb7019f5be27c991c28" @@ -2597,6 +2732,7 @@ dependencies = [ "checksum inflate 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6f53b811ee8e2057ccf9643ca6b4277de90efaf5e61e55fd5254576926bb4245" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8e17268922834707e1c29e8badbf9c712c9c43378e1b6a3388946baff10be2" +"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b7d43206b34b3f94ea9445174bda196e772049b9bddbc620c9d29b2d20110d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -2663,6 +2799,8 @@ dependencies = [ "checksum params 0.6.0 (git+https://github.com/agersant/params)" = "" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum pear 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)" = "" +"checksum pear_codegen 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)" = "" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum persistent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e8fa0009c4f3d350281309909c618abddf10bb7e3145f28410782f6a5ec74c5" "checksum phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "cec29da322b242f4c3098852c77a0ca261c9c01b806cae85a5572a1eb94db9a6" @@ -2692,6 +2830,9 @@ dependencies = [ "checksum reqwest 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5866613d84e2a39c0479a960bf2d0eff1fbfc934f02cd42b5c08c1e1efc5b1fd" "checksum reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "00a5870d8edc74fc6e1eb58edbd2815d2243e1a2255d6bf9c82a7a875901b5db" "checksum ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe642b9dd1ba0038d78c4a3999d1ee56178b4d415c1e1fbaba83b06dce012f0" +"checksum rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)" = "" +"checksum rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)" = "" +"checksum rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)" = "" "checksum route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3255338088df8146ba63d60a9b8e3556f1146ce2973bc05a75181a42ce2256" "checksum router 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc63b6f3b8895b0d04e816b2b1aa58fdba2d5acca3cbb8f0ab8e017347d57397" "checksum rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9d9118f1ce84d8d0b67f9779936432fb42bb620cef2122409d786892cce9a3c" @@ -2728,6 +2869,7 @@ dependencies = [ "checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013" "checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" "checksum staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "babd3fa68bb7e3994ce181c5f21ff3ff5fffef7b18b8a10163b45e4dafc6fb86" "checksum string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00caf261d6f90f588f8450b8e1230fa0d5be49ee6140fdfbcb55335aff350970" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" @@ -2795,3 +2937,4 @@ dependencies = [ "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" "checksum xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562" +"checksum yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d60c3b48c9cdec42fb06b3b84b5b087405e1fa1c644a1af3930e4dfafe93de48" diff --git a/Cargo.toml b/Cargo.toml index eea3287..64dd459 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ rand = "0.5.5" regex = "1.0.5" ring = "0.13.2" reqwest = "0.9.2" +rocket = { git = "https://github.com/SergioBenitez/Rocket" } router = "0.6.0" rust-crypto = "0.2.36" secure-session = "0.3.1" diff --git a/src/main.rs b/src/main.rs index 4535873..5c0be34 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ #![recursion_limit = "256"] +#![feature(proc_macro_hygiene, decl_macro)] extern crate ape; extern crate app_dirs; @@ -26,6 +27,8 @@ extern crate rand; extern crate regex; extern crate reqwest; extern crate ring; +#[macro_use] +extern crate rocket; extern crate router; extern crate rustfm_scrobble; extern crate secure_session; @@ -148,6 +151,11 @@ fn init_log(log_level: LevelFilter, _: &getopts::Matches) -> Result<()> { Ok(()) } +#[get("/")] +fn index() -> &'static str { + "Hello, world!" +} + fn run() -> Result<()> { // Parse CLI options let args: Vec = std::env::args().collect(); @@ -261,6 +269,8 @@ fn run() -> Result<()> { Err(e) => bail!("Error starting up server: {}", e), }; + rocket::ignite().mount("/", routes![index]).launch(); + // Start DDNS updates let db_ref = db.clone(); std::thread::spawn(move || { From 64afc8b6f541ce01eee5cae5952897661e54a19a Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 14:33:28 -0700 Subject: [PATCH 02/69] Mount static files --- Cargo.lock | 195 +++++++++++++++++++++++++++++++++++++++++++--------- Cargo.toml | 15 +++- src/main.rs | 13 ++-- 3 files changed, 181 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03a0471..2b4a361 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -355,7 +355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "diesel_derives 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libsqlite3-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -480,6 +480,16 @@ dependencies = [ "synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "filetime" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "flate2" version = "1.0.4" @@ -508,6 +518,24 @@ name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fsevent" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fsevent-sys" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -569,7 +597,7 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -620,7 +648,7 @@ dependencies = [ "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -647,7 +675,7 @@ dependencies = [ "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -740,6 +768,28 @@ dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "inotify" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "inotify-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "iovec" version = "0.1.2" @@ -848,7 +898,7 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -875,12 +925,12 @@ name = "log" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1038,13 +1088,24 @@ dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "mio-extras" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mio-uds" version = "0.6.7" @@ -1125,7 +1186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1150,6 +1211,24 @@ name = "nodrop" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "notify" +version = "4.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num" version = "0.1.42" @@ -1486,7 +1565,7 @@ dependencies = [ "image 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "metaflac 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1496,7 +1575,8 @@ dependencies = [ "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", + "rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", + "rocket_contrib 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", "router 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1694,7 +1774,7 @@ dependencies = [ "hyper 0.12.13 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1721,16 +1801,16 @@ dependencies = [ [[package]] name = "rocket" version = "0.4.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#556206e8b381b07c2c74f64fd88a762f5323fd70" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b381b07c2c74f64fd88a762f5323fd70" dependencies = [ "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "pear 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)", - "rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", - "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", + "rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", + "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", "state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1741,20 +1821,30 @@ dependencies = [ [[package]] name = "rocket_codegen" version = "0.4.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#556206e8b381b07c2c74f64fd88a762f5323fd70" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b381b07c2c74f64fd88a762f5323fd70" dependencies = [ "derive_utils 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)", + "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rocket_contrib" +version = "0.4.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b381b07c2c74f64fd88a762f5323fd70" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", +] + [[package]] name = "rocket_http" version = "0.4.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#556206e8b381b07c2c74f64fd88a762f5323fd70" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b381b07c2c74f64fd88a762f5323fd70" dependencies = [ "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1788,7 +1878,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libsqlite3-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1851,6 +1941,14 @@ name = "safemem" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "same-file" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "schannel" version = "0.1.14" @@ -2012,7 +2110,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2223,7 +2321,7 @@ dependencies = [ "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2267,7 +2365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2295,7 +2393,7 @@ dependencies = [ "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2333,7 +2431,7 @@ dependencies = [ "crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2368,7 +2466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2384,7 +2482,7 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2562,13 +2660,23 @@ name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "walkdir" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "want" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2578,7 +2686,7 @@ version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2606,6 +2714,14 @@ name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2706,10 +2822,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" "checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" +"checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f" "checksum flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3b0c7353385f92079524de3b7116cf99d73947c08a7472774e9b3b04bff3b901" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c4bbbf71584aeed076100b5665ac14e3d85eeb31fdbb45fbd41ef9a682b5ec05" +"checksum fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a772d36c338d07a032d5375a36f15f9a7043bf0cb8ce7cee658e037c6032874" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" @@ -2730,6 +2849,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum image 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60710fd3cb40c2434451d8d5147bcf39bbb68aae0741041133e09439cb2401e3" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum inflate 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6f53b811ee8e2057ccf9643ca6b4277de90efaf5e61e55fd5254576926bb4245" +"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" +"checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8e17268922834707e1c29e8badbf9c712c9c43378e1b6a3388946baff10be2" "checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" @@ -2743,11 +2864,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lewton 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c789d72e98a55ff54152fbe7c6005923ccf9ae6c29f71513f4737b7ccbea702" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "21138fc6669f438ed7ae3559d5789a5f0ba32f28c1f0608d1e452b0bb06ee936" -"checksum libsqlite3-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9eb7b8e152b6a01be6a4a2917248381875758250dc3df5d46caf9250341dda" +"checksum libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d3711dfd91a1081d2458ad2d06ea30a8755256e74038be2ad927d94e1c955ca8" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" @@ -2766,6 +2887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" @@ -2776,6 +2898,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" +"checksum notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "873ecfd8c174964ae30f401329d140142312c8e5590719cf1199d5f1717d8078" "checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" "checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" "checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" @@ -2830,9 +2953,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum reqwest 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5866613d84e2a39c0479a960bf2d0eff1fbfc934f02cd42b5c08c1e1efc5b1fd" "checksum reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "00a5870d8edc74fc6e1eb58edbd2815d2243e1a2255d6bf9c82a7a875901b5db" "checksum ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe642b9dd1ba0038d78c4a3999d1ee56178b4d415c1e1fbaba83b06dce012f0" -"checksum rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)" = "" -"checksum rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)" = "" -"checksum rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket)" = "" +"checksum rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" +"checksum rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" +"checksum rocket_contrib 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" +"checksum rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" "checksum route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3255338088df8146ba63d60a9b8e3556f1146ce2973bc05a75181a42ce2256" "checksum router 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc63b6f3b8895b0d04e816b2b1aa58fdba2d5acca3cbb8f0ab8e017347d57397" "checksum rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9d9118f1ce84d8d0b67f9779936432fb42bb620cef2122409d786892cce9a3c" @@ -2844,6 +2968,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" +"checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" @@ -2926,12 +3051,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "af464bc7be7b785c7ac72e266a6b67c4c9070155606f51655a650a6686204e35" "checksum want 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a05d9d966753fa4b5c8db73fcab5eed4549cfe0e1e4e66911e5564a0085c35d1" "checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wrapped-vec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "06c29bb4abe93d1c8ef79b60f270d0efcaa6c5c97aaaaaaa0d477ea72f5f9e45" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/Cargo.toml b/Cargo.toml index 64dd459..9f39ce2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ rand = "0.5.5" regex = "1.0.5" ring = "0.13.2" reqwest = "0.9.2" -rocket = { git = "https://github.com/SergioBenitez/Rocket" } +rocket = "0.4.0-dev" router = "0.6.0" rust-crypto = "0.2.36" secure-session = "0.3.1" @@ -44,6 +44,19 @@ toml = "0.4.5" typemap = "0.3" url = "1.2.0" +[patch.crates-io.rocket] +git = "https://github.com/SergioBenitez/Rocket.git" +rev = "556206e" + +[patch.crates-io.rocket_contrib] +git = "https://github.com/SergioBenitez/Rocket.git" +rev = "556206e" + +[dependencies.rocket_contrib] +version = "0.4.0-dev" +default_features = false +features = ["serve"] + [dependencies.rusqlite] version = "0.14.0" features = ["bundled"] diff --git a/src/main.rs b/src/main.rs index 5c0be34..e29971b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ extern crate reqwest; extern crate ring; #[macro_use] extern crate rocket; +extern crate rocket_contrib; extern crate router; extern crate rustfm_scrobble; extern crate secure_session; @@ -65,6 +66,7 @@ use errors::*; use getopts::Options; use iron::prelude::*; use mount::Mount; +use rocket_contrib::serve::StaticFiles; use simplelog::{Level, LevelFilter, SimpleLogger, TermLogger}; use staticfile::Static; use std::path::Path; @@ -151,11 +153,6 @@ fn init_log(log_level: LevelFilter, _: &getopts::Matches) -> Result<()> { Ok(()) } -#[get("/")] -fn index() -> &'static str { - "Hello, world!" -} - fn run() -> Result<()> { // Parse CLI options let args: Vec = std::env::args().collect(); @@ -255,7 +252,7 @@ fn run() -> Result<()> { info!("Static files location is {}", web_dir_path.display()); let static_url = format!("/{}", &prefix_url); info!("Mounting static files on {}", static_url); - mount.mount(&static_url, Static::new(web_dir_path)); + mount.mount(&static_url, Static::new(&web_dir_path)); info!("Starting up server"); let port: u16 = matches @@ -269,7 +266,9 @@ fn run() -> Result<()> { Err(e) => bail!("Error starting up server: {}", e), }; - rocket::ignite().mount("/", routes![index]).launch(); + rocket::ignite() + .mount(&static_url, StaticFiles::from(web_dir_path)) + .launch(); // Start DDNS updates let db_ref = db.clone(); From 33ae1c07b27dc1035336e83165a9c3d95a101ae0 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 15:19:31 -0700 Subject: [PATCH 03/69] Ported version endpoint to rocket --- Cargo.lock | 2 ++ Cargo.toml | 2 +- src/api.rs | 25 +++++++++++++------------ src/main.rs | 1 + 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b4a361..1b47801 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1839,6 +1839,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", + "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9f39ce2..83b1393 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ rev = "556206e" [dependencies.rocket_contrib] version = "0.4.0-dev" default_features = false -features = ["serve"] +features = ["json", "serve"] [dependencies.rusqlite] version = "0.14.0" diff --git a/src/api.rs b/src/api.rs index f1db58f..0766847 100644 --- a/src/api.rs +++ b/src/api.rs @@ -7,6 +7,7 @@ use iron::prelude::*; use iron::{status, AroundMiddleware, Handler}; use mount::Mount; use params; +use rocket_contrib::json::Json; use router::Router; use secure_session::middleware::{SessionConfig, SessionMiddleware}; use secure_session::session::ChaCha20Poly1305SessionManager; @@ -66,6 +67,10 @@ where Ok(secret) } +pub fn get_routes() -> Vec { + routes![version] +} + pub fn get_handler(db: &Arc, index: &Arc>>) -> Result { let api_handler = get_endpoints(&db.clone(), &index); let mut api_chain = Chain::new(api_handler); @@ -87,7 +92,6 @@ fn get_endpoints(db: &Arc, index_channel: &Arc> let mut api_handler = Mount::new(); { - api_handler.mount("/version/", self::version); { let db = db.clone(); api_handler.mount("/auth/", move |request: &mut Request| { @@ -373,22 +377,19 @@ impl Handler for AdminHandler { } } -fn version(_: &mut Request) -> IronResult { - #[derive(Serialize)] - struct Version { - major: i32, - minor: i32, - } +#[derive(Serialize)] +struct Version { + major: i32, + minor: i32, +} +#[get("/version")] +fn version() -> Json { let current_version = Version { major: CURRENT_MAJOR_VERSION, minor: CURRENT_MINOR_VERSION, }; - - match serde_json::to_string(¤t_version) { - Ok(result_json) => Ok(Response::with((status::Ok, result_json))), - Err(e) => Err(IronError::new(e, status::InternalServerError)), - } + Json(current_version) } fn initial_setup(_: &mut Request, db: &DB) -> IronResult { diff --git a/src/main.rs b/src/main.rs index 7c32db4..60f9357 100644 --- a/src/main.rs +++ b/src/main.rs @@ -269,6 +269,7 @@ fn run() -> Result<()> { rocket::ignite() .mount(&static_url, StaticFiles::from(web_dir_path)) + .mount(&api_url, api::get_routes()) .launch(); // Start DDNS updates From 06c694ab4a42eb16ec6e9a8b944e2146181230f3 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 15:24:52 -0700 Subject: [PATCH 04/69] Moved rocket API to a separate file --- src/api.rs | 23 ----------------------- src/main.rs | 3 ++- src/rocket_api.rs | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 src/rocket_api.rs diff --git a/src/api.rs b/src/api.rs index 0766847..6b0c7f4 100644 --- a/src/api.rs +++ b/src/api.rs @@ -7,7 +7,6 @@ use iron::prelude::*; use iron::{status, AroundMiddleware, Handler}; use mount::Mount; use params; -use rocket_contrib::json::Json; use router::Router; use secure_session::middleware::{SessionConfig, SessionMiddleware}; use secure_session::session::ChaCha20Poly1305SessionManager; @@ -34,9 +33,6 @@ use user; use utils::*; use vfs::VFSSource; -const CURRENT_MAJOR_VERSION: i32 = 2; -const CURRENT_MINOR_VERSION: i32 = 2; - #[derive(Deserialize, Serialize)] struct Session { username: String, @@ -67,10 +63,6 @@ where Ok(secret) } -pub fn get_routes() -> Vec { - routes![version] -} - pub fn get_handler(db: &Arc, index: &Arc>>) -> Result { let api_handler = get_endpoints(&db.clone(), &index); let mut api_chain = Chain::new(api_handler); @@ -377,21 +369,6 @@ impl Handler for AdminHandler { } } -#[derive(Serialize)] -struct Version { - major: i32, - minor: i32, -} - -#[get("/version")] -fn version() -> Json { - let current_version = Version { - major: CURRENT_MAJOR_VERSION, - minor: CURRENT_MINOR_VERSION, - }; - Json(current_version) -} - fn initial_setup(_: &mut Request, db: &DB) -> IronResult { #[derive(Serialize)] struct InitialSetup { diff --git a/src/main.rs b/src/main.rs index 60f9357..ff2274d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,6 +75,7 @@ use std::sync::mpsc::channel; use std::sync::{Arc, Mutex}; mod api; +mod rocket_api; mod config; mod db; mod ddns; @@ -269,7 +270,7 @@ fn run() -> Result<()> { rocket::ignite() .mount(&static_url, StaticFiles::from(web_dir_path)) - .mount(&api_url, api::get_routes()) + .mount(&api_url, rocket_api::get_routes()) .launch(); // Start DDNS updates diff --git a/src/rocket_api.rs b/src/rocket_api.rs new file mode 100644 index 0000000..6febf90 --- /dev/null +++ b/src/rocket_api.rs @@ -0,0 +1,23 @@ +use rocket_contrib::json::Json; + +const CURRENT_MAJOR_VERSION: i32 = 2; +const CURRENT_MINOR_VERSION: i32 = 2; + +pub fn get_routes() -> Vec { + routes![version] +} + +#[derive(Serialize)] +struct Version { + major: i32, + minor: i32, +} + +#[get("/version")] +fn version() -> Json { + let current_version = Version { + major: CURRENT_MAJOR_VERSION, + minor: CURRENT_MINOR_VERSION, + }; + Json(current_version) +} From e8d1baa6527867b2be0f811fa09c982ffdd08e7e Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 16:59:05 -0700 Subject: [PATCH 05/69] Implemented endpoints to load welcome page --- src/main.rs | 1 + src/rocket_api.rs | 71 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ff2274d..4fe8b04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -269,6 +269,7 @@ fn run() -> Result<()> { }; rocket::ignite() + .manage(db::DB::new(&db_path)?) .mount(&static_url, StaticFiles::from(web_dir_path)) .mount(&api_url, rocket_api::get_routes()) .launch(); diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 6febf90..ba156a5 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,10 +1,60 @@ +use rocket::{Outcome, State}; +use rocket::http::{Cookies, Status}; +use rocket::request::{self, Request, FromRequest}; use rocket_contrib::json::Json; +use config::{self, Config}; +use db::DB; +use errors; +use user; + const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; pub fn get_routes() -> Vec { - routes![version] + routes![ + version, + initial_setup, + get_settings, + ] +} + +struct Auth { + username: String, +} + +impl<'a, 'r> FromRequest<'a, 'r> for Auth { + type Error = (); + + fn from_request(request: &'a Request<'r>) -> request::Outcome { + let mut cookies = request.guard::().unwrap(); + match cookies.get_private("username") { + Some(u) => Outcome::Success(Auth { username: u.to_string() }), + _ => Outcome::Failure((Status::Forbidden, ())) + } + } +} + +struct AdminRights {} +impl<'a, 'r> FromRequest<'a, 'r> for AdminRights { + type Error = (); + + fn from_request(request: &'a Request<'r>) -> request::Outcome { + let db = request.guard::>()?; + + match user::count::(&db) { + Err(_) => return Outcome::Failure((Status::InternalServerError, ())), + Ok(0) => return Outcome::Success(AdminRights {}), + _ => () + }; + + let auth = request.guard::()?; + match user::is_admin::(&db, &auth.username) { + Err(_) => Outcome::Failure((Status::InternalServerError, ())), + Ok(true) => Outcome::Success(AdminRights {}), + Ok(false) => Outcome::Failure((Status::Forbidden, ())), + } + } } #[derive(Serialize)] @@ -21,3 +71,22 @@ fn version() -> Json { }; Json(current_version) } + +#[derive(Serialize)] +struct InitialSetup { + has_any_users: bool, +} + +#[get("/initial_setup")] +fn initial_setup(db: State) -> Result, errors::Error> { + let initial_setup = InitialSetup { + has_any_users: user::count::(&db)? > 0, + }; + Ok(Json(initial_setup)) +} + +#[get("/settings")] +fn get_settings(db: State, _admin_rights: AdminRights) -> Result, errors::Error> { + let config = config::read::(&db)?; + Ok(Json(config)) +} From 0ebcc8a2808bf09606fae2fa339d66e4112b6367 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 17:00:49 -0700 Subject: [PATCH 06/69] Autoformat --- src/config.rs | 12 ++++++++---- src/index.rs | 9 ++++++--- src/main.rs | 10 +++++----- src/rocket_api.rs | 22 ++++++++++------------ src/user.rs | 6 ++++-- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/config.rs b/src/config.rs index 1e3c57c..c8235f6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -100,7 +100,8 @@ where index_album_art_pattern, index_sleep_duration_seconds, prefix_url, - )).get_result(connection.deref())?; + )) + .get_result(connection.deref())?; config.album_art_pattern = Some(art_pattern); config.reindex_every_n_seconds = Some(sleep_duration); config.prefix_url = if url != "" { Some(url) } else { None }; @@ -124,7 +125,8 @@ where name, password: "".to_owned(), admin: admin != 0, - }).collect::<_>(), + }) + .collect::<_>(), ); let ydns = ddns_config @@ -194,7 +196,8 @@ where .iter() .find(|old_name| *old_name == &u.name) .is_none() - }).collect::<_>(); + }) + .collect::<_>(); for config_user in &insert_users { let new_user = User::new(&config_user.name, &config_user.password); diesel::insert_into(users::table) @@ -242,7 +245,8 @@ where host.eq(ydns.host.clone()), username.eq(ydns.username.clone()), password.eq(ydns.password.clone()), - )).execute(connection.deref())?; + )) + .execute(connection.deref())?; } if let Some(ref prefix_url) = new_config.prefix_url { diff --git a/src/index.rs b/src/index.rs index f6da66e..aadc115 100644 --- a/src/index.rs +++ b/src/index.rs @@ -318,7 +318,8 @@ where .filter(|ref song_path| { let path = Path::new(&song_path); !path.exists() || vfs.real_to_virtual(path).is_err() - }).collect::>(); + }) + .collect::>(); { let connection = db.get_connection(); @@ -343,7 +344,8 @@ where .filter(|ref directory_path| { let path = Path::new(&directory_path); !path.exists() || vfs.real_to_virtual(path).is_err() - }).collect::>(); + }) + .collect::>(); { let connection = db.get_connection(); @@ -623,7 +625,8 @@ where .or(album.like(&like_test)) .or(artist.like(&like_test)) .or(album_artist.like(&like_test)), - ).filter(parent.not_like(&like_test)) + ) + .filter(parent.not_like(&like_test)) .load(connection.deref())?; let virtual_songs = real_songs diff --git a/src/main.rs b/src/main.rs index 4fe8b04..15f83b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,7 +75,6 @@ use std::sync::mpsc::channel; use std::sync::{Arc, Mutex}; mod api; -mod rocket_api; mod config; mod db; mod ddns; @@ -84,6 +83,7 @@ mod index; mod lastfm; mod metadata; mod playlist; +mod rocket_api; mod serve; mod thumbnails; mod ui; @@ -269,10 +269,10 @@ fn run() -> Result<()> { }; rocket::ignite() - .manage(db::DB::new(&db_path)?) - .mount(&static_url, StaticFiles::from(web_dir_path)) - .mount(&api_url, rocket_api::get_routes()) - .launch(); + .manage(db::DB::new(&db_path)?) + .mount(&static_url, StaticFiles::from(web_dir_path)) + .mount(&api_url, rocket_api::get_routes()) + .launch(); // Start DDNS updates let db_ref = db.clone(); diff --git a/src/rocket_api.rs b/src/rocket_api.rs index ba156a5..7e74ebd 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,6 +1,6 @@ -use rocket::{Outcome, State}; use rocket::http::{Cookies, Status}; -use rocket::request::{self, Request, FromRequest}; +use rocket::request::{self, FromRequest, Request}; +use rocket::{Outcome, State}; use rocket_contrib::json::Json; use config::{self, Config}; @@ -12,11 +12,7 @@ const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; pub fn get_routes() -> Vec { - routes![ - version, - initial_setup, - get_settings, - ] + routes![version, initial_setup, get_settings,] } struct Auth { @@ -29,10 +25,12 @@ impl<'a, 'r> FromRequest<'a, 'r> for Auth { fn from_request(request: &'a Request<'r>) -> request::Outcome { let mut cookies = request.guard::().unwrap(); match cookies.get_private("username") { - Some(u) => Outcome::Success(Auth { username: u.to_string() }), - _ => Outcome::Failure((Status::Forbidden, ())) + Some(u) => Outcome::Success(Auth { + username: u.to_string(), + }), + _ => Outcome::Failure((Status::Forbidden, ())), } - } + } } struct AdminRights {} @@ -45,7 +43,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for AdminRights { match user::count::(&db) { Err(_) => return Outcome::Failure((Status::InternalServerError, ())), Ok(0) => return Outcome::Success(AdminRights {}), - _ => () + _ => (), }; let auth = request.guard::()?; @@ -54,7 +52,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for AdminRights { Ok(true) => Outcome::Success(AdminRights {}), Ok(false) => Outcome::Failure((Status::Forbidden, ())), } - } + } } #[derive(Serialize)] diff --git a/src/user.rs b/src/user.rs index 96f19ee..fdeaec7 100644 --- a/src/user.rs +++ b/src/user.rs @@ -58,7 +58,8 @@ fn verify_password( password_salt, attempted_password.as_bytes(), password_hash, - ).is_ok() + ) + .is_ok() } pub fn auth(db: &T, username: &str, password: &str) -> Result @@ -111,7 +112,8 @@ where .set(( lastfm_username.eq(lastfm_login), lastfm_session_key.eq(session_key), - )).execute(connection.deref())?; + )) + .execute(connection.deref())?; Ok(()) } From 769c12833adc08aa48bd0bed8d728b34df4fef5c Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 17:26:19 -0700 Subject: [PATCH 07/69] Implemented endpoint to write settings --- src/rocket_api.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 7e74ebd..1f1eb10 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -12,7 +12,7 @@ const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; pub fn get_routes() -> Vec { - routes![version, initial_setup, get_settings,] + routes![version, initial_setup, get_settings, put_settings] } struct Auth { @@ -88,3 +88,9 @@ fn get_settings(db: State, _admin_rights: AdminRights) -> Result(&db)?; Ok(Json(config)) } + +#[put("/settings", data = "")] +fn put_settings(db: State, _admin_rights: AdminRights, config: Json) -> Result<(), errors::Error> { + config::amend::(&db, &config)?; + Ok(()) +} From 00968f0a4f53d2b7735cc5042cd32f86cf9226ea Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 27 Oct 2018 17:27:47 -0700 Subject: [PATCH 08/69] Only expect nightly to build on CI --- .travis.yml | 4 ++-- appveyor.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a00618c..dbfd3b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,5 @@ rust: matrix: allow_failures: - - rust: beta - - rust: nightly \ No newline at end of file + - rust: stable + - rust: beta \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 23fc969..14bfe8d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -55,7 +55,7 @@ environment: # or test failure in the matching channels/targets from failing the entire build. matrix: allow_failures: - - channel: nightly + - channel: stable - channel: beta ## Install Script ## From 36e6016e6783bec894fbd1a370db22d30e7bfa1c Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 10:19:07 -0700 Subject: [PATCH 09/69] Added endpoint for trigger reindex --- src/api.rs | 14 +++++----- src/index.rs | 67 ++++++++++++++++++++++++++++++++++++++++------- src/main.rs | 21 +++------------ src/rocket_api.rs | 10 ++++++- 4 files changed, 77 insertions(+), 35 deletions(-) diff --git a/src/api.rs b/src/api.rs index 6b0c7f4..452c673 100644 --- a/src/api.rs +++ b/src/api.rs @@ -15,8 +15,7 @@ use std::fs; use std::io; use std::ops::Deref; use std::path::*; -use std::sync::mpsc::Sender; -use std::sync::{Arc, Mutex}; +use std::sync::{Arc}; use typemap; use url::percent_encoding::percent_decode; @@ -63,7 +62,7 @@ where Ok(secret) } -pub fn get_handler(db: &Arc, index: &Arc>>) -> Result { +pub fn get_handler(db: &Arc, index: &Arc) -> Result { let api_handler = get_endpoints(&db.clone(), &index); let mut api_chain = Chain::new(api_handler); @@ -80,7 +79,7 @@ pub fn get_handler(db: &Arc, index: &Arc>>) -> Ok(api_chain) } -fn get_endpoints(db: &Arc, index_channel: &Arc>>) -> Mount { +fn get_endpoints(db: &Arc, index_channel: &Arc) -> Mount { let mut api_handler = Mount::new(); { @@ -178,7 +177,7 @@ fn get_endpoints(db: &Arc, index_channel: &Arc> let mut reindex_router = Router::new(); reindex_router.post( "/", - move |_: &mut Request| self::trigger_index(index_channel.deref()), + move |_: &mut Request| self::trigger_index(index_channel.clone()), "trigger_index", ); @@ -603,10 +602,9 @@ fn put_preferences(request: &mut Request, db: &DB) -> IronResult { Ok(Response::with(status::Ok)) } -fn trigger_index(channel: &Mutex>) -> IronResult { - let channel = channel.lock().unwrap(); +fn trigger_index(channel: Arc) -> IronResult { let channel = channel.deref(); - if let Err(e) = channel.send(index::Command::REINDEX) { + if let Err(e) = channel.trigger_reindex() { return Err(IronError::new(e, status::InternalServerError)); }; Ok(Response::with(status::Ok)) diff --git a/src/index.rs b/src/index.rs index aadc115..cefc852 100644 --- a/src/index.rs +++ b/src/index.rs @@ -17,7 +17,7 @@ use std::time; use config::MiscSettings; #[cfg(test)] use db; -use db::ConnectionSource; +use db::{ConnectionSource, DB}; use db::{directories, misc_settings, songs}; use errors; use metadata; @@ -32,10 +32,60 @@ no_arg_sql_function!( "Represents the SQL RANDOM() function" ); -pub enum Command { +enum Command { REINDEX, } +struct CommandReceiver { + receiver: Receiver, +} + +impl CommandReceiver { + fn new(receiver: Receiver) -> CommandReceiver { + CommandReceiver{ receiver } + } +} + +pub struct CommandSender { + sender: Mutex>, +} + +impl CommandSender { + fn new(sender: Sender) -> CommandSender { + CommandSender{ sender: Mutex::new(sender) } + } + + pub fn trigger_reindex(&self) -> Result<(), errors::Error> { + let sender = self.sender.lock().unwrap(); + match sender.send(Command::REINDEX) { + Ok(_) => Ok(()), + Err(_) => bail!("Trigger reindex channel error"), + } + } +} + +pub fn init(db: Arc) -> Arc { + let (index_sender, index_receiver) = channel(); + let command_sender = Arc::new(CommandSender::new(index_sender)); + let command_receiver = CommandReceiver::new(index_receiver); + + // Start update loop + let db_ref = db.clone(); + std::thread::spawn(move || { + let db = db_ref.deref(); + update_loop(db, &command_receiver); + }); + + // Trigger auto-indexing + let db_ref = db.clone(); + let command_sender_clone = command_sender.clone(); + std::thread::spawn(move || { + self_trigger(db_ref.deref(), &command_sender_clone); + }); + + command_sender +} + #[derive(Debug, Queryable, QueryableByName, Serialize)] #[table_name = "songs"] pub struct Song { @@ -383,7 +433,7 @@ where Ok(()) } -pub fn update(db: &T) -> Result<(), errors::Error> +fn update(db: &T) -> Result<(), errors::Error> where T: ConnectionSource + VFSSource, { @@ -398,20 +448,20 @@ where Ok(()) } -pub fn update_loop(db: &T, command_buffer: &Receiver) +fn update_loop(db: &T, command_buffer: &CommandReceiver) where T: ConnectionSource + VFSSource, { loop { // Wait for a command - if let Err(e) = command_buffer.recv() { + if let Err(e) = command_buffer.receiver.recv() { error!("Error while waiting on index command buffer: {}", e); return; } // Flush the buffer to ignore spammy requests loop { - match command_buffer.try_recv() { + match command_buffer.receiver.try_recv() { Err(TryRecvError::Disconnected) => { error!("Error while flushing index command buffer"); return; @@ -428,15 +478,14 @@ where } } -pub fn self_trigger(db: &T, command_buffer: &Arc>>) +pub fn self_trigger(db: &T, command_buffer: &Arc) where T: ConnectionSource, { loop { { - let command_buffer = command_buffer.lock().unwrap(); let command_buffer = command_buffer.deref(); - if let Err(e) = command_buffer.send(Command::REINDEX) { + if let Err(e) = command_buffer.trigger_reindex() { error!("Error while writing to index command buffer: {}", e); return; } diff --git a/src/main.rs b/src/main.rs index 15f83b0..cb31d9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,8 +71,7 @@ use rocket_contrib::serve::StaticFiles; use simplelog::{Level, LevelFilter, SimpleLogger, TermLogger}; use staticfile::Static; use std::path::Path; -use std::sync::mpsc::channel; -use std::sync::{Arc, Mutex}; +use std::sync::Arc; mod api; mod config; @@ -221,27 +220,14 @@ fn run() -> Result<()> { let config = config::read(db.deref())?; // Init index - let (index_sender, index_receiver) = channel(); - let index_sender = Arc::new(Mutex::new(index_sender)); - let db_ref = db.clone(); - std::thread::spawn(move || { - let db = db_ref.deref(); - index::update_loop(db, &index_receiver); - }); - - // Trigger auto-indexing - let db_ref = db.clone(); - let sender_ref = index_sender.clone(); - std::thread::spawn(move || { - index::self_trigger(db_ref.deref(), &sender_ref); - }); + let command_sender = index::init(db.clone()); // Mount API let prefix_url = config.prefix_url.unwrap_or_else(|| "".to_string()); let api_url = format!("{}/api", &prefix_url); info!("Mounting API on {}", api_url); let mut mount = Mount::new(); - let handler = api::get_handler(&db.clone(), &index_sender)?; + let handler = api::get_handler(&db.clone(), &command_sender)?; mount.mount(&api_url, handler); // Mount static files @@ -270,6 +256,7 @@ fn run() -> Result<()> { rocket::ignite() .manage(db::DB::new(&db_path)?) + .manage(command_sender) .mount(&static_url, StaticFiles::from(web_dir_path)) .mount(&api_url, rocket_api::get_routes()) .launch(); diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 1f1eb10..783acae 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -2,17 +2,19 @@ use rocket::http::{Cookies, Status}; use rocket::request::{self, FromRequest, Request}; use rocket::{Outcome, State}; use rocket_contrib::json::Json; +use std::sync::Arc; use config::{self, Config}; use db::DB; use errors; +use index; use user; const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; pub fn get_routes() -> Vec { - routes![version, initial_setup, get_settings, put_settings] + routes![version, initial_setup, get_settings, put_settings, trigger_index] } struct Auth { @@ -94,3 +96,9 @@ fn put_settings(db: State, _admin_rights: AdminRights, config: Json) config::amend::(&db, &config)?; Ok(()) } + +#[post("/trigger_index")] +fn trigger_index(command_sender: State>) -> Result<(), errors::Error> { + command_sender.trigger_reindex()?; + Ok(()) +} From ed949b96781774f39811f642d6d720ea6ef951b7 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 10:22:28 -0700 Subject: [PATCH 10/69] Require admin rights to trigger reindex --- src/rocket_api.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 783acae..32c4383 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -98,7 +98,7 @@ fn put_settings(db: State, _admin_rights: AdminRights, config: Json) } #[post("/trigger_index")] -fn trigger_index(command_sender: State>) -> Result<(), errors::Error> { +fn trigger_index(command_sender: State>, _admin_rights: AdminRights) -> Result<(), errors::Error> { command_sender.trigger_reindex()?; Ok(()) } From bc9a3a461a410fd48e9d52791881d41c2fe5d576 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 10:33:54 -0700 Subject: [PATCH 11/69] Added auth endpoint --- src/rocket_api.rs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 32c4383..3a5a85c 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,4 +1,4 @@ -use rocket::http::{Cookies, Status}; +use rocket::http::{Cookie, Cookies, Status}; use rocket::request::{self, FromRequest, Request}; use rocket::{Outcome, State}; use rocket_contrib::json::Json; @@ -12,9 +12,10 @@ use user; const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; +const SESSION_FIELD_USERNAME: &str = "username"; pub fn get_routes() -> Vec { - routes![version, initial_setup, get_settings, put_settings, trigger_index] + routes![version, initial_setup, get_settings, put_settings, trigger_index, auth] } struct Auth { @@ -26,12 +27,14 @@ impl<'a, 'r> FromRequest<'a, 'r> for Auth { fn from_request(request: &'a Request<'r>) -> request::Outcome { let mut cookies = request.guard::().unwrap(); - match cookies.get_private("username") { + match cookies.get_private(SESSION_FIELD_USERNAME) { Some(u) => Outcome::Success(Auth { username: u.to_string(), }), _ => Outcome::Failure((Status::Forbidden, ())), } + + // TODO allow auth via authorization header } } @@ -102,3 +105,25 @@ fn trigger_index(command_sender: State>, _admin_rights command_sender.trigger_reindex()?; Ok(()) } + +#[derive(Deserialize)] +struct AuthCredentials { + username: String, + password: String, +} + +#[derive(Serialize)] +struct AuthOutput { + admin: bool, +} + +#[post("/auth", data = "")] +fn auth(db: State, credentials: Json, mut cookies: Cookies) -> Result<(Json), errors::Error> { + user::auth::(&db, &credentials.username, &credentials.password)?; + cookies.add_private(Cookie::new(SESSION_FIELD_USERNAME, credentials.username.clone())); + + let auth_output = AuthOutput { + admin: user::is_admin::(&db, &credentials.username)?, + }; + Ok(Json(auth_output)) +} From 5f28c445069ea4a5466e96614af2d33d1f3fbc30 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 10:53:11 -0700 Subject: [PATCH 12/69] Added endpoints for browse and flatten --- src/rocket_api.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 3a5a85c..222ea38 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -2,6 +2,7 @@ use rocket::http::{Cookie, Cookies, Status}; use rocket::request::{self, FromRequest, Request}; use rocket::{Outcome, State}; use rocket_contrib::json::Json; +use std::path::PathBuf; use std::sync::Arc; use config::{self, Config}; @@ -15,7 +16,7 @@ const CURRENT_MINOR_VERSION: i32 = 2; const SESSION_FIELD_USERNAME: &str = "username"; pub fn get_routes() -> Vec { - routes![version, initial_setup, get_settings, put_settings, trigger_index, auth] + routes![version, initial_setup, get_settings, put_settings, trigger_index, auth, browse_root, browse, flatten_root, flatten] } struct Auth { @@ -127,3 +128,27 @@ fn auth(db: State, credentials: Json, mut cookies: Cookies) }; Ok(Json(auth_output)) } + +#[get("/browse")] +fn browse_root(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { + let result = index::browse::(&db, &PathBuf::new())?; + Ok(Json(result)) +} + +#[get("/browse/")] +fn browse(db: State, _auth: Auth, path: PathBuf) -> Result<(Json>), errors::Error> { + let result = index::browse::(&db, &path)?; + Ok(Json(result)) +} + +#[get("/flatten")] +fn flatten_root(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { + let result = index::flatten::(&db, &PathBuf::new())?; + Ok(Json(result)) +} + +#[get("/flatten/")] +fn flatten(db: State, _auth: Auth, path: PathBuf) -> Result<(Json>), errors::Error> { + let result = index::flatten::(&db, &path)?; + Ok(Json(result)) +} \ No newline at end of file From e7a5fcf01b4e2b77f26d81d9236731d3b02b6d16 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 10:53:44 -0700 Subject: [PATCH 13/69] Autoformat --- src/api.rs | 2 +- src/index.rs | 8 ++++--- src/rocket_api.rs | 54 +++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/api.rs b/src/api.rs index 452c673..50450e2 100644 --- a/src/api.rs +++ b/src/api.rs @@ -15,7 +15,7 @@ use std::fs; use std::io; use std::ops::Deref; use std::path::*; -use std::sync::{Arc}; +use std::sync::Arc; use typemap; use url::percent_encoding::percent_decode; diff --git a/src/index.rs b/src/index.rs index cefc852..8e69680 100644 --- a/src/index.rs +++ b/src/index.rs @@ -17,8 +17,8 @@ use std::time; use config::MiscSettings; #[cfg(test)] use db; -use db::{ConnectionSource, DB}; use db::{directories, misc_settings, songs}; +use db::{ConnectionSource, DB}; use errors; use metadata; use vfs::{VFSSource, VFS}; @@ -42,7 +42,7 @@ struct CommandReceiver { impl CommandReceiver { fn new(receiver: Receiver) -> CommandReceiver { - CommandReceiver{ receiver } + CommandReceiver { receiver } } } @@ -52,7 +52,9 @@ pub struct CommandSender { impl CommandSender { fn new(sender: Sender) -> CommandSender { - CommandSender{ sender: Mutex::new(sender) } + CommandSender { + sender: Mutex::new(sender), + } } pub fn trigger_reindex(&self) -> Result<(), errors::Error> { diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 222ea38..5aba579 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -16,7 +16,18 @@ const CURRENT_MINOR_VERSION: i32 = 2; const SESSION_FIELD_USERNAME: &str = "username"; pub fn get_routes() -> Vec { - routes![version, initial_setup, get_settings, put_settings, trigger_index, auth, browse_root, browse, flatten_root, flatten] + routes![ + version, + initial_setup, + get_settings, + put_settings, + trigger_index, + auth, + browse_root, + browse, + flatten_root, + flatten + ] } struct Auth { @@ -96,13 +107,20 @@ fn get_settings(db: State, _admin_rights: AdminRights) -> Result, _admin_rights: AdminRights, config: Json) -> Result<(), errors::Error> { +fn put_settings( + db: State, + _admin_rights: AdminRights, + config: Json, +) -> Result<(), errors::Error> { config::amend::(&db, &config)?; Ok(()) } #[post("/trigger_index")] -fn trigger_index(command_sender: State>, _admin_rights: AdminRights) -> Result<(), errors::Error> { +fn trigger_index( + command_sender: State>, + _admin_rights: AdminRights, +) -> Result<(), errors::Error> { command_sender.trigger_reindex()?; Ok(()) } @@ -119,9 +137,16 @@ struct AuthOutput { } #[post("/auth", data = "")] -fn auth(db: State, credentials: Json, mut cookies: Cookies) -> Result<(Json), errors::Error> { +fn auth( + db: State, + credentials: Json, + mut cookies: Cookies, +) -> Result<(Json), errors::Error> { user::auth::(&db, &credentials.username, &credentials.password)?; - cookies.add_private(Cookie::new(SESSION_FIELD_USERNAME, credentials.username.clone())); + cookies.add_private(Cookie::new( + SESSION_FIELD_USERNAME, + credentials.username.clone(), + )); let auth_output = AuthOutput { admin: user::is_admin::(&db, &credentials.username)?, @@ -130,13 +155,20 @@ fn auth(db: State, credentials: Json, mut cookies: Cookies) } #[get("/browse")] -fn browse_root(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { +fn browse_root( + db: State, + _auth: Auth, +) -> Result<(Json>), errors::Error> { let result = index::browse::(&db, &PathBuf::new())?; Ok(Json(result)) } #[get("/browse/")] -fn browse(db: State, _auth: Auth, path: PathBuf) -> Result<(Json>), errors::Error> { +fn browse( + db: State, + _auth: Auth, + path: PathBuf, +) -> Result<(Json>), errors::Error> { let result = index::browse::(&db, &path)?; Ok(Json(result)) } @@ -148,7 +180,11 @@ fn flatten_root(db: State, _auth: Auth) -> Result<(Json>), } #[get("/flatten/")] -fn flatten(db: State, _auth: Auth, path: PathBuf) -> Result<(Json>), errors::Error> { +fn flatten( + db: State, + _auth: Auth, + path: PathBuf, +) -> Result<(Json>), errors::Error> { let result = index::flatten::(&db, &path)?; Ok(Json(result)) -} \ No newline at end of file +} From 91919a66285bc757b9e50f710a235d5e4cd31d77 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 10:56:04 -0700 Subject: [PATCH 14/69] Added endpoints for recent and random albums --- src/rocket_api.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 5aba579..a190525 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -26,7 +26,9 @@ pub fn get_routes() -> Vec { browse_root, browse, flatten_root, - flatten + flatten, + random, + recent, ] } @@ -188,3 +190,15 @@ fn flatten( let result = index::flatten::(&db, &path)?; Ok(Json(result)) } + +#[get("/random")] +fn random(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { + let result = index::get_random_albums::(&db, 20)?; + Ok(Json(result)) +} + +#[get("/recent")] +fn recent(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { + let result = index::get_recent_albums::(&db, 20)?; + Ok(Json(result)) +} From cabc72116abe51173deb3b9840c103d0a01394fc Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 11:03:21 -0700 Subject: [PATCH 15/69] Added search endpoints --- src/rocket_api.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index a190525..883bbff 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -29,6 +29,8 @@ pub fn get_routes() -> Vec { flatten, random, recent, + search_root, + search, ] } @@ -202,3 +204,15 @@ fn recent(db: State, _auth: Auth) -> Result<(Json>), e let result = index::get_recent_albums::(&db, 20)?; Ok(Json(result)) } + +#[get("/search")] +fn search_root(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { + let result = index::search::(&db, "")?; + Ok(Json(result)) +} + +#[get("/search/")] +fn search(db: State, _auth: Auth, query: String) -> Result<(Json>), errors::Error> { + let result = index::search::(&db, &query)?; + Ok(Json(result)) +} From 89e72d00ae2ef934e359f4502e816c82e4c958cc Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 12:21:46 -0700 Subject: [PATCH 16/69] Partial implementation of the serve endpoint --- src/errors.rs | 11 +++++++++++ src/rocket_api.rs | 43 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 18f453e..ba97132 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -11,6 +11,7 @@ use iron::IronError; use lewton; use metaflac; use regex; +use rocket; use rustfm_scrobble; use serde_json; use std; @@ -60,6 +61,16 @@ error_chain! { } } +impl<'r> rocket::response::Responder<'r> for Error { + fn respond_to(self, _: &rocket::request::Request) -> rocket::response::Result<'r> { + let mut build = rocket::response::Response::build(); + build.status(match self.0 { + ErrorKind::FileNotFound => rocket::http::Status::NotFound, + _ => rocket::http::Status::InternalServerError, + }).ok() + } +} + impl From for IronError { fn from(err: Error) -> IronError { match err { diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 883bbff..f0f923a 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,20 +1,28 @@ use rocket::http::{Cookie, Cookies, Status}; use rocket::request::{self, FromRequest, Request}; +use rocket::response::NamedFile; use rocket::{Outcome, State}; use rocket_contrib::json::Json; use std::path::PathBuf; +use std::ops::Deref; use std::sync::Arc; use config::{self, Config}; use db::DB; use errors; use index; +use thumbnails; use user; +use utils; +use vfs::VFSSource; const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; const SESSION_FIELD_USERNAME: &str = "username"; +// TODO every path.. argument breaks when the path contains square brackets. Needs URLencoding back!! +// TODO range header not supported + pub fn get_routes() -> Vec { routes![ version, @@ -31,6 +39,7 @@ pub fn get_routes() -> Vec { recent, search_root, search, + serve, ] } @@ -145,7 +154,7 @@ fn auth( db: State, credentials: Json, mut cookies: Cookies, -) -> Result<(Json), errors::Error> { +) -> Result, errors::Error> { user::auth::(&db, &credentials.username, &credentials.password)?; cookies.add_private(Cookie::new( SESSION_FIELD_USERNAME, @@ -162,7 +171,7 @@ fn auth( fn browse_root( db: State, _auth: Auth, -) -> Result<(Json>), errors::Error> { +) -> Result>, errors::Error> { let result = index::browse::(&db, &PathBuf::new())?; Ok(Json(result)) } @@ -172,13 +181,13 @@ fn browse( db: State, _auth: Auth, path: PathBuf, -) -> Result<(Json>), errors::Error> { +) -> Result>, errors::Error> { let result = index::browse::(&db, &path)?; Ok(Json(result)) } #[get("/flatten")] -fn flatten_root(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { +fn flatten_root(db: State, _auth: Auth) -> Result>, errors::Error> { let result = index::flatten::(&db, &PathBuf::new())?; Ok(Json(result)) } @@ -188,31 +197,47 @@ fn flatten( db: State, _auth: Auth, path: PathBuf, -) -> Result<(Json>), errors::Error> { +) -> Result>, errors::Error> { let result = index::flatten::(&db, &path)?; Ok(Json(result)) } #[get("/random")] -fn random(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { +fn random(db: State, _auth: Auth) -> Result>, errors::Error> { let result = index::get_random_albums::(&db, 20)?; Ok(Json(result)) } #[get("/recent")] -fn recent(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { +fn recent(db: State, _auth: Auth) -> Result>, errors::Error> { let result = index::get_recent_albums::(&db, 20)?; Ok(Json(result)) } #[get("/search")] -fn search_root(db: State, _auth: Auth) -> Result<(Json>), errors::Error> { +fn search_root(db: State, _auth: Auth) -> Result>, errors::Error> { let result = index::search::(&db, "")?; Ok(Json(result)) } #[get("/search/")] -fn search(db: State, _auth: Auth, query: String) -> Result<(Json>), errors::Error> { +fn search(db: State, _auth: Auth, query: String) -> Result>, errors::Error> { let result = index::search::(&db, &query)?; Ok(Json(result)) } + +#[get("/serve/")] +fn serve(db: State, _auth: Auth, path: PathBuf) -> Result { + let db: &DB = db.deref(); + let vfs = db.get_vfs()?; + let real_path = vfs.virtual_to_real(&path)?; + + let serve_path = if utils::is_image(&real_path) { + thumbnails::get_thumbnail(&real_path, 400)? + } else { + real_path + }; + + let serving = NamedFile::open(&serve_path)?; + Ok(serving) +} From 777cca245eab34ccf90e3d95b687854e408e21f6 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 14:00:25 -0700 Subject: [PATCH 17/69] Added support for range header when serving files --- src/rocket_api.rs | 9 ++-- src/serve.rs | 125 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 105 insertions(+), 29 deletions(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index f0f923a..ff05a71 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,8 +1,8 @@ use rocket::http::{Cookie, Cookies, Status}; use rocket::request::{self, FromRequest, Request}; -use rocket::response::NamedFile; use rocket::{Outcome, State}; use rocket_contrib::json::Json; +use std::fs::File; use std::path::PathBuf; use std::ops::Deref; use std::sync::Arc; @@ -11,6 +11,7 @@ use config::{self, Config}; use db::DB; use errors; use index; +use serve; use thumbnails; use user; use utils; @@ -227,7 +228,7 @@ fn search(db: State, _auth: Auth, query: String) -> Result")] -fn serve(db: State, _auth: Auth, path: PathBuf) -> Result { +fn serve(db: State, _auth: Auth, path: PathBuf) -> Result, errors::Error> { let db: &DB = db.deref(); let vfs = db.get_vfs()?; let real_path = vfs.virtual_to_real(&path)?; @@ -238,6 +239,6 @@ fn serve(db: State, _auth: Auth, path: PathBuf) -> Result for PartialFile { fn modify(self, res: &mut Response) { - use self::PartialFileRange::*; let metadata: Option<_> = self.file.metadata().ok(); let file_length: Option = metadata.map(|m| m.len()); - let range: Option<(u64, u64)> = match (self.range, file_length) { - (FromTo(from, to), Some(file_length)) => { - if from <= to && from < file_length { - Some((from, cmp::min(to, file_length - 1))) - } else { - None - } - } - (AllFrom(from), Some(file_length)) => { - if from < file_length { - Some((from, file_length - 1)) - } else { - None - } - } - (Last(last), Some(file_length)) => { - if last < file_length { - Some((file_length - last, file_length - 1)) - } else { - Some((0, file_length - 1)) - } - } - (_, None) => None, - }; + let range: Option<(u64, u64)> = truncate_range(&self.range, &file_length); + if let Some(range) = range { let content_range = ContentRange(ContentRangeSpec::Bytes { range: Some(range), @@ -165,3 +145,98 @@ impl WriteBody for PartialContentBody { io::copy(&mut limiter, res).map(|_| ()) } } + +pub struct RangeResponder { + original: R, +} + +impl<'r, R: Responder<'r>> RangeResponder { + pub fn new(original: R) -> RangeResponder { + RangeResponder{ original } + } + + fn ignore_range(self, request: &rocket::request::Request) -> response::Result<'r> { + let mut response = self.original.respond_to(request)?; + response.set_status(rocket::http::Status::RangeNotSatisfiable); + Ok(response) + } +} + +fn truncate_range(range: &PartialFileRange, file_length: &Option) -> Option<(u64, u64)> { + use self::PartialFileRange::*; + + match (range, file_length) { + (FromTo(from, to), Some(file_length)) => { + if from <= to && from < file_length { + Some((*from, cmp::min(*to, file_length - 1))) + } else { + None + } + } + (AllFrom(from), Some(file_length)) => { + if from < file_length { + Some((*from, file_length - 1)) + } else { + None + } + } + (Last(last), Some(file_length)) => { + if last < file_length { + Some((file_length - last, file_length - 1)) + } else { + Some((0, file_length - 1)) + } + } + (_, None) => None, + } +} + +impl<'r> Responder<'r> for RangeResponder { + + fn respond_to(mut self, request: &rocket::request::Request) -> response::Result<'r> { + + use rocket::http::hyper::header::*; + + let range_header = request.headers().get_one("Range"); + let range_header = match range_header { + None => return Ok(self.original.respond_to(request)?), + Some(h) => h, + }; + + let vec_range = match Range::from_str(range_header) { + Ok(Range::Bytes(v)) => v, + _ => return self.ignore_range(request), + }; + + let partial_file_range = match vec_range.into_iter().next() { + None => PartialFileRange::AllFrom(0), + Some(byte_range) => PartialFileRange::from(byte_range), + }; + + let metadata: Option<_> = self.original.metadata().ok(); + let file_length: Option = metadata.map(|m| m.len()); + let range: Option<(u64, u64)> = truncate_range(&partial_file_range, &file_length); + + if let Some((from, to)) = range { + let content_range = ContentRange(ContentRangeSpec::Bytes { + range: range, + instance_length: file_length, + }); + let content_len = to - from + 1; + + match self.original.seek(SeekFrom::Start(from)) { + Ok(_) => (), + Err(_) => return Err(rocket::http::Status::InternalServerError), + } + let partial_original = self.original.take(content_len).into_inner(); + let mut response = partial_original.respond_to(request)?; + response.set_header(ContentLength(content_len)); + response.set_header(content_range); + response.set_status(rocket::http::Status::PartialContent); + + Ok(response) + } else { + self.ignore_range(request) + } + } +} From 5d0ead96e497cb915f1e3787d02debe9af8a54e5 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 14:03:28 -0700 Subject: [PATCH 18/69] Removed TODO --- src/rocket_api.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index ff05a71..b8c514d 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -22,7 +22,6 @@ const CURRENT_MINOR_VERSION: i32 = 2; const SESSION_FIELD_USERNAME: &str = "username"; // TODO every path.. argument breaks when the path contains square brackets. Needs URLencoding back!! -// TODO range header not supported pub fn get_routes() -> Vec { routes![ From 84507e4d8664537846db03f7a870a6a30351ab12 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 15:13:34 -0700 Subject: [PATCH 19/69] Fixed a bug where names with square brackets tripped routing --- src/api.rs | 4 ++-- src/index.rs | 10 +++++---- src/rocket_api.rs | 57 +++++++++++++++++++++++++++++++---------------- src/vfs.rs | 8 +++---- 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/src/api.rs b/src/api.rs index 50450e2..a48591d 100644 --- a/src/api.rs +++ b/src/api.rs @@ -430,7 +430,7 @@ fn browse(request: &mut Request, db: &DB) -> IronResult { Err(e) => return Err(IronError::new(e, status::BadRequest)), Ok(p) => p, }; - let browse_result = index::browse(db, &path)?; + let browse_result = index::browse(db, path)?; let result_json = serde_json::to_string(&browse_result); let result_json = match result_json { @@ -504,7 +504,7 @@ fn serve(request: &mut Request, db: &DB) -> IronResult { }; let vfs = db.get_vfs()?; - let real_path = vfs.virtual_to_real(&virtual_path); + let real_path = vfs.virtual_to_real(virtual_path); let real_path = match real_path { Err(e) => return Err(IronError::new(e, status::NotFound)), Ok(p) => p, diff --git a/src/index.rs b/src/index.rs index 8e69680..ebb1e9e 100644 --- a/src/index.rs +++ b/src/index.rs @@ -537,15 +537,16 @@ fn virtualize_directory(vfs: &VFS, mut directory: Directory) -> Option(db: &T, virtual_path: &Path) -> Result, errors::Error> +pub fn browse(db: &T, virtual_path: P) -> Result, errors::Error> where T: ConnectionSource + VFSSource, + P: AsRef, { let mut output = Vec::new(); let vfs = db.get_vfs()?; let connection = db.get_connection(); - if virtual_path.components().count() == 0 { + if virtual_path.as_ref().components().count() == 0 { // Browse top-level let real_directories: Vec = directories::table .filter(directories::parent.is_null()) @@ -581,15 +582,16 @@ where Ok(output) } -pub fn flatten(db: &T, virtual_path: &Path) -> Result, errors::Error> +pub fn flatten(db: &T, virtual_path: P) -> Result, errors::Error> where T: ConnectionSource + VFSSource, + P: AsRef, { use self::songs::dsl::*; let vfs = db.get_vfs()?; let connection = db.get_connection(); - let real_songs: Vec = if virtual_path.parent() != None { + let real_songs: Vec = if virtual_path.as_ref().parent() != None { let real_path = vfs.virtual_to_real(virtual_path)?; let like_path = real_path.as_path().to_string_lossy().into_owned() + "%"; songs diff --git a/src/rocket_api.rs b/src/rocket_api.rs index b8c514d..38b7c47 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,5 +1,5 @@ -use rocket::http::{Cookie, Cookies, Status}; -use rocket::request::{self, FromRequest, Request}; +use rocket::http::{Cookie, Cookies, RawStr, Status}; +use rocket::request::{self, FromParam, FromRequest, Request}; use rocket::{Outcome, State}; use rocket_contrib::json::Json; use std::fs::File; @@ -21,8 +21,6 @@ const CURRENT_MAJOR_VERSION: i32 = 2; const CURRENT_MINOR_VERSION: i32 = 2; const SESSION_FIELD_USERNAME: &str = "username"; -// TODO every path.. argument breaks when the path contains square brackets. Needs URLencoding back!! - pub fn get_routes() -> Vec { routes![ version, @@ -85,6 +83,27 @@ impl<'a, 'r> FromRequest<'a, 'r> for AdminRights { } } +struct VFSPathBuf { + path_buf: PathBuf, +} + +impl<'r> FromParam<'r> for VFSPathBuf { + type Error = &'r RawStr; + + fn from_param(param: &'r RawStr) -> Result { + let decoded_path = param.percent_decode_lossy(); + Ok(VFSPathBuf{ + path_buf: PathBuf::from(decoded_path.into_owned()) + }) + } +} + +impl From for PathBuf { + fn from(vfs_path_buf: VFSPathBuf) -> Self { + vfs_path_buf.path_buf.clone() + } +} + #[derive(Serialize)] struct Version { major: i32, @@ -172,65 +191,65 @@ fn browse_root( db: State, _auth: Auth, ) -> Result>, errors::Error> { - let result = index::browse::(&db, &PathBuf::new())?; + let result = index::browse(db.deref(), &PathBuf::new())?; Ok(Json(result)) } -#[get("/browse/")] +#[get("/browse/")] fn browse( db: State, _auth: Auth, - path: PathBuf, + path: VFSPathBuf, ) -> Result>, errors::Error> { - let result = index::browse::(&db, &path)?; + let result = index::browse(db.deref(), &path.into() as &PathBuf)?; Ok(Json(result)) } #[get("/flatten")] fn flatten_root(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::flatten::(&db, &PathBuf::new())?; + let result = index::flatten(db.deref(), &PathBuf::new())?; Ok(Json(result)) } -#[get("/flatten/")] +#[get("/flatten/")] fn flatten( db: State, _auth: Auth, - path: PathBuf, + path: VFSPathBuf, ) -> Result>, errors::Error> { - let result = index::flatten::(&db, &path)?; + let result = index::flatten(db.deref(), &path.into() as &PathBuf)?; Ok(Json(result)) } #[get("/random")] fn random(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::get_random_albums::(&db, 20)?; + let result = index::get_random_albums(db.deref(), 20)?; Ok(Json(result)) } #[get("/recent")] fn recent(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::get_recent_albums::(&db, 20)?; + let result = index::get_recent_albums(db.deref(), 20)?; Ok(Json(result)) } #[get("/search")] fn search_root(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::search::(&db, "")?; + let result = index::search(db.deref(), "")?; Ok(Json(result)) } #[get("/search/")] fn search(db: State, _auth: Auth, query: String) -> Result>, errors::Error> { - let result = index::search::(&db, &query)?; + let result = index::search(db.deref(), &query)?; Ok(Json(result)) } -#[get("/serve/")] -fn serve(db: State, _auth: Auth, path: PathBuf) -> Result, errors::Error> { +#[get("/serve/")] +fn serve(db: State, _auth: Auth, path: VFSPathBuf) -> Result, errors::Error> { let db: &DB = db.deref(); let vfs = db.get_vfs()?; - let real_path = vfs.virtual_to_real(&path)?; + let real_path = vfs.virtual_to_real(&path.into() as &PathBuf)?; let serve_path = if utils::is_image(&real_path) { thumbnails::get_thumbnail(&real_path, 400)? diff --git a/src/vfs.rs b/src/vfs.rs index 8469c2b..9af661a 100644 --- a/src/vfs.rs +++ b/src/vfs.rs @@ -51,9 +51,9 @@ impl VFS { Ok(()) } - pub fn real_to_virtual(&self, real_path: &Path) -> Result { + pub fn real_to_virtual>(&self, real_path: P) -> Result { for (name, target) in &self.mount_points { - if let Ok(p) = real_path.strip_prefix(target) { + if let Ok(p) = real_path.as_ref().strip_prefix(target) { let mount_path = Path::new(&name); return if p.components().count() == 0 { Ok(mount_path.to_path_buf()) @@ -65,10 +65,10 @@ impl VFS { bail!("Real path has no match in VFS") } - pub fn virtual_to_real(&self, virtual_path: &Path) -> Result { + pub fn virtual_to_real>(&self, virtual_path: P) -> Result { for (name, target) in &self.mount_points { let mount_path = Path::new(&name); - if let Ok(p) = virtual_path.strip_prefix(mount_path) { + if let Ok(p) = virtual_path.as_ref().strip_prefix(mount_path) { return if p.components().count() == 0 { Ok(target.clone()) } else { From 35514182aaf35feca9fbf87c9b0e879a9705fb33 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 15:14:51 -0700 Subject: [PATCH 20/69] Bumped version for breaking changes on string encoding and json input --- src/rocket_api.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 38b7c47..3b65d04 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -17,8 +17,8 @@ use user; use utils; use vfs::VFSSource; -const CURRENT_MAJOR_VERSION: i32 = 2; -const CURRENT_MINOR_VERSION: i32 = 2; +const CURRENT_MAJOR_VERSION: i32 = 3; +const CURRENT_MINOR_VERSION: i32 = 0; const SESSION_FIELD_USERNAME: &str = "username"; pub fn get_routes() -> Vec { From ea299312d036f657ffb2d628d53c80fcabeac72f Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 15:46:35 -0700 Subject: [PATCH 21/69] Fixed a bug where authentication yielded incorrect usernames --- src/rocket_api.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 3b65d04..0bef85b 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -52,7 +52,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for Auth { let mut cookies = request.guard::().unwrap(); match cookies.get_private(SESSION_FIELD_USERNAME) { Some(u) => Outcome::Success(Auth { - username: u.to_string(), + username: u.value().to_string(), }), _ => Outcome::Failure((Status::Forbidden, ())), } From 2ee33e76151a286e37d3dae51af739e9db2933fa Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 15:52:09 -0700 Subject: [PATCH 22/69] Added preferences endpoint --- src/rocket_api.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 0bef85b..f39d506 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -7,7 +7,7 @@ use std::path::PathBuf; use std::ops::Deref; use std::sync::Arc; -use config::{self, Config}; +use config::{self, Config, Preferences}; use db::DB; use errors; use index; @@ -27,6 +27,8 @@ pub fn get_routes() -> Vec { initial_setup, get_settings, put_settings, + get_preferences, + put_preferences, trigger_index, auth, browse_root, @@ -148,6 +150,22 @@ fn put_settings( Ok(()) } +#[get("/preferences")] +fn get_preferences(db: State, auth: Auth) -> Result, errors::Error> { + let preferences = config::read_preferences::(&db, &auth.username)?; + Ok(Json(preferences)) +} + +#[put("/preferences", data = "")] +fn put_preferences( + db: State, + auth: Auth, + preferences: Json, +) -> Result<(), errors::Error> { + config::write_preferences::(&db, &auth.username, &preferences)?; + Ok(()) +} + #[post("/trigger_index")] fn trigger_index( command_sender: State>, From 8354eeff1d530b7e560e6bfee0b2f6e900c23be7 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 16:13:00 -0700 Subject: [PATCH 23/69] Implemented playlist endpoints --- src/rocket_api.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index f39d506..d496290 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -11,6 +11,7 @@ use config::{self, Config, Preferences}; use db::DB; use errors; use index; +use playlist; use serve; use thumbnails; use user; @@ -40,6 +41,10 @@ pub fn get_routes() -> Vec { search_root, search, serve, + list_playlists, + save_playlist, + read_playlist, + delete_playlist, ] } @@ -278,3 +283,43 @@ fn serve(db: State, _auth: Auth, path: VFSPathBuf) -> Result, auth: Auth) -> Result>, errors::Error> { + + let playlist_names = playlist::list_playlists(&auth.username, db.deref())?; + let playlists: Vec = playlist_names + .into_iter() + .map(|p| ListPlaylistsEntry { name: p }) + .collect(); + + Ok(Json(playlists)) +} + +#[derive(Deserialize)] +struct SavePlaylistInput { + tracks: Vec, +} + +#[put("/playlist/", data = "")] +fn save_playlist(db: State, auth: Auth, name: String, playlist: Json) -> Result<(), errors::Error> { + playlist::save_playlist(&name, &auth.username, &playlist.tracks, db.deref())?; + Ok(()) +} + +#[get("/playlist/")] +fn read_playlist(db: State, auth: Auth, name: String) -> Result>, errors::Error> { + let songs = playlist::read_playlist(&name, &auth.username, db.deref())?; + Ok(Json(songs)) +} + +#[delete("/playlist/")] +fn delete_playlist(db: State, auth: Auth, name: String) -> Result<(), errors::Error> { + playlist::delete_playlist(&name, &auth.username, db.deref())?; + Ok(()) +} From 9f84b352b9ccfdf4c26311f4e73b9e03a3a9965d Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:03:25 -0700 Subject: [PATCH 24/69] Formatting --- src/errors.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index ba97132..74014bc 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -63,12 +63,14 @@ error_chain! { impl<'r> rocket::response::Responder<'r> for Error { fn respond_to(self, _: &rocket::request::Request) -> rocket::response::Result<'r> { - let mut build = rocket::response::Response::build(); - build.status(match self.0 { - ErrorKind::FileNotFound => rocket::http::Status::NotFound, - _ => rocket::http::Status::InternalServerError, - }).ok() - } + let mut build = rocket::response::Response::build(); + build + .status(match self.0 { + ErrorKind::FileNotFound => rocket::http::Status::NotFound, + _ => rocket::http::Status::InternalServerError, + }) + .ok() + } } impl From for IronError { From 4af2c0f09e5158659e9b46a85ef00744230d9da4 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:05:04 -0700 Subject: [PATCH 25/69] Formatting --- src/serve.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/serve.rs b/src/serve.rs index d8d41a0..53338a4 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -152,7 +152,7 @@ pub struct RangeResponder { impl<'r, R: Responder<'r>> RangeResponder { pub fn new(original: R) -> RangeResponder { - RangeResponder{ original } + RangeResponder { original } } fn ignore_range(self, request: &rocket::request::Request) -> response::Result<'r> { @@ -192,9 +192,7 @@ fn truncate_range(range: &PartialFileRange, file_length: &Option) -> Option } impl<'r> Responder<'r> for RangeResponder { - fn respond_to(mut self, request: &rocket::request::Request) -> response::Result<'r> { - use rocket::http::hyper::header::*; let range_header = request.headers().get_one("Range"); @@ -238,5 +236,5 @@ impl<'r> Responder<'r> for RangeResponder { } else { self.ignore_range(request) } - } + } } From c25dc8155fba1ebe7f5a44b64321de7c0854409f Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:05:14 -0700 Subject: [PATCH 26/69] Implemented last fm endpoints --- src/api.rs | 2 +- src/rocket_api.rs | 116 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 98 insertions(+), 20 deletions(-) diff --git a/src/api.rs b/src/api.rs index a48591d..cdce98f 100644 --- a/src/api.rs +++ b/src/api.rs @@ -249,7 +249,7 @@ fn get_endpoints(db: &Arc, index_channel: &Arc) -> Mou lastfm_router.get( "/scrobble", move |request: &mut Request| self::lastfm_scrobble(request, scrobble_db.deref()), - "auth", + "scrobble", ); auth_api_mount.mount("/lastfm/", lastfm_router); diff --git a/src/rocket_api.rs b/src/rocket_api.rs index d496290..ec4f3f4 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -1,16 +1,19 @@ use rocket::http::{Cookie, Cookies, RawStr, Status}; use rocket::request::{self, FromParam, FromRequest, Request}; +use rocket::response::content::Html; use rocket::{Outcome, State}; use rocket_contrib::json::Json; use std::fs::File; -use std::path::PathBuf; use std::ops::Deref; +use std::path::PathBuf; +use std::str; use std::sync::Arc; use config::{self, Config, Preferences}; use db::DB; use errors; use index; +use lastfm; use playlist; use serve; use thumbnails; @@ -45,6 +48,10 @@ pub fn get_routes() -> Vec { save_playlist, read_playlist, delete_playlist, + lastfm_link, + lastfm_unlink, + lastfm_now_playing, + lastfm_scrobble, ] } @@ -97,18 +104,18 @@ struct VFSPathBuf { impl<'r> FromParam<'r> for VFSPathBuf { type Error = &'r RawStr; - fn from_param(param: &'r RawStr) -> Result { + fn from_param(param: &'r RawStr) -> Result { let decoded_path = param.percent_decode_lossy(); - Ok(VFSPathBuf{ - path_buf: PathBuf::from(decoded_path.into_owned()) + Ok(VFSPathBuf { + path_buf: PathBuf::from(decoded_path.into_owned()), }) - } + } } impl From for PathBuf { - fn from(vfs_path_buf: VFSPathBuf) -> Self { - vfs_path_buf.path_buf.clone() - } + fn from(vfs_path_buf: VFSPathBuf) -> Self { + vfs_path_buf.path_buf.clone() + } } #[derive(Serialize)] @@ -198,10 +205,11 @@ fn auth( mut cookies: Cookies, ) -> Result, errors::Error> { user::auth::(&db, &credentials.username, &credentials.password)?; - cookies.add_private(Cookie::new( - SESSION_FIELD_USERNAME, - credentials.username.clone(), - )); + cookies.add_private( + Cookie::build(SESSION_FIELD_USERNAME, credentials.username.clone()) + .same_site(rocket::http::SameSite::Lax) + .finish(), + ); let auth_output = AuthOutput { admin: user::is_admin::(&db, &credentials.username)?, @@ -257,19 +265,30 @@ fn recent(db: State, _auth: Auth) -> Result>, err } #[get("/search")] -fn search_root(db: State, _auth: Auth) -> Result>, errors::Error> { +fn search_root( + db: State, + _auth: Auth, +) -> Result>, errors::Error> { let result = index::search(db.deref(), "")?; Ok(Json(result)) } #[get("/search/")] -fn search(db: State, _auth: Auth, query: String) -> Result>, errors::Error> { +fn search( + db: State, + _auth: Auth, + query: String, +) -> Result>, errors::Error> { let result = index::search(db.deref(), &query)?; Ok(Json(result)) } #[get("/serve/")] -fn serve(db: State, _auth: Auth, path: VFSPathBuf) -> Result, errors::Error> { +fn serve( + db: State, + _auth: Auth, + path: VFSPathBuf, +) -> Result, errors::Error> { let db: &DB = db.deref(); let vfs = db.get_vfs()?; let real_path = vfs.virtual_to_real(&path.into() as &PathBuf)?; @@ -290,8 +309,10 @@ struct ListPlaylistsEntry { } #[get("/playlists")] -fn list_playlists(db: State, auth: Auth) -> Result>, errors::Error> { - +fn list_playlists( + db: State, + auth: Auth, +) -> Result>, errors::Error> { let playlist_names = playlist::list_playlists(&auth.username, db.deref())?; let playlists: Vec = playlist_names .into_iter() @@ -307,13 +328,22 @@ struct SavePlaylistInput { } #[put("/playlist/", data = "")] -fn save_playlist(db: State, auth: Auth, name: String, playlist: Json) -> Result<(), errors::Error> { +fn save_playlist( + db: State, + auth: Auth, + name: String, + playlist: Json, +) -> Result<(), errors::Error> { playlist::save_playlist(&name, &auth.username, &playlist.tracks, db.deref())?; Ok(()) } #[get("/playlist/")] -fn read_playlist(db: State, auth: Auth, name: String) -> Result>, errors::Error> { +fn read_playlist( + db: State, + auth: Auth, + name: String, +) -> Result>, errors::Error> { let songs = playlist::read_playlist(&name, &auth.username, db.deref())?; Ok(Json(songs)) } @@ -323,3 +353,51 @@ fn delete_playlist(db: State, auth: Auth, name: String) -> Result<(), errors playlist::delete_playlist(&name, &auth.username, db.deref())?; Ok(()) } + +#[put("/lastfm/now_playing/")] +fn lastfm_now_playing(db: State, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { + lastfm::now_playing(db.deref(), &auth.username, &path.into() as &PathBuf)?; + Ok(()) +} + +#[post("/lastfm/scrobble/")] +fn lastfm_scrobble(db: State, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { + lastfm::scrobble(db.deref(), &auth.username, &path.into() as &PathBuf)?; + Ok(()) +} + +#[get("/lastfm/link?&")] +fn lastfm_link( + db: State, + auth: Auth, + token: String, + content: String, +) -> Result, errors::Error> { + lastfm::link(db.deref(), &auth.username, &token)?; + + // Percent decode + let base64_content = match RawStr::from_str(&content).percent_decode() { + Ok(s) => s, + Err(_) => return Err(errors::Error::from(errors::ErrorKind::EncodingError).into()), + }; + + // Base64 decode + let popup_content = match base64::decode(base64_content.as_bytes()) { + Ok(c) => c, + Err(_) => return Err(errors::Error::from(errors::ErrorKind::EncodingError).into()), + }; + + // UTF-8 decode + let popup_content_string = match str::from_utf8(&popup_content) { + Ok(s) => s, + Err(_) => return Err(errors::Error::from(errors::ErrorKind::EncodingError).into()), + }; + + Ok(Html(popup_content_string.to_string())) +} + +#[delete("/lastfm/link")] +fn lastfm_unlink(db: State, auth: Auth) -> Result<(), errors::Error> { + lastfm::unlink(db.deref(), &auth.username)?; + Ok(()) +} From 5786c99b3ad76a5213932522ec6c901bb4f8dc17 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:07:11 -0700 Subject: [PATCH 27/69] Fixed test compilation error --- src/index.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.rs b/src/index.rs index ebb1e9e..4f8bbe5 100644 --- a/src/index.rs +++ b/src/index.rs @@ -435,7 +435,7 @@ where Ok(()) } -fn update(db: &T) -> Result<(), errors::Error> +pub fn update(db: &T) -> Result<(), errors::Error> where T: ConnectionSource + VFSSource, { From a8a98fdd22806ea7074df81fd4024565b5027fe1 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:27:47 -0700 Subject: [PATCH 28/69] Removed iron --- Cargo.lock | 272 ++--------------- Cargo.toml | 9 +- src/api.rs | 789 -------------------------------------------------- src/config.rs | 7 - src/errors.rs | 26 -- src/main.rs | 27 +- src/serve.rs | 123 +------- src/utils.rs | 4 - 8 files changed, 41 insertions(+), 1216 deletions(-) delete mode 100644 src/api.rs diff --git a/Cargo.lock b/Cargo.lock index 1b47801..ae58788 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,12 +69,11 @@ dependencies = [ ] [[package]] -name = "bincode" -version = "0.9.2" +name = "base64" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -92,27 +91,6 @@ name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bodyparser" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "persistent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "buf_redux" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "build_const" version = "0.2.1" @@ -149,7 +127,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -166,15 +143,6 @@ name = "color_quant" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cookie" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cookie" version = "0.11.0" @@ -286,11 +254,6 @@ name = "crossbeam-utils" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "data-encoding" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "deflate" version = "0.7.19" @@ -334,7 +297,7 @@ version = "0.1.0" source = "git+https://github.com/SergioBenitez/derive-utils?rev=62f361f#62f361fe78b3b19dac5348e1a91c4960ec4dcb60" dependencies = [ "derive_utils_core 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -344,8 +307,8 @@ source = "git+https://github.com/SergioBenitez/derive-utils?rev=62f361f#62f361fe dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -475,9 +438,9 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -873,11 +836,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lewton" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ogg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -959,14 +922,6 @@ name = "md5" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "memchr" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "memchr" version = "2.1.0" @@ -1132,15 +1087,6 @@ name = "modifier" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "mount" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sequence_trie 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "mp3-duration" version = "0.1.3" @@ -1149,22 +1095,6 @@ dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "multipart" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "buf_redux 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mime_guess 1.8.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "twoway 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "native-tls" version = "0.1.5" @@ -1242,19 +1172,6 @@ dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "num" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-bigint 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num-bigint" version = "0.1.44" @@ -1266,15 +1183,6 @@ dependencies = [ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "num-bigint" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num-complex" version = "0.1.43" @@ -1284,14 +1192,6 @@ dependencies = [ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "num-complex" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num-derive" version = "0.2.3" @@ -1299,8 +1199,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1336,7 +1236,6 @@ name = "num-rational" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-bigint 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1356,7 +1255,7 @@ dependencies = [ [[package]] name = "ogg" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1420,21 +1319,6 @@ dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "params" -version = "0.6.0" -source = "git+https://github.com/agersant/params#cd5717e07347bf4da792ba58d08bcd2f4692186c" -dependencies = [ - "bodyparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "multipart 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "urlencoded 0.6.0 (git+https://github.com/agersant/urlencoded)", -] - [[package]] name = "parking_lot" version = "0.6.4" @@ -1470,8 +1354,8 @@ version = "0.1.0" source = "git+http://github.com/SergioBenitez/Pear?rev=00b9af5#00b9af5456932533c876cdb227eb123701b142f6" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1481,15 +1365,6 @@ name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "persistent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "phf" version = "0.7.23" @@ -1555,22 +1430,18 @@ version = "0.8.0" dependencies = [ "ape 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "diesel 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "diesel_migrations 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.13 (registry+https://github.com/rust-lang/crates.io-index)", "id3 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lewton 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lewton 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "metaflac 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "mp3-duration 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "params 0.6.0 (git+https://github.com/agersant/params)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1581,17 +1452,14 @@ dependencies = [ "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustfm-scrobble 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "secure-session 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde-xml-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix-daemonize 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1627,7 +1495,7 @@ dependencies = [ [[package]] name = "quote" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1825,7 +1693,7 @@ source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b3 dependencies = [ "derive_utils 0.1.0 (git+https://github.com/SergioBenitez/derive-utils?rev=62f361f)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1933,11 +1801,6 @@ name = "ryu" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "safemem" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "safemem" version = "0.3.0" @@ -1975,24 +1838,6 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "secure-session" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "data-encoding 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "security-framework" version = "0.1.16" @@ -2046,11 +1891,6 @@ name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "sequence_trie" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "serde" version = "1.0.80" @@ -2072,8 +1912,8 @@ version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2154,17 +1994,6 @@ name = "state" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "staticfile" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "string" version = "0.1.1" @@ -2192,11 +2021,11 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.14" +version = "0.15.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2210,12 +2039,12 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2514,14 +2343,6 @@ name = "try-lock" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "twoway" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "typeable" version = "0.1.2" @@ -2623,17 +2444,6 @@ dependencies = [ "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "urlencoded" -version = "0.6.0" -source = "git+https://github.com/agersant/urlencoded#243246d794b94257f33d6ef409e5bbe6b379656e" -dependencies = [ - "bodyparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "utf8-ranges" version = "1.0.1" @@ -2773,13 +2583,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" +"checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -"checksum bincode 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9a6301db0b49fb63551bc15b5ae348147101cdf323242b93ec7546d5002ff1af" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum bodyparser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f023abfa58aad6f6bc4ae0630799e24d5ee0ab8bb2e49f651d9b1f9aa4f52f30" -"checksum buf_redux 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b9279646319ff816b05fb5897883ece50d7d854d12b59992683d4f8a71b0f949" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" @@ -2788,7 +2596,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum color_quant 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" -"checksum cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "746858cae4eae40fff37e1998320068df317bc247dc91a67c6cfa053afdc2abb" "checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf" "checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67" "checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" @@ -2801,7 +2608,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" -"checksum data-encoding 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "67df0571a74bf0d97fb8b2ed22abdd9a48475c96bd327db968b7d9cace99655e" "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum derive_builder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c998e6ab02a828dd9735c18f154e14100e674ed08cb4e1938f0e4177543f439" "checksum derive_builder_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "735e24ee9e5fa8e16b86da5007856e97d592e11867e45d76e0c0d0a164a0b757" @@ -2863,7 +2669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" "checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" -"checksum lewton 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c789d72e98a55ff54152fbe7c6005923ccf9ae6c29f71513f4737b7ccbea702" +"checksum lewton 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "81d583f12101d36b9c19f85326f3c4e7d3b88d17f1131113e13da056dc0d4437" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "21138fc6669f438ed7ae3559d5789a5f0ba32f28c1f0608d1e452b0bb06ee936" "checksum libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d3711dfd91a1081d2458ad2d06ea30a8755256e74038be2ad927d94e1c955ca8" @@ -2875,7 +2681,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum md5 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1ad8b18d0b6ae54e03c9fe1f7dea2ee5f8e0115a87611316794be1bc51537f7" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum metaflac 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1839a57e30c651fb9647d1c140dcda407282a2228cddb25a21c1708645621219" @@ -2893,20 +2698,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" -"checksum mount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e25c06012941aaf8c75f2eaf7ec5c48cf69f9fc489ab3eb3589edc107e386f0b" "checksum mp3-duration 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "23016ba75045a23213bf6ebf062a664a37852a2cfe4b8fe277d75dfbe96fce26" -"checksum multipart 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "65ea55ea673966fa285eadafb6e7fb03c7328c7bbad60bea23a483e374eeccb3" "checksum native-tls 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f74dbadc8b43df7864539cedb7bc91345e532fdd913cfdc23ad94f4d2d40fbc0" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "873ecfd8c174964ae30f401329d140142312c8e5590719cf1199d5f1717d8078" "checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -"checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" "checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" -"checksum num-bigint 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3eceac7784c5dc97c2d6edf30259b4e153e6e2b42b3c85e9a6e9f45d06caef6e" "checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "107b9be86cd2481930688277b675b0114578227f034674726605b8a482d8baf8" "checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124" @@ -2914,20 +2714,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e96f040177bb3da242b5b1ecf3f54b5d5af3efbbfb18608977a5d2767b22f10" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" -"checksum ogg 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c4663614e6994a1bd003633f93bfef54c16b420d5622e11ffc36d9c27632cae" +"checksum ogg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d79f1db9148be9d0e174bb3ac890f6030fcb1ed947267c5a91ee4c91b5a91e15" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" "checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum params 0.6.0 (git+https://github.com/agersant/params)" = "" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum pear 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)" = "" "checksum pear_codegen 0.1.0 (git+http://github.com/SergioBenitez/Pear?rev=00b9af5)" = "" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" -"checksum persistent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e8fa0009c4f3d350281309909c618abddf10bb7e3145f28410782f6a5ec74c5" "checksum phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "cec29da322b242f4c3098852c77a0ca261c9c01b806cae85a5572a1eb94db9a6" "checksum phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "7d187f00cd98d5afbcd8898f6cf181743a449162aeb329dcd2f3849009e605ad" "checksum phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "03dc191feb9b08b0dc1330d6549b795b9d81aec19efe6b4a45aec8d4caee0c4b" @@ -2939,7 +2737,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" -"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" +"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" @@ -2968,21 +2766,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustfm-scrobble 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a186f33cd665fc22db048b72e0b52b077eff8c060d33f6d06384f43efe477734" "checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" -"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum secure-session 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "823aa16cfb188f679c966493213c77b485dd95a2bd79e88a43c4a2da3f88be89" "checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332" "checksum security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "697d3f3c23a618272ead9e1fb259c1411102b31c6af8b93f1d64cca9c3b0e8e0" "checksum security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5421621e836278a0b139268f36eee0dc7e389b784dc3f79d8f11aabadf41bead" "checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum sequence_trie 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "32157204e5c9d3c04007bd7e56e96e987635ce0e8e23c085b1e403861b76c351" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde-xml-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0c06881f4313eec67d4ecfcd8e14339f6042cfc0de4b1bd3ceae74c29d597f68" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" @@ -2997,13 +2792,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" -"checksum staticfile 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "babd3fa68bb7e3994ce181c5f21ff3ff5fffef7b18b8a10163b45e4dafc6fb86" "checksum string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00caf261d6f90f588f8450b8e1230fa0d5be49ee6140fdfbcb55335aff350970" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" -"checksum syn 0.15.14 (registry+https://github.com/rust-lang/crates.io-index)" = "baaba45c6bf60fe29aaf241fa33306c0b75c801edea8378263a8f043b09a5634" +"checksum syn 0.15.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0a9c2bf1e53c21704a7cce1b2a42768f1ae32a6777108a0d7f1faa4bfe7f7c04" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec37f4fab4bafaf6b5621c1d54e6aa5d4d059a8f84929e87abfdd7f9f04c6db2" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" @@ -3031,7 +2825,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2aa4715743892880f70885373966c83d73ef1b0838a664ef0c76fffd35e7c2" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" -"checksum twoway 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" @@ -3047,7 +2840,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" "checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6" -"checksum urlencoded 0.6.0 (git+https://github.com/agersant/urlencoded)" = "" "checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" "checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" diff --git a/Cargo.toml b/Cargo.toml index 83b1393..c27ecf1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,23 +9,19 @@ ui = [] [dependencies] ape = "0.2.0" app_dirs = "1.1.1" -base64 = "0.9.3" +base64 = "0.10.0" diesel = { version = "1.3.3", features = ["sqlite"] } diesel_migrations = { version = "1.3.0", features = ["sqlite"] } error-chain = "0.12.0" getopts = "0.2.15" -hyper = "0.12.11" id3 = "0.2.3" image = "0.20.0" -iron = "0.6.0" rustfm-scrobble = "0.9.1" lewton = "0.9.1" log = "0.4.5" md5 = "0.5.0" metaflac = "0.1.8" -mount = "0.4.0" mp3-duration = "0.1.0" -params = { git = "https://github.com/agersant/params" } rand = "0.5.5" regex = "1.0.5" ring = "0.13.2" @@ -33,16 +29,13 @@ reqwest = "0.9.2" rocket = "0.4.0-dev" router = "0.6.0" rust-crypto = "0.2.36" -secure-session = "0.3.1" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" serde-xml-rs = "0.2.1" -staticfile = "0.5.0" simplelog = "0.5.2" toml = "0.4.5" typemap = "0.3" -url = "1.2.0" [patch.crates-io.rocket] git = "https://github.com/SergioBenitez/Rocket.git" diff --git a/src/api.rs b/src/api.rs deleted file mode 100644 index cdce98f..0000000 --- a/src/api.rs +++ /dev/null @@ -1,789 +0,0 @@ -use base64; -use crypto::scrypt; -use diesel::prelude::*; -use iron::headers::{Authorization, Basic, Range}; -use iron::mime::Mime; -use iron::prelude::*; -use iron::{status, AroundMiddleware, Handler}; -use mount::Mount; -use params; -use router::Router; -use secure_session::middleware::{SessionConfig, SessionMiddleware}; -use secure_session::session::ChaCha20Poly1305SessionManager; -use serde_json; -use std::fs; -use std::io; -use std::ops::Deref; -use std::path::*; -use std::sync::Arc; -use typemap; -use url::percent_encoding::percent_decode; - -use config; -use db::misc_settings; -use db::{ConnectionSource, DB}; -use errors::*; -use index; -use lastfm; -use playlist; -use serve; -use thumbnails::*; -use user; -use utils::*; -use vfs::VFSSource; - -#[derive(Deserialize, Serialize)] -struct Session { - username: String, -} - -struct SessionKey {} - -impl typemap::Key for SessionKey { - type Value = Session; -} - -fn get_auth_secret(db: &T) -> Result<[u8; 32]> -where - T: ConnectionSource, -{ - use self::misc_settings::dsl::*; - let connection = db.get_connection(); - let misc: config::MiscSettings = misc_settings.get_result(connection.deref())?; - - let params = scrypt::ScryptParams::new(12, 8, 1); - let mut secret = [0; 32]; - scrypt::scrypt( - misc.auth_secret.as_bytes(), - b"polaris-salt-and-pepper-with-cheese", - ¶ms, - &mut secret, - ); - Ok(secret) -} - -pub fn get_handler(db: &Arc, index: &Arc) -> Result { - let api_handler = get_endpoints(&db.clone(), &index); - let mut api_chain = Chain::new(api_handler); - - let auth_secret = get_auth_secret(db.deref())?; - let session_manager = ChaCha20Poly1305SessionManager::::from_key(auth_secret); - let session_config = SessionConfig::default(); - let session_middleware = SessionMiddleware::< - Session, - SessionKey, - ChaCha20Poly1305SessionManager, - >::new(session_manager, session_config); - api_chain.link_around(session_middleware); - - Ok(api_chain) -} - -fn get_endpoints(db: &Arc, index_channel: &Arc) -> Mount { - let mut api_handler = Mount::new(); - - { - { - let db = db.clone(); - api_handler.mount("/auth/", move |request: &mut Request| { - self::auth(request, db.deref()) - }); - } - { - let db = db.clone(); - api_handler.mount("/initial_setup/", move |request: &mut Request| { - self::initial_setup(request, db.deref()) - }); - } - } - - { - let mut auth_api_mount = Mount::new(); - { - let db = db.clone(); - auth_api_mount.mount("/browse/", move |request: &mut Request| { - self::browse(request, db.deref()) - }); - } - { - let db = db.clone(); - auth_api_mount.mount("/flatten/", move |request: &mut Request| { - self::flatten(request, db.deref()) - }); - } - { - let db = db.clone(); - auth_api_mount.mount("/random/", move |request: &mut Request| { - self::random(request, db.deref()) - }); - } - { - let db = db.clone(); - auth_api_mount.mount("/recent/", move |request: &mut Request| { - self::recent(request, db.deref()) - }); - } - { - let db = db.clone(); - auth_api_mount.mount("/search/", move |request: &mut Request| { - self::search(request, db.deref()) - }); - } - { - let db = db.clone(); - auth_api_mount.mount("/serve/", move |request: &mut Request| { - self::serve(request, db.deref()) - }); - } - { - let mut preferences_router = Router::new(); - let get_db = db.clone(); - let put_db = db.clone(); - preferences_router.get( - "/", - move |request: &mut Request| self::get_preferences(request, get_db.deref()), - "get_preferences", - ); - preferences_router.put( - "/", - move |request: &mut Request| self::put_preferences(request, put_db.deref()), - "put_preferences", - ); - auth_api_mount.mount("/preferences/", preferences_router); - } - { - let mut settings_router = Router::new(); - let get_db = db.clone(); - let put_db = db.clone(); - settings_router.get( - "/", - move |request: &mut Request| self::get_config(request, get_db.deref()), - "get_config", - ); - settings_router.put( - "/", - move |request: &mut Request| self::put_config(request, put_db.deref()), - "put_config", - ); - - let mut settings_api_chain = Chain::new(settings_router); - let admin_req = AdminRequirement { db: db.clone() }; - settings_api_chain.link_around(admin_req); - - auth_api_mount.mount("/settings/", settings_api_chain); - } - { - let index_channel = index_channel.clone(); - let mut reindex_router = Router::new(); - reindex_router.post( - "/", - move |_: &mut Request| self::trigger_index(index_channel.clone()), - "trigger_index", - ); - - let mut reindex_api_chain = Chain::new(reindex_router); - let admin_req = AdminRequirement { db: db.clone() }; - reindex_api_chain.link_around(admin_req); - - auth_api_mount.mount("/trigger_index/", reindex_api_chain); - } - { - let mut playlist_router = Router::new(); - let put_db = db.clone(); - let list_db = db.clone(); - let read_db = db.clone(); - let delete_db = db.clone(); - playlist_router.put( - "/", - move |request: &mut Request| self::save_playlist(request, put_db.deref()), - "save_playlist", - ); - - playlist_router.get( - "/list", - move |request: &mut Request| self::list_playlists(request, list_db.deref()), - "list_playlists", - ); - - playlist_router.get( - "/read/:playlist_name", - move |request: &mut Request| self::read_playlist(request, read_db.deref()), - "read_playlist", - ); - - playlist_router.delete( - "/:playlist_name", - move |request: &mut Request| self::delete_playlist(request, delete_db.deref()), - "delete_playlist", - ); - - auth_api_mount.mount("/playlist/", playlist_router); - } - { - let mut lastfm_router = Router::new(); - let now_playing_db = db.clone(); - let link_db = db.clone(); - let unlink_db = db.clone(); - let scrobble_db = db.clone(); - - lastfm_router.put( - "/now_playing", - move |request: &mut Request| { - self::lastfm_now_playing(request, now_playing_db.deref()) - }, - "now_playing", - ); - - lastfm_router.get( - "/link", - move |request: &mut Request| self::lastfm_link(request, link_db.deref()), - "link", - ); - - lastfm_router.delete( - "/link", - move |request: &mut Request| self::lastfm_unlink(request, unlink_db.deref()), - "unlink", - ); - - lastfm_router.get( - "/scrobble", - move |request: &mut Request| self::lastfm_scrobble(request, scrobble_db.deref()), - "scrobble", - ); - - auth_api_mount.mount("/lastfm/", lastfm_router); - } - - let mut auth_api_chain = Chain::new(auth_api_mount); - let auth = AuthRequirement { db: db.clone() }; - auth_api_chain.link_around(auth); - - api_handler.mount("/", auth_api_chain); - } - - api_handler -} - -fn path_from_request(request: &Request) -> Result { - let path_string = request - .url - .path() - .join(&::std::path::MAIN_SEPARATOR.to_string()); - let decoded_path = percent_decode(path_string.as_bytes()).decode_utf8()?; - Ok(PathBuf::from(decoded_path.deref())) -} - -struct AuthRequirement { - db: Arc, -} - -impl AroundMiddleware for AuthRequirement { - fn around(self, handler: Box) -> Box { - Box::new(AuthHandler { - db: self.db, - handler, - }) as Box - } -} - -struct AuthHandler { - handler: Box, - db: Arc, -} - -impl Handler for AuthHandler { - fn handle(&self, req: &mut Request) -> IronResult { - { - // Skip auth for first time setup - let mut auth_success = user::count(self.db.deref())? == 0; - - // Auth via Authorization header - if !auth_success { - if let Some(auth) = req.headers.get::>() { - if let Some(ref password) = auth.password { - auth_success = - user::auth(self.db.deref(), auth.username.as_str(), password.as_str())?; - if auth_success { - req.extensions.insert::(Session { - username: auth.username.clone(), - }); - } - } - } - } - - // Auth via Session - if !auth_success { - auth_success = req.extensions.get::().is_some(); - } - - // Reject - if !auth_success { - return Err(Error::from(ErrorKind::AuthenticationRequired).into()); - } - } - - self.handler.handle(req) - } -} - -struct AdminRequirement { - db: Arc, -} - -impl AroundMiddleware for AdminRequirement { - fn around(self, handler: Box) -> Box { - Box::new(AdminHandler { - db: self.db, - handler, - }) as Box - } -} - -struct AdminHandler { - handler: Box, - db: Arc, -} - -impl Handler for AdminHandler { - fn handle(&self, req: &mut Request) -> IronResult { - { - // Skip auth for first time setup - let mut auth_success = user::count(self.db.deref())? == 0; - - if !auth_success { - match req.extensions.get::() { - Some(s) => auth_success = user::is_admin(self.db.deref(), &s.username)?, - _ => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - } - } - - if !auth_success { - return Err(Error::from(ErrorKind::AdminPrivilegeRequired).into()); - } - } - - self.handler.handle(req) - } -} - -fn initial_setup(_: &mut Request, db: &DB) -> IronResult { - #[derive(Serialize)] - struct InitialSetup { - has_any_users: bool, - }; - - let initial_setup = InitialSetup { - has_any_users: user::count(db)? > 0, - }; - - match serde_json::to_string(&initial_setup) { - Ok(result_json) => Ok(Response::with((status::Ok, result_json))), - Err(e) => Err(IronError::new(e, status::InternalServerError)), - } -} - -fn auth(request: &mut Request, db: &DB) -> IronResult { - let username; - let password; - { - let input = request.get_ref::().unwrap(); - username = match input.find(&["username"]) { - Some(¶ms::Value::String(ref username)) => username.clone(), - _ => return Err(Error::from(ErrorKind::MissingUsername).into()), - }; - password = match input.find(&["password"]) { - Some(¶ms::Value::String(ref password)) => password.clone(), - _ => return Err(Error::from(ErrorKind::MissingPassword).into()), - }; - } - - if !user::auth(db, username.as_str(), password.as_str())? { - return Err(Error::from(ErrorKind::IncorrectCredentials).into()); - } - - request.extensions.insert::(Session { - username: username.clone(), - }); - - #[derive(Serialize)] - struct AuthOutput { - admin: bool, - } - - let auth_output = AuthOutput { - admin: user::is_admin(db.deref(), &username)?, - }; - let result_json = serde_json::to_string(&auth_output); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - - Ok(Response::with((status::Ok, result_json))) -} - -fn browse(request: &mut Request, db: &DB) -> IronResult { - let path = path_from_request(request); - let path = match path { - Err(e) => return Err(IronError::new(e, status::BadRequest)), - Ok(p) => p, - }; - let browse_result = index::browse(db, path)?; - - let result_json = serde_json::to_string(&browse_result); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - - Ok(Response::with((status::Ok, result_json))) -} - -fn flatten(request: &mut Request, db: &DB) -> IronResult { - let path = path_from_request(request); - let path = match path { - Err(e) => return Err(IronError::new(e, status::BadRequest)), - Ok(p) => p, - }; - let flatten_result = index::flatten(db, &path)?; - - let result_json = serde_json::to_string(&flatten_result); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - - Ok(Response::with((status::Ok, result_json))) -} - -fn random(_: &mut Request, db: &DB) -> IronResult { - let random_result = index::get_random_albums(db, 20)?; - let result_json = serde_json::to_string(&random_result); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - Ok(Response::with((status::Ok, result_json))) -} - -fn recent(_: &mut Request, db: &DB) -> IronResult { - let recent_result = index::get_recent_albums(db, 20)?; - let result_json = serde_json::to_string(&recent_result); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - Ok(Response::with((status::Ok, result_json))) -} - -fn search(request: &mut Request, db: &DB) -> IronResult { - let query = request - .url - .path() - .join(&::std::path::MAIN_SEPARATOR.to_string()); - let query = match percent_decode(query.as_bytes()).decode_utf8() { - Ok(s) => s, - Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()), - }; - let search_result = index::search(db, &query)?; - let result_json = serde_json::to_string(&search_result); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - Ok(Response::with((status::Ok, result_json))) -} - -fn serve(request: &mut Request, db: &DB) -> IronResult { - let virtual_path = path_from_request(request); - let virtual_path = match virtual_path { - Err(e) => return Err(IronError::new(e, status::BadRequest)), - Ok(p) => p, - }; - - let vfs = db.get_vfs()?; - let real_path = vfs.virtual_to_real(virtual_path); - let real_path = match real_path { - Err(e) => return Err(IronError::new(e, status::NotFound)), - Ok(p) => p, - }; - - let metadata = match fs::metadata(real_path.as_path()) { - Ok(meta) => meta, - Err(e) => { - let status = match e.kind() { - io::ErrorKind::NotFound => status::NotFound, - io::ErrorKind::PermissionDenied => status::Forbidden, - _ => status::InternalServerError, - }; - return Err(IronError::new(e, status)); - } - }; - - if !metadata.is_file() { - return Err(Error::from(ErrorKind::CannotServeDirectory).into()); - } - - if is_song(real_path.as_path()) { - let range_header = request.headers.get::(); - return serve::deliver(&real_path, range_header); - } - - if is_image(real_path.as_path()) { - return art(request, real_path.as_path()); - } - - Err(Error::from(ErrorKind::UnsupportedFileType).into()) -} - -fn art(_: &mut Request, real_path: &Path) -> IronResult { - let thumb = get_thumbnail(real_path, 400); - match thumb { - Ok(path) => Ok(Response::with((status::Ok, path))), - Err(e) => Err(IronError::from(e)), - } -} - -fn get_config(_: &mut Request, db: &DB) -> IronResult { - let c = config::read(db)?; - let result_json = serde_json::to_string(&c); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - Ok(Response::with((status::Ok, result_json))) -} - -fn put_config(request: &mut Request, db: &DB) -> IronResult { - let input = request.get_ref::().unwrap(); - let config = match input.find(&["config"]) { - Some(¶ms::Value::String(ref config)) => config, - _ => return Err(Error::from(ErrorKind::MissingConfig).into()), - }; - let config = config::parse_json(config)?; - config::amend(db, &config)?; - Ok(Response::with(status::Ok)) -} - -fn get_preferences(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let preferences = config::read_preferences(db, &username)?; - let result_json = serde_json::to_string(&preferences); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - Ok(Response::with((status::Ok, result_json))) -} - -fn put_preferences(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let input = request.get_ref::().unwrap(); - let preferences = match input.find(&["preferences"]) { - Some(¶ms::Value::String(ref preferences)) => preferences, - _ => return Err(Error::from(ErrorKind::MissingPreferences).into()), - }; - let preferences = match serde_json::from_str::(preferences) { - Ok(p) => p, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - - config::write_preferences(db, &username, &preferences)?; - Ok(Response::with(status::Ok)) -} - -fn trigger_index(channel: Arc) -> IronResult { - let channel = channel.deref(); - if let Err(e) = channel.trigger_reindex() { - return Err(IronError::new(e, status::InternalServerError)); - }; - Ok(Response::with(status::Ok)) -} - -fn save_playlist(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let input = request.get_ref::().unwrap(); - let playlist = match input.find(&["playlist"]) { - Some(¶ms::Value::String(ref playlist)) => playlist, - _ => return Err(Error::from(ErrorKind::MissingPlaylist).into()), - }; - - #[derive(Deserialize)] - struct SavePlaylistInput { - name: String, - tracks: Vec, - } - - let playlist = match serde_json::from_str::(playlist) { - Ok(p) => p, - Err(e) => return Err(IronError::new(e, status::BadRequest)), - }; - - playlist::save_playlist(&playlist.name, &username, &playlist.tracks, db)?; - - Ok(Response::with(status::Ok)) -} - -fn list_playlists(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - #[derive(Serialize)] - struct ListPlaylistsOutput { - name: String, - } - - let playlist_name = playlist::list_playlists(&username, db)?; - let playlists: Vec = playlist_name - .into_iter() - .map(|p| ListPlaylistsOutput { name: p }) - .collect(); - - let result_json = serde_json::to_string(&playlists); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - Ok(Response::with((status::Ok, result_json))) -} - -fn read_playlist(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let params = request.extensions.get::().unwrap(); - let playlist_name = &(match params.find("playlist_name") { - Some(s) => s, - _ => return Err(Error::from(ErrorKind::MissingPlaylistName).into()), - }); - - let playlist_name = match percent_decode(playlist_name.as_bytes()).decode_utf8() { - Ok(s) => s, - Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()), - }; - - let songs = playlist::read_playlist(&playlist_name, &username, db)?; - let result_json = serde_json::to_string(&songs); - let result_json = match result_json { - Ok(j) => j, - Err(e) => return Err(IronError::new(e, status::InternalServerError)), - }; - - Ok(Response::with((status::Ok, result_json))) -} - -fn delete_playlist(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let params = request.extensions.get::().unwrap(); - let playlist_name = &(match params.find("playlist_name") { - Some(s) => s, - _ => return Err(Error::from(ErrorKind::MissingPlaylistName).into()), - }); - - let playlist_name = match percent_decode(playlist_name.as_bytes()).decode_utf8() { - Ok(s) => s, - Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()), - }; - - playlist::delete_playlist(&playlist_name, &username, db)?; - - Ok(Response::with(status::Ok)) -} - -fn lastfm_link(request: &mut Request, db: &DB) -> IronResult { - let input = request.get_ref::().unwrap(); - let username = match input.find(&["username"]) { - Some(¶ms::Value::String(ref username)) => username.clone(), - _ => return Err(Error::from(ErrorKind::MissingUsername).into()), - }; - let token = match input.find(&["token"]) { - Some(¶ms::Value::String(ref token)) => token.clone(), - _ => return Err(Error::from(ErrorKind::MissingPassword).into()), - }; - - lastfm::link(db, &username, &token)?; - - let url_encoded_content = match input.find(&["content"]) { - Some(¶ms::Value::String(ref content)) => content.clone(), - _ => return Err(Error::from(ErrorKind::MissingDesiredResponse).into()), - }; - - let base64_content = match percent_decode(url_encoded_content.as_bytes()).decode_utf8() { - Ok(s) => s, - Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()), - }; - - let popup_content = match base64::decode(base64_content.as_bytes()) { - Ok(c) => c, - Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()), - }; - - let mime = "text/html".parse::().unwrap(); - - Ok(Response::with((mime, status::Ok, popup_content))) -} - -fn lastfm_unlink(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - lastfm::unlink(db, &username)?; - Ok(Response::with(status::Ok)) -} - -fn lastfm_now_playing(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let virtual_path = path_from_request(request); - let virtual_path = match virtual_path { - Err(e) => return Err(IronError::new(e, status::BadRequest)), - Ok(p) => p, - }; - - lastfm::now_playing(db, &username, &virtual_path)?; - - Ok(Response::with(status::Ok)) -} - -fn lastfm_scrobble(request: &mut Request, db: &DB) -> IronResult { - let username = match request.extensions.get::() { - Some(s) => s.username.clone(), - None => return Err(Error::from(ErrorKind::AuthenticationRequired).into()), - }; - - let virtual_path = path_from_request(request); - let virtual_path = match virtual_path { - Err(e) => return Err(IronError::new(e, status::BadRequest)), - Ok(p) => p, - }; - - lastfm::scrobble(db, &username, &virtual_path)?; - - Ok(Response::with(status::Ok)) -} diff --git a/src/config.rs b/src/config.rs index c8235f6..198dc5f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,7 +2,6 @@ use core::ops::Deref; use diesel; use diesel::prelude::*; use regex::Regex; -use serde_json; use std::fs; use std::io::Read; use std::path; @@ -61,12 +60,6 @@ impl Config { } } -pub fn parse_json(content: &str) -> Result { - let mut config = serde_json::from_str::(content)?; - config.clean_paths()?; - Ok(config) -} - pub fn parse_toml_file(path: &path::Path) -> Result { info!("Config file path: {}", path.to_string_lossy()); let mut config_file = fs::File::open(path)?; diff --git a/src/errors.rs b/src/errors.rs index 74014bc..5e8c9c4 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -3,11 +3,8 @@ use core; use diesel; use diesel_migrations; use getopts; -use hyper; use id3; use image; -use iron::status::Status; -use iron::IronError; use lewton; use metaflac; use regex; @@ -26,7 +23,6 @@ error_chain! { Encoding(core::str::Utf8Error); Flac(metaflac::Error); GetOpts(getopts::Fail); - Hyper(hyper::Error); Id3(id3::Error); Image(image::ImageError); Io(std::io::Error); @@ -72,25 +68,3 @@ impl<'r> rocket::response::Responder<'r> for Error { .ok() } } - -impl From for IronError { - fn from(err: Error) -> IronError { - match err { - e @ Error(ErrorKind::AuthenticationRequired, _) => { - IronError::new(e, Status::Unauthorized) - } - e @ Error(ErrorKind::AdminPrivilegeRequired, _) => IronError::new(e, Status::Forbidden), - e @ Error(ErrorKind::MissingUsername, _) => IronError::new(e, Status::BadRequest), - e @ Error(ErrorKind::MissingPassword, _) => IronError::new(e, Status::BadRequest), - e @ Error(ErrorKind::IncorrectCredentials, _) => { - IronError::new(e, Status::Unauthorized) - } - e @ Error(ErrorKind::CannotServeDirectory, _) => IronError::new(e, Status::BadRequest), - e @ Error(ErrorKind::UnsupportedFileType, _) => IronError::new(e, Status::BadRequest), - e @ Error(ErrorKind::MissingLastFMCredentials, _) => { - IronError::new(e, Status::Unauthorized) - } - e => IronError::new(e, Status::InternalServerError), - } - } -} diff --git a/src/main.rs b/src/main.rs index cb31d9d..1e22b44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,16 +14,12 @@ extern crate diesel_migrations; #[macro_use] extern crate error_chain; extern crate getopts; -extern crate hyper; extern crate id3; extern crate image; -extern crate iron; extern crate lewton; extern crate md5; extern crate metaflac; -extern crate mount; extern crate mp3_duration; -extern crate params; extern crate rand; extern crate regex; extern crate reqwest; @@ -33,16 +29,13 @@ extern crate rocket; extern crate rocket_contrib; extern crate router; extern crate rustfm_scrobble; -extern crate secure_session; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate serde_xml_rs; -extern crate staticfile; extern crate toml; extern crate typemap; -extern crate url; #[macro_use] extern crate log; extern crate simplelog; @@ -65,15 +58,11 @@ use unix_daemonize::{daemonize_redirect, ChdirMode}; use core::ops::Deref; use errors::*; use getopts::Options; -use iron::prelude::*; -use mount::Mount; use rocket_contrib::serve::StaticFiles; use simplelog::{Level, LevelFilter, SimpleLogger, TermLogger}; -use staticfile::Static; use std::path::Path; use std::sync::Arc; -mod api; mod config; mod db; mod ddns; @@ -226,9 +215,6 @@ fn run() -> Result<()> { let prefix_url = config.prefix_url.unwrap_or_else(|| "".to_string()); let api_url = format!("{}/api", &prefix_url); info!("Mounting API on {}", api_url); - let mut mount = Mount::new(); - let handler = api::get_handler(&db.clone(), &command_sender)?; - mount.mount(&api_url, handler); // Mount static files let web_dir_name = matches.opt_str("w"); @@ -240,7 +226,6 @@ fn run() -> Result<()> { info!("Static files location is {}", web_dir_path.display()); let static_url = format!("/{}", &prefix_url); info!("Mounting static files on {}", static_url); - mount.mount(&static_url, Static::new(&web_dir_path)); info!("Starting up server"); let port: u16 = matches @@ -249,13 +234,10 @@ fn run() -> Result<()> { .parse() .or(Err("invalid port number"))?; - let mut server = match Iron::new(mount).http(("0.0.0.0", port)) { - Ok(s) => s, - Err(e) => bail!("Error starting up server: {}", e), - }; + // TODO Use port number rocket::ignite() - .manage(db::DB::new(&db_path)?) + .manage(db.clone()) .manage(command_sender) .mount(&static_url, StaticFiles::from(web_dir_path)) .mount(&api_url, rocket_api::get_routes()) @@ -268,12 +250,11 @@ fn run() -> Result<()> { }); // Run UI + + // TODO do we still reach this? ui::run(); info!("Shutting down server"); - if let Err(e) = server.close() { - bail!("Error shutting down server: {}", e); - } Ok(()) } diff --git a/src/serve.rs b/src/serve.rs index 53338a4..4192b90 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -1,56 +1,12 @@ -use iron::headers::{ - AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec, Range, RangeUnit, -}; -use iron::modifier::Modifier; -use iron::modifiers::Header; -use iron::prelude::*; -use iron::response::WriteBody; -use iron::status::{self, Status}; use rocket; +use rocket::http::hyper::header::*; use rocket::response::{self, Responder}; use std::cmp; -use std::fs::{self, File}; -use std::io::{self, Read, Seek, SeekFrom, Write}; -use std::path::Path; +use std::convert::From; +use std::fs::{File}; +use std::io::{Read, Seek, SeekFrom}; use std::str::FromStr; -use errors::{Error, ErrorKind}; - -pub fn deliver(path: &Path, range_header: Option<&Range>) -> IronResult { - match fs::metadata(path) { - Ok(meta) => meta, - Err(e) => { - let status = match e.kind() { - io::ErrorKind::NotFound => status::NotFound, - io::ErrorKind::PermissionDenied => status::Forbidden, - _ => status::InternalServerError, - }; - return Err(IronError::new(e, status)); - } - }; - - let accept_range_header = Header(AcceptRanges(vec![RangeUnit::Bytes])); - let range_header = range_header.cloned(); - - match range_header { - None => Ok(Response::with((status::Ok, path, accept_range_header))), - Some(range) => match range { - Range::Bytes(vec_range) => { - if let Ok(partial_file) = PartialFile::from_path(path, vec_range) { - Ok(Response::with(( - status::Ok, - partial_file, - accept_range_header, - ))) - } else { - Err(Error::from(ErrorKind::FileNotFound).into()) - } - } - _ => Ok(Response::with(status::RangeNotSatisfiable)), - }, - } -} - pub enum PartialFileRange { AllFrom(u64), FromTo(u64, u64), @@ -67,11 +23,6 @@ impl From for PartialFileRange { } } -pub struct PartialFile { - file: File, - range: PartialFileRange, -} - impl From> for PartialFileRange { fn from(v: Vec) -> PartialFileRange { match v.into_iter().next() { @@ -81,71 +32,6 @@ impl From> for PartialFileRange { } } -impl PartialFile { - pub fn new(file: File, range: Range) -> PartialFile - where - Range: Into, - { - let range = range.into(); - PartialFile { file, range } - } - - pub fn from_path, Range>(path: P, range: Range) -> Result - where - Range: Into, - { - let file = File::open(path.as_ref())?; - Ok(Self::new(file, range)) - } -} - -impl Modifier for PartialFile { - fn modify(self, res: &mut Response) { - let metadata: Option<_> = self.file.metadata().ok(); - let file_length: Option = metadata.map(|m| m.len()); - let range: Option<(u64, u64)> = truncate_range(&self.range, &file_length); - - if let Some(range) = range { - let content_range = ContentRange(ContentRangeSpec::Bytes { - range: Some(range), - instance_length: file_length, - }); - let content_len = range.1 - range.0 + 1; - res.headers.set(ContentLength(content_len)); - res.headers.set(content_range); - let partial_content = PartialContentBody { - file: self.file, - offset: range.0, - len: content_len, - }; - res.status = Some(Status::PartialContent); - res.body = Some(Box::new(partial_content)); - } else { - if let Some(file_length) = file_length { - res.headers.set(ContentRange(ContentRangeSpec::Bytes { - range: None, - instance_length: Some(file_length), - })); - }; - res.status = Some(Status::RangeNotSatisfiable); - } - } -} - -struct PartialContentBody { - pub file: File, - pub offset: u64, - pub len: u64, -} - -impl WriteBody for PartialContentBody { - fn write_body(&mut self, res: &mut Write) -> io::Result<()> { - self.file.seek(SeekFrom::Start(self.offset))?; - let mut limiter = ::by_ref(&mut self.file).take(self.len); - io::copy(&mut limiter, res).map(|_| ()) - } -} - pub struct RangeResponder { original: R, } @@ -193,7 +79,6 @@ fn truncate_range(range: &PartialFileRange, file_length: &Option) -> Option impl<'r> Responder<'r> for RangeResponder { fn respond_to(mut self, request: &rocket::request::Request) -> response::Result<'r> { - use rocket::http::hyper::header::*; let range_header = request.headers().get_one("Range"); let range_header = match range_header { diff --git a/src/utils.rs b/src/utils.rs index 184b240..a48a8f1 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -64,10 +64,6 @@ fn test_get_audio_format() { ); } -pub fn is_song(path: &Path) -> bool { - get_audio_format(path).is_some() -} - #[test] fn test_is_song() { assert!(is_song(Path::new("animals/🐷/my🐖file.mp3"))); From 0f2556516a3a1f70023cf217312922d30614f165 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:33:41 -0700 Subject: [PATCH 29/69] Removed more unused dependencies --- Cargo.lock | 80 ----------------------------------------------------- Cargo.toml | 2 -- src/main.rs | 2 -- 3 files changed, 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae58788..90385d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -762,21 +762,6 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "iron" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "mime_guess 1.8.6 (registry+https://github.com/rust-lang/crates.io-index)", - "modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "isatty" version = "0.1.9" @@ -982,17 +967,6 @@ dependencies = [ "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "mime_guess" -version = "1.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "mime_guess" version = "2.0.0-alpha.6" @@ -1082,11 +1056,6 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "modifier" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "mp3-duration" version = "0.1.3" @@ -1405,14 +1374,6 @@ name = "pkg-config" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "plugin" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "png" version = "0.12.0" @@ -1448,7 +1409,6 @@ dependencies = [ "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", "rocket_contrib 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)", - "router 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustfm-scrobble 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1458,7 +1418,6 @@ dependencies = [ "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix-daemonize 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1727,21 +1686,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "route-recognizer" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "router" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rusqlite" version = "0.14.0" @@ -2348,14 +2292,6 @@ name = "typeable" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "typemap" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ucd-util" version = "0.1.1" @@ -2421,14 +2357,6 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "unsafe-any" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "untrusted" version = "0.6.2" @@ -2660,7 +2588,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" "checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8e17268922834707e1c29e8badbf9c712c9c43378e1b6a3388946baff10be2" "checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b7d43206b34b3f94ea9445174bda196e772049b9bddbc620c9d29b2d20110d" @@ -2688,7 +2615,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum migrations_macros 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79f12499ef7353bdeca2d081bc61edd8351dac09a33af845952009b5a3d68c1a" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "0a907b83e7b9e987032439a387e187119cddafc92d5c2aaeb1d92580a793f630" -"checksum mime_guess 1.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4c0961143b8efdcfa29c3ae63281601b446a4a668165454b6c90f8024954c5" "checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" @@ -2697,7 +2623,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" "checksum mp3-duration 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "23016ba75045a23213bf6ebf062a664a37852a2cfe4b8fe277d75dfbe96fce26" "checksum native-tls 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f74dbadc8b43df7864539cedb7bc91345e532fdd913cfdc23ad94f4d2d40fbc0" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" @@ -2731,7 +2656,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "03dc191feb9b08b0dc1330d6549b795b9d81aec19efe6b4a45aec8d4caee0c4b" "checksum phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "b539898d22d4273ded07f64a05737649dc69095d92cb87c7097ec68e3f150b93" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" -"checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" "checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" @@ -2757,8 +2681,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rocket_codegen 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" "checksum rocket_contrib 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" "checksum rocket_http 0.4.0-dev (git+https://github.com/SergioBenitez/Rocket.git?rev=556206e)" = "" -"checksum route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3255338088df8146ba63d60a9b8e3556f1146ce2973bc05a75181a42ce2256" -"checksum router 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc63b6f3b8895b0d04e816b2b1aa58fdba2d5acca3cbb8f0ab8e017347d57397" "checksum rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9d9118f1ce84d8d0b67f9779936432fb42bb620cef2122409d786892cce9a3c" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" @@ -2826,7 +2748,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2aa4715743892880f70885373966c83d73ef1b0838a664ef0c76fffd35e7c2" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" -"checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" @@ -2837,7 +2758,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unix-daemonize 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "531faed80732acaa13d1016c66d6a9180b5045c4fcef8daa20bb2baf46b13907" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" "checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6" "checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" diff --git a/Cargo.toml b/Cargo.toml index c27ecf1..f5a1f87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ regex = "1.0.5" ring = "0.13.2" reqwest = "0.9.2" rocket = "0.4.0-dev" -router = "0.6.0" rust-crypto = "0.2.36" serde = "1.0" serde_derive = "1.0" @@ -35,7 +34,6 @@ serde_json = "1.0" serde-xml-rs = "0.2.1" simplelog = "0.5.2" toml = "0.4.5" -typemap = "0.3" [patch.crates-io.rocket] git = "https://github.com/SergioBenitez/Rocket.git" diff --git a/src/main.rs b/src/main.rs index 1e22b44..a1b194c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,6 @@ extern crate ring; #[macro_use] extern crate rocket; extern crate rocket_contrib; -extern crate router; extern crate rustfm_scrobble; extern crate serde; #[macro_use] @@ -35,7 +34,6 @@ extern crate serde_derive; extern crate serde_json; extern crate serde_xml_rs; extern crate toml; -extern crate typemap; #[macro_use] extern crate log; extern crate simplelog; From 75449aa0e025ae7fb8509e899d6a160d2416a78c Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:42:08 -0700 Subject: [PATCH 30/69] Dont run server on main thread --- src/main.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index a1b194c..05ebc6f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -198,6 +198,7 @@ fn run() -> Result<()> { let db = Arc::new(db::DB::new(&db_path)?); // Parse config + info!("Parsing configuration"); let config_file_name = matches.opt_str("c"); let config_file_path = config_file_name.map(|p| Path::new(p.as_str()).to_path_buf()); if let Some(path) = config_file_path { @@ -207,14 +208,15 @@ fn run() -> Result<()> { let config = config::read(db.deref())?; // Init index + info!("Initializing index"); let command_sender = index::init(db.clone()); - // Mount API + // API mount target let prefix_url = config.prefix_url.unwrap_or_else(|| "".to_string()); let api_url = format!("{}/api", &prefix_url); info!("Mounting API on {}", api_url); - // Mount static files + // Static files mount target let web_dir_name = matches.opt_str("w"); let mut default_web_dir = utils::get_data_root()?; default_web_dir.push("web"); @@ -225,6 +227,7 @@ fn run() -> Result<()> { let static_url = format!("/{}", &prefix_url); info!("Mounting static files on {}", static_url); + // Start server info!("Starting up server"); let port: u16 = matches .opt_str("p") @@ -233,26 +236,25 @@ fn run() -> Result<()> { .or(Err("invalid port number"))?; // TODO Use port number - - rocket::ignite() - .manage(db.clone()) + let db_server = db.clone(); + std::thread::spawn(move || { + rocket::ignite() + .manage(db_server) .manage(command_sender) .mount(&static_url, StaticFiles::from(web_dir_path)) .mount(&api_url, rocket_api::get_routes()) .launch(); + }); // Start DDNS updates - let db_ref = db.clone(); + let db_ddns = db.clone(); std::thread::spawn(move || { - ddns::run(db_ref.deref()); + ddns::run(db_ddns.deref()); }); // Run UI - - // TODO do we still reach this? ui::run(); info!("Shutting down server"); - Ok(()) } From af17c821df64df06dd7a543b190f691cde2659f0 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:43:54 -0700 Subject: [PATCH 31/69] Bumped version number --- Cargo.lock | 2 +- Cargo.toml | 2 +- res/windows/installer/installer.wxs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90385d2..5fb1fda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1387,7 +1387,7 @@ dependencies = [ [[package]] name = "polaris" -version = "0.8.0" +version = "0.9.0" dependencies = [ "ape 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index f5a1f87..5580011 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polaris" -version = "0.8.0" +version = "0.9.0" authors = ["Antoine Gersant "] [features] diff --git a/res/windows/installer/installer.wxs b/res/windows/installer/installer.wxs index 245e28b..a12c6ee 100644 --- a/res/windows/installer/installer.wxs +++ b/res/windows/installer/installer.wxs @@ -1,6 +1,6 @@ - + From 7e11b651edfe0c1f9b5efb333f4494fd7f3a1e1f Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:51:46 -0700 Subject: [PATCH 32/69] Fixed a bug where DB wasn't accessed with the correct type --- src/rocket_api.rs | 82 +++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index ec4f3f4..353f602 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -80,7 +80,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for AdminRights { type Error = (); fn from_request(request: &'a Request<'r>) -> request::Outcome { - let db = request.guard::>()?; + let db = request.guard::>>()?; match user::count::(&db) { Err(_) => return Outcome::Failure((Status::InternalServerError, ())), @@ -139,7 +139,7 @@ struct InitialSetup { } #[get("/initial_setup")] -fn initial_setup(db: State) -> Result, errors::Error> { +fn initial_setup(db: State>) -> Result, errors::Error> { let initial_setup = InitialSetup { has_any_users: user::count::(&db)? > 0, }; @@ -147,14 +147,14 @@ fn initial_setup(db: State) -> Result, errors::Error> { } #[get("/settings")] -fn get_settings(db: State, _admin_rights: AdminRights) -> Result, errors::Error> { +fn get_settings(db: State>, _admin_rights: AdminRights) -> Result, errors::Error> { let config = config::read::(&db)?; Ok(Json(config)) } #[put("/settings", data = "")] fn put_settings( - db: State, + db: State>, _admin_rights: AdminRights, config: Json, ) -> Result<(), errors::Error> { @@ -163,14 +163,14 @@ fn put_settings( } #[get("/preferences")] -fn get_preferences(db: State, auth: Auth) -> Result, errors::Error> { +fn get_preferences(db: State>, auth: Auth) -> Result, errors::Error> { let preferences = config::read_preferences::(&db, &auth.username)?; Ok(Json(preferences)) } #[put("/preferences", data = "")] fn put_preferences( - db: State, + db: State>, auth: Auth, preferences: Json, ) -> Result<(), errors::Error> { @@ -200,7 +200,7 @@ struct AuthOutput { #[post("/auth", data = "")] fn auth( - db: State, + db: State>, credentials: Json, mut cookies: Cookies, ) -> Result, errors::Error> { @@ -219,77 +219,77 @@ fn auth( #[get("/browse")] fn browse_root( - db: State, + db: State>, _auth: Auth, ) -> Result>, errors::Error> { - let result = index::browse(db.deref(), &PathBuf::new())?; + let result = index::browse(db.deref().deref(), &PathBuf::new())?; Ok(Json(result)) } #[get("/browse/")] fn browse( - db: State, + db: State>, _auth: Auth, path: VFSPathBuf, ) -> Result>, errors::Error> { - let result = index::browse(db.deref(), &path.into() as &PathBuf)?; + let result = index::browse(db.deref().deref(), &path.into() as &PathBuf)?; Ok(Json(result)) } #[get("/flatten")] -fn flatten_root(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::flatten(db.deref(), &PathBuf::new())?; +fn flatten_root(db: State>, _auth: Auth) -> Result>, errors::Error> { + let result = index::flatten(db.deref().deref(), &PathBuf::new())?; Ok(Json(result)) } #[get("/flatten/")] fn flatten( - db: State, + db: State>, _auth: Auth, path: VFSPathBuf, ) -> Result>, errors::Error> { - let result = index::flatten(db.deref(), &path.into() as &PathBuf)?; + let result = index::flatten(db.deref().deref(), &path.into() as &PathBuf)?; Ok(Json(result)) } #[get("/random")] -fn random(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::get_random_albums(db.deref(), 20)?; +fn random(db: State>, _auth: Auth) -> Result>, errors::Error> { + let result = index::get_random_albums(db.deref().deref(), 20)?; Ok(Json(result)) } #[get("/recent")] -fn recent(db: State, _auth: Auth) -> Result>, errors::Error> { - let result = index::get_recent_albums(db.deref(), 20)?; +fn recent(db: State>, _auth: Auth) -> Result>, errors::Error> { + let result = index::get_recent_albums(db.deref().deref(), 20)?; Ok(Json(result)) } #[get("/search")] fn search_root( - db: State, + db: State>, _auth: Auth, ) -> Result>, errors::Error> { - let result = index::search(db.deref(), "")?; + let result = index::search(db.deref().deref(), "")?; Ok(Json(result)) } #[get("/search/")] fn search( - db: State, + db: State>, _auth: Auth, query: String, ) -> Result>, errors::Error> { - let result = index::search(db.deref(), &query)?; + let result = index::search(db.deref().deref(), &query)?; Ok(Json(result)) } #[get("/serve/")] fn serve( - db: State, + db: State>, _auth: Auth, path: VFSPathBuf, ) -> Result, errors::Error> { - let db: &DB = db.deref(); + let db: &DB = db.deref().deref(); let vfs = db.get_vfs()?; let real_path = vfs.virtual_to_real(&path.into() as &PathBuf)?; @@ -310,10 +310,10 @@ struct ListPlaylistsEntry { #[get("/playlists")] fn list_playlists( - db: State, + db: State>, auth: Auth, ) -> Result>, errors::Error> { - let playlist_names = playlist::list_playlists(&auth.username, db.deref())?; + let playlist_names = playlist::list_playlists(&auth.username, db.deref().deref())?; let playlists: Vec = playlist_names .into_iter() .map(|p| ListPlaylistsEntry { name: p }) @@ -329,51 +329,51 @@ struct SavePlaylistInput { #[put("/playlist/", data = "")] fn save_playlist( - db: State, + db: State>, auth: Auth, name: String, playlist: Json, ) -> Result<(), errors::Error> { - playlist::save_playlist(&name, &auth.username, &playlist.tracks, db.deref())?; + playlist::save_playlist(&name, &auth.username, &playlist.tracks, db.deref().deref())?; Ok(()) } #[get("/playlist/")] fn read_playlist( - db: State, + db: State>, auth: Auth, name: String, ) -> Result>, errors::Error> { - let songs = playlist::read_playlist(&name, &auth.username, db.deref())?; + let songs = playlist::read_playlist(&name, &auth.username, db.deref().deref())?; Ok(Json(songs)) } #[delete("/playlist/")] -fn delete_playlist(db: State, auth: Auth, name: String) -> Result<(), errors::Error> { - playlist::delete_playlist(&name, &auth.username, db.deref())?; +fn delete_playlist(db: State>, auth: Auth, name: String) -> Result<(), errors::Error> { + playlist::delete_playlist(&name, &auth.username, db.deref().deref())?; Ok(()) } #[put("/lastfm/now_playing/")] -fn lastfm_now_playing(db: State, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { - lastfm::now_playing(db.deref(), &auth.username, &path.into() as &PathBuf)?; +fn lastfm_now_playing(db: State>, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { + lastfm::now_playing(db.deref().deref(), &auth.username, &path.into() as &PathBuf)?; Ok(()) } #[post("/lastfm/scrobble/")] -fn lastfm_scrobble(db: State, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { - lastfm::scrobble(db.deref(), &auth.username, &path.into() as &PathBuf)?; +fn lastfm_scrobble(db: State>, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { + lastfm::scrobble(db.deref().deref(), &auth.username, &path.into() as &PathBuf)?; Ok(()) } #[get("/lastfm/link?&")] fn lastfm_link( - db: State, + db: State>, auth: Auth, token: String, content: String, ) -> Result, errors::Error> { - lastfm::link(db.deref(), &auth.username, &token)?; + lastfm::link(db.deref().deref(), &auth.username, &token)?; // Percent decode let base64_content = match RawStr::from_str(&content).percent_decode() { @@ -397,7 +397,7 @@ fn lastfm_link( } #[delete("/lastfm/link")] -fn lastfm_unlink(db: State, auth: Auth) -> Result<(), errors::Error> { - lastfm::unlink(db.deref(), &auth.username)?; +fn lastfm_unlink(db: State>, auth: Auth) -> Result<(), errors::Error> { + lastfm::unlink(db.deref().deref(), &auth.username)?; Ok(()) } From ed2ae209515b32ad2ebd5c28bdd926eb646a0d84 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 19:04:21 -0700 Subject: [PATCH 33/69] Allow auth via HTTP authorization header --- src/main.rs | 10 ++++----- src/rocket_api.rs | 53 ++++++++++++++++++++++++++++++++++++----------- src/serve.rs | 3 +-- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/main.rs b/src/main.rs index 05ebc6f..0d353c7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -239,11 +239,11 @@ fn run() -> Result<()> { let db_server = db.clone(); std::thread::spawn(move || { rocket::ignite() - .manage(db_server) - .manage(command_sender) - .mount(&static_url, StaticFiles::from(web_dir_path)) - .mount(&api_url, rocket_api::get_routes()) - .launch(); + .manage(db_server) + .manage(command_sender) + .mount(&static_url, StaticFiles::from(web_dir_path)) + .mount(&api_url, rocket_api::get_routes()) + .launch(); }); // Start DDNS updates diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 353f602..a7c079f 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -7,6 +7,7 @@ use std::fs::File; use std::ops::Deref; use std::path::PathBuf; use std::str; +use std::str::FromStr; use std::sync::Arc; use config::{self, Config, Preferences}; @@ -59,19 +60,44 @@ struct Auth { username: String, } +fn get_auth_cookie(username: &str) -> Cookie<'static> { + Cookie::build(SESSION_FIELD_USERNAME, username.to_owned()) + .same_site(rocket::http::SameSite::Lax) + .finish() +} + impl<'a, 'r> FromRequest<'a, 'r> for Auth { type Error = (); fn from_request(request: &'a Request<'r>) -> request::Outcome { let mut cookies = request.guard::().unwrap(); - match cookies.get_private(SESSION_FIELD_USERNAME) { - Some(u) => Outcome::Success(Auth { + if let Some(u) = cookies.get_private(SESSION_FIELD_USERNAME) { + return Outcome::Success(Auth { username: u.value().to_string(), - }), - _ => Outcome::Failure((Status::Forbidden, ())), + }); } - // TODO allow auth via authorization header + if let Some(auth_header_string) = request.headers().get_one("Authorization") { + use rocket::http::hyper::header::*; + if let Ok(Basic { + username, + password: Some(password), + }) = Basic::from_str(auth_header_string.trim_start_matches("Basic ")) // Sadness + { + let db = match request.guard::>>() { + Outcome::Success(d) => d, + _ => return Outcome::Failure((Status::InternalServerError, ())) + }; + if user::auth(db.deref().deref(), &username, &password).unwrap_or(false) { + cookies.add_private(get_auth_cookie(&username)); + return Outcome::Success(Auth { + username: username.to_string(), + }); + } + } + } + + Outcome::Failure((Status::Unauthorized, ())) } } @@ -147,7 +173,10 @@ fn initial_setup(db: State>) -> Result, errors::Error } #[get("/settings")] -fn get_settings(db: State>, _admin_rights: AdminRights) -> Result, errors::Error> { +fn get_settings( + db: State>, + _admin_rights: AdminRights, +) -> Result, errors::Error> { let config = config::read::(&db)?; Ok(Json(config)) } @@ -205,11 +234,7 @@ fn auth( mut cookies: Cookies, ) -> Result, errors::Error> { user::auth::(&db, &credentials.username, &credentials.password)?; - cookies.add_private( - Cookie::build(SESSION_FIELD_USERNAME, credentials.username.clone()) - .same_site(rocket::http::SameSite::Lax) - .finish(), - ); + cookies.add_private(get_auth_cookie(&credentials.username)); let auth_output = AuthOutput { admin: user::is_admin::(&db, &credentials.username)?, @@ -355,7 +380,11 @@ fn delete_playlist(db: State>, auth: Auth, name: String) -> Result<(), e } #[put("/lastfm/now_playing/")] -fn lastfm_now_playing(db: State>, auth: Auth, path: VFSPathBuf) -> Result<(), errors::Error> { +fn lastfm_now_playing( + db: State>, + auth: Auth, + path: VFSPathBuf, +) -> Result<(), errors::Error> { lastfm::now_playing(db.deref().deref(), &auth.username, &path.into() as &PathBuf)?; Ok(()) } diff --git a/src/serve.rs b/src/serve.rs index 4192b90..780b391 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -3,7 +3,7 @@ use rocket::http::hyper::header::*; use rocket::response::{self, Responder}; use std::cmp; use std::convert::From; -use std::fs::{File}; +use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use std::str::FromStr; @@ -79,7 +79,6 @@ fn truncate_range(range: &PartialFileRange, file_length: &Option) -> Option impl<'r> Responder<'r> for RangeResponder { fn respond_to(mut self, request: &rocket::request::Request) -> response::Result<'r> { - let range_header = request.headers().get_one("Range"); let range_header = match range_header { None => return Ok(self.original.respond_to(request)?), From cba28e8e2c509a8946741920cedbe17c78373221 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 19:09:32 -0700 Subject: [PATCH 34/69] Run server on expected port (5050 or custom) --- src/errors.rs | 1 + src/main.rs | 7 +++++-- src/rocket_api.rs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 5e8c9c4..30278a9 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -30,6 +30,7 @@ error_chain! { Time(std::time::SystemTimeError); Toml(toml::de::Error); Regex(regex::Error); + RocketConfig(rocket::config::ConfigError); Scrobbler(rustfm_scrobble::ScrobblerError); Vorbis(lewton::VorbisError); } diff --git a/src/main.rs b/src/main.rs index 0d353c7..693350e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -235,10 +235,13 @@ fn run() -> Result<()> { .parse() .or(Err("invalid port number"))?; - // TODO Use port number + let config = rocket::Config::build(rocket::config::Environment::Production) + .port(port) + .finalize()?; + let db_server = db.clone(); std::thread::spawn(move || { - rocket::ignite() + rocket::custom(config) .manage(db_server) .manage(command_sender) .mount(&static_url, StaticFiles::from(web_dir_path)) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index a7c079f..32ea386 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -82,11 +82,11 @@ impl<'a, 'r> FromRequest<'a, 'r> for Auth { if let Ok(Basic { username, password: Some(password), - }) = Basic::from_str(auth_header_string.trim_start_matches("Basic ")) // Sadness + }) = Basic::from_str(auth_header_string.trim_start_matches("Basic ")) { let db = match request.guard::>>() { Outcome::Success(d) => d, - _ => return Outcome::Failure((Status::InternalServerError, ())) + _ => return Outcome::Failure((Status::InternalServerError, ())), }; if user::auth(db.deref().deref(), &username, &password).unwrap_or(false) { cookies.add_private(get_auth_cookie(&username)); From fdf40f2683a238fbd90cb78984742b8bb77772a1 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 30 Oct 2018 23:47:29 -0700 Subject: [PATCH 35/69] Removed outdated test --- src/utils.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index a48a8f1..5ed62fa 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -64,12 +64,6 @@ fn test_get_audio_format() { ); } -#[test] -fn test_is_song() { - assert!(is_song(Path::new("animals/🐷/my🐖file.mp3"))); - assert!(!is_song(Path::new("animals/🐷/my🐖file.jpg"))); -} - pub fn is_image(path: &Path) -> bool { let extension = match path.extension() { Some(e) => e, From 4b4ab8145cda881208077da84294e2aa0dfa12f6 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 30 Oct 2018 23:49:30 -0700 Subject: [PATCH 36/69] Rust 2018 --- Cargo.toml | 1 + src/config.rs | 14 +++++++------- src/db/mod.rs | 4 ++-- src/ddns.rs | 6 +++--- src/index.rs | 14 +++++++------- src/lastfm.rs | 10 +++++----- src/main.rs | 2 +- src/metadata.rs | 6 +++--- src/playlist.rs | 14 +++++++------- src/rocket_api.rs | 22 +++++++++++----------- src/thumbnails.rs | 4 ++-- src/user.rs | 18 +++++++++--------- src/utils.rs | 2 +- src/vfs.rs | 6 +++--- 14 files changed, 62 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5580011..0470933 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "polaris" version = "0.9.0" authors = ["Antoine Gersant "] +edition = "2018" [features] ui = [] diff --git a/src/config.rs b/src/config.rs index 198dc5f..2e4737a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,13 +7,13 @@ use std::io::Read; use std::path; use toml; -use db::ConnectionSource; -use db::DB; -use db::{ddns_config, misc_settings, mount_points, users}; -use ddns::DDNSConfig; -use errors::*; -use user::*; -use vfs::MountPoint; +use crate::db::ConnectionSource; +use crate::db::DB; +use crate::db::{ddns_config, misc_settings, mount_points, users}; +use crate::ddns::DDNSConfig; +use crate::errors::*; +use crate::user::*; +use crate::vfs::MountPoint; #[derive(Debug, Queryable)] pub struct MiscSettings { diff --git a/src/db/mod.rs b/src/db/mod.rs index d875064..5a2a80b 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -6,7 +6,7 @@ use std::fs; use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex, MutexGuard}; -use errors::*; +use crate::errors::*; mod schema; @@ -85,7 +85,7 @@ impl ConnectionSource for DB { } pub fn _get_test_db(name: &str) -> DB { - use config; + use crate::config; let config_path = Path::new("test/config.toml"); let config = config::parse_toml_file(&config_path).unwrap(); diff --git a/src/ddns.rs b/src/ddns.rs index 1ab6d6e..457fb0c 100644 --- a/src/ddns.rs +++ b/src/ddns.rs @@ -5,9 +5,9 @@ use std::io; use std::thread; use std::time; -use db::ddns_config; -use db::{ConnectionSource, DB}; -use errors; +use crate::db::ddns_config; +use crate::db::{ConnectionSource, DB}; +use crate::errors; #[derive(Clone, Debug, Deserialize, Insertable, PartialEq, Queryable, Serialize)] #[table_name = "ddns_config"] diff --git a/src/index.rs b/src/index.rs index 4f8bbe5..6a48b5a 100644 --- a/src/index.rs +++ b/src/index.rs @@ -14,14 +14,14 @@ use std::sync::{Arc, Mutex}; use std::thread; use std::time; -use config::MiscSettings; +use crate::config::MiscSettings; #[cfg(test)] -use db; -use db::{directories, misc_settings, songs}; -use db::{ConnectionSource, DB}; -use errors; -use metadata; -use vfs::{VFSSource, VFS}; +use crate::db; +use crate::db::{directories, misc_settings, songs}; +use crate::db::{ConnectionSource, DB}; +use crate::errors; +use crate::metadata; +use crate::vfs::{VFSSource, VFS}; const INDEX_BUILDING_INSERT_BUFFER_SIZE: usize = 1000; // Insertions in each transaction const INDEX_BUILDING_CLEAN_BUFFER_SIZE: usize = 500; // Insertions in each transaction diff --git a/src/lastfm.rs b/src/lastfm.rs index c865b4e..20535c4 100644 --- a/src/lastfm.rs +++ b/src/lastfm.rs @@ -6,11 +6,11 @@ use std::collections::HashMap; use std::io::Read; use std::path::Path; -use db::ConnectionSource; -use errors; -use index; -use user; -use vfs::VFSSource; +use crate::db::ConnectionSource; +use crate::errors; +use crate::index; +use crate::user; +use crate::vfs::VFSSource; const LASTFM_API_KEY: &str = "02b96c939a2b451c31dfd67add1f696e"; const LASTFM_API_SECRET: &str = "0f25a80ceef4b470b5cb97d99d4b3420"; diff --git a/src/main.rs b/src/main.rs index 693350e..fb25154 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,7 +54,7 @@ use std::io::prelude::*; use unix_daemonize::{daemonize_redirect, ChdirMode}; use core::ops::Deref; -use errors::*; +use crate::errors::*; use getopts::Options; use rocket_contrib::serve::StaticFiles; use simplelog::{Level, LevelFilter, SimpleLogger, TermLogger}; diff --git a/src/metadata.rs b/src/metadata.rs index f5db638..b50fac4 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -7,9 +7,9 @@ use regex::Regex; use std::fs; use std::path::Path; -use errors::*; -use utils; -use utils::AudioFormat; +use crate::errors::*; +use crate::utils; +use crate::utils::AudioFormat; #[derive(Debug, Clone, PartialEq)] pub struct SongTags { diff --git a/src/playlist.rs b/src/playlist.rs index 1e42889..91bced2 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -7,12 +7,12 @@ use diesel::BelongingToDsl; use std::path::Path; #[cfg(test)] -use db; -use db::ConnectionSource; -use db::{playlist_songs, playlists, users}; -use errors::*; -use index::{self, Song}; -use vfs::VFSSource; +use crate::db; +use crate::db::ConnectionSource; +use crate::db::{playlist_songs, playlists, users}; +use crate::errors::*; +use crate::index::{self, Song}; +use crate::vfs::VFSSource; #[derive(Insertable)] #[table_name = "playlists"] @@ -262,7 +262,7 @@ fn test_delete_playlist() { #[test] fn test_fill_playlist() { - use index; + use crate::index; let db = db::_get_test_db("fill_playlist.sqlite"); index::update(&db).unwrap(); diff --git a/src/rocket_api.rs b/src/rocket_api.rs index 32ea386..e1d244c 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -10,17 +10,17 @@ use std::str; use std::str::FromStr; use std::sync::Arc; -use config::{self, Config, Preferences}; -use db::DB; -use errors; -use index; -use lastfm; -use playlist; -use serve; -use thumbnails; -use user; -use utils; -use vfs::VFSSource; +use crate::config::{self, Config, Preferences}; +use crate::db::DB; +use crate::errors; +use crate::index; +use crate::lastfm; +use crate::playlist; +use crate::serve; +use crate::thumbnails; +use crate::user; +use crate::utils; +use crate::vfs::VFSSource; const CURRENT_MAJOR_VERSION: i32 = 3; const CURRENT_MINOR_VERSION: i32 = 0; diff --git a/src/thumbnails.rs b/src/thumbnails.rs index 23acfda..8f45708 100644 --- a/src/thumbnails.rs +++ b/src/thumbnails.rs @@ -11,8 +11,8 @@ use std::fs::{DirBuilder, File}; use std::hash::{Hash, Hasher}; use std::path::*; -use errors::*; -use utils; +use crate::errors::*; +use crate::utils; const THUMBNAILS_PATH: &str = "thumbnails"; diff --git a/src/user.rs b/src/user.rs index fdeaec7..f67cd41 100644 --- a/src/user.rs +++ b/src/user.rs @@ -4,9 +4,9 @@ use diesel::prelude::*; use rand; use ring::{digest, pbkdf2}; -use db::users; -use db::ConnectionSource; -use errors::*; +use crate::db::users; +use crate::db::ConnectionSource; +use crate::errors::*; #[derive(Debug, Insertable, Queryable)] #[table_name = "users"] @@ -66,7 +66,7 @@ pub fn auth(db: &T, username: &str, password: &str) -> Result where T: ConnectionSource, { - use db::users::dsl::*; + use crate::db::users::dsl::*; let connection = db.get_connection(); match users .select((password_hash, password_salt)) @@ -83,7 +83,7 @@ pub fn count(db: &T) -> Result where T: ConnectionSource, { - use db::users::dsl::*; + use crate::db::users::dsl::*; let connection = db.get_connection(); let count = users.count().get_result(connection.deref())?; Ok(count) @@ -93,7 +93,7 @@ pub fn is_admin(db: &T, username: &str) -> Result where T: ConnectionSource, { - use db::users::dsl::*; + use crate::db::users::dsl::*; let connection = db.get_connection(); let is_admin: i32 = users .filter(name.eq(username)) @@ -106,7 +106,7 @@ pub fn lastfm_link(db: &T, username: &str, lastfm_login: &str, session_key: & where T: ConnectionSource, { - use db::users::dsl::*; + use crate::db::users::dsl::*; let connection = db.get_connection(); diesel::update(users.filter(name.eq(username))) .set(( @@ -121,7 +121,7 @@ pub fn get_lastfm_session_key(db: &T, username: &str) -> Result where T: ConnectionSource, { - use db::users::dsl::*; + use crate::db::users::dsl::*; let connection = db.get_connection(); let token = users .filter(name.eq(username)) @@ -137,7 +137,7 @@ pub fn lastfm_unlink(db: &T, username: &str) -> Result<()> where T: ConnectionSource, { - use db::users::dsl::*; + use crate::db::users::dsl::*; let connection = db.get_connection(); diesel::update(users.filter(name.eq(username))) .set((lastfm_session_key.eq(""), lastfm_username.eq(""))) diff --git a/src/utils.rs b/src/utils.rs index 5ed62fa..f82dc99 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,7 +2,7 @@ use app_dirs::{app_root, AppDataType, AppInfo}; use std::fs; use std::path::{Path, PathBuf}; -use errors::*; +use crate::errors::*; #[cfg(not(target_os = "linux"))] const APP_INFO: AppInfo = AppInfo { diff --git a/src/vfs.rs b/src/vfs.rs index 9af661a..f55c7c7 100644 --- a/src/vfs.rs +++ b/src/vfs.rs @@ -4,9 +4,9 @@ use std::collections::HashMap; use std::path::Path; use std::path::PathBuf; -use db::mount_points; -use db::{ConnectionSource, DB}; -use errors::*; +use crate::db::mount_points; +use crate::db::{ConnectionSource, DB}; +use crate::errors::*; pub trait VFSSource { fn get_vfs(&self) -> Result; From f0b360e3d08843b079c4ccb122ebe2de9cefb251 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 10 Nov 2018 19:39:34 -0800 Subject: [PATCH 37/69] Use rocket branch of polaris-web --- .gitmodules | 1 + web | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index ef8cc0c..707ad02 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "web"] path = web url = https://github.com/agersant/polaris-web.git + branch = . diff --git a/web b/web index 484a109..a3434a5 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 484a1099806c0805964d19006c6128c75384bb30 +Subproject commit a3434a5fba7c81b635147450a613418045ebf157 From e0b3ea4b98f6e9846b6a7f3584f443974c2a3a7d Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 10 Nov 2018 23:34:31 -0800 Subject: [PATCH 38/69] Fixed a bug where credentials were not being validated --- src/errors.rs | 1 + src/rocket_api.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/errors.rs b/src/errors.rs index 30278a9..31493b3 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -64,6 +64,7 @@ impl<'r> rocket::response::Responder<'r> for Error { build .status(match self.0 { ErrorKind::FileNotFound => rocket::http::Status::NotFound, + ErrorKind::IncorrectCredentials => rocket::http::Status::Unauthorized, _ => rocket::http::Status::InternalServerError, }) .ok() diff --git a/src/rocket_api.rs b/src/rocket_api.rs index e1d244c..b5dbc4f 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -233,7 +233,11 @@ fn auth( credentials: Json, mut cookies: Cookies, ) -> Result, errors::Error> { - user::auth::(&db, &credentials.username, &credentials.password)?; + + if !user::auth::(&db, &credentials.username, &credentials.password)? { + return Err(errors::Error::from(errors::ErrorKind::IncorrectCredentials)) + } + cookies.add_private(get_auth_cookie(&credentials.username)); let auth_output = AuthOutput { From 72c40d5fcd672a0602e13992396e3a2cfe0a6d69 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sat, 10 Nov 2018 23:37:17 -0800 Subject: [PATCH 39/69] Removed unused errors --- src/errors.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 31493b3..b9aa910 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -37,24 +37,11 @@ error_chain! { errors { DaemonError {} - AuthenticationRequired {} - AdminPrivilegeRequired {} - MissingConfig {} - MissingPreferences {} - MissingUsername {} - MissingPassword {} - MissingPlaylist {} IncorrectCredentials {} - CannotServeDirectory {} - UnsupportedFileType {} - FileNotFound {} - MissingIndexVersion {} - MissingPlaylistName {} EncodingError {} MissingLastFMCredentials {} LastFMAuthError {} LastFMDeserializationError {} - MissingDesiredResponse {} } } @@ -63,7 +50,6 @@ impl<'r> rocket::response::Responder<'r> for Error { let mut build = rocket::response::Response::build(); build .status(match self.0 { - ErrorKind::FileNotFound => rocket::http::Status::NotFound, ErrorKind::IncorrectCredentials => rocket::http::Status::Unauthorized, _ => rocket::http::Status::InternalServerError, }) From c6d5f7b7ee46d66f7225241befcc92467a6ab460 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 00:17:38 -0800 Subject: [PATCH 40/69] Fixed a bug where auth cookie was interfering with polaris-web cookie --- src/rocket_api.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rocket_api.rs b/src/rocket_api.rs index b5dbc4f..2f97847 100644 --- a/src/rocket_api.rs +++ b/src/rocket_api.rs @@ -24,7 +24,7 @@ use crate::vfs::VFSSource; const CURRENT_MAJOR_VERSION: i32 = 3; const CURRENT_MINOR_VERSION: i32 = 0; -const SESSION_FIELD_USERNAME: &str = "username"; +const COOKIE_SESSION: &str = "session"; pub fn get_routes() -> Vec { routes![ @@ -60,9 +60,10 @@ struct Auth { username: String, } -fn get_auth_cookie(username: &str) -> Cookie<'static> { - Cookie::build(SESSION_FIELD_USERNAME, username.to_owned()) +fn get_session_cookie(username: &str) -> Cookie<'static> { + Cookie::build(COOKIE_SESSION, username.to_owned()) .same_site(rocket::http::SameSite::Lax) + .http_only(true) .finish() } @@ -71,7 +72,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for Auth { fn from_request(request: &'a Request<'r>) -> request::Outcome { let mut cookies = request.guard::().unwrap(); - if let Some(u) = cookies.get_private(SESSION_FIELD_USERNAME) { + if let Some(u) = cookies.get_private(COOKIE_SESSION) { return Outcome::Success(Auth { username: u.value().to_string(), }); @@ -89,7 +90,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for Auth { _ => return Outcome::Failure((Status::InternalServerError, ())), }; if user::auth(db.deref().deref(), &username, &password).unwrap_or(false) { - cookies.add_private(get_auth_cookie(&username)); + cookies.add_private(get_session_cookie(&username)); return Outcome::Success(Auth { username: username.to_string(), }); @@ -238,7 +239,7 @@ fn auth( return Err(errors::Error::from(errors::ErrorKind::IncorrectCredentials)) } - cookies.add_private(get_auth_cookie(&credentials.username)); + cookies.add_private(get_session_cookie(&credentials.username)); let auth_output = AuthOutput { admin: user::is_admin::(&db, &credentials.username)?, From 9dbf8526dcc5aeece2877c8888fc02a072347de3 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 11:11:24 -0800 Subject: [PATCH 41/69] Renamed rocket_api to api --- src/{rocket_api.rs => api.rs} | 0 src/main.rs | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/{rocket_api.rs => api.rs} (100%) diff --git a/src/rocket_api.rs b/src/api.rs similarity index 100% rename from src/rocket_api.rs rename to src/api.rs diff --git a/src/main.rs b/src/main.rs index 3a00585..d764575 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,6 +59,7 @@ use simplelog::{Level, LevelFilter, SimpleLogger, TermLogger}; use std::path::Path; use std::sync::Arc; +mod api; mod config; mod db; mod ddns; @@ -67,7 +68,6 @@ mod index; mod lastfm; mod metadata; mod playlist; -mod rocket_api; mod serve; mod thumbnails; mod ui; @@ -243,7 +243,7 @@ fn run() -> Result<()> { .manage(db_server) .manage(command_sender) .mount(&static_url, StaticFiles::from(web_dir_path)) - .mount(&api_url, rocket_api::get_routes()) + .mount(&api_url, api::get_routes()) .launch(); }); From 2cbc1645ee46d8e91ea0c9bb050961e33dfb0e6d Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 11:16:06 -0800 Subject: [PATCH 42/69] Pulled latest polaris-web --- web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web b/web index a3434a5..8cc2cba 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit a3434a5fba7c81b635147450a613418045ebf157 +Subproject commit 8cc2cbaee0c5ede96a6c0b66ce1c2c36a94473bc From 4e68293450fbfb2a342994fff1ada446fd9a4eb6 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 11:19:28 -0800 Subject: [PATCH 43/69] Simplified error syntax --- src/api.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api.rs b/src/api.rs index 2f97847..d28b47f 100644 --- a/src/api.rs +++ b/src/api.rs @@ -236,7 +236,7 @@ fn auth( ) -> Result, errors::Error> { if !user::auth::(&db, &credentials.username, &credentials.password)? { - return Err(errors::Error::from(errors::ErrorKind::IncorrectCredentials)) + bail!(errors::ErrorKind::IncorrectCredentials) } cookies.add_private(get_session_cookie(&credentials.username)); @@ -412,19 +412,19 @@ fn lastfm_link( // Percent decode let base64_content = match RawStr::from_str(&content).percent_decode() { Ok(s) => s, - Err(_) => return Err(errors::Error::from(errors::ErrorKind::EncodingError).into()), + Err(_) => bail!(errors::ErrorKind::EncodingError), }; // Base64 decode let popup_content = match base64::decode(base64_content.as_bytes()) { Ok(c) => c, - Err(_) => return Err(errors::Error::from(errors::ErrorKind::EncodingError).into()), + Err(_) => bail!(errors::ErrorKind::EncodingError), }; // UTF-8 decode let popup_content_string = match str::from_utf8(&popup_content) { Ok(s) => s, - Err(_) => return Err(errors::Error::from(errors::ErrorKind::EncodingError).into()), + Err(_) => bail!(errors::ErrorKind::EncodingError), }; Ok(Html(popup_content_string.to_string())) From c1c70d4fbf491c6a5f1c6d804bdfd89ebf242025 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 11:33:18 -0800 Subject: [PATCH 44/69] Updated dependencies --- Cargo.lock | 60 +++++++++++++++++++++++------------------------------- Cargo.toml | 4 ++-- 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f657ca..5dc1fe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -294,7 +294,7 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -425,7 +425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1043,7 +1043,7 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1088,7 +1088,7 @@ dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1231,7 +1231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1313,8 +1313,8 @@ dependencies = [ "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_contrib 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", + "rocket_contrib 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustfm-scrobble 0.9.1 (git+https://github.com/agersant/rustfm-scrobble)", @@ -1504,7 +1504,7 @@ dependencies = [ [[package]] name = "rocket" version = "0.4.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" dependencies = [ "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1512,8 +1512,8 @@ dependencies = [ "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "pear 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_codegen 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_http 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_codegen 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", + "rocket_http 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", "state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1524,12 +1524,12 @@ dependencies = [ [[package]] name = "rocket_codegen" version = "0.4.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" dependencies = [ "devise 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_http 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_http 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1537,11 +1537,11 @@ dependencies = [ [[package]] name = "rocket_contrib" version = "0.4.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1549,7 +1549,7 @@ dependencies = [ [[package]] name = "rocket_http" version = "0.4.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" dependencies = [ "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1698,7 +1698,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1796,7 +1796,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.19" +version = "0.15.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1819,7 +1819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2160,7 +2160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.6" +version = "2.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2243,16 +2243,6 @@ name = "yansi" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[patch.unused]] -name = "rocket" -version = "0.4.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b381b07c2c74f64fd88a762f5323fd70" - -[[patch.unused]] -name = "rocket_contrib" -version = "0.4.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b381b07c2c74f64fd88a762f5323fd70" - [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" @@ -2417,10 +2407,10 @@ source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b3 "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "00a5870d8edc74fc6e1eb58edbd2815d2243e1a2255d6bf9c82a7a875901b5db" "checksum ring 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7ed733c36010c3d4d4718588f16a6c06a670b01c0047029ae81c3ca0acd81ff5" -"checksum rocket 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)" = "71f9970125ea965ae6e468a5bb878f47762aff210596e4cfc2d4ee9af2365b0f" -"checksum rocket_codegen 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9a9adbb359e17dabd05d97aa05a328817a20db5ba6b694cd51bba2900b262691" -"checksum rocket_contrib 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)" = "38cce3e4f0de0b950604c2a5cda4b3d74a7f17c62937cee54f4996b36c2d31a5" -"checksum rocket_http 0.4.0-rc.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2201c854709fd6f8cc7dca9bd7ebbddb10f27e1cdda191f932546c3dcd98d4a6" +"checksum rocket 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" +"checksum rocket_codegen 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" +"checksum rocket_contrib 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" +"checksum rocket_http 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" "checksum rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9d9118f1ce84d8d0b67f9779936432fb42bb620cef2122409d786892cce9a3c" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" @@ -2451,7 +2441,7 @@ source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b3 "checksum string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00caf261d6f90f588f8450b8e1230fa0d5be49ee6140fdfbcb55335aff350970" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" -"checksum syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)" = "39054bb43f2c5e4f3aef47718a391bf397c1b820fefc86f467d4d354f67bf7ef" +"checksum syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8886c8d2774e853fcd7d9d2131f6e40ba46c9c0e358e4d57178452abd6859bb0" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" @@ -2492,7 +2482,7 @@ source = "git+https://github.com/SergioBenitez/Rocket.git?rev=556206e#556206e8b3 "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0ffb549f212c31e19f3667c55a7f515b983a84aef10fd0a4d1f9c125425115f3" +"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" diff --git a/Cargo.toml b/Cargo.toml index 1f6291e..be13644 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,11 +36,11 @@ toml = "0.4.5" [patch.crates-io.rocket] git = "https://github.com/SergioBenitez/Rocket.git" -rev = "556206e" +rev = "4224419e63a99b1f21db447f8c4aedab8daec41a" [patch.crates-io.rocket_contrib] git = "https://github.com/SergioBenitez/Rocket.git" -rev = "556206e" +rev = "4224419e63a99b1f21db447f8c4aedab8daec41a" [dependencies.rocket_contrib] version = "0.4.0-dev" From ed81d24b7b231b2bce84910cef62acb7f7cf8ccd Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 12:10:09 -0800 Subject: [PATCH 45/69] Formatting --- src/api.rs | 1 - src/lastfm.rs | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/api.rs b/src/api.rs index d28b47f..73f2b0a 100644 --- a/src/api.rs +++ b/src/api.rs @@ -234,7 +234,6 @@ fn auth( credentials: Json, mut cookies: Cookies, ) -> Result, errors::Error> { - if !user::auth::(&db, &credentials.username, &credentials.password)? { bail!(errors::ErrorKind::IncorrectCredentials) } diff --git a/src/lastfm.rs b/src/lastfm.rs index 0f45554..3236e4d 100644 --- a/src/lastfm.rs +++ b/src/lastfm.rs @@ -60,12 +60,7 @@ where let mut scrobbler = Scrobbler::new(LASTFM_API_KEY.into(), LASTFM_API_SECRET.into()); let auth_response = scrobbler.authenticate_with_token(token.to_string())?; - user::lastfm_link( - db, - username, - &auth_response.name, - &auth_response.key, - ) + user::lastfm_link(db, username, &auth_response.name, &auth_response.key) } pub fn unlink(db: &T, username: &str) -> Result<(), errors::Error> From a3968e9cb7fe597e1cdd7e1bf448e47c9a4792c0 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 12:11:18 -0800 Subject: [PATCH 46/69] Moved server initialization outside of main for easier testing --- src/main.rs | 24 ++++++++++++------------ src/server.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 src/server.rs diff --git a/src/main.rs b/src/main.rs index d764575..c5b97c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,12 +54,13 @@ use unix_daemonize::{daemonize_redirect, ChdirMode}; use core::ops::Deref; use crate::errors::*; use getopts::Options; -use rocket_contrib::serve::StaticFiles; use simplelog::{Level, LevelFilter, SimpleLogger, TermLogger}; use std::path::Path; use std::sync::Arc; mod api; +#[cfg(test)] +mod api_tests; mod config; mod db; mod ddns; @@ -69,6 +70,7 @@ mod lastfm; mod metadata; mod playlist; mod serve; +mod server; mod thumbnails; mod ui; mod user; @@ -233,18 +235,16 @@ fn run() -> Result<()> { .parse() .or(Err("invalid port number"))?; - let config = rocket::Config::build(rocket::config::Environment::Production) - .port(port) - .finalize()?; - - let db_server = db.clone(); + let server = server::get_server( + port, + &static_url, + &api_url, + &web_dir_path, + db.clone(), + command_sender, + )?; std::thread::spawn(move || { - rocket::custom(config) - .manage(db_server) - .manage(command_sender) - .mount(&static_url, StaticFiles::from(web_dir_path)) - .mount(&api_url, api::get_routes()) - .launch(); + server.launch(); }); // Start DDNS updates diff --git a/src/server.rs b/src/server.rs new file mode 100644 index 0000000..f0ccd3a --- /dev/null +++ b/src/server.rs @@ -0,0 +1,28 @@ +use rocket; +use rocket_contrib::serve::StaticFiles; +use std::path::PathBuf; +use std::sync::Arc; + +use crate::api; +use crate::db::DB; +use crate::errors; +use crate::index::CommandSender; + +pub fn get_server( + port: u16, + static_url: &str, + api_url: &str, + web_dir_path: &PathBuf, + db: Arc, + command_sender: Arc, +) -> Result { + let config = rocket::Config::build(rocket::config::Environment::Production) + .port(port) + .finalize()?; + + Ok(rocket::custom(config) + .manage(db) + .manage(command_sender) + .mount(&static_url, StaticFiles::from(web_dir_path)) + .mount(&api_url, api::get_routes())) +} From 5f91da915e23d19c82ee95def87363c4d2724d01 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 17:49:38 -0800 Subject: [PATCH 47/69] Added unit test for api/version --- src/api.rs | 8 +++---- src/api_tests.rs | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ src/index.rs | 25 +++++++++++----------- src/main.rs | 7 +++++++ 4 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 src/api_tests.rs diff --git a/src/api.rs b/src/api.rs index 73f2b0a..d66ff7a 100644 --- a/src/api.rs +++ b/src/api.rs @@ -145,10 +145,10 @@ impl From for PathBuf { } } -#[derive(Serialize)] -struct Version { - major: i32, - minor: i32, +#[derive(PartialEq, Debug, Serialize, Deserialize)] +pub struct Version { + pub major: i32, + pub minor: i32, } #[get("/version")] diff --git a/src/api_tests.rs b/src/api_tests.rs new file mode 100644 index 0000000..7959770 --- /dev/null +++ b/src/api_tests.rs @@ -0,0 +1,54 @@ +use rocket::http::Status; +use rocket::local::Client; +use std::path::PathBuf; +use std::ops::Deref; +use std::sync::Arc; +use std::fs; + +use crate::api; +use crate::db; +use crate::index; +use crate::server; + +struct TestEnvironment { + pub client: Client, + command_sender: Arc, +} + +impl Drop for TestEnvironment { + fn drop(&mut self) { + self.command_sender.deref().exit().unwrap(); + } +} + +fn get_test_environment(db_name: &str) -> TestEnvironment +{ + let mut db_path = PathBuf::new(); + db_path.push("test"); + db_path.push(db_name); + if db_path.exists() { + fs::remove_file(&db_path).unwrap(); + } + + let db = Arc::new(db::DB::new(&db_path).unwrap()); + + let web_dir_path = PathBuf::from("web"); + let command_sender = index::init(db.clone()); + + let server = server::get_server(5050, "/", "/api", &web_dir_path, db, command_sender.clone()).unwrap(); + let client = Client::new(server).unwrap(); + TestEnvironment { client, command_sender } +} + +#[test] +fn version() { + let env = get_test_environment("api_version.sqlite"); + let client = &env.client; + let mut response = client.get("/api/version").dispatch(); + + assert_eq!(response.status(), Status::Ok); + + let response_body = response.body_string().unwrap(); + let response_json: api::Version = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json, api::Version{major: 3, minor: 0}); +} diff --git a/src/index.rs b/src/index.rs index 6a48b5a..a76cdb5 100644 --- a/src/index.rs +++ b/src/index.rs @@ -34,6 +34,7 @@ no_arg_sql_function!( enum Command { REINDEX, + EXIT, } struct CommandReceiver { @@ -64,6 +65,14 @@ impl CommandSender { Err(_) => bail!("Trigger reindex channel error"), } } + + pub fn exit(&self) -> Result<(), errors::Error> { + let sender = self.sender.lock().unwrap(); + match sender.send(Command::EXIT) { + Ok(_) => Ok(()), + Err(_) => bail!("Index exit channel error"), + } + } } pub fn init(db: Arc) -> Arc { @@ -78,13 +87,6 @@ pub fn init(db: Arc) -> Arc { update_loop(db, &command_receiver); }); - // Trigger auto-indexing - let db_ref = db.clone(); - let command_sender_clone = command_sender.clone(); - std::thread::spawn(move || { - self_trigger(db_ref.deref(), &command_sender_clone); - }); - command_sender } @@ -456,18 +458,15 @@ where { loop { // Wait for a command - if let Err(e) = command_buffer.receiver.recv() { - error!("Error while waiting on index command buffer: {}", e); + if command_buffer.receiver.recv().is_err() { return; } // Flush the buffer to ignore spammy requests loop { match command_buffer.receiver.try_recv() { - Err(TryRecvError::Disconnected) => { - error!("Error while flushing index command buffer"); - return; - } + Err(TryRecvError::Disconnected) => return, + Ok(Command::EXIT) => return, Err(TryRecvError::Empty) => break, Ok(_) => (), } diff --git a/src/main.rs b/src/main.rs index c5b97c8..c9a8cb2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -211,6 +211,13 @@ fn run() -> Result<()> { info!("Initializing index"); let command_sender = index::init(db.clone()); + // Trigger auto-indexing + let db_auto_index = db.clone(); + let command_sender_auto_index = command_sender.clone(); + std::thread::spawn(move || { + index::self_trigger(db_auto_index.deref(), &command_sender_auto_index); + }); + // API mount target let prefix_url = config.prefix_url.unwrap_or_else(|| "".to_string()); let api_url = format!("{}/api", &prefix_url); From 132a8c3dbfa8287a824311daf79e7f15fa3fd678 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 18:03:14 -0800 Subject: [PATCH 48/69] Added unit test for api/initial_setup --- src/api.rs | 6 +++--- src/api_tests.rs | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/api.rs b/src/api.rs index d66ff7a..1a0dc79 100644 --- a/src/api.rs +++ b/src/api.rs @@ -160,9 +160,9 @@ fn version() -> Json { Json(current_version) } -#[derive(Serialize)] -struct InitialSetup { - has_any_users: bool, +#[derive(PartialEq, Debug, Serialize, Deserialize)] +pub struct InitialSetup { + pub has_any_users: bool, } #[get("/initial_setup")] diff --git a/src/api_tests.rs b/src/api_tests.rs index 7959770..2bc19d0 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -40,6 +40,16 @@ fn get_test_environment(db_name: &str) -> TestEnvironment TestEnvironment { client, command_sender } } +fn complete_initial_setup(client: &Client) { + client.get("/api/initial_setup").dispatch(); + client.put("/api/settings") + .body(r#" + { "users": [{ "name": "test_user", "password": "test_password", "admin": true }] + , "mount_dirs": [{ "name": "collection", "source": "test/collection" }] + }"#) + .dispatch(); +} + #[test] fn version() { let env = get_test_environment("api_version.sqlite"); @@ -52,3 +62,27 @@ fn version() { let response_json: api::Version = serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json, api::Version{major: 3, minor: 0}); } + +#[test] +fn initial_setup() { + let env = get_test_environment("api_initial_setup.sqlite"); + let client = &env.client; + + { + let mut response = client.get("/api/initial_setup").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: api::InitialSetup = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json, api::InitialSetup{has_any_users: false}); + } + + complete_initial_setup(client); + + { + let mut response = client.get("/api/initial_setup").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: api::InitialSetup = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json, api::InitialSetup{has_any_users: true}); + } +} From 264c38b7fd74a3e412770b3c9c7e0d8d98a51c30 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 18:11:05 -0800 Subject: [PATCH 49/69] API tests skeleton --- src/api_tests.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/api_tests.rs b/src/api_tests.rs index 2bc19d0..86caebd 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -86,3 +86,63 @@ fn initial_setup() { assert_eq!(response_json, api::InitialSetup{has_any_users: true}); } } + +#[test] +fn settings() { + // TODO +} + +#[test] +fn preferences() { + // TODO +} + +#[test] +fn trigger_index() { + // TODO +} + +#[test] +fn auth() { + // TODO +} + +#[test] +fn browse() { + // TODO +} + +#[test] +fn flatten() { + // TODO +} + +#[test] +fn random() { + // TODO +} + +#[test] +fn recent() { + // TODO +} + +#[test] +fn search() { + // TODO +} + +#[test] +fn serve() { + // TODO +} + +#[test] +fn playlists() { + // TODO +} + +#[test] +fn last_fm() { + // TODO +} From c18134058bc1a6e8e480ea68006e222d71f59696 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 18:51:13 -0800 Subject: [PATCH 50/69] Added unit test for api/settings --- src/api_tests.rs | 166 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 148 insertions(+), 18 deletions(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 86caebd..fbd3592 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -1,14 +1,22 @@ use rocket::http::Status; use rocket::local::Client; -use std::path::PathBuf; -use std::ops::Deref; -use std::sync::Arc; use std::fs; +use std::ops::Deref; +use std::path::PathBuf; +use std::sync::Arc; use crate::api; +use crate::config; use crate::db; +use crate::ddns; use crate::index; use crate::server; +use crate::vfs; + +const TEST_USERNAME: &str = "test_user"; +const TEST_PASSWORD: &str = "test_password"; +const TEST_MOUNT_NAME: &str = "collection"; +const TEST_MOUNT_SOURCE: &str = "test/collection"; struct TestEnvironment { pub client: Client, @@ -21,8 +29,7 @@ impl Drop for TestEnvironment { } } -fn get_test_environment(db_name: &str) -> TestEnvironment -{ +fn get_test_environment(db_name: &str) -> TestEnvironment { let mut db_path = PathBuf::new(); db_path.push("test"); db_path.push(db_name); @@ -35,19 +42,39 @@ fn get_test_environment(db_name: &str) -> TestEnvironment let web_dir_path = PathBuf::from("web"); let command_sender = index::init(db.clone()); - let server = server::get_server(5050, "/", "/api", &web_dir_path, db, command_sender.clone()).unwrap(); + let server = + server::get_server(5050, "/", "/api", &web_dir_path, db, command_sender.clone()).unwrap(); let client = Client::new(server).unwrap(); - TestEnvironment { client, command_sender } + TestEnvironment { + client, + command_sender, + } } fn complete_initial_setup(client: &Client) { - client.get("/api/initial_setup").dispatch(); - client.put("/api/settings") - .body(r#" - { "users": [{ "name": "test_user", "password": "test_password", "admin": true }] - , "mount_dirs": [{ "name": "collection", "source": "test/collection" }] - }"#) - .dispatch(); + let body = format!( + r#" + {{ "users": [{{ "name": "{}", "password": "{}", "admin": true }}] + , "mount_dirs": [{{ "name": "{}", "source": "{}" }}] + }}"#, + TEST_USERNAME, TEST_PASSWORD, TEST_MOUNT_NAME, TEST_MOUNT_SOURCE + ); + + let response = client.put("/api/settings").body(&body).dispatch(); + assert_eq!(response.status(), Status::Ok); +} + +fn do_auth(client: &Client) { + let body = format!( + r#" + {{ "username": "{}" + , "password": "{}" + }}"#, + TEST_USERNAME, TEST_PASSWORD + ); + + let response = client.post("/api/auth").body(body).dispatch(); + assert_eq!(response.status(), Status::Ok); } #[test] @@ -60,7 +87,7 @@ fn version() { let response_body = response.body_string().unwrap(); let response_json: api::Version = serde_json::from_str(&response_body).unwrap(); - assert_eq!(response_json, api::Version{major: 3, minor: 0}); + assert_eq!(response_json, api::Version { major: 3, minor: 0 }); } #[test] @@ -73,7 +100,12 @@ fn initial_setup() { assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); let response_json: api::InitialSetup = serde_json::from_str(&response_body).unwrap(); - assert_eq!(response_json, api::InitialSetup{has_any_users: false}); + assert_eq!( + response_json, + api::InitialSetup { + has_any_users: false + } + ); } complete_initial_setup(client); @@ -83,13 +115,111 @@ fn initial_setup() { assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); let response_json: api::InitialSetup = serde_json::from_str(&response_body).unwrap(); - assert_eq!(response_json, api::InitialSetup{has_any_users: true}); + assert_eq!( + response_json, + api::InitialSetup { + has_any_users: true + } + ); } } #[test] fn settings() { - // TODO + let env = get_test_environment("api_settings.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + + { + let mut response = client.get("/api/settings").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: config::Config = serde_json::from_str(&response_body).unwrap(); + assert_eq!( + response_json, + config::Config { + album_art_pattern: Some("Folder.(jpg|png)".to_string()), + reindex_every_n_seconds: Some(1800), + mount_dirs: Some(vec![vfs::MountPoint { + name: TEST_MOUNT_NAME.into(), + source: TEST_MOUNT_SOURCE.into() + }]), + prefix_url: None, + users: Some(vec![config::ConfigUser { + name: TEST_USERNAME.into(), + password: "".into(), + admin: true + }]), + ydns: Some(ddns::DDNSConfig { + host: "".into(), + username: "".into(), + password: "".into() + }), + } + ); + } + + client + .put("/api/settings") + .body( + r#" + { "users": [ { "name": "test_user", "password": "test_password", "admin": true } + , { "name": "other_user", "password": "other_password", "admin": false } + ] + , "mount_dirs": [ { "name": "collection", "source": "test/collection" } + , { "name": "more_music", "source": "test/collection" } + ] + , "album_art_pattern": "my_pattern" + , "reindex_every_n_seconds": 3600 + , "prefix_url": "my_prefix" + , "ydns": { "host": "my_host", "username": "my_username", "password": "my_password" } + }"#, + ) + .dispatch(); + + { + let mut response = client.get("/api/settings").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: config::Config = serde_json::from_str(&response_body).unwrap(); + + assert_eq!( + response_json, + config::Config { + album_art_pattern: Some("my_pattern".to_owned()), + reindex_every_n_seconds: Some(3600), + mount_dirs: Some(vec![ + vfs::MountPoint { + name: TEST_MOUNT_NAME.into(), + source: TEST_MOUNT_SOURCE.into() + }, + vfs::MountPoint { + name: "more_music".into(), + source: "test/collection".into() + } + ]), + prefix_url: Some("my_prefix".to_owned()), + users: Some(vec![ + config::ConfigUser { + name: "test_user".into(), + password: "".into(), + admin: true + }, + config::ConfigUser { + name: "other_user".into(), + password: "".into(), + admin: false + } + ]), + ydns: Some(ddns::DDNSConfig { + host: "my_host".into(), + username: "my_username".into(), + password: "my_password".into() + }), + } + ); + } } #[test] From f5d46a0aa36af175ef952c7d7c65b3913818df78 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 19:10:51 -0800 Subject: [PATCH 51/69] Added unit test for api/auth --- src/api_tests.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index fbd3592..f1de9f4 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -234,7 +234,38 @@ fn trigger_index() { #[test] fn auth() { - // TODO + let env = get_test_environment("api_auth.sqlite"); + let client = &env.client; + complete_initial_setup(client); + + { + let response = client + .post("/api/auth") + .body(r#"{"username": "garbage", "password": "garbage"}"#) + .dispatch(); + assert_eq!(response.status(), Status::Unauthorized); + } + { + let response = client + .post("/api/auth") + .body(format!( + r#"{{"username": "{}", "password": "garbage"}}"#, + TEST_USERNAME + )) + .dispatch(); + assert_eq!(response.status(), Status::Unauthorized); + } + { + let response = client + .post("/api/auth") + .body(format!( + r#"{{"username": "{}", "password": "{}"}}"#, + TEST_USERNAME, TEST_PASSWORD + )) + .dispatch(); + assert_eq!(response.status(), Status::Ok); + assert_eq!(response.cookies()[0].name(), "session"); + } } #[test] From be1479a40c514ead44211ebad67303987ca53efe Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 19:12:16 -0800 Subject: [PATCH 52/69] Test that settings endpoint requires auth --- src/api_tests.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api_tests.rs b/src/api_tests.rs index f1de9f4..57e3c5a 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -129,6 +129,12 @@ fn settings() { let env = get_test_environment("api_settings.sqlite"); let client = &env.client; complete_initial_setup(client); + + { + let response = client.get("/api/settings").dispatch(); + assert_eq!(response.status(), Status::Unauthorized); + } + do_auth(client); { From 8a4c327fa8fbee2aee600153fb85119101d2328a Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 19:20:06 -0800 Subject: [PATCH 53/69] Added unit test for api/random --- src/api_tests.rs | 22 ++++++++++++++++++++-- src/index.rs | 6 +++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 57e3c5a..93e05ef 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -21,6 +21,13 @@ const TEST_MOUNT_SOURCE: &str = "test/collection"; struct TestEnvironment { pub client: Client, command_sender: Arc, + db: Arc, +} + +impl TestEnvironment { + pub fn update_index(&self) { + index::update(self.db.deref()).unwrap(); + } } impl Drop for TestEnvironment { @@ -43,11 +50,12 @@ fn get_test_environment(db_name: &str) -> TestEnvironment { let command_sender = index::init(db.clone()); let server = - server::get_server(5050, "/", "/api", &web_dir_path, db, command_sender.clone()).unwrap(); + server::get_server(5050, "/", "/api", &web_dir_path, db.clone(), command_sender.clone()).unwrap(); let client = Client::new(server).unwrap(); TestEnvironment { client, command_sender, + db, } } @@ -286,7 +294,17 @@ fn flatten() { #[test] fn random() { - // TODO + let env = get_test_environment("api_random.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + let mut response = client.get("/api/random").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 2); } #[test] diff --git a/src/index.rs b/src/index.rs index a76cdb5..5651962 100644 --- a/src/index.rs +++ b/src/index.rs @@ -109,12 +109,12 @@ pub struct Song { pub duration: Option, } -#[derive(Debug, Queryable, Serialize)] +#[derive(Debug, Queryable, Serialize, Deserialize)] pub struct Directory { - #[serde(skip_serializing)] + #[serde(skip_serializing, skip_deserializing)] id: i32, pub path: String, - #[serde(skip_serializing)] + #[serde(skip_serializing, skip_deserializing)] pub parent: Option, pub artist: Option, pub year: Option, From 552e4fda9dddccc16aac83c675c82d6cc21d0665 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 19:20:56 -0800 Subject: [PATCH 54/69] Added unit test for api/recent --- src/api_tests.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 93e05ef..a1290e2 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -309,7 +309,17 @@ fn random() { #[test] fn recent() { - // TODO + let env = get_test_environment("api_recent.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + let mut response = client.get("/api/recent").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 2); } #[test] From 3f5a84ba8a66fe0d6de431e069ba1dee334104ae Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 11 Nov 2018 19:27:30 -0800 Subject: [PATCH 55/69] Added test for api/trigger_index --- src/api_tests.rs | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index a1290e2..2c08edf 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -4,6 +4,7 @@ use std::fs; use std::ops::Deref; use std::path::PathBuf; use std::sync::Arc; +use std::{thread, time}; use crate::api; use crate::config; @@ -49,8 +50,15 @@ fn get_test_environment(db_name: &str) -> TestEnvironment { let web_dir_path = PathBuf::from("web"); let command_sender = index::init(db.clone()); - let server = - server::get_server(5050, "/", "/api", &web_dir_path, db.clone(), command_sender.clone()).unwrap(); + let server = server::get_server( + 5050, + "/", + "/api", + &web_dir_path, + db.clone(), + command_sender.clone(), + ) + .unwrap(); let client = Client::new(server).unwrap(); TestEnvironment { client, @@ -243,7 +251,34 @@ fn preferences() { #[test] fn trigger_index() { - // TODO + let env = get_test_environment("api_trigger_index.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + + { + let mut response = client.get("/api/random").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 0); + } + + { + let response = client.post("/api/trigger_index").dispatch(); + assert_eq!(response.status(), Status::Ok); + } + + let timeout = time::Duration::from_secs(5); + thread::sleep(timeout); + + { + let mut response = client.get("/api/random").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 2); + } } #[test] From cc17c6db97fabcb18d728cdd50140fd5c9f20a90 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 20:20:56 -0800 Subject: [PATCH 56/69] Added unit test for /api/search --- src/api_tests.rs | 16 +++++++++++++++- src/index.rs | 10 +++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 2c08edf..8f46cc4 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -359,7 +359,21 @@ fn recent() { #[test] fn search() { - // TODO + let env = get_test_environment("api_search.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + let mut response = client.get("/api/search/door").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 1); + match response_json[0] { + index::CollectionFile::Song(ref s) => assert_eq!(s.title, Some("Beyond The Door".into())), + _ => panic!() + } } #[test] diff --git a/src/index.rs b/src/index.rs index 5651962..8334136 100644 --- a/src/index.rs +++ b/src/index.rs @@ -90,13 +90,13 @@ pub fn init(db: Arc) -> Arc { command_sender } -#[derive(Debug, Queryable, QueryableByName, Serialize)] +#[derive(Debug, PartialEq, Queryable, QueryableByName, Serialize, Deserialize)] #[table_name = "songs"] pub struct Song { - #[serde(skip_serializing)] + #[serde(skip_serializing, skip_deserializing)] id: i32, pub path: String, - #[serde(skip_serializing)] + #[serde(skip_serializing, skip_deserializing)] pub parent: String, pub track_number: Option, pub disc_number: Option, @@ -109,7 +109,7 @@ pub struct Song { pub duration: Option, } -#[derive(Debug, Queryable, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Queryable, Serialize, Deserialize)] pub struct Directory { #[serde(skip_serializing, skip_deserializing)] id: i32, @@ -123,7 +123,7 @@ pub struct Directory { pub date_added: i32, } -#[derive(Debug, Serialize)] +#[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CollectionFile { Directory(Directory), Song(Song), From 79992b71204024ae9c1731246785ff47a2088a66 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 21:52:04 -0800 Subject: [PATCH 57/69] Added unit test for api/browse --- src/api_tests.rs | 57 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 8f46cc4..9fc3153 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -1,4 +1,5 @@ use rocket::http::Status; +use rocket::http::uri::Uri; use rocket::local::Client; use std::fs; use std::ops::Deref; @@ -319,7 +320,61 @@ fn auth() { #[test] fn browse() { - // TODO + let env = get_test_environment("api_browse.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + { + let mut response = client.get("/api/browse").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 1); + } + + let mut next; + { + let mut response = client.get("/api/browse/collection").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 2); + + match response_json[0] { + index::CollectionFile::Directory(ref d) => { + next = d.path.clone(); + }, + _ => panic!() + } + } + + // /api/browse/collection/Khemmis + { + let url = format!("/api/browse/{}", Uri::percent_encode(&next)); + let mut response = client.get(url).dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 1); + match response_json[0] { + index::CollectionFile::Directory(ref d) => { + next = d.path.clone(); + }, + _ => panic!() + } + } + + // /api/browse/collection/Khemmis/Hunted + { + let url = format!("/api/browse/{}", Uri::percent_encode(&next)); + let mut response = client.get(url).dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 5); + } } #[test] From 43538853a4b5b1443ea1965f9baad6837e3bba74 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 21:53:40 -0800 Subject: [PATCH 58/69] Added unit test for api/flatten --- src/api_tests.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 9fc3153..04d079f 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -379,7 +379,27 @@ fn browse() { #[test] fn flatten() { - // TODO + let env = get_test_environment("api_flatten.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + { + let mut response = client.get("/api/flatten").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 12); + } + + { + let mut response = client.get("/api/flatten/collection").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 12); + } } #[test] From 0185634071f5d4243f4235d742218c499f083fad Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 22:10:32 -0800 Subject: [PATCH 59/69] Added unit tests for playlists API --- src/api.rs | 12 +++++----- src/api_tests.rs | 59 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/src/api.rs b/src/api.rs index 1a0dc79..5390378 100644 --- a/src/api.rs +++ b/src/api.rs @@ -332,9 +332,9 @@ fn serve( Ok(serve::RangeResponder::new(file)) } -#[derive(Serialize)] -struct ListPlaylistsEntry { - name: String, +#[derive(Debug, PartialEq, Serialize, Deserialize)] +pub struct ListPlaylistsEntry { + pub name: String, } #[get("/playlists")] @@ -351,9 +351,9 @@ fn list_playlists( Ok(Json(playlists)) } -#[derive(Deserialize)] -struct SavePlaylistInput { - tracks: Vec, +#[derive(Serialize, Deserialize)] +pub struct SavePlaylistInput { + pub tracks: Vec, } #[put("/playlist/", data = "")] diff --git a/src/api_tests.rs b/src/api_tests.rs index 04d079f..0167eb9 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -458,7 +458,64 @@ fn serve() { #[test] fn playlists() { - // TODO + let env = get_test_environment("api_playlists.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + { + let mut response = client.get("/api/playlists").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 0); + } + + { + let songs: Vec; + { + let mut response = client.get("/api/flatten").dispatch(); + let response_body = response.body_string().unwrap(); + songs = serde_json::from_str(&response_body).unwrap(); + } + let my_playlist = api::SavePlaylistInput{ + tracks: songs[2..6].into_iter().map(|s| s.path.clone()).collect(), + }; + let response = client.put("/api/playlist/my_playlist") + .body(serde_json::to_string(&my_playlist).unwrap()) + .dispatch(); + assert_eq!(response.status(), Status::Ok); + } + + { + let mut response = client.get("/api/playlists").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json, vec![api::ListPlaylistsEntry{ name: "my_playlist".into() }]); + } + + { + let mut response = client.get("/api/playlist/my_playlist").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 4); + } + + { + let response = client.delete("/api/playlist/my_playlist").dispatch(); + assert_eq!(response.status(), Status::Ok); + } + + { + let mut response = client.get("/api/playlists").dispatch(); + assert_eq!(response.status(), Status::Ok); + let response_body = response.body_string().unwrap(); + let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + assert_eq!(response_json.len(), 0); + } } #[test] From 64e86f5079c8e4f0dada8eb13621dee74e9a1c7b Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 22:10:48 -0800 Subject: [PATCH 60/69] Formatting --- src/api_tests.rs | 49 ++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 0167eb9..da4e92b 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -1,5 +1,5 @@ -use rocket::http::Status; use rocket::http::uri::Uri; +use rocket::http::Status; use rocket::local::Client; use std::fs; use std::ops::Deref; @@ -330,7 +330,8 @@ fn browse() { let mut response = client.get("/api/browse").dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json.len(), 1); } @@ -339,14 +340,15 @@ fn browse() { let mut response = client.get("/api/browse/collection").dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json.len(), 2); match response_json[0] { index::CollectionFile::Directory(ref d) => { next = d.path.clone(); - }, - _ => panic!() + } + _ => panic!(), } } @@ -356,13 +358,14 @@ fn browse() { let mut response = client.get(url).dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json.len(), 1); match response_json[0] { index::CollectionFile::Directory(ref d) => { next = d.path.clone(); - }, - _ => panic!() + } + _ => panic!(), } } @@ -372,7 +375,8 @@ fn browse() { let mut response = client.get(url).dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json.len(), 5); } } @@ -447,7 +451,7 @@ fn search() { assert_eq!(response_json.len(), 1); match response_json[0] { index::CollectionFile::Song(ref s) => assert_eq!(s.title, Some("Beyond The Door".into())), - _ => panic!() + _ => panic!(), } } @@ -468,7 +472,8 @@ fn playlists() { let mut response = client.get("/api/playlists").dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json.len(), 0); } @@ -479,12 +484,13 @@ fn playlists() { let response_body = response.body_string().unwrap(); songs = serde_json::from_str(&response_body).unwrap(); } - let my_playlist = api::SavePlaylistInput{ + let my_playlist = api::SavePlaylistInput { tracks: songs[2..6].into_iter().map(|s| s.path.clone()).collect(), }; - let response = client.put("/api/playlist/my_playlist") - .body(serde_json::to_string(&my_playlist).unwrap()) - .dispatch(); + let response = client + .put("/api/playlist/my_playlist") + .body(serde_json::to_string(&my_playlist).unwrap()) + .dispatch(); assert_eq!(response.status(), Status::Ok); } @@ -492,8 +498,14 @@ fn playlists() { let mut response = client.get("/api/playlists").dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); - assert_eq!(response_json, vec![api::ListPlaylistsEntry{ name: "my_playlist".into() }]); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); + assert_eq!( + response_json, + vec![api::ListPlaylistsEntry { + name: "my_playlist".into() + }] + ); } { @@ -513,7 +525,8 @@ fn playlists() { let mut response = client.get("/api/playlists").dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); - let response_json: Vec = serde_json::from_str(&response_body).unwrap(); + let response_json: Vec = + serde_json::from_str(&response_body).unwrap(); assert_eq!(response_json.len(), 0); } } From b781071b4e746a827b3fd70c8ca72287a9938629 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 22:31:43 -0800 Subject: [PATCH 61/69] Got rid of raw json strings in unit tests --- src/api.rs | 8 +-- src/api_tests.rs | 164 +++++++++++++++++++++++++---------------------- 2 files changed, 90 insertions(+), 82 deletions(-) diff --git a/src/api.rs b/src/api.rs index 5390378..ddc0368 100644 --- a/src/api.rs +++ b/src/api.rs @@ -217,10 +217,10 @@ fn trigger_index( Ok(()) } -#[derive(Deserialize)] -struct AuthCredentials { - username: String, - password: String, +#[derive(Serialize, Deserialize)] +pub struct AuthCredentials { + pub username: String, + pub password: String, } #[derive(Serialize)] diff --git a/src/api_tests.rs b/src/api_tests.rs index da4e92b..839f4b1 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -69,27 +69,32 @@ fn get_test_environment(db_name: &str) -> TestEnvironment { } fn complete_initial_setup(client: &Client) { - let body = format!( - r#" - {{ "users": [{{ "name": "{}", "password": "{}", "admin": true }}] - , "mount_dirs": [{{ "name": "{}", "source": "{}" }}] - }}"#, - TEST_USERNAME, TEST_PASSWORD, TEST_MOUNT_NAME, TEST_MOUNT_SOURCE - ); - + let configuration = config::Config { + album_art_pattern: None, + prefix_url: None, + reindex_every_n_seconds: None, + ydns: None, + users: Some(vec![config::ConfigUser { + name: TEST_USERNAME.into(), + password: TEST_PASSWORD.into(), + admin: true, + }]), + mount_dirs: Some(vec![vfs::MountPoint { + name: TEST_MOUNT_NAME.into(), + source: TEST_MOUNT_SOURCE.into(), + }]), + }; + let body = serde_json::to_string(&configuration).unwrap(); let response = client.put("/api/settings").body(&body).dispatch(); assert_eq!(response.status(), Status::Ok); } fn do_auth(client: &Client) { - let body = format!( - r#" - {{ "username": "{}" - , "password": "{}" - }}"#, - TEST_USERNAME, TEST_PASSWORD - ); - + let credentials = api::AuthCredentials { + username: TEST_USERNAME.into(), + password: TEST_PASSWORD.into(), + }; + let body = serde_json::to_string(&credentials).unwrap(); let response = client.post("/api/auth").body(body).dispatch(); assert_eq!(response.status(), Status::Ok); } @@ -183,65 +188,62 @@ fn settings() { ); } - client - .put("/api/settings") - .body( - r#" - { "users": [ { "name": "test_user", "password": "test_password", "admin": true } - , { "name": "other_user", "password": "other_password", "admin": false } - ] - , "mount_dirs": [ { "name": "collection", "source": "test/collection" } - , { "name": "more_music", "source": "test/collection" } - ] - , "album_art_pattern": "my_pattern" - , "reindex_every_n_seconds": 3600 - , "prefix_url": "my_prefix" - , "ydns": { "host": "my_host", "username": "my_username", "password": "my_password" } - }"#, - ) - .dispatch(); + let mut configuration = config::Config { + album_art_pattern: Some("my_pattern".to_owned()), + reindex_every_n_seconds: Some(3600), + mount_dirs: Some(vec![ + vfs::MountPoint { + name: TEST_MOUNT_NAME.into(), + source: TEST_MOUNT_SOURCE.into(), + }, + vfs::MountPoint { + name: "more_music".into(), + source: "test/collection".into(), + }, + ]), + prefix_url: Some("my_prefix".to_owned()), + users: Some(vec![ + config::ConfigUser { + name: "test_user".into(), + password: "some_password".into(), + admin: true, + }, + config::ConfigUser { + name: "other_user".into(), + password: "some_other_password".into(), + admin: false, + }, + ]), + ydns: Some(ddns::DDNSConfig { + host: "my_host".into(), + username: "my_username".into(), + password: "my_password".into(), + }), + }; + + let body = serde_json::to_string(&configuration).unwrap(); + + configuration.users = Some(vec![ + config::ConfigUser { + name: "test_user".into(), + password: "".into(), + admin: true, + }, + config::ConfigUser { + name: "other_user".into(), + password: "".into(), + admin: false, + }, + ]); + + client.put("/api/settings").body(body).dispatch(); { let mut response = client.get("/api/settings").dispatch(); assert_eq!(response.status(), Status::Ok); let response_body = response.body_string().unwrap(); let response_json: config::Config = serde_json::from_str(&response_body).unwrap(); - - assert_eq!( - response_json, - config::Config { - album_art_pattern: Some("my_pattern".to_owned()), - reindex_every_n_seconds: Some(3600), - mount_dirs: Some(vec![ - vfs::MountPoint { - name: TEST_MOUNT_NAME.into(), - source: TEST_MOUNT_SOURCE.into() - }, - vfs::MountPoint { - name: "more_music".into(), - source: "test/collection".into() - } - ]), - prefix_url: Some("my_prefix".to_owned()), - users: Some(vec![ - config::ConfigUser { - name: "test_user".into(), - password: "".into(), - admin: true - }, - config::ConfigUser { - name: "other_user".into(), - password: "".into(), - admin: false - } - ]), - ydns: Some(ddns::DDNSConfig { - host: "my_host".into(), - username: "my_username".into(), - password: "my_password".into() - }), - } - ); + assert_eq!(response_json, configuration); } } @@ -289,29 +291,35 @@ fn auth() { complete_initial_setup(client); { + let credentials = api::AuthCredentials { + username: "garbage".into(), + password: "garbage".into(), + }; let response = client .post("/api/auth") - .body(r#"{"username": "garbage", "password": "garbage"}"#) + .body(serde_json::to_string(&credentials).unwrap()) .dispatch(); assert_eq!(response.status(), Status::Unauthorized); } { + let credentials = api::AuthCredentials { + username: TEST_USERNAME.into(), + password: "garbage".into(), + }; let response = client .post("/api/auth") - .body(format!( - r#"{{"username": "{}", "password": "garbage"}}"#, - TEST_USERNAME - )) + .body(serde_json::to_string(&credentials).unwrap()) .dispatch(); assert_eq!(response.status(), Status::Unauthorized); } { + let credentials = api::AuthCredentials { + username: TEST_USERNAME.into(), + password: TEST_PASSWORD.into(), + }; let response = client .post("/api/auth") - .body(format!( - r#"{{"username": "{}", "password": "{}"}}"#, - TEST_USERNAME, TEST_PASSWORD - )) + .body(serde_json::to_string(&credentials).unwrap()) .dispatch(); assert_eq!(response.status(), Status::Ok); assert_eq!(response.cookies()[0].name(), "session"); From 58482bf5122a4d7d330b3f48cdfa638d86938dfb Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Mon, 12 Nov 2018 22:32:49 -0800 Subject: [PATCH 62/69] Remove lastfm test placeholder --- src/api_tests.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index 839f4b1..b1265a1 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -538,8 +538,3 @@ fn playlists() { assert_eq!(response_json.len(), 0); } } - -#[test] -fn last_fm() { - // TODO -} From 3009636f8893982362732126a47e8a9959ccb31c Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 18:02:09 -0800 Subject: [PATCH 63/69] Updated dependencies --- Cargo.lock | 1257 +++++++++++++++++++++++++++------------------------- Cargo.toml | 14 +- 2 files changed, 655 insertions(+), 616 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dc1fe0..30652bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,13 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "MacTypes-sys" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "adler32" version = "1.0.3" @@ -5,10 +15,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "aho-corasick" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -16,7 +26,7 @@ name = "ape" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -27,36 +37,42 @@ dependencies = [ "ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "autocfg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "backtrace" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.24" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -64,16 +80,16 @@ name = "base64" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "base64" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -93,21 +109,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.2.7" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bytes" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" -version = "1.0.25" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -122,7 +138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -144,8 +160,8 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -155,7 +171,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -163,7 +179,7 @@ name = "core-foundation-sys" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -174,6 +190,38 @@ dependencies = [ "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crc32fast" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-channel" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-deque" version = "0.2.0" @@ -185,11 +233,11 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -197,23 +245,23 @@ name = "crossbeam-epoch" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -229,15 +277,11 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-utils" -version = "0.6.0" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -246,7 +290,7 @@ version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -270,60 +314,60 @@ dependencies = [ [[package]] name = "devise" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "devise_codegen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "devise_core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "devise_codegen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "devise_codegen" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "devise_core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "devise_core" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "diesel" -version = "1.3.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "diesel_derives 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "diesel_derives" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "diesel_migrations" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "migrations_internals 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "migrations_macros 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "migrations_macros 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -395,7 +439,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "encoding_rs" -version = "0.8.10" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -406,47 +450,48 @@ name = "error-chain" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "filetime" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -474,7 +519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -482,9 +527,14 @@ name = "fsevent-sys" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -510,7 +560,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -537,27 +587,27 @@ dependencies = [ [[package]] name = "h2" -version = "0.1.13" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "http" -version = "0.1.13" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -577,8 +627,8 @@ dependencies = [ "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -587,27 +637,27 @@ dependencies = [ [[package]] name = "hyper" -version = "0.12.14" +version = "0.12.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -616,11 +666,11 @@ name = "hyper-tls" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.24 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -629,12 +679,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "derive_builder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -644,7 +694,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -652,7 +702,7 @@ name = "image" version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "gif 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "jpeg-decoder 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -661,7 +711,7 @@ dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tiff 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiff 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -671,7 +721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "inflate" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -683,12 +733,8 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -696,7 +742,7 @@ name = "inotify-sys" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -704,7 +750,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -714,8 +760,8 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -729,7 +775,7 @@ name = "jpeg-decoder" version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -754,7 +800,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazycell" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -762,24 +808,24 @@ name = "lewton" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "ogg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.2.43" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libflate" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -787,7 +833,7 @@ name = "libsqlite3-sys" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -799,10 +845,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -842,13 +888,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memchr" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "memoffset" @@ -860,7 +901,7 @@ name = "metaflac" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -868,18 +909,18 @@ dependencies = [ [[package]] name = "migrations_internals" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "diesel 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "migrations_macros" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "migrations_internals 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -894,7 +935,7 @@ dependencies = [ [[package]] name = "mime" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -905,9 +946,9 @@ name = "mime_guess" version = "2.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", - "phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -916,13 +957,13 @@ name = "miniz-sys" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz_oxide" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -930,13 +971,13 @@ dependencies = [ [[package]] name = "miniz_oxide_c_api" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -948,12 +989,12 @@ dependencies = [ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -962,20 +1003,10 @@ name = "mio-extras" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "mio-uds" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -991,10 +1022,10 @@ dependencies = [ [[package]] name = "mp3-duration" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1003,15 +1034,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1020,27 +1051,27 @@ version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "notify" -version = "4.0.6" +version = "4.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1067,7 +1098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1082,13 +1113,12 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1135,10 +1165,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1146,7 +1176,7 @@ name = "ogg" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1160,15 +1190,15 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.15" +version = "0.10.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1178,18 +1208,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.39" +version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "owning_ref" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1197,41 +1227,41 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.6.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pear" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pear_codegen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pear_codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pear_codegen" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1243,33 +1273,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "phf" -version = "0.7.23" +version = "0.7.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_codegen" -version = "0.7.23" +version = "0.7.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_generator" -version = "0.7.23" +version = "0.7.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf_shared" -version = "0.7.23" +version = "0.7.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1288,7 +1318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)", - "inflate 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1298,9 +1328,9 @@ version = "0.9.0" dependencies = [ "ape 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "diesel 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "diesel_migrations 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "diesel_migrations 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "id3 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1308,37 +1338,29 @@ dependencies = [ "lewton 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "metaflac 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "mp3-duration 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", - "rocket_contrib 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", + "mp3-duration 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "reqwest 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_contrib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustfm-scrobble 0.9.1 (git+https://github.com/agersant/rustfm-scrobble)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "unix-daemonize 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.4.21" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1351,64 +1373,140 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.5.2" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_core" -version = "0.2.2" +name = "rand" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_jitter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_os" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "rayon" @@ -1427,33 +1525,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.1.40" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex" -version = "1.0.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1466,99 +1572,102 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.9.4" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding_rs 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.24 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_urlencoded 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ring" -version = "0.13.3" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rocket" -version = "0.4.0-rc.1" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pear 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_codegen 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", - "rocket_http 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rocket_codegen" -version = "0.4.0-rc.1" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "devise 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "devise 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket_http 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rocket_contrib" -version = "0.4.0-rc.1" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rocket 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "notify 4.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rocket_http" -version = "0.4.0-rc.1" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a#4224419e63a99b1f21db447f8c4aedab8daec41a" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pear 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1570,7 +1679,7 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1579,15 +1688,15 @@ version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-demangle" -version = "0.1.9" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1608,11 +1717,11 @@ name = "rustfm-scrobble" version = "0.9.1" source = "git+https://github.com/agersant/rustfm-scrobble#4305bc8632258e06983999b246e69127ead760f9" dependencies = [ - "reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", + "reqwest 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "wrapped-vec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1631,7 +1740,7 @@ name = "same-file" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1655,22 +1764,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "security-framework" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "security-framework-sys" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "MacTypes-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1688,37 +1798,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.80" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.80" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.33" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_urlencoded" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1748,16 +1858,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "slab" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smallvec" -version = "0.6.5" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "stable_deref_trait" @@ -1771,7 +1878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "string" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1786,21 +1893,11 @@ dependencies = [ [[package]] name = "syn" -version = "0.13.11" +version = "0.15.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.15.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1817,21 +1914,21 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" -version = "3.0.4" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1841,7 +1938,7 @@ name = "term" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1855,184 +1952,134 @@ dependencies = [ [[package]] name = "tiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.40" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio" -version = "0.1.11" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-codec" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-current-thread" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-executor" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-fs" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-io" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-reactor" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-tcp" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-threadpool" -version = "0.1.8" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-timer" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-udp" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-uds" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "toml" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2052,7 +2099,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ucd-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2081,8 +2128,11 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "unicode-width" @@ -2104,15 +2154,7 @@ name = "unix-daemonize" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2137,10 +2179,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "uuid" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2153,11 +2195,6 @@ name = "version_check" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "walkdir" version = "2.2.7" @@ -2165,7 +2202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2204,7 +2241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2235,7 +2272,7 @@ dependencies = [ [[package]] name = "xdg" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2243,22 +2280,29 @@ name = "yansi" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "yansi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] +"checksum MacTypes-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eaf9f0d0b1cc33a4d2aee14fb4b2eac03462ef4db29c8ac4057327d8a71ad86f" "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" -"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" "checksum ape 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "890eeb3dc52632a4b762e3ea6ac37475a35577f22fce09bb6e758c2aaf38a229" "checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" -"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" -"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" -"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" -"checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2" +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" +"checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0ce55bd354b095246fc34caf4e9e242f5297a7fd938b090cadfea6eee614aa62" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" +"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" +"checksum cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4390a3b5f4f6bce9c1d0c00128379df433e53777fdd30e92f16a529332baec4e" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -2267,22 +2311,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" +"checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" -"checksum crossbeam-deque 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe1b6f945f824c7a25afe44f62e25d714c0cc523f8e99d8db5cd1026e1269d3" +"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" -"checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" +"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" -"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" -"checksum crossbeam-utils 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6efda20eef4ccf2a862d442a1e0319d568f9133e16a085a1f8126fe9b6da852d" +"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum derive_builder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c998e6ab02a828dd9735c18f154e14100e674ed08cb4e1938f0e4177543f439" "checksum derive_builder_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "735e24ee9e5fa8e16b86da5007856e97d592e11867e45d76e0c0d0a164a0b757" -"checksum devise 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f8e7e0601aeb557a7a8f6a4f87d29c8cc0feb2c41d15f5d65900723dabf083b" -"checksum devise_codegen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c88254efd3c2dfbeaf598d0ea35a54ef457ca04e31d214420d086ac9236b436" -"checksum devise_core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e33669c00593713cedf755f69723aa0731de7bc1f552903d6df98d6c4f91bcca" -"checksum diesel 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "164080ac16a4d1d80a50f0a623e4ddef41cb2779eee85bcc76907d340dfc98cc" -"checksum diesel_derives 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03bcaf77491f53e400d5ee3bdd57142ea4e1c47fe9217b3361ff9a76ca0e3d37" -"checksum diesel_migrations 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b42c35d1ce9e8d57a3e7001b4127f2bc1b073a89708bb7019f5be27c991c28" +"checksum devise 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3" +"checksum devise_codegen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7" +"checksum devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" +"checksum diesel 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a2469cbcf1dfb9446e491cac4c493c2554133f87f7d041e892ac82e5cd36e863" +"checksum diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62a27666098617d52c487a41f70de23d44a1dc1f3aa5877ceba2790fb1f1cab4" +"checksum diesel_migrations 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c" "checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" @@ -2292,17 +2338,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" "checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" "checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" -"checksum encoding_rs 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)" = "065f4d0c826fdaef059ac45487169d918558e3cf86c9d89f6e81cf52369126e5" +"checksum encoding_rs 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0535f350c60aac0b87ccf28319abc749391e912192255b0c00a2c12c6917bd73" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" -"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" -"checksum filetime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f57e64bf5eae62efd4efed005ae81a7115012a61f522bba54542e1a556af921" -"checksum flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3b0c7353385f92079524de3b7116cf99d73947c08a7472774e9b3b04bff3b901" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c4bbbf71584aeed076100b5665ac14e3d85eeb31fdbb45fbd41ef9a682b5ec05" "checksum fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a772d36c338d07a032d5375a36f15f9a7043bf0cb8ce7cee658e037c6032874" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" @@ -2310,17 +2357,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0a7292d30132fb5424b354f5dc02512a86e4c516fe544bb7a25e7f266951b797" "checksum gif 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4bca55ac1f213920ce3527ccd62386f1f15fa3f1714aeee1cf93f2c416903f" -"checksum h2 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "7dd33bafe2e6370e6c8eb0cf1b8c5f93390b90acde7e9b03723f166b28b648ed" -"checksum http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "24f58e8c2d8e886055c3ead7b28793e1455270b5fb39650984c224bc538ba581" +"checksum h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb2b25a33e231484694267af28fec74ac63b5ccf51ee2065a5e313b834d836e" +"checksum http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fe67e3678f2827030e89cc4b9e7ecd16d52f132c0b940ab5005f88e821500f6a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "df0caae6b71d266b91b4a83111a61d2b94ed2e2bea024c532b933dcff867e58c" -"checksum hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2f60ae467ef4fc5eba9a34d31648c9c8ed902faf45a217f6734ce9ea64779ac7" +"checksum hyper 0.12.24 (registry+https://github.com/rust-lang/crates.io-index)" = "fdfa9b401ef6c4229745bb6e9b2529192d07b920eed624cdee2a82348cd550af" "checksum hyper-tls 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "32cd73f14ad370d3b4d4b7dce08f69b81536c82e39fcc89731930fe5788cd661" "checksum id3 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a1657242b0b84b8659aaf00f8ca5513fe3082efb72e78f04cee19dc9c5ceb1ff" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum image 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44665b4395d1844c96e7dc8ed5754782a1cdfd9ef458a80bbe45702681450504" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" -"checksum inflate 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6f53b811ee8e2057ccf9643ca6b4277de90efaf5e61e55fd5254576926bb4245" +"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" "checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" "checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" @@ -2330,90 +2377,96 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum lewton 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "81d583f12101d36b9c19f85326f3c4e7d3b88d17f1131113e13da056dc0d4437" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "21138fc6669f438ed7ae3559d5789a5f0ba32f28c1f0608d1e452b0bb06ee936" +"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" +"checksum libflate 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "54d1ddf9c52870243c5689d7638d888331c1116aa5b398f3ba1acfa7d8758ca1" "checksum libsqlite3-sys 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d3711dfd91a1081d2458ad2d06ea30a8755256e74038be2ad927d94e1c955ca8" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" -"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" +"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" +"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum metaflac 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1839a57e30c651fb9647d1c140dcda407282a2228cddb25a21c1708645621219" -"checksum migrations_internals 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8cf7c8c4f83fa9f47440c0b4af99973502de55e6e7b875f693bd263e03f93e7e" -"checksum migrations_macros 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79f12499ef7353bdeca2d081bc61edd8351dac09a33af845952009b5a3d68c1a" +"checksum migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8089920229070f914b9ce9b07ef60e175b2b9bc2d35c3edd8bf4433604e863b9" +"checksum migrations_macros 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1664412abf7db2b8a6d58be42a38b099780cc542b5b350383b805d88932833fe" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -"checksum mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "0a907b83e7b9e987032439a387e187119cddafc92d5c2aaeb1d92580a793f630" +"checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425" "checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" -"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" -"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" +"checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e" +"checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" -"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum mp3-duration 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "23016ba75045a23213bf6ebf062a664a37852a2cfe4b8fe277d75dfbe96fce26" +"checksum mp3-duration 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d8676e9295ab39d1e0d7df860880c63eb847ec0c6ceea99c734a7177aec3c5cd" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" -"checksum notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "873ecfd8c174964ae30f401329d140142312c8e5590719cf1199d5f1717d8078" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum notify 4.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9cc7ed2bd4b7edad3ee93b659c38e53dabb619f7274e127a0fab054ad2bb998d" "checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" "checksum num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" "checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -"checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d" +"checksum num-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d9fe8fcafd1b86a37ce8a1cfa15ae504817e0c8c2e7ad42767371461ac1d316d" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124" "checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" "checksum num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e96f040177bb3da242b5b1ecf3f54b5d5af3efbbfb18608977a5d2767b22f10" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" -"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" "checksum ogg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d79f1db9148be9d0e174bb3ac890f6030fcb1ed947267c5a91ee4c91b5a91e15" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" -"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" +"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" -"checksum pear 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6fafc1ff6226da94e62a0543e823b9787816330e7362055ff7881a29a4ed7392" -"checksum pear_codegen 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79675c685b21a3adc17113410122ee8e9ad7551d52fca2abd175aefb1dfadd79" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" +"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c26d2b92e47063ffce70d3e3b1bd097af121a9e0db07ca38a6cc1cf0cc85ff25" +"checksum pear_codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "336db4a192cc7f54efeb0c4e11a9245394824cc3bcbd37ba3ff51240c35d7a6e" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" -"checksum phf 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "cec29da322b242f4c3098852c77a0ca261c9c01b806cae85a5572a1eb94db9a6" -"checksum phf_codegen 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "7d187f00cd98d5afbcd8898f6cf181743a449162aeb329dcd2f3849009e605ad" -"checksum phf_generator 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "03dc191feb9b08b0dc1330d6549b795b9d81aec19efe6b4a45aec8d4caee0c4b" -"checksum phf_shared 0.7.23 (registry+https://github.com/rust-lang/crates.io-index)" = "b539898d22d4273ded07f64a05737649dc69095d92cb87c7097ec68e3f150b93" +"checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" +"checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" +"checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" +"checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b" -"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" -"checksum proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ab2fc21ba78ac73e4ff6b3818ece00be4e175ffbef4d0a717d978b48b24150c4" +"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" -"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" -"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" -"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" -"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" -"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" +"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" +"checksum rand_os 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b7c690732391ae0abafced5015ffb53656abfaec61b342290e5eb56b286a679d" +"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" -"checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467" -"checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum reqwest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "00a5870d8edc74fc6e1eb58edbd2815d2243e1a2255d6bf9c82a7a875901b5db" -"checksum ring 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7ed733c36010c3d4d4718588f16a6c06a670b01c0047029ae81c3ca0acd81ff5" -"checksum rocket 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" -"checksum rocket_codegen 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" -"checksum rocket_contrib 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" -"checksum rocket_http 0.4.0-rc.1 (git+https://github.com/SergioBenitez/Rocket.git?rev=4224419e63a99b1f21db447f8c4aedab8daec41a)" = "" +"checksum reqwest 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "f205a95638627fc0d21c53901671b06f439dc2830311ff11ecdff34ae2d839a8" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" +"checksum rocket 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "242154377a85c2a9e036fc31ffc8c200b9e1f22a196e47baa3b57716606ca89d" +"checksum rocket_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d907d6d458c859651c1cf4c8fa99b77685082bde0561db6a4600b365058f710" +"checksum rocket_contrib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f73e161dad5730435f51c815a5c6831d2e57b6b4299b1bf609d31b09aa9a2fa7" +"checksum rocket_http 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba9d4f2ce5bba6e1b6d3100493bbad63879e99bbf6b4365d61e6f781daab324d" "checksum rusqlite 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9d9118f1ce84d8d0b67f9779936432fb42bb620cef2122409d786892cce9a3c" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" -"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustfm-scrobble 0.9.1 (git+https://github.com/agersant/rustfm-scrobble)" = "" @@ -2423,74 +2476,68 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "697d3f3c23a618272ead9e1fb259c1411102b31c6af8b93f1d64cca9c3b0e8e0" -"checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" +"checksum security-framework 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfab8dda0e7a327c696d893df9ffa19cadc4bd195797997f5223cf5831beaf05" +"checksum security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d6696852716b589dff9e886ff83778bb635150168e83afa8ac6b8a78cb82abc" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" -"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" -"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" -"checksum serde_urlencoded 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aaed41d9fb1e2f587201b863356590c90c1157495d811430a0c0325fe8169650" +"checksum serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "9f301d728f2b94c9a7691c90f07b0b4e8a4517181d9461be94c04bddeb4bd850" +"checksum serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "beed18e6f5175aef3ba670e57c60ef3b1b74d250d962a26604bff4c80e970dd4" +"checksum serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "27dce848e7467aa0e2fcaf0a413641499c0b745452aaca1194d24dedde9e13c9" +"checksum serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d48f9f99cd749a2de71d29da5f948de7f2764cc5a9d7f3c97e3514d4ee6eabf2" "checksum shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ee04b46101f57121c9da2b151988283b6beb79b34f5bb29a58ee48cb695122c" "checksum simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e95345f185d5adeb8ec93459d2dc99654e294cc6ccf5b75414d8ea262de9a13" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" -"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum state 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" -"checksum string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00caf261d6f90f588f8450b8e1230fa0d5be49ee6140fdfbcb55335aff350970" +"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" -"checksum syn 0.15.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8886c8d2774e853fcd7d9d2131f6e40ba46c9c0e358e4d57178452abd6859bb0" +"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" +"checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum tiff 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a2cc6c4fd13cb1cfd20abdb196e794ceccb29371855b7e7f575945f920a5b3c2" -"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" -"checksum tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6e93c78d23cc61aa245a8acd2c4a79c4d7fa7fb5c3ca90d5737029f043a84895" -"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" -"checksum tokio-current-thread 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f90fcd90952f0a496d438a976afba8e5c205fb12123f813d8ab3aa1c8436638c" -"checksum tokio-executor 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c117b6cf86bb730aab4834f10df96e4dd586eff2c3c27d3781348da49e255bde" -"checksum tokio-fs 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "60ae25f6b17d25116d2cba342083abe5255d3c2c79cb21ea11aa049c53bf7c75" -"checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21" -"checksum tokio-reactor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4b26fd37f1125738b2170c80b551f69ff6fecb277e6e5ca885e53eec2b005018" -"checksum tokio-tcp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad235e9dadd126b2d47f6736f65aa1fdcd6420e66ca63f44177bc78df89f912" -"checksum tokio-threadpool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3929aee321c9220ed838ed6c3928be7f9b69986b0e3c22c972a66dbf8a298c68" -"checksum tokio-timer 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3a52f00c97fedb6d535d27f65cccb7181c8dd4c6edc3eda9ea93f6d45d05168e" -"checksum tokio-udp 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "da941144b816d0dcda4db3a1ba87596e4df5e860a72b70783fe435891f80601c" -"checksum tokio-uds 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df195376b43508f01570bacc73e13a1de0854dc59e79d1ec09913e8db6dd2a70" -"checksum toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4a2ecc31b0351ea18b3fe11274b8db6e4d82bce861bbb22e6dbed40417902c65" +"checksum tiff 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4834f28a0330cb9f3f2c87d2649dca723cb33802e2bdcf18da32759fbec7ce" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "e0500b88064f08bebddd0c0bed39e19f5c567a5f30975bee52b0c0d3e2eeb38c" +"checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" +"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" +"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" +"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"checksum tokio-threadpool 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c3fd86cb15547d02daa2b21aadaf4e37dee3368df38a526178a5afa3c034d2fb" +"checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" +"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" -"checksum ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f8bfa9ff0cadcd210129ad9d2c5f145c13e9ced3d3e5d948a6213487d52444" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unix-daemonize 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "531faed80732acaa13d1016c66d6a9180b5045c4fcef8daa20bb2baf46b13907" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" -"checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" +"checksum uuid 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0238db0c5b605dd1cf51de0f21766f97fba2645897024461d6a00c036819a768" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wrapped-vec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "06c29bb4abe93d1c8ef79b60f270d0efcaa6c5c97aaaaaaa0d477ea72f5f9e45" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" +"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" "checksum yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d60c3b48c9cdec42fb06b3b84b5b087405e1fa1c644a1af3930e4dfafe93de48" +"checksum yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" diff --git a/Cargo.toml b/Cargo.toml index be13644..f52ba0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ metaflac = "0.1.8" mp3-duration = "0.1.0" rand = "0.5.5" regex = "1.0.5" -ring = "0.13.2" +ring = "0.13.5" reqwest = "0.9.2" -rocket = "0.4.0-dev" +rocket = "0.4.0" rust-crypto = "0.2.36" serde = "1.0" serde_derive = "1.0" @@ -34,16 +34,8 @@ serde_json = "1.0" simplelog = "0.5.2" toml = "0.4.5" -[patch.crates-io.rocket] -git = "https://github.com/SergioBenitez/Rocket.git" -rev = "4224419e63a99b1f21db447f8c4aedab8daec41a" - -[patch.crates-io.rocket_contrib] -git = "https://github.com/SergioBenitez/Rocket.git" -rev = "4224419e63a99b1f21db447f8c4aedab8daec41a" - [dependencies.rocket_contrib] -version = "0.4.0-dev" +version = "0.4.0" default_features = false features = ["json", "serve"] From e0d3b3034a452bfeb12e2c3b56bc12e4f06b79f5 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 18:02:22 -0800 Subject: [PATCH 64/69] Fixed warning outside of building tests --- src/index.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.rs b/src/index.rs index 8334136..dac7f08 100644 --- a/src/index.rs +++ b/src/index.rs @@ -66,6 +66,7 @@ impl CommandSender { } } + #[allow(dead_code)] pub fn exit(&self) -> Result<(), errors::Error> { let sender = self.sender.lock().unwrap(); match sender.send(Command::EXIT) { From f77be4a1e16435b6363292ed2b4a1c6a41674192 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 19:29:35 -0800 Subject: [PATCH 65/69] Removed unused errors --- src/errors.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index b9aa910..3c933a6 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -40,8 +40,6 @@ error_chain! { IncorrectCredentials {} EncodingError {} MissingLastFMCredentials {} - LastFMAuthError {} - LastFMDeserializationError {} } } From 727f83098830c9779bf0965b9c051d11df0fbc28 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 21:07:25 -0800 Subject: [PATCH 66/69] Added logging around HTTP range handling --- src/serve.rs | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/serve.rs b/src/serve.rs index 780b391..5455313 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -1,5 +1,7 @@ use rocket; use rocket::http::hyper::header::*; +use rocket::http::Status; +use rocket::Response; use rocket::response::{self, Responder}; use std::cmp; use std::convert::From; @@ -7,6 +9,7 @@ use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use std::str::FromStr; +#[derive(Debug)] pub enum PartialFileRange { AllFrom(u64), FromTo(u64, u64), @@ -41,9 +44,27 @@ impl<'r, R: Responder<'r>> RangeResponder { RangeResponder { original } } - fn ignore_range(self, request: &rocket::request::Request) -> response::Result<'r> { + fn ignore_range(self, request: &rocket::request::Request, file_length: Option) -> response::Result<'r> { let mut response = self.original.respond_to(request)?; - response.set_status(rocket::http::Status::RangeNotSatisfiable); + if let Some(content_length) = file_length { + response.set_header(ContentLength(content_length)); + } + response.set_status(Status::Ok); + Ok(response) + } + + fn reject_range(self, file_length: Option) -> response::Result<'r> { + let mut response = Response::build() + .status(Status::RangeNotSatisfiable) + .finalize(); + if file_length.is_some() { + let content_range = ContentRange(ContentRangeSpec::Bytes { + range: None, + instance_length: file_length, + }); + response.set_header(content_range); + } + response.set_status(Status::RangeNotSatisfiable); Ok(response) } } @@ -79,15 +100,22 @@ fn truncate_range(range: &PartialFileRange, file_length: &Option) -> Option impl<'r> Responder<'r> for RangeResponder { fn respond_to(mut self, request: &rocket::request::Request) -> response::Result<'r> { + + let metadata: Option<_> = self.original.metadata().ok(); + let file_length: Option = metadata.map(|m| m.len()); + let range_header = request.headers().get_one("Range"); let range_header = match range_header { - None => return Ok(self.original.respond_to(request)?), + None => return self.ignore_range(request, file_length), Some(h) => h, }; let vec_range = match Range::from_str(range_header) { Ok(Range::Bytes(v)) => v, - _ => return self.ignore_range(request), + _ => { + warn!("Ignoring range header that could not be parse {:?}, file length is {:?}", range_header, file_length); + return self.ignore_range(request, file_length); + }, }; let partial_file_range = match vec_range.into_iter().next() { @@ -95,8 +123,6 @@ impl<'r> Responder<'r> for RangeResponder { Some(byte_range) => PartialFileRange::from(byte_range), }; - let metadata: Option<_> = self.original.metadata().ok(); - let file_length: Option = metadata.map(|m| m.len()); let range: Option<(u64, u64)> = truncate_range(&partial_file_range, &file_length); if let Some((from, to)) = range { @@ -118,7 +144,8 @@ impl<'r> Responder<'r> for RangeResponder { Ok(response) } else { - self.ignore_range(request) + warn!("Rejecting unsatisfiable range header {:?}, file length is {:?}", &partial_file_range, &file_length); + self.reject_range(file_length) } } } From 7aabd6b15e2144a12eaaa2d71a3048063b490f82 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 23:42:55 -0800 Subject: [PATCH 67/69] Added tests for serve endpoints --- src/api_tests.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index b1265a1..a91f574 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -1,3 +1,4 @@ +use rocket::http::hyper::header::*; use rocket::http::uri::Uri; use rocket::http::Status; use rocket::local::Client; @@ -465,7 +466,30 @@ fn search() { #[test] fn serve() { - // TODO + let env = get_test_environment("api_serve.sqlite"); + let client = &env.client; + complete_initial_setup(client); + do_auth(client); + env.update_index(); + + { + let mut response = client.get("/api/serve/collection%2FKhemmis%2FHunted%2F02%20-%20Candlelight.mp3").dispatch(); + assert_eq!(response.status(), Status::Ok); + let body = response.body().unwrap(); + let body = body.into_bytes().unwrap(); + assert_eq!(body.len(), 24_142); + } + + { + let mut response = client.get("/api/serve/collection%2FKhemmis%2FHunted%2F02%20-%20Candlelight.mp3") + .header(Range::bytes(100, 299)) + .dispatch(); + assert_eq!(response.status(), Status::Ok); + let body = response.body().unwrap(); + let body = body.into_bytes().unwrap(); + assert_eq!(body.len(), 200); + assert_eq!(response.headers().get_one("Content-Length").unwrap(), "200"); + } } #[test] From b24e6e077de35eb5247ad1e7e64eb312a89c3cd1 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 23:45:31 -0800 Subject: [PATCH 68/69] Fixed expected HTTP response --- src/api_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_tests.rs b/src/api_tests.rs index a91f574..a83ee4c 100644 --- a/src/api_tests.rs +++ b/src/api_tests.rs @@ -484,7 +484,7 @@ fn serve() { let mut response = client.get("/api/serve/collection%2FKhemmis%2FHunted%2F02%20-%20Candlelight.mp3") .header(Range::bytes(100, 299)) .dispatch(); - assert_eq!(response.status(), Status::Ok); + assert_eq!(response.status(), Status::PartialContent); let body = response.body().unwrap(); let body = body.into_bytes().unwrap(); assert_eq!(body.len(), 200); From 55952a7d28846f16cddef8b420a89f73466c9d1e Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Tue, 19 Feb 2019 23:47:31 -0800 Subject: [PATCH 69/69] Fixed partial content responses --- src/serve.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/serve.rs b/src/serve.rs index 5455313..2d1215a 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -136,11 +136,13 @@ impl<'r> Responder<'r> for RangeResponder { Ok(_) => (), Err(_) => return Err(rocket::http::Status::InternalServerError), } - let partial_original = self.original.take(content_len).into_inner(); - let mut response = partial_original.respond_to(request)?; - response.set_header(ContentLength(content_len)); - response.set_header(content_range); - response.set_status(rocket::http::Status::PartialContent); + let partial_original = self.original.take(content_len); + let response = Response::build() + .status(Status::PartialContent) + .header(ContentLength(content_len)) + .header(content_range) + .streamed_body(partial_original) + .finalize(); Ok(response) } else {