mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-10 06:25:00 +00:00
Update download route to return 'details'
This commit is contained in:
parent
0acdfffe08
commit
2e9fb2a830
6 changed files with 23 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1449,7 +1449,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pict-rs"
|
name = "pict-rs"
|
||||||
version = "0.3.0-alpha.2"
|
version = "0.3.0-alpha.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-form-data",
|
"actix-form-data",
|
||||||
"actix-fs",
|
"actix-fs",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pict-rs"
|
name = "pict-rs"
|
||||||
description = "A simple image hosting service"
|
description = "A simple image hosting service"
|
||||||
version = "0.3.0-alpha.2"
|
version = "0.3.0-alpha.3"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -190,7 +190,7 @@ RUN \
|
||||||
pictrs && \
|
pictrs && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get upgrade -y && \
|
apt-get upgrade -y && \
|
||||||
apt-get install -y \
|
apt-get install -y --no-install-recommends \
|
||||||
libgexiv2-2 \
|
libgexiv2-2 \
|
||||||
libpng16-16 \
|
libpng16-16 \
|
||||||
libjpeg8 \
|
libjpeg8 \
|
||||||
|
|
|
@ -191,7 +191,7 @@ RUN \
|
||||||
pictrs && \
|
pictrs && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get upgrade -y && \
|
apt-get upgrade -y && \
|
||||||
apt-get install -y \
|
apt-get install -y --no-install-recommends \
|
||||||
libgexiv2-2 \
|
libgexiv2-2 \
|
||||||
libpng16-16 \
|
libpng16-16 \
|
||||||
libjpeg8 \
|
libjpeg8 \
|
||||||
|
|
|
@ -191,7 +191,7 @@ RUN \
|
||||||
pictrs && \
|
pictrs && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get upgrade -y && \
|
apt-get upgrade -y && \
|
||||||
apt-get install -y \
|
apt-get install -y --no-install-recommends \
|
||||||
libgexiv2-2 \
|
libgexiv2-2 \
|
||||||
libpng16-16 \
|
libpng16-16 \
|
||||||
libjpeg8 \
|
libjpeg8 \
|
||||||
|
|
19
src/main.rs
19
src/main.rs
|
@ -214,11 +214,28 @@ async fn download(
|
||||||
let alias = manager.upload(stream).await?;
|
let alias = manager.upload(stream).await?;
|
||||||
let delete_token = manager.delete_token(alias.clone()).await?;
|
let delete_token = manager.delete_token(alias.clone()).await?;
|
||||||
|
|
||||||
|
let name = manager.from_alias(alias.to_owned()).await?;
|
||||||
|
let mut path = manager.image_dir();
|
||||||
|
path.push(name.clone());
|
||||||
|
|
||||||
|
let details = manager.variant_details(path.clone(), name.clone()).await?;
|
||||||
|
|
||||||
|
let details = if let Some(details) = details {
|
||||||
|
details
|
||||||
|
} else {
|
||||||
|
let new_details = Details::from_path(path.clone()).await?;
|
||||||
|
manager
|
||||||
|
.store_variant_details(path, name, &new_details)
|
||||||
|
.await?;
|
||||||
|
new_details
|
||||||
|
};
|
||||||
|
|
||||||
Ok(HttpResponse::Created().json(serde_json::json!({
|
Ok(HttpResponse::Created().json(serde_json::json!({
|
||||||
"msg": "ok",
|
"msg": "ok",
|
||||||
"files": [{
|
"files": [{
|
||||||
"file": alias,
|
"file": alias,
|
||||||
"delete_token": delete_token
|
"delete_token": delete_token,
|
||||||
|
"details": details,
|
||||||
}]
|
}]
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue