diff --git a/.forgejo/workflows/check.yaml b/.forgejo/workflows/check.yaml index ec520d4..cc4bc19 100644 --- a/.forgejo/workflows/check.yaml +++ b/.forgejo/workflows/check.yaml @@ -10,7 +10,7 @@ jobs: clippy: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -27,7 +27,7 @@ jobs: deny: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -43,7 +43,7 @@ jobs: tests: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -65,7 +65,7 @@ jobs: - aarch64-unknown-linux-musl runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index 10ac4d3..f2d3f07 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -10,7 +10,7 @@ jobs: clippy: runs-on: base-image container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -27,7 +27,7 @@ jobs: # deny: # runs-on: docker # container: - # image: docker.io/asonix/actions-base-image:0.1.21 + # image: docker.io/asonix/actions-base-image:0.1.22 # steps: # - # name: Checkout pict-rs @@ -43,7 +43,7 @@ jobs: tests: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs @@ -62,7 +62,7 @@ jobs: - tests runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 strategy: fail-fast: false matrix: @@ -162,7 +162,7 @@ jobs: publish-docker: runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 needs: [build] steps: - @@ -213,7 +213,7 @@ jobs: needs: [build] runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - uses: https://github.com/actions/download-artifact@v3 with: @@ -231,7 +231,7 @@ jobs: needs: [build] runs-on: docker container: - image: docker.io/asonix/actions-base-image:0.1.21 + image: docker.io/asonix/actions-base-image:0.1.22 steps: - name: Checkout pict-rs diff --git a/Cargo.lock b/Cargo.lock index d581531..883f405 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -783,6 +783,41 @@ dependencies = [ "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]] name = "dashmap" version = "6.1.0" @@ -846,9 +881,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.1.6" +version = "2.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" +checksum = "158fe8e2e68695bd615d7e4f3227c0727b151330d3e253b525086c348d055d5e" dependencies = [ "bitflags 2.6.0", "byteorder", @@ -861,9 +896,9 @@ dependencies = [ [[package]] name = "diesel-async" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acada1517534c92d3f382217b485db8a8638f111b0e3f2a2a8e26165050f77be" +checksum = "4c5c6ec8d5c7b8444d19a47161797cbe361e0fb1ee40c6a8124ec915b64a4125" dependencies = [ "async-trait", "bb8", @@ -888,11 +923,12 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.1.4" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14701062d6bed917b5c7103bdffaee1e4609279e240488ad24e7bd979ca6866c" +checksum = "e7f2c3de51e2ba6bf2a648285696137aaf0f5f487bcbea93972fe8a364e131a4" dependencies = [ "diesel_table_macro_syntax", + "dsl_auto_type", "proc-macro2", "quote", "syn", @@ -900,9 +936,9 @@ dependencies = [ [[package]] name = "diesel_table_macro_syntax" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" +checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ "syn", ] @@ -929,6 +965,20 @@ dependencies = [ "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]] name = "either" version = "1.13.0" @@ -1539,6 +1589,12 @@ dependencies = [ "syn", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.0.3" diff --git a/Cargo.toml b/Cargo.toml index ad6a1bb..0edf207 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ license = "AGPL-3.0" readme = "README.md" repository = "https://git.asonix.dog/asonix/pict-rs" edition = "2021" +rust-version = "1.82" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] } [profile.release] strip = true @@ -31,8 +35,8 @@ color-eyre = "0.6.3" config = { version = "0.14.0", default-features = false, features = ["json", "ron", "toml", "yaml"] } console-subscriber = "0.4.0" dashmap = "6.0.1" -diesel = { version = "2.1.6", features = ["postgres_backend", "serde_json", "time", "uuid"] } -diesel-async = { version = "0.4.1", features = ["bb8", "postgres"] } +diesel = { version = "2.2.1", features = ["postgres_backend", "serde_json", "time", "uuid"] } +diesel-async = { version = "0.5.0", features = ["bb8", "postgres"] } diesel-derive-enum = { version = "2.1.0", features = ["postgres"] } futures-core = "0.3.30" hex = "0.4.3" diff --git a/README.md b/README.md index 4ffb07e..abadc59 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ More information is available in the [Ubuntu and Debian docs](./docs/ubuntu-and- ##### Compile from Source 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 pict-rs to run properly. diff --git a/deny.toml b/deny.toml index 89807d4..cbf0492 100644 --- a/deny.toml +++ b/deny.toml @@ -70,7 +70,6 @@ feature-depth = 1 # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ - { id = "RUSTSEC-2024-0365", reason = "Can't update due to MSRV" }, { id = "RUSTSEC-2024-0384", reason = "Sled 0.34.7 dependency" }, #"RUSTSEC-0000-0000", #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, diff --git a/flake.lock b/flake.lock index 8823d44..35b5307 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -20,16 +20,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718895438, - "narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", + "lastModified": 1731755305, + "narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", + "rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index d358657..d5f40bb 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "pict-rs"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; flake-utils.url = "github:numtide/flake-utils"; }; @@ -15,12 +15,12 @@ in { 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 {}; pict-rs = pkgs.callPackage ./pict-rs.nix { inherit (pkgs.darwin.apple_sdk.frameworks) Security; - inherit imagemagick7_pict-rs ffmpeg6_pict-rs; + inherit imagemagick_pict-rs ffmpeg6_pict-rs; }; default = pict-rs; @@ -54,7 +54,7 @@ diesel-cli exiftool garage - self.packages.${system}.imagemagick7_pict-rs + self.packages.${system}.imagemagick_pict-rs self.packages.${system}.ffmpeg6_pict-rs jq minio-client diff --git a/nix/pkgs/imagemagick_pict-rs/default.nix b/nix/pkgs/imagemagick_pict-rs/default.nix index 00674e8..902a63a 100644 --- a/nix/pkgs/imagemagick_pict-rs/default.nix +++ b/nix/pkgs/imagemagick_pict-rs/default.nix @@ -1,6 +1,6 @@ -{ imagemagick7 }: +{ imagemagick }: -imagemagick7.override { +imagemagick.override { bzip2Support = true; zlibSupport = true; libX11Support = false; diff --git a/src/lib.rs b/src/lib.rs index dc90e96..e6e88b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,7 +360,7 @@ async fn handle_upload( image.result.disarm(); } - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok", "files": files }))) @@ -462,7 +462,7 @@ async fn upload_backgrounded( image.result.disarm(); } - Ok(HttpResponse::Accepted().json(&serde_json::json!({ + Ok(HttpResponse::Accepted().json(serde_json::json!({ "msg": "ok", "uploads": files }))) @@ -496,7 +496,7 @@ async fn claim_upload( UploadResult::Success { alias, token } => { let details = ensure_details(&state, &alias).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "files": [{ "file": alias.to_string(), @@ -506,7 +506,7 @@ async fn claim_upload( }))) } UploadResult::Failure { message, code } => Ok(HttpResponse::UnprocessableEntity() - .json(&serde_json::json!({ + .json(serde_json::json!({ "msg": message, "code": code, }))), @@ -601,7 +601,7 @@ async fn do_download_inline( 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", "files": [{ "file": alias.to_string(), @@ -628,7 +628,7 @@ async fn do_download_backgrounded( backgrounded.disarm(); - Ok(HttpResponse::Accepted().json(&serde_json::json!({ + Ok(HttpResponse::Accepted().json(serde_json::json!({ "msg": "ok", "uploads": [{ "upload_id": upload_id.to_string(), @@ -821,7 +821,7 @@ async fn process_details( 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, Error> { @@ -1076,7 +1076,7 @@ async fn details_query( 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 @@ -1087,7 +1087,7 @@ async fn details( ) -> Result { 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 @@ -1550,7 +1550,7 @@ async fn purge( queue::cleanup_hash(&state.repo, hash).await?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "aliases": aliases.iter().map(|a| a.to_string()).collect::>() }))) @@ -1573,7 +1573,7 @@ async fn delete_alias( return Ok(HttpResponse::NotFound().finish()); } - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", }))) } @@ -1587,7 +1587,7 @@ async fn aliases( 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", "aliases": aliases.iter().map(|a| a.to_string()).collect::>() }))) @@ -1606,7 +1606,7 @@ async fn identifier( .await? .ok_or(UploadError::MissingAlias)?; - Ok(HttpResponse::Ok().json(&serde_json::json!({ + Ok(HttpResponse::Ok().json(serde_json::json!({ "msg": "ok", "identifier": identifier.as_ref(), }))) @@ -1942,7 +1942,7 @@ impl, T: serde::Serialize> ConfigSource { async fn export_handler(repo: web::Data) -> Result { repo.export().await?; - Ok(HttpResponse::Created().json(&serde_json::json!({ + Ok(HttpResponse::Created().json(serde_json::json!({ "msg": "ok" }))) } diff --git a/src/repo/postgres.rs b/src/repo/postgres.rs index 89e952c..3014558 100644 --- a/src/repo/postgres.rs +++ b/src/repo/postgres.rs @@ -1666,7 +1666,7 @@ impl QueueRepo for PostgresRepo { .map_err(PostgresError::Diesel)?; 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(); tracing::debug!("{job_json}"); diff --git a/src/repo/sled.rs b/src/repo/sled.rs index 6f1a553..371c233 100644 --- a/src/repo/sled.rs +++ b/src/repo/sled.rs @@ -807,7 +807,7 @@ impl QueueRepo for SledRepo { .map_err(|_| RepoError::Canceled)??; 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(); tracing::debug!("{job_json}");