fix: video embeds
add: listening state api
This commit is contained in:
parent
498884291e
commit
a114d862ae
4 changed files with 39 additions and 11 deletions
|
@ -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>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue