mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Clean up librespot-connect dependencies
This commit is contained in:
parent
d064ffc670
commit
59c556635e
6 changed files with 42 additions and 65 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1406,7 +1406,8 @@ dependencies = [
|
|||
"base64",
|
||||
"block-modes",
|
||||
"dns-sd",
|
||||
"futures",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"hmac",
|
||||
"hyper",
|
||||
"libmdns",
|
||||
|
@ -1418,7 +1419,6 @@ dependencies = [
|
|||
"protobuf",
|
||||
"rand 0.8.3",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha-1 0.9.4",
|
||||
"tokio",
|
||||
|
|
|
@ -7,39 +7,42 @@ license = "MIT"
|
|||
repository = "https://github.com/librespot-org/librespot"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies.librespot-core]
|
||||
path = "../core"
|
||||
version = "0.1.6"
|
||||
[dependencies.librespot-playback]
|
||||
path = "../playback"
|
||||
version = "0.1.6"
|
||||
[dependencies.librespot-protocol]
|
||||
path = "../protocol"
|
||||
version = "0.1.6"
|
||||
|
||||
[dependencies]
|
||||
aes-ctr = "0.6"
|
||||
base64 = "0.13"
|
||||
block-modes = "0.7"
|
||||
futures = "0.3"
|
||||
futures-core = "0.3"
|
||||
futures-util = "0.3"
|
||||
hmac = "0.10"
|
||||
hyper = { version = "0.14", features = ["server", "http1"] }
|
||||
log = "0.4"
|
||||
num-bigint = "0.3"
|
||||
protobuf = "~2.14.0"
|
||||
rand = "0.8"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
sha-1 = "0.9"
|
||||
tokio = { version = "1.0", features = ["macros"] }
|
||||
tokio = { version = "1.0", features = ["macros", "sync"] }
|
||||
tokio-stream = { version = "0.1" }
|
||||
url = "1.7"
|
||||
|
||||
dns-sd = { version = "0.1.3", optional = true }
|
||||
libmdns = { version = "0.6", optional = true }
|
||||
|
||||
[dependencies.librespot-core]
|
||||
path = "../core"
|
||||
version = "0.1.6"
|
||||
|
||||
[dependencies.librespot-playback]
|
||||
path = "../playback"
|
||||
version = "0.1.6"
|
||||
|
||||
[dependencies.librespot-protocol]
|
||||
path = "../protocol"
|
||||
version = "0.1.6"
|
||||
|
||||
[features]
|
||||
default = ["libmdns"]
|
||||
with-libmdns = ["libmdns"]
|
||||
with-dns-sd = ["dns-sd"]
|
||||
|
||||
default = ["with-libmdns"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::core::spotify_id::SpotifyId;
|
||||
use crate::protocol::spirc::TrackRef;
|
||||
use librespot_core::spotify_id::SpotifyId;
|
||||
|
||||
use serde;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct StationContext {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use aes_ctr::cipher::generic_array::GenericArray;
|
||||
use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher};
|
||||
use aes_ctr::Aes128Ctr;
|
||||
use base64;
|
||||
use futures::channel::{mpsc, oneshot};
|
||||
use futures::{Stream, StreamExt};
|
||||
use futures_core::Stream;
|
||||
use hmac::{Hmac, Mac, NewMac};
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
use hyper::{Body, Method, Request, Response, StatusCode};
|
||||
use serde_json::json;
|
||||
use sha1::{Digest, Sha1};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::convert::Infallible;
|
||||
|
@ -50,7 +50,7 @@ impl Discovery {
|
|||
config: ConnectConfig,
|
||||
device_id: String,
|
||||
) -> (Discovery, mpsc::UnboundedReceiver<Credentials>) {
|
||||
let (tx, rx) = mpsc::unbounded();
|
||||
let (tx, rx) = mpsc::unbounded_channel();
|
||||
|
||||
let key_data = util::rand_vec(&mut rand::thread_rng(), 95);
|
||||
let private_key = BigUint::from_bytes_be(&key_data);
|
||||
|
@ -155,7 +155,7 @@ impl Discovery {
|
|||
let credentials =
|
||||
Credentials::with_blob(username.to_string(), &decrypted, &self.0.device_id);
|
||||
|
||||
self.0.tx.unbounded_send(credentials).unwrap();
|
||||
self.0.tx.send(credentials).unwrap();
|
||||
|
||||
let result = json!({
|
||||
"status": 101,
|
||||
|
@ -273,6 +273,6 @@ impl Stream for DiscoveryStream {
|
|||
type Item = Credentials;
|
||||
|
||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
self.credentials.poll_next_unpin(cx)
|
||||
self.credentials.poll_recv(cx)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,9 @@
|
|||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde;
|
||||
|
||||
extern crate base64;
|
||||
extern crate futures;
|
||||
extern crate hyper;
|
||||
extern crate num_bigint;
|
||||
extern crate protobuf;
|
||||
extern crate rand;
|
||||
extern crate tokio;
|
||||
extern crate url;
|
||||
|
||||
extern crate aes_ctr;
|
||||
extern crate block_modes;
|
||||
extern crate hmac;
|
||||
extern crate sha1;
|
||||
|
||||
#[cfg(feature = "with-dns-sd")]
|
||||
extern crate dns_sd;
|
||||
|
||||
#[cfg(not(feature = "with-dns-sd"))]
|
||||
extern crate libmdns;
|
||||
|
||||
extern crate librespot_core;
|
||||
extern crate librespot_playback as playback;
|
||||
extern crate librespot_protocol as protocol;
|
||||
use librespot_core as core;
|
||||
use librespot_playback as playback;
|
||||
use librespot_protocol as protocol;
|
||||
|
||||
pub mod context;
|
||||
pub mod discovery;
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use crate::context::StationContext;
|
||||
use crate::core::config::{ConnectConfig, VolumeCtrl};
|
||||
use crate::core::mercury::{MercuryError, MercurySender};
|
||||
use crate::core::session::Session;
|
||||
use crate::core::spotify_id::{SpotifyAudioType, SpotifyId, SpotifyIdError};
|
||||
use crate::core::util::url_encode;
|
||||
use crate::core::util::SeqGenerator;
|
||||
use crate::core::version;
|
||||
use crate::playback::mixer::Mixer;
|
||||
use crate::playback::player::{Player, PlayerEvent, PlayerEventChannel};
|
||||
use crate::protocol;
|
||||
use crate::protocol::spirc::{DeviceState, Frame, MessageType, PlayStatus, State, TrackRef};
|
||||
|
||||
use futures::future::{self, FusedFuture};
|
||||
use futures::stream::FusedStream;
|
||||
use futures::{Future, FutureExt, StreamExt};
|
||||
use librespot_core::config::{ConnectConfig, VolumeCtrl};
|
||||
use librespot_core::mercury::{MercuryError, MercurySender};
|
||||
use librespot_core::session::Session;
|
||||
use librespot_core::spotify_id::{SpotifyAudioType, SpotifyId, SpotifyIdError};
|
||||
use librespot_core::util::url_encode;
|
||||
use librespot_core::util::SeqGenerator;
|
||||
use librespot_core::version;
|
||||
use futures_util::future::{self, FusedFuture};
|
||||
use futures_util::stream::FusedStream;
|
||||
use futures_util::{FutureExt, StreamExt};
|
||||
use protobuf::{self, Message};
|
||||
use rand;
|
||||
use rand::seq::SliceRandom;
|
||||
use serde_json;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
|
||||
|
|
Loading…
Reference in a new issue