Skip to content

Commit

Permalink
将web服务移至可选feature (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
hguandl committed Feb 17, 2024
1 parent b8dda9f commit fdc2e9e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/biliup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ m3u8-rs = "5.0.3"
nom = "7"
chrono = "0.4"
byteorder = "1.4.3"
indexmap = "2.1.0"
indexmap = { version = "2.1.0", optional = true }
regex = "1.6.0"
async-trait = "0.1.57"
humantime = "2.1.0"
axum = "0.7.3"
tower-http = { version = "0.5.0", features = ["cors"] }
axum = { version = "0.7.3", optional = true }
tower-http = { version = "0.5.0", features = ["cors"], optional = true }
reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "blocking", "deflate", "gzip", "rustls-tls"] }
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "sqlite" ] }
sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "sqlite" ], optional = true }

[build-dependencies]
native-tls = { version = "0.2.11", features = ["vendored"] }
openssl = { version = "0.10.42", features = ["vendored"] }

[features]
server = ["indexmap", "axum", "tower-http", "sqlx"]
1 change: 1 addition & 0 deletions crates/biliup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use tracing::info;
pub mod client;
pub mod downloader;
pub mod error;
#[cfg(feature = "server")]
pub mod server;
pub mod uploader;

Expand Down
1 change: 1 addition & 0 deletions crates/bin/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub enum Commands {
#[arg(long)]
split_time: Option<humantime::Duration>,
},
#[cfg(feature = "server")]
/// 启动web服务,默认端口19159
Server {
/// Specify bind address
Expand Down
2 changes: 2 additions & 0 deletions crates/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod cli;
mod downloader;
#[cfg(feature = "server")]
mod server;
mod uploader;

Expand Down Expand Up @@ -73,6 +74,7 @@ async fn main() -> Result<()> {
split_size,
split_time,
} => download(&url, output, split_size, split_time).await?,
#[cfg(feature = "server")]
Commands::Server { bind, port } => server::run((&bind, port)).await?,
Commands::List {
is_pubing,
Expand Down

0 comments on commit fdc2e9e

Please sign in to comment.