fix: video embeds

add: listening state api
This commit is contained in:
trisua 2025-04-26 21:55:32 -04:00
parent 498884291e
commit a114d862ae
4 changed files with 39 additions and 11 deletions

View file

@ -1,5 +1,5 @@
use std::collections::HashMap;
use axum::{response::IntoResponse, Extension, Json};
use axum::{extract::Path, response::IntoResponse, Extension, Json};
use axum_extra::extract::CookieJar;
use tetratto_core::{
database::connections::last_fm::LastFmConnection,
@ -49,6 +49,29 @@ pub async fn create_request(
})
}
pub async fn get_request(
Extension(data): Extension<State>,
Path(username): Path<String>,
) -> impl IntoResponse {
let data = &(data.read().await).0;
let profile = match data.get_user_by_username(&username).await {
Ok(ua) => ua,
Err(e) => return Json(e.into()),
};
let con = match profile.connections.get(&ConnectionService::LastFm) {
Some(c) => c,
None => return Json(Error::GeneralNotFound("connection".to_string()).into()),
};
Json(ApiReturn {
ok: true,
message: "Connection exists".to_string(),
payload: Some(con.1.clone()),
})
}
pub async fn proxy_request(
jar: CookieJar,
Extension(data): Extension<State>,