From a8a98fdd22806ea7074df81fd4024565b5027fe1 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 28 Oct 2018 17:27:47 -0700 Subject: [PATCH] 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")));