More code changes
pr CI / Test Suite (pull_request) Failing after 1m53s

This commit is contained in:
2026-08-13 10:44:44 -04:00
parent 57bf21a406
commit c8d13d5097
3 changed files with 67 additions and 50 deletions
+38 -19
View File
@@ -352,28 +352,47 @@ pub mod endpoint {
)]
pub async fn download_queued_song(
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
axum::extract::Path(song_queue_id): axum::extract::Path<uuid::Uuid>,
) -> (axum::http::StatusCode, axum::response::Response) {
println!("Id: {id}");
println!("Id: {song_queue_id}");
match repo::song::get_data(&pool, &id).await {
Ok(data) => {
let by = axum::body::Bytes::from(data);
let mut response = by.into_response();
let headers = response.headers_mut();
headers.insert(
axum::http::header::CONTENT_TYPE,
"audio/flac".parse().unwrap(),
);
headers.insert(
axum::http::header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{id}.flac\"")
.parse()
.unwrap(),
);
let lab_config = crate::util::maze::get_config();
(axum::http::StatusCode::OK, response)
}
let lr = labyrinth::Labyrinth { config: lab_config };
/*
let data = labyrinth::Data {
raw_data: copied_raw_data,
..Default::default()
};
*/
match repo::data::get_with_song_queue_id(&pool, &song_queue_id).await {
Ok((id, file_key, _bucket, _region, _)) => match lr.download(&file_key).await {
Ok(data) => {
let by = axum::body::Bytes::from(data);
let mut response = by.into_response();
let headers = response.headers_mut();
headers.insert(
axum::http::header::CONTENT_TYPE,
"audio/flac".parse().unwrap(),
);
headers.insert(
axum::http::header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{id}.flac\"")
.parse()
.unwrap(),
);
(axum::http::StatusCode::OK, response)
}
Err(err) => {
eprintln!("Error: {err:?}");
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::response::Response::default(),
)
}
},
Err(_err) => (
axum::http::StatusCode::BAD_REQUEST,
axum::response::Response::default(),
+17 -9
View File
@@ -974,8 +974,9 @@ mod tests {
}
let songpath = song.song_path().unwrap();
let raw_uri =
String::from(soaricarus_api::callers::queue::endpoints::QUEUESONGUPDATE);
let raw_uri = String::from(
soaricarus_api::callers::queue::endpoints::QUEUESONGUPDATE,
);
let end_index = raw_uri.len() - 5;
let uri = format!(
@@ -1992,7 +1993,10 @@ mod tests {
let id = test_data::coverart_id().await.unwrap();
let uri = format!("{}?id={id}", soaricarus_api::callers::endpoints::GETCOVERART);
let uri = format!(
"{}?id={id}",
soaricarus_api::callers::endpoints::GETCOVERART
);
match app
.clone()
@@ -2126,9 +2130,11 @@ mod tests {
let (id, _, _, _) = test_data::song_id().await.unwrap();
let uri =
super::util::format_url_with_value(soaricarus_api::callers::endpoints::DOWNLOADSONG, &id)
.await;
let uri = super::util::format_url_with_value(
soaricarus_api::callers::endpoints::DOWNLOADSONG,
&id,
)
.await;
match app
.clone()
@@ -2303,9 +2309,11 @@ mod tests {
.await
.unwrap();
let uri =
super::util::format_url_with_value(soaricarus_api::callers::endpoints::DELETESONG, &id)
.await;
let uri = super::util::format_url_with_value(
soaricarus_api::callers::endpoints::DELETESONG,
&id,
)
.await;
match app
.clone()
+12 -22
View File
@@ -1,27 +1,17 @@
pub mod maze {
pub fn get_config() -> labyrinth::config::Config {
let s3_endpoint_url = sienvy::environment::get_env("S3_ENDPOINT_URL");
let bucket_name = sienvy::environment::get_env("S3_BUCKET_NAME");
let region = sienvy::environment::get_env("GARAGE_S3_REGION");
let access_key_id = sienvy::environment::get_env("GARAGE_DEFAULT_ACCESS_KEY");
let secret_key = sienvy::environment::get_env("GARAGE_DEFAULT_SECRET_KEY");
let s3_endpoint_url =
sienvy::environment::get_env("S3_ENDPOINT_URL");
let bucket_name =
sienvy::environment::get_env("S3_BUCKET_NAME");
let region =
sienvy::environment::get_env("GARAGE_S3_REGION");
let access_key_id = sienvy::environment::get_env(
"GARAGE_DEFAULT_ACCESS_KEY",
);
let secret_key = sienvy::environment::get_env(
"GARAGE_DEFAULT_SECRET_KEY",
);
labyrinth::config::Config {
url: s3_endpoint_url.value,
bucket: bucket_name.value,
region: region.value,
access_key_id: access_key_id.value,
secret_key: secret_key.value,
}
labyrinth::config::Config {
url: s3_endpoint_url.value,
bucket: bucket_name.value,
region: region.value,
access_key_id: access_key_id.value,
secret_key: secret_key.value,
}
}
}