chore: update dependencies
parent
9963cff724
commit
e684cfb84e
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@ authors = ["Jef Roosens"]
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
axum = { version = "0.6.18", features = ["http2"] }
|
||||
axum = { version = "0.7.5", features = ["http2"] }
|
||||
chrono = { version = "0.4.26", features = ["serde"] }
|
||||
clap = { version = "4.3.12", features = ["env", "derive"] }
|
||||
futures = "0.3.28"
|
||||
|
@ -18,7 +18,7 @@ sha256 = "1.1.4"
|
|||
tokio = { version = "1.29.1", features = ["full"] }
|
||||
tokio-util = { version = "0.7.8", features = ["io"] }
|
||||
tower = { version = "0.4.13", features = ["make"] }
|
||||
tower-http = { version = "0.4.1", features = ["fs", "trace", "auth"] }
|
||||
tower-http = { version = "0.5.2", features = ["fs", "trace", "auth"] }
|
||||
tracing = "0.1.37"
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
uuid = { version = "1.4.0", features = ["v4"] }
|
||||
|
|
|
@ -101,12 +101,11 @@ impl Cli {
|
|||
.with_state(global)
|
||||
.layer(TraceLayer::new_for_http());
|
||||
|
||||
let domain: String = format!("0.0.0.0:{}", self.port).parse().unwrap();
|
||||
let listener = tokio::net::TcpListener::bind(domain).await?;
|
||||
// run it with hyper on localhost:3000
|
||||
Ok(
|
||||
axum::Server::bind(&format!("0.0.0.0:{}", self.port).parse().unwrap())
|
||||
.serve(app.into_make_service())
|
||||
Ok(axum::serve(listener, app.into_make_service())
|
||||
.await
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?,
|
||||
)
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ pub use manager::RepoGroupManager;
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use axum::body::Body;
|
||||
use axum::extract::{BodyStream, Path, State};
|
||||
use axum::body::{Body, BodyDataStream};
|
||||
use axum::extract::{Path, State};
|
||||
use axum::http::Request;
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::IntoResponse;
|
||||
|
@ -98,13 +98,15 @@ async fn get_file(
|
|||
async fn post_package_archive(
|
||||
State(global): State<crate::Global>,
|
||||
Path(repo): Path<String>,
|
||||
mut body: BodyStream,
|
||||
body: Body,
|
||||
) -> crate::Result<()> {
|
||||
// We first stream the uploaded file to disk
|
||||
let uuid: uuid::fmt::Simple = Uuid::new_v4().into();
|
||||
let path = global.config.pkg_dir.join(uuid.to_string());
|
||||
let mut f = fs::File::create(&path).await?;
|
||||
|
||||
let mut body = body.into_data_stream();
|
||||
|
||||
while let Some(chunk) = body.next().await {
|
||||
f.write_all(&chunk?).await?;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue