|
|
@ -69,12 +69,12 @@ async fn content_scheme<R: Runtime>(app: &AppHandle<R>, request: &Request) -> Re
|
|
|
|
let api = api_state.api().await?;
|
|
|
|
let api = api_state.api().await?;
|
|
|
|
let file = api
|
|
|
|
let file = api
|
|
|
|
.file
|
|
|
|
.file
|
|
|
|
.get_file(FileIdentifier::CID(hash.to_string()))
|
|
|
|
.get_file(FileIdentifier::CD(hash.to_string()))
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
|
let mime = file.mime_type;
|
|
|
|
let mime = file.mime_type;
|
|
|
|
let bytes = api
|
|
|
|
let bytes = api
|
|
|
|
.file
|
|
|
|
.file
|
|
|
|
.read_file(FileIdentifier::CID(hash.to_string()))
|
|
|
|
.read_file(FileIdentifier::CD(hash.to_string()))
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
|
tracing::debug!("Received {} content bytes", bytes.len());
|
|
|
|
tracing::debug!("Received {} content bytes", bytes.len());
|
|
|
|
buf_state.add_entry(hash.to_string(), mime.clone(), bytes.clone());
|
|
|
|
buf_state.add_entry(hash.to_string(), mime.clone(), bytes.clone());
|
|
|
@ -121,7 +121,7 @@ async fn thumb_scheme<R: Runtime>(app: &AppHandle<R>, request: &Request) -> Resu
|
|
|
|
let (thumb, bytes) = api
|
|
|
|
let (thumb, bytes) = api
|
|
|
|
.file
|
|
|
|
.file
|
|
|
|
.get_thumbnail_of_size(
|
|
|
|
.get_thumbnail_of_size(
|
|
|
|
FileIdentifier::CID(hash.to_string()),
|
|
|
|
FileIdentifier::CD(hash.to_string()),
|
|
|
|
((height as f32 * 0.8) as u32, (width as f32 * 0.8) as u32),
|
|
|
|
((height as f32 * 0.8) as u32, (width as f32 * 0.8) as u32),
|
|
|
|
((height as f32 * 1.2) as u32, (width as f32 * 1.2) as u32),
|
|
|
|
((height as f32 * 1.2) as u32, (width as f32 * 1.2) as u32),
|
|
|
|
)
|
|
|
|
)
|
|
|
|