From 24594b24ae01c85a0384b5b6a361182be7b191f5 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Fri, 20 Nov 2026 02:44:22 +0100 Subject: [PATCH] refactor(photos): take the Gallery engine from crates.io Replace the git revision pin on Proton Gallery with proton-gallery-rs and proton-gallery-app-rs 0.1.0 from the proton-rs workspace. This also moves the engine from 858d244 to b171232. The Nix package no longer needs to fetch from Git. --- Cargo.lock | 131 ++++++++++++------------ Cargo.toml | 4 +- crates/pdfs-fuse/Cargo.toml | 4 +- crates/pdfs-fuse/src/gallery.rs | 21 ++-- crates/pdfs-fuse/src/gallery/video.rs | 4 +- crates/pdfs-gui/Cargo.toml | 2 +- crates/pdfs-gui/src/app/pages/photos.rs | 4 +- docs/CHANGELOG.md | 6 ++ packaging/nix/package.nix | 5 +- 9 files changed, 96 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6f2f6a..815b315 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3655,9 +3655,9 @@ dependencies = [ "notify", "parking_lot 0.13.0", "pdfs-core", - "pg-app", - "pg-core", "proton-drive-rs", + "proton-gallery-app-rs", + "proton-gallery-rs", "rustix", "serde", "serde_json", @@ -3683,7 +3683,7 @@ dependencies = [ "libadwaita", "pangocairo", "pdfs-core", - "pg-core", + "proton-gallery-rs", "reqwest", "serde", "serde_json", @@ -3708,65 +3708,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" -[[package]] -name = "pg-app" -version = "0.3.0" -source = "git+https://github.com/narrrl/proton-gallery.git?rev=858d2446f71214ec5357eb8b543d6b82abf47386#858d2446f71214ec5357eb8b543d6b82abf47386" -dependencies = [ - "async-trait", - "hex", - "pg-core", - "pg-drive", - "proton-drive-rs", - "proton-sdk", - "serde_json", - "sha2 0.11.1", - "tempfile", - "thiserror 2.0.21", - "tokio", - "tracing", - "zeroize", -] - -[[package]] -name = "pg-core" -version = "0.3.0" -source = "git+https://github.com/narrrl/proton-gallery.git?rev=858d2446f71214ec5357eb8b543d6b82abf47386#858d2446f71214ec5357eb8b543d6b82abf47386" -dependencies = [ - "aes-gcm 0.11.1", - "async-trait", - "getrandom 0.4.3", - "hex", - "rusqlite", - "serde", - "serde_json", - "sha2 0.11.1", - "tempfile", - "thiserror 2.0.21", - "tokio", - "tokio-util", - "zeroize", -] - -[[package]] -name = "pg-drive" -version = "0.3.0" -source = "git+https://github.com/narrrl/proton-gallery.git?rev=858d2446f71214ec5357eb8b543d6b82abf47386#858d2446f71214ec5357eb8b543d6b82abf47386" -dependencies = [ - "async-trait", - "hex", - "pg-core", - "proton-drive-rs", - "proton-sdk", - "serde", - "serde_json", - "sha2 0.11.1", - "thiserror 2.0.21", - "tokio", - "tracing", - "zeroize", -] - [[package]] name = "pgp" version = "0.21.0" @@ -3999,6 +3940,70 @@ dependencies = [ "tracing", ] +[[package]] +name = "proton-gallery-app-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6d18d11266ab2be5ab2f4b4040941caf2736c257e13909af7be8ea331892d59" +dependencies = [ + "async-trait", + "futures-util", + "hex", + "proton-drive-rs", + "proton-gallery-drive-rs", + "proton-gallery-rs", + "proton-sdk", + "serde_json", + "sha2 0.11.1", + "tempfile", + "thiserror 2.0.21", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "proton-gallery-drive-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535a14f63fd542701d2606acb971d4a7e8f235ca7b9439fea8c80a3f26110186" +dependencies = [ + "async-trait", + "hex", + "proton-drive-rs", + "proton-gallery-rs", + "proton-sdk", + "serde", + "serde_json", + "sha2 0.11.1", + "thiserror 2.0.21", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "proton-gallery-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a1159db137629675b0c91a75fa4b2b416a4ef306127e70bad8039c372855cd3" +dependencies = [ + "aes-gcm 0.11.1", + "async-trait", + "getrandom 0.4.3", + "hex", + "kamadak-exif", + "rusqlite", + "serde", + "serde_json", + "sha2 0.11.1", + "tempfile", + "thiserror 2.0.21", + "tokio", + "tokio-util", + "zeroize", +] + [[package]] name = "proton-sdk" version = "0.12.1" @@ -5139,7 +5144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.3", "once_cell", "rustix", "windows-sys 0.61.2", diff --git a/Cargo.toml b/Cargo.toml index 1be8eda..7d5ecb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ categories = ["filesystem", "command-line-utilities"] [workspace.dependencies] proton-sdk = { version = "0.12.1" } proton-drive-rs = { version = "0.12.1" } -pg-app = { git = "https://github.com/narrrl/proton-gallery.git", rev = "858d2446f71214ec5357eb8b543d6b82abf47386" } -pg-core = { git = "https://github.com/narrrl/proton-gallery.git", rev = "858d2446f71214ec5357eb8b543d6b82abf47386" } +proton-gallery-app-rs = "0.1.0" +proton-gallery-rs = "0.1.0" chrono = { version = "0.4", default-features = false, features = ["std"] } # Internal crates. diff --git a/crates/pdfs-fuse/Cargo.toml b/crates/pdfs-fuse/Cargo.toml index be377a8..cefc5a6 100644 --- a/crates/pdfs-fuse/Cargo.toml +++ b/crates/pdfs-fuse/Cargo.toml @@ -14,8 +14,8 @@ pdfs-core.workspace = true zip.workspace = true sha1.workspace = true proton-drive-rs.workspace = true -pg-app.workspace = true -pg-core.workspace = true +proton-gallery-app-rs.workspace = true +proton-gallery-rs.workspace = true hyper = { version = "1", features = ["http1", "server"] } hyper-util = { version = "0.1", features = ["tokio"] } http-body-util = "0.1" diff --git a/crates/pdfs-fuse/src/gallery.rs b/crates/pdfs-fuse/src/gallery.rs index bd136e6..33d3ece 100644 --- a/crates/pdfs-fuse/src/gallery.rs +++ b/crates/pdfs-fuse/src/gallery.rs @@ -14,10 +14,10 @@ use pdfs_core::control::{ GalleryAction, GalleryAlbum, GalleryFolder, GalleryPlace, PhotoItem, PhotoKind, Response, }; use pdfs_core::{CoreError, CoreResult}; -use pg_app::{App, View}; -use pg_core::CancellationToken; -use pg_core::model::{AssetKey, SourceId}; use proton_drive_rs::proton_sdk::session::ProtonApiSession; +use proton_gallery_app_rs::{App, View}; +use proton_gallery_rs::CancellationToken; +use proton_gallery_rs::model::{AssetKey, SourceId}; use tokio::sync::{Mutex, Notify, OnceCell}; use super::{Core, NodeUid, parse_uid}; @@ -187,8 +187,9 @@ impl Gallery { Ok(Arc::new(visibility)) } - fn account(&self) -> CoreResult { - pg_core::model::AccountId::new(self.session.user_id().as_str()).map_err(gallery_error) + fn account(&self) -> CoreResult { + proton_gallery_rs::model::AccountId::new(self.session.user_id().as_str()) + .map_err(gallery_error) } async fn page( @@ -345,13 +346,15 @@ impl Gallery { fn asset(&self, uid: &NodeUid) -> CoreResult { Ok(AssetKey { account: self.account()?, - volume: pg_core::model::VolumeId::new(uid.volume_id.as_str()).map_err(gallery_error)?, - node: pg_core::model::NodeId::new(uid.link_id.as_str()).map_err(gallery_error)?, + volume: proton_gallery_rs::model::VolumeId::new(uid.volume_id.as_str()) + .map_err(gallery_error)?, + node: proton_gallery_rs::model::NodeId::new(uid.link_id.as_str()) + .map_err(gallery_error)?, }) } } -fn gallery_album(entry: pg_core::library::Album, proton: bool) -> GalleryAlbum { +fn gallery_album(entry: proton_gallery_rs::library::Album, proton: bool) -> GalleryAlbum { GalleryAlbum { place: GalleryPlace { gallery: entry.gallery.to_string(), @@ -444,7 +447,7 @@ impl Core { "Use your Linux sign-in to unlock Hidden albums.", )); } - let subject = pg_app::desktop_auth::Subject::new( + let subject = proton_gallery_app_rs::desktop_auth::Subject::new( peer.pid.as_raw_nonzero().get() as u32, peer.uid.as_raw(), ) diff --git a/crates/pdfs-fuse/src/gallery/video.rs b/crates/pdfs-fuse/src/gallery/video.rs index 35a9a4f..448ebf7 100644 --- a/crates/pdfs-fuse/src/gallery/video.rs +++ b/crates/pdfs-fuse/src/gallery/video.rs @@ -11,8 +11,8 @@ use hyper::{ }; use hyper_util::rt::TokioIo; use pdfs_core::{CoreResult, control::Response as ControlResponse}; -use pg_app::video::VideoStream; -use pg_core::CancellationToken; +use proton_gallery_app_rs::video::VideoStream; +use proton_gallery_rs::CancellationToken; use tokio::net::TcpListener; type Body = UnsyncBoxBody; diff --git a/crates/pdfs-gui/Cargo.toml b/crates/pdfs-gui/Cargo.toml index ddee5ac..4f734aa 100644 --- a/crates/pdfs-gui/Cargo.toml +++ b/crates/pdfs-gui/Cargo.toml @@ -22,7 +22,7 @@ name = "pdfs-prompt" path = "src/prompt.rs" [dependencies] -pg-core.workspace = true +proton-gallery-rs.workspace = true base64.workspace = true pdfs-core.workspace = true tracing.workspace = true diff --git a/crates/pdfs-gui/src/app/pages/photos.rs b/crates/pdfs-gui/src/app/pages/photos.rs index fd0770b..0c31057 100644 --- a/crates/pdfs-gui/src/app/pages/photos.rs +++ b/crates/pdfs-gui/src/app/pages/photos.rs @@ -2360,7 +2360,7 @@ const TILE_RATIO_MAX: f64 = 2.5; /// The shape a photo's tile takes: its own, clamped, or square while the /// daemon has not seen a thumbnail of it yet. pub(crate) fn tile_ratio(ratio: Option) -> f64 { - pg_core::grid::tile_ratio(ratio.unwrap_or(1.0)) + proton_gallery_rs::grid::tile_ratio(ratio.unwrap_or(1.0)) } /// The justified layout math: tiles of the given shapes, in order, broken into @@ -2373,7 +2373,7 @@ pub(crate) fn tile_ratio(ratio: Option) -> f64 { /// two photos from one day stay two photos at the target height, not two /// photos as tall as the window. pub(crate) fn plan_justified(ratios: &[f64], width: i32, target: i32) -> Vec> { - let Ok(grid) = pg_core::grid::plan_sections( + let Ok(grid) = proton_gallery_rs::grid::plan_sections( ratios, &[], width.clamp(1, 32_768) as u32, diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d00a5a0..e3160be 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,12 @@ scratch (user data in `staging/` and `recovery/` is never touched by this). ## [Unreleased] +### Changed + +- The shared Gallery engine now comes from the `proton-gallery-rs` and + `proton-gallery-app-rs` crates on crates.io instead of a pinned Git revision of + Proton Gallery. Builds, vendoring and the Nix package no longer fetch from Git. + ## [3.9.0] — 2026-11-19 Schema: **46**. Photos adds a local database migration for incremental metadata sync. diff --git a/packaging/nix/package.nix b/packaging/nix/package.nix index 00e922a..f075e02 100644 --- a/packaging/nix/package.nix +++ b/packaging/nix/package.nix @@ -46,10 +46,7 @@ rustPlatform.buildRustPackage { ]; }; - cargoLock = { - lockFile = ../../Cargo.lock; - allowBuiltinFetchGit = true; - }; + cargoLock.lockFile = ../../Cargo.lock; cargoBuildFlags = [ "--bin"