tsk-211: Fix SQL error when checking queue (#217)
* tsk-211: Fixing error on getting queue item * tsk-211: Some cleanup * tsk-211: Cleanup * tsk-211: Updated readme * tsk-211: Version bump
This commit was merged in pull request #217.
This commit is contained in:
Generated
+1
-1
@@ -834,7 +834,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icarus"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-extra",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "icarus"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
edition = "2024"
|
||||
rust-version = "1.90"
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ Web API for the Icarus project.
|
||||
|
||||
|
||||
### Requires
|
||||
`icarus_auth` v0.6.1
|
||||
`songparser` v0.4.2
|
||||
`icarus_auth` +v0.6.5
|
||||
`songparser` +v0.4.8
|
||||
|
||||
### Compatible with
|
||||
`icarus-dm` v0.8.2
|
||||
`icarus-dm` v0.8.4
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
+2
-10
@@ -67,8 +67,6 @@ pub async fn auth<B>(
|
||||
req: Request<axum::body::Body>,
|
||||
next: Next,
|
||||
) -> Result<impl IntoResponse, (StatusCode, Json<ErrorResponse>)> {
|
||||
println!("Cookie: {cookie_jar:?}");
|
||||
|
||||
let token = cookie_jar
|
||||
.get("token")
|
||||
.map(|cookie| cookie.value().to_string())
|
||||
@@ -76,10 +74,7 @@ pub async fn auth<B>(
|
||||
req.headers()
|
||||
.get(axum::http::header::AUTHORIZATION)
|
||||
.and_then(|auth_header| auth_header.to_str().ok())
|
||||
.and_then(|auth_value| {
|
||||
println!("Auth value: {auth_value:?}");
|
||||
auth_value.strip_prefix("Bearer ").map(String::from)
|
||||
})
|
||||
.and_then(|auth_value| auth_value.strip_prefix("Bearer ").map(String::from))
|
||||
});
|
||||
|
||||
let token = token.ok_or_else(|| {
|
||||
@@ -94,9 +89,8 @@ pub async fn auth<B>(
|
||||
|
||||
let mut validation = Validation::new(jsonwebtoken::Algorithm::HS256);
|
||||
validation.set_audience(&["icarus"]); // Must match exactly what's in the token
|
||||
let claims = decode::<UserClaims>(
|
||||
let _claims = decode::<UserClaims>(
|
||||
&token,
|
||||
// TODO: Replace with code to get secret from env
|
||||
&DecodingKey::from_secret(secret_key.as_ref()),
|
||||
&validation,
|
||||
)
|
||||
@@ -110,7 +104,5 @@ pub async fn auth<B>(
|
||||
})?
|
||||
.claims;
|
||||
|
||||
println!("Claims: {claims:?}");
|
||||
|
||||
Ok(next.run(req).await)
|
||||
}
|
||||
|
||||
@@ -97,10 +97,7 @@ pub async fn get_most_recent_and_update(pool: &sqlx::PgPool) -> Result<SongQueue
|
||||
.bind(status::PROCESSING)
|
||||
.bind(status::READY)
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("Error inserting: {e}");
|
||||
});
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(row) => {
|
||||
|
||||
Reference in New Issue
Block a user