Change file id variant CID to CD

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 2 years ago
parent 77241ebc2d
commit b315024c6a

@ -1,6 +1,6 @@
[package]
name = "mediarepo-api"
version = "0.21.0"
version = "0.22.0"
edition = "2018"
license = "gpl-3"

@ -122,10 +122,7 @@ pub async fn read_file(
Ok(buffer.buf)
} else {
let api = api_state.api().await?;
let content = api
.file
.read_file(FileIdentifier::CID(hash.clone()))
.await?;
let content = api.file.read_file(FileIdentifier::CD(hash.clone())).await?;
Ok(content)
}

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

@ -3,5 +3,5 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum FileIdentifier {
ID(i64),
CID(String),
CD(String),
}

Loading…
Cancel
Save