chore: update dependencies
This commit is contained in:
parent
9963cff724
commit
e684cfb84e
4 changed files with 751 additions and 634 deletions
|
|
@ -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())
|
||||
.await
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?,
|
||||
)
|
||||
Ok(axum::serve(listener, app.into_make_service())
|
||||
.await
|
||||
.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…
Add table
Add a link
Reference in a new issue