Remove support for Facebook authentication.

This commit is contained in:
Paul Lietar 2017-01-05 14:40:33 +01:00
parent 7ba3d766c0
commit e254bb7291
11 changed files with 4 additions and 295 deletions

71
Cargo.lock generated
View file

@ -10,7 +10,6 @@ dependencies = [
"eventual 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "eventual 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-rustls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"json_macros 0.3.1 (git+https://github.com/plietar/json_macros)", "json_macros 0.3.1 (git+https://github.com/plietar/json_macros)",
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libpulse-sys 0.0.0 (git+https://github.com/astro/libpulse-sys)", "libpulse-sys 0.0.0 (git+https://github.com/astro/libpulse-sys)",
@ -27,7 +26,6 @@ dependencies = [
"rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rustls 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.21 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.21 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_codegen 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -80,11 +78,6 @@ dependencies = [
"syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "base64"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.4.0" version = "0.4.0"
@ -232,16 +225,6 @@ dependencies = [
"url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "hyper-rustls"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustls 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"webpki-roots 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "0.1.0" version = "0.1.0"
@ -648,15 +631,6 @@ name = "regex-syntax"
version = "0.3.9" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ring"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "rpassword" name = "rpassword"
version = "0.3.0" version = "0.3.0"
@ -693,19 +667,6 @@ dependencies = [
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "rustls"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"base64 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ring 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"webpki 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "scoped-tls" name = "scoped-tls"
version = "0.1.0" version = "0.1.0"
@ -1064,11 +1025,6 @@ name = "unicode-xid"
version = "0.0.3" version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "untrusted"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "url" name = "url"
version = "0.5.10" version = "0.5.10"
@ -1165,26 +1121,6 @@ dependencies = [
"vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "webpki"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ring 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "webpki-roots"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"webpki 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.2.8" version = "0.2.8"
@ -1210,7 +1146,6 @@ dependencies = [
"checksum aster 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258989846dd255a1e0eeef92d425d345477c9999433cecc9f0879f4549d5e5c9" "checksum aster 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258989846dd255a1e0eeef92d425d345477c9999433cecc9f0879f4549d5e5c9"
"checksum aster 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88bb8ecdf6a7eaddb7bfd872ebf5e085d343ca42ce98c582dba8046e3450b524" "checksum aster 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88bb8ecdf6a7eaddb7bfd872ebf5e085d343ca42ce98c582dba8046e3450b524"
"checksum aster 0.36.0 (registry+https://github.com/rust-lang/crates.io-index)" = "365684a2d8153bde2ca60826e54c8d3df76e06578ed868f8baaf91ae811af07b" "checksum aster 0.36.0 (registry+https://github.com/rust-lang/crates.io-index)" = "365684a2d8153bde2ca60826e54c8d3df76e06578ed868f8baaf91ae811af07b"
"checksum base64 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2015e3793554aa5b6007e3a72959e84c1070039e74f13dde08fa64afe1ddd892"
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c" "checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d" "checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
"checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c" "checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c"
@ -1231,7 +1166,6 @@ dependencies = [
"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58" "checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58"
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d" "checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
"checksum hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)" = "bcb3fc65554155980167fb821d05c7c66177f92464976c0b676a19d9e03387a7" "checksum hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)" = "bcb3fc65554155980167fb821d05c7c66177f92464976c0b676a19d9e03387a7"
"checksum hyper-rustls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aaa757ec75ba51b7dfeef94696ceb6b8b44be7775a524e1d7b64102481a7e43e"
"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" "checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11"
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1" "checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
"checksum json_macros 0.3.1 (git+https://github.com/plietar/json_macros)" = "<none>" "checksum json_macros 0.3.1 (git+https://github.com/plietar/json_macros)" = "<none>"
@ -1278,12 +1212,10 @@ dependencies = [
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" "checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
"checksum ring 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7609de2b0dbc70eb7b27a1c2508aff1af9be7c05265ce19d98631b91281ee4"
"checksum rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab6e42be826e215f30ff830904f8f4a0933c6e2ae890e1af8b408f5bae60081e" "checksum rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab6e42be826e215f30ff830904f8f4a0933c6e2ae890e1af8b408f5bae60081e"
"checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" "checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b"
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
"checksum rustls 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "340c03bcbc24e09a1fb49027a480c5dd2950edc2746e324ec684917ab84b56a0"
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d" "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
"checksum serde 0.8.21 (registry+https://github.com/rust-lang/crates.io-index)" = "7b7c6bf11cf766473ea1d53eb4e3bc4e80f31f50082fc24077cf06f600279a66" "checksum serde 0.8.21 (registry+https://github.com/rust-lang/crates.io-index)" = "7b7c6bf11cf766473ea1d53eb4e3bc4e80f31f50082fc24077cf06f600279a66"
@ -1323,7 +1255,6 @@ dependencies = [
"checksum unicode-bidi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b61814f3e7fd0e0f15370f767c7c943e08bc2e3214233ae8f88522b334ceb778" "checksum unicode-bidi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b61814f3e7fd0e0f15370f767c7c943e08bc2e3214233ae8f88522b334ceb778"
"checksum unicode-normalization 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5e94e9f6961090fcc75180629c4ef33e5310d6ed2c0dd173f4ca63c9043b669e" "checksum unicode-normalization 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5e94e9f6961090fcc75180629c4ef33e5310d6ed2c0dd173f4ca63c9043b669e"
"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" "checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
"checksum untrusted 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "193df64312e3515fd983ded55ad5bcaa7647a035804828ed757e832ce6029ef3"
"checksum url 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4a3440c1ed62af4a2aee71c6fb78ef32ddcb75cfa24bf42f45e07c02b6d6a2f6" "checksum url 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4a3440c1ed62af4a2aee71c6fb78ef32ddcb75cfa24bf42f45e07c02b6d6a2f6"
"checksum url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f024e241a55f5c88401595adc1d4af0c9649e91da82d0e190fe55950231ae575" "checksum url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f024e241a55f5c88401595adc1d4af0c9649e91da82d0e190fe55950231ae575"
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
@ -1334,8 +1265,6 @@ dependencies = [
"checksum vorbis-encoder 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3fb66bcdde056dd230991bb86669a1269778fe8ad1f6cee403428ac7985391bc" "checksum vorbis-encoder 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3fb66bcdde056dd230991bb86669a1269778fe8ad1f6cee403428ac7985391bc"
"checksum vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "729e1f15395850b4e6d19ca0cd1d42ef44707503a53b69d40ff49182b3c5589d" "checksum vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "729e1f15395850b4e6d19ca0cd1d42ef44707503a53b69d40ff49182b3c5589d"
"checksum vorbisfile-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f4306d7e1ac4699b55e20de9483750b90c250913188efd7484db6bfbe9042d1" "checksum vorbisfile-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f4306d7e1ac4699b55e20de9483750b90c250913188efd7484db6bfbe9042d1"
"checksum webpki 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9cf747b3007eb728e9b130d09540394b7e0a57444f5981f5f2d44c86ba22ce60"
"checksum webpki-roots 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73093f9095120f5d3b3ea923ff09e50c3d44bffb0bb27ecf85f3ff442ecdf826"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"

View file

@ -28,7 +28,6 @@ env_logger = "0.3.2"
eventual = "0.1.6" eventual = "0.1.6"
getopts = "0.2.14" getopts = "0.2.14"
hyper = { version = "0.9.1", default-features = false } hyper = { version = "0.9.1", default-features = false }
hyper-rustls = "0.2.1"
lazy_static = "0.2.0" lazy_static = "0.2.0"
linear-map = "1.0" linear-map = "1.0"
lmdb-rs = "0.7.2" lmdb-rs = "0.7.2"
@ -37,7 +36,6 @@ num = "0.1.30"
protobuf = "1.0.15" protobuf = "1.0.15"
rand = "0.3.13" rand = "0.3.13"
rpassword = "0.3.0" rpassword = "0.3.0"
rustls = "0.5.3"
rust-crypto = "0.2.34" rust-crypto = "0.2.34"
rustc-serialize = "0.3.16" rustc-serialize = "0.3.16"
serde = "0.8" serde = "0.8"

View file

@ -44,15 +44,6 @@ target/release/librespot --username USERNAME --cache CACHEDIR --name DEVICENAME
*librespot* can be run in discovery mode, in which case no password is required at startup. *librespot* can be run in discovery mode, in which case no password is required at startup.
For that, simply omit the `--username` argument. For that, simply omit the `--username` argument.
## Facebook Accounts
*librespot* can use Facebook for authentication.
```shell
target/release/librespot --cache CACHEDIR --name DEVICENAME --facebook
```
This will print a link to the console, which must be visited on the same computer *librespot* is running on.
## Audio Backends ## Audio Backends
*librespot* supports various audio backends. Multiple backends can be enabled at compile time by enabling the *librespot* supports various audio backends. Multiple backends can be enabled at compile time by enabling the
corresponding cargo feature. By default, only PortAudio is enabled. corresponding cargo feature. By default, only PortAudio is enabled.

View file

@ -1,11 +1,9 @@
const APRESOLVE_ENDPOINT : &'static str = "https://apresolve.spotify.com/"; const APRESOLVE_ENDPOINT : &'static str = "http://apresolve.spotify.com/";
const AP_FALLBACK : &'static str = "ap.spotify.com:80"; const AP_FALLBACK : &'static str = "ap.spotify.com:80";
use hyper; use hyper;
use hyper_rustls;
use std::io::Read; use std::io::Read;
use serde_json; use serde_json;
use hyper::net::HttpsConnector;
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
pub struct APResolveData { pub struct APResolveData {
@ -13,8 +11,7 @@ pub struct APResolveData {
} }
pub fn apresolve() -> String { pub fn apresolve() -> String {
let connector = HttpsConnector::new(hyper_rustls::TlsClient::new()); let client = hyper::Client::new();
let client = hyper::Client::with_connector(connector);
(|| { (|| {
let mut response = client.get(APRESOLVE_ENDPOINT).send().map_err(|_| ())?; let mut response = client.get(APRESOLVE_ENDPOINT).send().map_err(|_| ())?;

View file

@ -1,108 +0,0 @@
use hyper;
use hyper::header::AccessControlAllowOrigin;
use hyper::net::HttpsConnector;
use hyper::net::NetworkListener;
use hyper::server::Request;
use hyper::server::Response;
use hyper::uri::RequestUri;
use hyper_rustls;
use rand::{self, Rng};
use rustls;
use serde_json;
use std::collections::BTreeMap;
use std::io::Read;
use std::sync::{mpsc, Mutex};
use url;
use protocol::authentication::AuthenticationType;
use authentication::Credentials;
use spotilocal::{SPOTILOCAL_CERT, SPOTILOCAL_KEY};
struct ServerHandler {
token_tx: Mutex<mpsc::Sender<String>>,
csrf: String,
}
impl ServerHandler {
fn handle_login(&self, params: &BTreeMap<String, String>) -> hyper::status::StatusCode {
let token = params.get("access_token").unwrap();
let csrf = params.get("csrf").unwrap();
if *csrf == self.csrf {
self.token_tx.lock().unwrap().send(token.to_owned()).unwrap();
hyper::status::StatusCode::Ok
} else {
hyper::status::StatusCode::Forbidden
}
}
}
impl hyper::server::Handler for ServerHandler {
fn handle<'a, 'k>(&'a self, request: Request<'a, 'k>, mut response: Response<'a, hyper::net::Fresh>) {
response.headers_mut().set(AccessControlAllowOrigin::Value("https://login.spotify.com".to_owned()));
*response.status_mut() = if let RequestUri::AbsolutePath(path) = request.uri {
let (path, query, _) = url::parse_path(&path).unwrap();
let params = query.map_or(vec![], |q| url::form_urlencoded::parse(q.as_bytes()))
.into_iter().collect::<BTreeMap<_,_>>();
debug!("{:?} {:?} {:?}", request.method, path, params);
if request.method == hyper::method::Method::Get && path == vec!["login", "facebook_login_sso.json"] {
self.handle_login(&params)
} else {
hyper::status::StatusCode::NotFound
}
} else {
hyper::status::StatusCode::NotFound
}
}
}
fn facebook_get_me_id(token: &str) -> Result<String, ()> {
let url = format!("https://graph.facebook.com/me?fields=id&access_token={}", token);
let connector = HttpsConnector::new(hyper_rustls::TlsClient::new());
let client = hyper::Client::with_connector(connector);
let mut response = client.get(&url).send().unwrap();
let mut body = String::new();
response.read_to_string(&mut body).unwrap();
let mut result : BTreeMap<String, String> = serde_json::from_str(&body).unwrap();
Ok(result.remove("id").unwrap())
}
pub fn facebook_login() -> Result<Credentials, ()> {
let (tx, rx) = mpsc::channel();
let csrf = rand::thread_rng().gen_ascii_chars().take(32).collect::<String>();
let handler = ServerHandler {
token_tx: Mutex::new(tx),
csrf: csrf.clone()
};
let mut cert_data = SPOTILOCAL_CERT;
let mut key_data = SPOTILOCAL_KEY;
let certs = rustls::internal::pemfile::certs(&mut cert_data).unwrap();
let key = rustls::internal::pemfile::rsa_private_keys(&mut key_data).unwrap().swap_remove(0);
let tls = hyper_rustls::TlsServer::new(certs, key);
let mut listener = hyper::net::HttpsListener::new("127.0.0.1:0", tls).unwrap();
let port = listener.local_addr().unwrap().port();
let mut server = hyper::Server::new(listener).handle(handler).unwrap();
println!("Logging in using Facebook, please visit https://login.spotify.com/login-facebook-sso/?csrf={}&port={} in your browser.",
csrf, port);
let token = rx.recv().unwrap();
let user_id = facebook_get_me_id(&token).unwrap();
let cred = Credentials {
username: user_id,
auth_type: AuthenticationType::AUTHENTICATION_FACEBOOK_TOKEN,
auth_data: token.as_bytes().to_owned(),
};
server.close().unwrap();
Ok(cred)
}

View file

@ -170,6 +170,3 @@ fn deserialize_base64<D>(de: &mut D) -> Result<Vec<u8>, D::Error>
mod discovery; mod discovery;
pub use self::discovery::discovery_login; pub use self::discovery::discovery_login;
mod facebook;
pub use self::facebook::facebook_login;

View file

@ -1,35 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIGGzCCBQOgAwIBAgIQCMsbyFVsBNk7vWlJ7YFryjANBgkqhkiG9w0BAQsFADBN
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E
aWdpQ2VydCBTSEEyIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTQxMTI4MDAwMDAwWhcN
MTcxMjA2MTIwMDAwWjBlMQswCQYDVQQGEwJTRTESMBAGA1UECBMJU3RvY2tob2xt
MRIwEAYDVQQHEwlTdG9ja2hvbG0xEzARBgNVBAoTClNwb3RpZnkgQUIxGTAXBgNV
BAMMECouc3BvdGlsb2NhbC5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK
AoICAQDwccCju1/MY/lVM+2j0Hiu/M4u8jbR5ctk11U3i3ugYF4xwyqzbh8ziQq6
9atIDg33OTEGGD1m2LkOursIRng6UUth1wqdRlRylHG2p4JYW22WEa730hnysSDn
AHLfFawfHh40BPwLY7UD/0c0J8dUTu7Xx3fNHcJATQAHO7KlhTj+t+axUvFj+AxK
0YyGZKmyS4GATtdDuI7uFp188iDI3zZgSI7A4svoDUvn3yGA2G7sgOG1va8aYVRW
ftD5f2minppMy3UKt8XVGM+CuFMbQbLaTnQCW6t3fj/luscX4mlBC7pWj+swfoC2
q5LvV3vErA8q6jPKDZElps8KRqeLvqkSheKI9Zh7+foijkAkC1kJGbJiX7BnFhM1
EKKS6xda4tbewDVBseguO5b37Xqvh3vexSC42q/lxGbo7Md2LlgkORoeGYw7wzDH
OoVvYmgktmwEccNu6BtjT0ql9OW3/+PPxxBXL/85crFWrMieNBf3eLeiT5ncv/mR
JD+EB4QTTiUvZokEbG8/haGNrJVxDImBIqc4B9dUdikNkwr+cFgjdJezM8FBy7vd
5suQHfeLYeqkc+pN097jw6qWdIA2ZPr/96IhIb1Pg0rIC+N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Tzny4lnrSiTDm5VLUWHQaW4KHTF0RVG2xur4=
-----END RSA PRIVATE KEY-----

View file

@ -18,7 +18,6 @@ extern crate env_logger;
extern crate eventual; extern crate eventual;
extern crate getopts; extern crate getopts;
extern crate hyper; extern crate hyper;
extern crate hyper_rustls;
extern crate linear_map; extern crate linear_map;
extern crate lmdb_rs; extern crate lmdb_rs;
extern crate mdns; extern crate mdns;
@ -27,7 +26,6 @@ extern crate protobuf;
extern crate rand; extern crate rand;
extern crate rpassword; extern crate rpassword;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate rustls;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate shannon; extern crate shannon;
@ -61,7 +59,6 @@ pub mod link;
pub mod main_helper; pub mod main_helper;
pub mod metadata; pub mod metadata;
pub mod player; pub mod player;
pub mod spotilocal;
pub mod stream; pub mod stream;
pub mod util; pub mod util;
pub mod version; pub mod version;

View file

@ -7,7 +7,7 @@ use std::path::PathBuf;
use std::process::exit; use std::process::exit;
use audio_backend::{BACKENDS, Sink}; use audio_backend::{BACKENDS, Sink};
use authentication::{Credentials, facebook_login, discovery_login}; use authentication::{Credentials, discovery_login};
use cache::{Cache, DefaultCache, NoCache}; use cache::{Cache, DefaultCache, NoCache};
use player::Player; use player::Player;
use session::{Bitrate, Config, Session}; use session::{Bitrate, Config, Session};
@ -47,8 +47,7 @@ pub fn add_session_arguments(opts: &mut getopts::Options) {
pub fn add_authentication_arguments(opts: &mut getopts::Options) { pub fn add_authentication_arguments(opts: &mut getopts::Options) {
opts.optopt("u", "username", "Username to sign in with", "USERNAME") opts.optopt("u", "username", "Username to sign in with", "USERNAME")
.optopt("p", "password", "Password", "PASSWORD") .optopt("p", "password", "Password", "PASSWORD");
.optflag("", "facebook", "Login with a Facebook account");
} }
pub fn add_player_arguments(opts: &mut getopts::Options) { pub fn add_player_arguments(opts: &mut getopts::Options) {
@ -113,9 +112,6 @@ pub fn get_credentials(session: &Session, matches: &getopts::Matches) -> Credent
Credentials::with_password(username.clone(), password) Credentials::with_password(username.clone(), password)
} }
(None, _, _) if matches.opt_present("facebook")
=> facebook_login().unwrap(),
(None, _, Some(credentials)) (None, _, Some(credentials))
=> credentials, => credentials,

View file

@ -1,2 +0,0 @@
pub static SPOTILOCAL_CERT : &'static [u8] = include_bytes!("data/spotilocal.cert");
pub static SPOTILOCAL_KEY : &'static [u8] = include_bytes!("data/spotilocal.key");