2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Merge pull request 'Update diesel-async to 0.5.0, msrv bump' (#71) from asonix/update-diesel-async-05 into main

Reviewed-on: https://git.asonix.dog/asonix/pict-rs/pulls/71
This commit is contained in:
asonix 2024-11-23 20:43:13 +00:00
commit 2e97a77ccb
12 changed files with 111 additions and 52 deletions

View file

@ -10,7 +10,7 @@ jobs:
clippy: clippy:
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs
@ -27,7 +27,7 @@ jobs:
deny: deny:
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs
@ -43,7 +43,7 @@ jobs:
tests: tests:
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs
@ -65,7 +65,7 @@ jobs:
- aarch64-unknown-linux-musl - aarch64-unknown-linux-musl
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs

View file

@ -10,7 +10,7 @@ jobs:
clippy: clippy:
runs-on: base-image runs-on: base-image
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs
@ -27,7 +27,7 @@ jobs:
# deny: # deny:
# runs-on: docker # runs-on: docker
# container: # container:
# image: docker.io/asonix/actions-base-image:0.1.21 # image: docker.io/asonix/actions-base-image:0.1.22
# steps: # steps:
# - # -
# name: Checkout pict-rs # name: Checkout pict-rs
@ -43,7 +43,7 @@ jobs:
tests: tests:
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs
@ -62,7 +62,7 @@ jobs:
- tests - tests
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -162,7 +162,7 @@ jobs:
publish-docker: publish-docker:
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
needs: [build] needs: [build]
steps: steps:
- -
@ -213,7 +213,7 @@ jobs:
needs: [build] needs: [build]
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- uses: https://github.com/actions/download-artifact@v3 - uses: https://github.com/actions/download-artifact@v3
with: with:
@ -231,7 +231,7 @@ jobs:
needs: [build] needs: [build]
runs-on: docker runs-on: docker
container: container:
image: docker.io/asonix/actions-base-image:0.1.21 image: docker.io/asonix/actions-base-image:0.1.22
steps: steps:
- -
name: Checkout pict-rs name: Checkout pict-rs

72
Cargo.lock generated
View file

@ -783,6 +783,41 @@ dependencies = [
"typenum", "typenum",
] ]
[[package]]
name = "darling"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
"darling_core",
"quote",
"syn",
]
[[package]] [[package]]
name = "dashmap" name = "dashmap"
version = "6.1.0" version = "6.1.0"
@ -846,9 +881,9 @@ dependencies = [
[[package]] [[package]]
name = "diesel" name = "diesel"
version = "2.1.6" version = "2.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" checksum = "158fe8e2e68695bd615d7e4f3227c0727b151330d3e253b525086c348d055d5e"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"byteorder", "byteorder",
@ -861,9 +896,9 @@ dependencies = [
[[package]] [[package]]
name = "diesel-async" name = "diesel-async"
version = "0.4.1" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acada1517534c92d3f382217b485db8a8638f111b0e3f2a2a8e26165050f77be" checksum = "4c5c6ec8d5c7b8444d19a47161797cbe361e0fb1ee40c6a8124ec915b64a4125"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bb8", "bb8",
@ -888,11 +923,12 @@ dependencies = [
[[package]] [[package]]
name = "diesel_derives" name = "diesel_derives"
version = "2.1.4" version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14701062d6bed917b5c7103bdffaee1e4609279e240488ad24e7bd979ca6866c" checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4"
dependencies = [ dependencies = [
"diesel_table_macro_syntax", "diesel_table_macro_syntax",
"dsl_auto_type",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@ -900,9 +936,9 @@ dependencies = [
[[package]] [[package]]
name = "diesel_table_macro_syntax" name = "diesel_table_macro_syntax"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25"
dependencies = [ dependencies = [
"syn", "syn",
] ]
@ -929,6 +965,20 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "dsl_auto_type"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607"
dependencies = [
"darling",
"either",
"heck 0.5.0",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "either" name = "either"
version = "1.13.0" version = "1.13.0"
@ -1539,6 +1589,12 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "idna" name = "idna"
version = "1.0.3" version = "1.0.3"

View file

@ -7,6 +7,10 @@ license = "AGPL-3.0"
readme = "README.md" readme = "README.md"
repository = "https://git.asonix.dog/asonix/pict-rs" repository = "https://git.asonix.dog/asonix/pict-rs"
edition = "2021" edition = "2021"
rust-version = "1.82"
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
[profile.release] [profile.release]
strip = true strip = true
@ -31,8 +35,8 @@ color-eyre = "0.6.3"
config = { version = "0.14.0", default-features = false, features = ["json", "ron", "toml", "yaml"] } config = { version = "0.14.0", default-features = false, features = ["json", "ron", "toml", "yaml"] }
console-subscriber = "0.4.0" console-subscriber = "0.4.0"
dashmap = "6.0.1" dashmap = "6.0.1"
diesel = { version = "2.1.6", features = ["postgres_backend", "serde_json", "time", "uuid"] } diesel = { version = "2.2.1", features = ["postgres_backend", "serde_json", "time", "uuid"] }
diesel-async = { version = "0.4.1", features = ["bb8", "postgres"] } diesel-async = { version = "0.5.0", features = ["bb8", "postgres"] }
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] } diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
futures-core = "0.3.30" futures-core = "0.3.30"
hex = "0.4.3" hex = "0.4.3"

View file

@ -220,7 +220,7 @@ More information is available in the [Ubuntu and Debian docs](./docs/ubuntu-and-
##### Compile from Source ##### Compile from Source
pict-rs can be compiled from source using a recent version of the rust compiler. I do development pict-rs can be compiled from source using a recent version of the rust compiler. I do development
and produce releases on 1.75 and produce releases on 1.82
Like the Binary Download option, `imagemagick`, `ffmpeg`, and `exiftool` must be installed for Like the Binary Download option, `imagemagick`, `ffmpeg`, and `exiftool` must be installed for
pict-rs to run properly. pict-rs to run properly.

View file

@ -70,7 +70,6 @@ feature-depth = 1
# A list of advisory IDs to ignore. Note that ignored advisories will still # A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered. # output a note when they are encountered.
ignore = [ ignore = [
{ id = "RUSTSEC-2024-0365", reason = "Can't update due to MSRV" },
{ id = "RUSTSEC-2024-0384", reason = "Sled 0.34.7 dependency" }, { id = "RUSTSEC-2024-0384", reason = "Sled 0.34.7 dependency" },
#"RUSTSEC-0000-0000", #"RUSTSEC-0000-0000",
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },

View file

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1726560853,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,16 +20,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1718895438, "lastModified": 1731755305,
"narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", "narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", "rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-24.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View file

@ -2,7 +2,7 @@
description = "pict-rs"; description = "pict-rs";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
@ -15,12 +15,12 @@
in in
{ {
packages = rec { packages = rec {
imagemagick7_pict-rs = pkgs.callPackage ./nix/pkgs/imagemagick_pict-rs {}; imagemagick_pict-rs = pkgs.callPackage ./nix/pkgs/imagemagick_pict-rs {};
ffmpeg6_pict-rs = pkgs.callPackage ./nix/pkgs/ffmpeg_pict-rs {}; ffmpeg6_pict-rs = pkgs.callPackage ./nix/pkgs/ffmpeg_pict-rs {};
pict-rs = pkgs.callPackage ./pict-rs.nix { pict-rs = pkgs.callPackage ./pict-rs.nix {
inherit (pkgs.darwin.apple_sdk.frameworks) Security; inherit (pkgs.darwin.apple_sdk.frameworks) Security;
inherit imagemagick7_pict-rs ffmpeg6_pict-rs; inherit imagemagick_pict-rs ffmpeg6_pict-rs;
}; };
default = pict-rs; default = pict-rs;
@ -54,7 +54,7 @@
diesel-cli diesel-cli
exiftool exiftool
garage garage
self.packages.${system}.imagemagick7_pict-rs self.packages.${system}.imagemagick_pict-rs
self.packages.${system}.ffmpeg6_pict-rs self.packages.${system}.ffmpeg6_pict-rs
jq jq
minio-client minio-client

View file

@ -1,6 +1,6 @@
{ imagemagick7 }: { imagemagick }:
imagemagick7.override { imagemagick.override {
bzip2Support = true; bzip2Support = true;
zlibSupport = true; zlibSupport = true;
libX11Support = false; libX11Support = false;

View file

@ -360,7 +360,7 @@ async fn handle_upload<S: Store + 'static>(
image.result.disarm(); image.result.disarm();
} }
Ok(HttpResponse::Created().json(&serde_json::json!({ Ok(HttpResponse::Created().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"files": files "files": files
}))) })))
@ -462,7 +462,7 @@ async fn upload_backgrounded<S: Store>(
image.result.disarm(); image.result.disarm();
} }
Ok(HttpResponse::Accepted().json(&serde_json::json!({ Ok(HttpResponse::Accepted().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"uploads": files "uploads": files
}))) })))
@ -496,7 +496,7 @@ async fn claim_upload<S: Store + 'static>(
UploadResult::Success { alias, token } => { UploadResult::Success { alias, token } => {
let details = ensure_details(&state, &alias).await?; let details = ensure_details(&state, &alias).await?;
Ok(HttpResponse::Ok().json(&serde_json::json!({ Ok(HttpResponse::Ok().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"files": [{ "files": [{
"file": alias.to_string(), "file": alias.to_string(),
@ -506,7 +506,7 @@ async fn claim_upload<S: Store + 'static>(
}))) })))
} }
UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity() UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity()
.json(&serde_json::json!({ .json(serde_json::json!({
"msg": message, "msg": message,
"code": code, "code": code,
}))), }))),
@ -601,7 +601,7 @@ async fn do_download_inline<S: Store + 'static>(
let (alias, delete_token, details) = ingest_inline(stream, state, upload_query).await?; let (alias, delete_token, details) = ingest_inline(stream, state, upload_query).await?;
Ok(HttpResponse::Created().json(&serde_json::json!({ Ok(HttpResponse::Created().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"files": [{ "files": [{
"file": alias.to_string(), "file": alias.to_string(),
@ -628,7 +628,7 @@ async fn do_download_backgrounded<S: Store + 'static>(
backgrounded.disarm(); backgrounded.disarm();
Ok(HttpResponse::Accepted().json(&serde_json::json!({ Ok(HttpResponse::Accepted().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"uploads": [{ "uploads": [{
"upload_id": upload_id.to_string(), "upload_id": upload_id.to_string(),
@ -821,7 +821,7 @@ async fn process_details<S: Store>(
let details = details.ok_or(UploadError::NoFiles)?; let details = details.ok_or(UploadError::NoFiles)?;
Ok(HttpResponse::Ok().json(&details.into_api_details())) Ok(HttpResponse::Ok().json(details.into_api_details()))
} }
async fn not_found_hash(repo: &ArcRepo) -> Result<Option<(Alias, Hash)>, Error> { async fn not_found_hash(repo: &ArcRepo) -> Result<Option<(Alias, Hash)>, Error> {
@ -1076,7 +1076,7 @@ async fn details_query<S: Store + 'static>(
let details = ensure_details(&state, &alias).await?; let details = ensure_details(&state, &alias).await?;
Ok(HttpResponse::Ok().json(&details.into_api_details())) Ok(HttpResponse::Ok().json(details.into_api_details()))
} }
/// Fetch file details /// Fetch file details
@ -1087,7 +1087,7 @@ async fn details<S: Store + 'static>(
) -> Result<HttpResponse, Error> { ) -> Result<HttpResponse, Error> {
let details = ensure_details(&state, &alias).await?; let details = ensure_details(&state, &alias).await?;
Ok(HttpResponse::Ok().json(&details.into_api_details())) Ok(HttpResponse::Ok().json(details.into_api_details()))
} }
/// Serve files based on alias query /// Serve files based on alias query
@ -1550,7 +1550,7 @@ async fn purge<S>(
queue::cleanup_hash(&state.repo, hash).await?; queue::cleanup_hash(&state.repo, hash).await?;
Ok(HttpResponse::Ok().json(&serde_json::json!({ Ok(HttpResponse::Ok().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>() "aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>()
}))) })))
@ -1573,7 +1573,7 @@ async fn delete_alias<S>(
return Ok(HttpResponse::NotFound().finish()); return Ok(HttpResponse::NotFound().finish());
} }
Ok(HttpResponse::Ok().json(&serde_json::json!({ Ok(HttpResponse::Ok().json(serde_json::json!({
"msg": "ok", "msg": "ok",
}))) })))
} }
@ -1587,7 +1587,7 @@ async fn aliases<S>(
let aliases = state.repo.aliases_from_alias(&alias).await?; let aliases = state.repo.aliases_from_alias(&alias).await?;
Ok(HttpResponse::Ok().json(&serde_json::json!({ Ok(HttpResponse::Ok().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>() "aliases": aliases.iter().map(|a| a.to_string()).collect::<Vec<_>>()
}))) })))
@ -1606,7 +1606,7 @@ async fn identifier<S>(
.await? .await?
.ok_or(UploadError::MissingAlias)?; .ok_or(UploadError::MissingAlias)?;
Ok(HttpResponse::Ok().json(&serde_json::json!({ Ok(HttpResponse::Ok().json(serde_json::json!({
"msg": "ok", "msg": "ok",
"identifier": identifier.as_ref(), "identifier": identifier.as_ref(),
}))) })))
@ -1942,7 +1942,7 @@ impl<P: AsRef<Path>, T: serde::Serialize> ConfigSource<P, T> {
async fn export_handler(repo: web::Data<SledRepo>) -> Result<HttpResponse, Error> { async fn export_handler(repo: web::Data<SledRepo>) -> Result<HttpResponse, Error> {
repo.export().await?; repo.export().await?;
Ok(HttpResponse::Created().json(&serde_json::json!({ Ok(HttpResponse::Created().json(serde_json::json!({
"msg": "ok" "msg": "ok"
}))) })))
} }

View file

@ -1666,7 +1666,7 @@ impl QueueRepo for PostgresRepo {
.map_err(PostgresError::Diesel)?; .map_err(PostgresError::Diesel)?;
if let Some((job_id, job_json)) = opt { if let Some((job_id, job_json)) = opt {
tracing::Span::current().record("job_id", &format!("{job_id}")); tracing::Span::current().record("job_id", format!("{job_id}"));
guard.disarm(); guard.disarm();
tracing::debug!("{job_json}"); tracing::debug!("{job_json}");

View file

@ -807,7 +807,7 @@ impl QueueRepo for SledRepo {
.map_err(|_| RepoError::Canceled)??; .map_err(|_| RepoError::Canceled)??;
if let Some((job_id, job_json)) = opt { if let Some((job_id, job_json)) = opt {
tracing::Span::current().record("job_id", &format!("{}", job_id.0)); tracing::Span::current().record("job_id", format!("{}", job_id.0));
metrics_guard.disarm(); metrics_guard.disarm();
tracing::debug!("{job_json}"); tracing::debug!("{job_json}");