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:
KD
2025-10-22 21:42:19 -04:00
committed by GitHub
parent 381dd49b56
commit 351b4acb1c
5 changed files with 8 additions and 19 deletions
+2 -10
View File
@@ -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)
}
+1 -4
View File
@@ -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) => {