From cc020bfb54862ac13c0adead2c92ebf66591b766 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Thu, 19 Nov 2026 20:55:26 +0100 Subject: [PATCH] feat(photos): unlock hidden albums with system login --- .github/workflows/release.yml | 3 +- Cargo.lock | 14 +-- Cargo.toml | 4 +- crates/pdfs-core/Cargo.toml | 1 - crates/pdfs-core/src/auth.rs | 42 ------- crates/pdfs-core/src/control.rs | 4 +- crates/pdfs-fuse/Cargo.toml | 1 + crates/pdfs-fuse/src/control.rs | 9 +- crates/pdfs-fuse/src/gallery.rs | 44 +++++-- .../pdfs-gui/src/app/pages/drive_galleries.rs | 117 ++++++++++-------- docs/CHANGELOG.md | 2 +- docs/PHOTOS.md | 17 ++- packaging/PKGBUILD | 5 +- .../aur/proton-drive-for-linux-bin/.SRCINFO | 1 + .../aur/proton-drive-for-linux-bin/PKGBUILD | 2 +- .../aur/proton-drive-for-linux-git/.SRCINFO | 1 + .../aur/proton-drive-for-linux-git/PKGBUILD | 5 +- packaging/aur/proton-drive-for-linux/.SRCINFO | 1 + packaging/aur/proton-drive-for-linux/PKGBUILD | 5 +- packaging/io.narl.proton-drive-linux.policy | 14 +++ packaging/nix/package.nix | 6 +- packaging/proton-drive-linux.spec | 4 + packaging/tarball/build.sh | 2 + 23 files changed, 175 insertions(+), 129 deletions(-) create mode 100644 packaging/io.narl.proton-drive-linux.policy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b314769..468bd3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -156,6 +156,7 @@ jobs: cp packaging/io.narl.proton-drive-linux.desktop deb/usr/share/applications/ cp packaging/io.narl.proton-drive-linux-tray.desktop deb/etc/xdg/autostart/ cp packaging/io.narl.proton-drive-linux.svg deb/usr/share/icons/hicolor/scalable/apps/ + install -Dm644 packaging/io.narl.proton-drive-linux.policy deb/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy cp packaging/proton-drive.service deb/usr/lib/systemd/user/ cp LICENSE deb/usr/share/licenses/proton-drive-linux/ po/build.sh deb/usr/share/locale @@ -175,7 +176,7 @@ jobs: Priority: optional Architecture: amd64 Maintainer: Nils Pukropp - Depends: fuse3, libgtk-4-1 (>= 4.12.0), libadwaita-1-0 (>= 1.5.0), libsecret-1-0, libwebkitgtk-6.0-4, libimage-exiftool-perl + Depends: polkitd, fuse3, libgtk-4-1 (>= 4.12.0), libadwaita-1-0 (>= 1.5.0), libsecret-1-0, libwebkitgtk-6.0-4, libimage-exiftool-perl Installed-Size: ${INSTALLED_SIZE} Homepage: https://proton-drive.narl.io Description: Unofficial Proton Drive client for Linux diff --git a/Cargo.lock b/Cargo.lock index 11ce2b7..a6f2f6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3611,7 +3611,6 @@ dependencies = [ name = "pdfs-core" version = "3.9.0" dependencies = [ - "argon2", "async-trait", "base64 0.23.1", "chrono", @@ -3659,6 +3658,7 @@ dependencies = [ "pg-app", "pg-core", "proton-drive-rs", + "rustix", "serde", "serde_json", "sha1 0.11.0", @@ -3710,8 +3710,8 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pg-app" -version = "0.2.0" -source = "git+https://github.com/narrrl/proton-gallery.git?rev=b841c37ad57694470f499f575f7a956425c28ade#b841c37ad57694470f499f575f7a956425c28ade" +version = "0.3.0" +source = "git+https://github.com/narrrl/proton-gallery.git?rev=858d2446f71214ec5357eb8b543d6b82abf47386#858d2446f71214ec5357eb8b543d6b82abf47386" dependencies = [ "async-trait", "hex", @@ -3730,8 +3730,8 @@ dependencies = [ [[package]] name = "pg-core" -version = "0.2.0" -source = "git+https://github.com/narrrl/proton-gallery.git?rev=b841c37ad57694470f499f575f7a956425c28ade#b841c37ad57694470f499f575f7a956425c28ade" +version = "0.3.0" +source = "git+https://github.com/narrrl/proton-gallery.git?rev=858d2446f71214ec5357eb8b543d6b82abf47386#858d2446f71214ec5357eb8b543d6b82abf47386" dependencies = [ "aes-gcm 0.11.1", "async-trait", @@ -3750,8 +3750,8 @@ dependencies = [ [[package]] name = "pg-drive" -version = "0.2.0" -source = "git+https://github.com/narrrl/proton-gallery.git?rev=b841c37ad57694470f499f575f7a956425c28ade#b841c37ad57694470f499f575f7a956425c28ade" +version = "0.3.0" +source = "git+https://github.com/narrrl/proton-gallery.git?rev=858d2446f71214ec5357eb8b543d6b82abf47386#858d2446f71214ec5357eb8b543d6b82abf47386" dependencies = [ "async-trait", "hex", diff --git a/Cargo.toml b/Cargo.toml index fbcfe1b..1be8eda 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 = "b841c37ad57694470f499f575f7a956425c28ade" } -pg-core = { git = "https://github.com/narrrl/proton-gallery.git", rev = "b841c37ad57694470f499f575f7a956425c28ade" } +pg-app = { git = "https://github.com/narrrl/proton-gallery.git", rev = "858d2446f71214ec5357eb8b543d6b82abf47386" } +pg-core = { git = "https://github.com/narrrl/proton-gallery.git", rev = "858d2446f71214ec5357eb8b543d6b82abf47386" } chrono = { version = "0.4", default-features = false, features = ["std"] } # Internal crates. diff --git a/crates/pdfs-core/Cargo.toml b/crates/pdfs-core/Cargo.toml index 46a80a3..9deceea 100644 --- a/crates/pdfs-core/Cargo.toml +++ b/crates/pdfs-core/Cargo.toml @@ -10,7 +10,6 @@ homepage.workspace = true description = "Core auth/session/config for the Proton Drive Linux client" [dependencies] -argon2 = "0.5" proton-sdk.workspace = true proton-drive-rs.workspace = true chrono.workspace = true diff --git a/crates/pdfs-core/src/auth.rs b/crates/pdfs-core/src/auth.rs index b22dd6d..fe57852 100644 --- a/crates/pdfs-core/src/auth.rs +++ b/crates/pdfs-core/src/auth.rs @@ -128,48 +128,6 @@ fn with_keyring(op: impl Fn(&Entry) -> keyring_core::Result) -> Result with_keyring_entry(KEYRING_SERVICE, KEYRING_USER, op) } -/// Verify the machine-local Gallery passphrase, setting it on first use. -pub fn unlock_gallery(username: &str, passphrase: &str) -> std::result::Result<(), String> { - use argon2::password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString}; - use std::io::Read; - - if passphrase.is_empty() || passphrase.len() > 1024 { - return Err("Enter your Gallery passphrase.".into()); - } - static VERIFY: parking_lot::Mutex<()> = parking_lot::Mutex::new(()); - let _verify = VERIFY.lock(); - let service = "io.narl.protongallery"; - let user = format!("hidden-albums:{username}"); - let argon = argon2::Argon2::default(); - match with_keyring_entry(service, &user, Entry::get_password) { - Ok(stored) => { - let hash = PasswordHash::new(&stored) - .map_err(|_| "The saved Gallery passphrase is unreadable.")?; - argon - .verify_password(passphrase.as_bytes(), &hash) - .map_err(|_| "The Gallery passphrase is incorrect.".into()) - } - Err(Error::Keyring(keyring_core::Error::NoEntry)) => { - if passphrase.chars().count() < 12 { - return Err("Choose a Gallery passphrase with at least 12 characters.".into()); - } - let mut bytes = [0; 16]; - std::fs::File::open("/dev/urandom") - .and_then(|mut file| file.read_exact(&mut bytes)) - .map_err(|_| "Couldn’t generate the passphrase salt.")?; - let salt = SaltString::encode_b64(&bytes) - .map_err(|_| "Couldn’t generate the passphrase salt.")?; - let hash = argon - .hash_password(passphrase.as_bytes(), &salt) - .map_err(|_| "Couldn’t protect the Gallery passphrase.")? - .to_string(); - with_keyring_entry(service, &user, |entry| entry.set_password(&hash)) - .map_err(|_| "Couldn’t save the Gallery passphrase in the system keyring.".into()) - } - Err(_) => Err("The system keyring is locked or unavailable.".into()), - } -} - /// Run `op` on the entry `service`/`user`, reconnecting once if the Secret /// Service fails the call. /// diff --git a/crates/pdfs-core/src/control.rs b/crates/pdfs-core/src/control.rs index 506c3f5..688cd34 100644 --- a/crates/pdfs-core/src/control.rs +++ b/crates/pdfs-core/src/control.rs @@ -2019,9 +2019,7 @@ pub struct MappingProgress { /// Actions on saved Drive folder galleries. #[derive(Serialize, Deserialize, Debug, Clone)] pub enum GalleryAction { - Unlock { - passphrase: String, - }, + AuthenticateHidden, Lock, List { album: Option, diff --git a/crates/pdfs-fuse/Cargo.toml b/crates/pdfs-fuse/Cargo.toml index 28c1d0a..be377a8 100644 --- a/crates/pdfs-fuse/Cargo.toml +++ b/crates/pdfs-fuse/Cargo.toml @@ -27,6 +27,7 @@ tokio.workspace = true tracing.workspace = true fuser.workspace = true libc.workspace = true +rustix = { version = "1", features = ["net", "process"] } serde.workspace = true serde_json.workspace = true base64.workspace = true diff --git a/crates/pdfs-fuse/src/control.rs b/crates/pdfs-fuse/src/control.rs index 3047c3d..0fcc1b4 100644 --- a/crates/pdfs-fuse/src/control.rs +++ b/crates/pdfs-fuse/src/control.rs @@ -396,8 +396,8 @@ fn touched_topics(request: &CtlRequest) -> &'static [Topic] { use CtlRequest as R; match request { R::Pin { .. } | R::Unpin { .. } => &[Topic::Files], - // Unlock affects private requests only. Publishing the lock notification - // here for Unlock as well could close the view that just opened. + // Only locking invalidates a hidden view. Authentication does not + // change the public catalog and must not emit this notification. R::DriveGallery { action: pdfs_core::control::GalleryAction::Lock, } => &[Topic::GalleryVisibility], @@ -952,6 +952,11 @@ fn handle_control_conn(core: &Core, username: &str, mountpoint: &Path, stream: U }, None => CtlResponse::error(CoreError::invalid(format!("bad uid: {uid}"))), }, + Ok(CtlRequest::DriveGallery { + action: pdfs_core::control::GalleryAction::AuthenticateHidden, + }) => core + .authenticate_hidden_gallery(&stream) + .unwrap_or_else(CtlResponse::error), Ok(CtlRequest::DriveGallery { action }) => core .drive_gallery(action) .unwrap_or_else(CtlResponse::error), diff --git a/crates/pdfs-fuse/src/gallery.rs b/crates/pdfs-fuse/src/gallery.rs index 2ba81bb..bd136e6 100644 --- a/crates/pdfs-fuse/src/gallery.rs +++ b/crates/pdfs-fuse/src/gallery.rs @@ -431,20 +431,40 @@ impl Core { .ok_or_else(|| CoreError::remote("The Gallery session is unavailable")) } + pub(super) fn authenticate_hidden_gallery( + &self, + stream: &std::os::unix::net::UnixStream, + ) -> CoreResult { + let gallery = self.gallery_host()?; + let access = gallery.access.load(Ordering::SeqCst); + let peer = rustix::net::sockopt::socket_peercred(stream) + .map_err(|_| CoreError::invalid("Couldn’t identify the authentication requester."))?; + if peer.uid != rustix::process::geteuid() { + return Err(CoreError::invalid( + "Use your Linux sign-in to unlock Hidden albums.", + )); + } + let subject = pg_app::desktop_auth::Subject::new( + peer.pid.as_raw_nonzero().get() as u32, + peer.uid.as_raw(), + ) + .map_err(gallery_error)?; + self.rt + .block_on(subject.authenticate("io.narl.proton-drive-linux.unlock-hidden-albums")) + .map_err(gallery_error)?; + if gallery.cancel.is_cancelled() { + return Err(CoreError::invalid("The Gallery session has ended.")); + } + gallery + .access + .compare_exchange(access, access | 1, Ordering::SeqCst, Ordering::SeqCst) + .map_err(|_| CoreError::invalid("Hidden albums were locked"))?; + Ok(done()) + } + pub(super) fn drive_gallery(&self, action: GalleryAction) -> CoreResult { let gallery = self.gallery_host()?; let action = match action { - GalleryAction::Unlock { passphrase } => { - let passphrase = zeroize::Zeroizing::new(passphrase); - let access = gallery.access.load(Ordering::SeqCst); - pdfs_core::auth::unlock_gallery(gallery.session.username(), &passphrase) - .map_err(gallery_error)?; - gallery - .access - .compare_exchange(access, access | 1, Ordering::SeqCst, Ordering::SeqCst) - .map_err(|_| CoreError::invalid("Hidden albums were locked"))?; - return Ok(done()); - } GalleryAction::Lock => { gallery.lock(); return Ok(done()); @@ -457,7 +477,7 @@ impl Core { .ensure_visibility(self, app, matches!(action, GalleryAction::Refresh)) .await?; match action { - GalleryAction::Unlock { .. } | GalleryAction::Lock => unreachable!(), + GalleryAction::AuthenticateHidden | GalleryAction::Lock => unreachable!(), GalleryAction::List { album, offset, diff --git a/crates/pdfs-gui/src/app/pages/drive_galleries.rs b/crates/pdfs-gui/src/app/pages/drive_galleries.rs index 8edf00e..e35a041 100644 --- a/crates/pdfs-gui/src/app/pages/drive_galleries.rs +++ b/crates/pdfs-gui/src/app/pages/drive_galleries.rs @@ -31,6 +31,7 @@ pub(crate) struct Browser { root_reload: Cell, preview: glib::WeakRef, unlock_pending: Cell, + unlock_verified: Cell, rows: gio::ListStore, scroll: gtk4::ScrolledWindow, title: adw::WindowTitle, @@ -75,7 +76,9 @@ impl Browser { self.next_request(); self.loading.set(false); self.total.set(0); - if self.unlocked.replace(false) || self.unlock_pending.get() { + let was_unlocked = self.unlocked.replace(false); + let was_verified = self.unlock_verified.replace(false); + if was_unlocked || was_verified || self.unlock_pending.get() { self.lock(); } if let Some(preview) = self.preview.upgrade() { @@ -120,6 +123,15 @@ impl Browser { if !self.active() || self.chooser.borrow().is_some() || self.unlock_pending.get() { return; } + if self.unlock_verified.get() { + if locked { + self.close(); + } + return; + } + if !self.unlocked.get() && self.current().is_none() { + return; + } if let Some(preview) = self.preview.upgrade() { preview.force_close(); } @@ -393,7 +405,6 @@ impl Browser { } fn change(self: &Rc, action: GalleryAction) { - let unlock = matches!(action, GalleryAction::Unlock { .. }); let update_root = matches!( action, GalleryAction::Add { .. } @@ -401,9 +412,6 @@ impl Browser { | GalleryAction::Refresh | GalleryAction::Cover { .. } ); - if unlock && self.unlock_pending.replace(true) { - return; - } self.unlock.set_visible(false); let generation = self.next_request(); self.status.set_label(&gettext("Updating gallery…")); @@ -414,25 +422,11 @@ impl Browser { let browser = self.clone(); glib::spawn_future_local(async move { let result = rx.recv().await; - if unlock { - browser.unlock_pending.set(false); - browser.unlock.set_visible( - browser.active() - && browser.generation.get() == generation - && !matches!(result, Ok(Ok(Response::Ok { .. }))), - ); - } if browser.generation.get() != generation { - if unlock && matches!(result, Ok(Ok(Response::Ok { .. }))) { - browser.lock(); - } return; } match result { Ok(Ok(Response::Ok { .. })) => { - if unlock { - browser.unlocked.set(true); - } let added = browser.chooser.borrow().is_some(); if update_root { browser.load_root(); @@ -467,36 +461,58 @@ impl Browser { } fn prompt_unlock(self: &Rc) { - if self.unlock_pending.get() { + if self.unlock_pending.replace(true) { return; } - let Some(parent) = ui_window(&self.ui) else { - return; - }; - let dialog = adw::AlertDialog::builder() - .heading(gettext("Unlock Hidden Albums")) - .body(gettext("Enter your Gallery passphrase. On first use, choose one with at least 12 characters.")) - .build(); - let password = gtk4::PasswordEntry::builder().show_peek_icon(true).build(); - dialog.set_extra_child(Some(&password)); - dialog.add_response("cancel", &gettext("Cancel")); - dialog.add_response("unlock", &gettext("Unlock")); - dialog.set_response_appearance("unlock", adw::ResponseAppearance::Suggested); - dialog.set_default_response(Some("unlock")); - let browser = Rc::downgrade(self); - dialog.connect_response(None, move |_, response| { - let passphrase = password.text().to_string(); - password.set_text(""); - if response == "unlock" - && let Some(browser) = browser.upgrade() - { - browser.enter(); - browser.more.set_visible(false); - browser.title.set_title(&gettext("Hidden albums")); - browser.change(GalleryAction::Unlock { passphrase }); + self.enter(); + self.more.set_visible(false); + self.unlock.set_visible(false); + self.title.set_title(&gettext("Hidden albums")); + self.status + .set_label(&gettext("Use your Linux sign-in to unlock Hidden albums.")); + let generation = self.next_request(); + let rx = spawn_request( + self.ui.dirs.control_socket(), + Request::DriveGallery { + action: GalleryAction::AuthenticateHidden, + }, + ); + let browser = self.clone(); + glib::spawn_future_local(async move { + let result = rx.recv().await; + browser.unlock_pending.set(false); + if browser.generation.get() != generation { + if matches!(result, Ok(Ok(Response::Ok { .. }))) { + browser.lock(); + } + return; + } + match result { + Ok(Ok(Response::Ok { .. })) => { + browser.unlock_verified.set(true); + browser.reveal_verified(); + } + Ok(Ok(Response::Error { message, .. })) => { + browser.status.set_label(&message); + browser.unlock.set_visible(true); + } + _ => { + browser + .status + .set_label(&gettext("Couldn't reach Proton Drive.")); + browser.unlock.set_visible(true); + } } }); - dialog.present(Some(&parent)); + } + + fn reveal_verified(self: &Rc) { + if ui_window(&self.ui).is_some_and(|window| window.is_active()) + && self.unlock_verified.replace(false) + { + self.unlocked.set(true); + self.load(0, 0.0); + } } pub(crate) fn back(self: &Rc) { @@ -713,6 +729,7 @@ pub(crate) fn wire( root_loading: Cell::new(false), preview: glib::WeakRef::new(), unlock_pending: Cell::new(false), + unlock_verified: Cell::new(false), rows, scroll: scroll.clone(), title, @@ -737,10 +754,12 @@ pub(crate) fn wire( *ui.drive_galleries.borrow_mut() = Rc::downgrade(&browser); let weak = Rc::downgrade(&browser); window.connect_is_active_notify(move |window| { - if !window.is_active() - && let Some(browser) = weak.upgrade() - && (browser.unlocked.get() || browser.unlock_pending.get()) - { + let Some(browser) = weak.upgrade() else { + return; + }; + if window.is_active() { + browser.reveal_verified(); + } else if browser.unlocked.get() { browser.close(); } }); diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2fd2f73..d00a5a0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -20,7 +20,7 @@ Schema: **46**. Photos adds a local database migration for incremental metadata - Open **Drive galleries** in Photos → Albums to browse saved My files folders and their subfolders, choose album covers, and manage public links. Saved galleries and covers sync with Proton Gallery on desktop and Android. -- Unlock hidden albums from the Albums view with the local Gallery passphrase. +- Unlock hidden albums from the Albums view with your Linux sign-in. ### Changed diff --git a/docs/PHOTOS.md b/docs/PHOTOS.md index f64643c..75b70a4 100644 --- a/docs/PHOTOS.md +++ b/docs/PHOTOS.md @@ -9,10 +9,19 @@ gallery by choosing a folder from **My files**. Opening it or any subfolder keeps you in Photos. Back or Escape returns to the parent and its scroll position. -**Hidden albums** opens with the Gallery passphrase stored for this account in -your Linux keyring. It includes hidden Proton albums and hidden Drive gallery -folders, including folders inside public galleries. Leaving Hidden albums or -switching away from the window locks it and closes its previews. +**Hidden albums** opens with your Linux sign-in. The app uses the desktop +polkit prompt, so it needs a running authentication agent and the installed +polkit policy. Existing hidden albums remain hidden after upgrading. This view +includes hidden Proton albums and hidden Drive folders, including folders +inside public galleries. Leaving Hidden albums or switching away from the +window locks it and closes its previews. + +For a system package, the policy is installed with the app. For a source build +or a per-user tarball install, have your system administrator install +`packaging/io.narl.proton-drive-linux.policy` (or the corresponding file under the +tarball's `share/polkit-1/actions/`) into the system polkit actions directory. +On NixOS, enable `security.polkit` and install the package system-wide to +register its policy. GTK pages Timeline, Proton albums, and Places through the Drive daemon's Photos control requests backed by its SQLite database. Saved Drive galleries come from diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index f5ae332..7d8a29a 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -15,7 +15,7 @@ pkgdesc="Unofficial Proton Drive client for Linux: files-on-demand FUSE mount, C arch=('x86_64') url="https://proton-drive.narl.io" license=('MIT') -depends=('fuse3' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'perl-image-exiftool') +depends=('fuse3' 'polkit' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'perl-image-exiftool') makedepends=('cargo' 'git' 'gettext') provides=('pdfs') # Files-on-demand mount + keyring need these at runtime. @@ -77,6 +77,9 @@ package() { install -Dm644 "packaging/proton-drive.service" \ "$pkgdir/usr/lib/systemd/user/proton-drive.service" + install -Dm644 "packaging/io.narl.proton-drive-linux.policy" \ + "$pkgdir/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy" + # Translations: compiled from po/ into /usr/share/locale. po/build.sh "$pkgdir/usr/share/locale" diff --git a/packaging/aur/proton-drive-for-linux-bin/.SRCINFO b/packaging/aur/proton-drive-for-linux-bin/.SRCINFO index a2ce7d9..bb7c4e5 100644 --- a/packaging/aur/proton-drive-for-linux-bin/.SRCINFO +++ b/packaging/aur/proton-drive-for-linux-bin/.SRCINFO @@ -7,6 +7,7 @@ pkgbase = proton-drive-for-linux-bin arch = x86_64 license = MIT depends = fuse3 + depends = polkit depends = gtk4 depends = libadwaita depends = webkitgtk-6.0 diff --git a/packaging/aur/proton-drive-for-linux-bin/PKGBUILD b/packaging/aur/proton-drive-for-linux-bin/PKGBUILD index 2349a5f..894782a 100644 --- a/packaging/aur/proton-drive-for-linux-bin/PKGBUILD +++ b/packaging/aur/proton-drive-for-linux-bin/PKGBUILD @@ -8,7 +8,7 @@ arch=('x86_64') url="https://proton-drive.narl.io" _repo="https://github.com/narrrl/proton-drive-linux" license=('MIT') -depends=('fuse3' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'dbus' 'gcc-libs' 'glibc' +depends=('fuse3' 'polkit' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'dbus' 'gcc-libs' 'glibc' 'hicolor-icon-theme') optdepends=('perl-image-exiftool: thumbnails for camera RAW files' 'ffmpeg: video thumbnails' diff --git a/packaging/aur/proton-drive-for-linux-git/.SRCINFO b/packaging/aur/proton-drive-for-linux-git/.SRCINFO index 618bbbe..061e342 100644 --- a/packaging/aur/proton-drive-for-linux-git/.SRCINFO +++ b/packaging/aur/proton-drive-for-linux-git/.SRCINFO @@ -10,6 +10,7 @@ pkgbase = proton-drive-for-linux-git makedepends = git makedepends = gettext depends = fuse3 + depends = polkit depends = gtk4 depends = libadwaita depends = webkitgtk-6.0 diff --git a/packaging/aur/proton-drive-for-linux-git/PKGBUILD b/packaging/aur/proton-drive-for-linux-git/PKGBUILD index 766b830..f924141 100644 --- a/packaging/aur/proton-drive-for-linux-git/PKGBUILD +++ b/packaging/aur/proton-drive-for-linux-git/PKGBUILD @@ -8,7 +8,7 @@ arch=('x86_64') url="https://proton-drive.narl.io" _repo="https://github.com/narrrl/proton-drive-linux" license=('MIT') -depends=('fuse3' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'dbus' 'gcc-libs' 'glibc' +depends=('fuse3' 'polkit' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'dbus' 'gcc-libs' 'glibc' 'hicolor-icon-theme') makedepends=('cargo' 'git' 'gettext') optdepends=('perl-image-exiftool: thumbnails for camera RAW files' @@ -78,6 +78,9 @@ package() { install -Dm644 packaging/proton-drive.service \ "$pkgdir/usr/lib/systemd/user/proton-drive.service" + install -Dm644 "packaging/io.narl.proton-drive-linux.policy" \ + "$pkgdir/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy" + # Translations: compiled from po/ into /usr/share/locale. po/build.sh "$pkgdir/usr/share/locale" diff --git a/packaging/aur/proton-drive-for-linux/.SRCINFO b/packaging/aur/proton-drive-for-linux/.SRCINFO index ab35217..e7d78c5 100644 --- a/packaging/aur/proton-drive-for-linux/.SRCINFO +++ b/packaging/aur/proton-drive-for-linux/.SRCINFO @@ -9,6 +9,7 @@ pkgbase = proton-drive-for-linux makedepends = cargo makedepends = gettext depends = fuse3 + depends = polkit depends = gtk4 depends = libadwaita depends = webkitgtk-6.0 diff --git a/packaging/aur/proton-drive-for-linux/PKGBUILD b/packaging/aur/proton-drive-for-linux/PKGBUILD index b94dc45..6cd2de3 100644 --- a/packaging/aur/proton-drive-for-linux/PKGBUILD +++ b/packaging/aur/proton-drive-for-linux/PKGBUILD @@ -8,7 +8,7 @@ arch=('x86_64') url="https://proton-drive.narl.io" _repo="https://github.com/narrrl/proton-drive-linux" license=('MIT') -depends=('fuse3' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'dbus' 'gcc-libs' 'glibc' +depends=('fuse3' 'polkit' 'gtk4' 'libadwaita' 'webkitgtk-6.0' 'dbus' 'gcc-libs' 'glibc' 'hicolor-icon-theme') makedepends=('cargo' 'gettext') optdepends=('perl-image-exiftool: thumbnails for camera RAW files' @@ -73,6 +73,9 @@ package() { install -Dm644 packaging/proton-drive.service \ "$pkgdir/usr/lib/systemd/user/proton-drive.service" + install -Dm644 "packaging/io.narl.proton-drive-linux.policy" \ + "$pkgdir/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy" + # Translations: compiled from po/ into /usr/share/locale. po/build.sh "$pkgdir/usr/share/locale" diff --git a/packaging/io.narl.proton-drive-linux.policy b/packaging/io.narl.proton-drive-linux.policy new file mode 100644 index 0000000..a658152 --- /dev/null +++ b/packaging/io.narl.proton-drive-linux.policy @@ -0,0 +1,14 @@ + + + + + Unlock Hidden albums in Proton Drive + Authenticate to unlock Hidden albums in Proton Drive + + no + no + auth_self + + + diff --git a/packaging/nix/package.nix b/packaging/nix/package.nix index e9f4b4a..00e922a 100644 --- a/packaging/nix/package.nix +++ b/packaging/nix/package.nix @@ -15,6 +15,7 @@ webkitgtk_6_0, libsecret, dbus, + polkit, exiftool, ffmpeg-headless, withFfmpeg ? true, @@ -36,6 +37,7 @@ rustPlatform.buildRustPackage { ../../crates ../../po ../../LICENSE + ../io.narl.proton-drive-linux.policy ../proton-drive.service ../io.narl.proton-drive-linux.desktop ../io.narl.proton-drive-linux-tray.desktop @@ -103,6 +105,8 @@ rustPlatform.buildRustPackage { substituteInPlace $out/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop \ --replace-fail "Exec=pdfs-tray" "Exec=$out/bin/pdfs-tray" + install -Dm644 packaging/io.narl.proton-drive-linux.policy \ + $out/share/polkit-1/actions/io.narl.proton-drive-linux.policy install -Dm644 packaging/proton-drive.service \ $out/lib/systemd/user/proton-drive.service substituteInPlace $out/lib/systemd/user/proton-drive.service \ @@ -123,7 +127,7 @@ rustPlatform.buildRustPackage { # it is the setuid wrapper in /run/wrappers/bin. preFixup = '' gappsWrapperArgs+=(--suffix PATH : ${ - lib.makeBinPath ([ exiftool ] ++ lib.optional withFfmpeg ffmpeg-headless) + lib.makeBinPath ([ exiftool polkit ] ++ lib.optional withFfmpeg ffmpeg-headless) }) ''; diff --git a/packaging/proton-drive-linux.spec b/packaging/proton-drive-linux.spec index 442c631..8ee61ab 100644 --- a/packaging/proton-drive-linux.spec +++ b/packaging/proton-drive-linux.spec @@ -39,6 +39,7 @@ BuildRequires: glib2-devel BuildRequires: webkitgtk6.0-devel BuildRequires: gettext +Requires: polkit Requires: fuse3 Requires: gtk4 Requires: libadwaita @@ -114,6 +115,8 @@ install -D -m0644 %{src}/packaging/io.narl.proton-drive-linux-tray.desktop \ %{buildroot}%{_sysconfdir}/xdg/autostart/io.narl.proton-drive-linux-tray.desktop install -D -m0644 %{src}/packaging/io.narl.proton-drive-linux.svg \ %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg +install -D -m0644 %{src}/packaging/io.narl.proton-drive-linux.policy \ + %{buildroot}/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy install -D -m0644 %{src}/packaging/proton-drive.service \ %{buildroot}/usr/lib/systemd/user/proton-drive.service %{src}/po/build.sh %{buildroot}%{_datadir}/locale @@ -152,6 +155,7 @@ fi %{_sysconfdir}/xdg/autostart/io.narl.proton-drive-linux-tray.desktop %{_datadir}/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg /usr/lib/systemd/user/proton-drive.service +%{_datadir}/polkit-1/actions/io.narl.proton-drive-linux.policy %{_datadir}/locale/*/LC_MESSAGES/pdfs.mo %{_datadir}/bash-completion/completions/pdfs %{_datadir}/zsh/site-functions/_pdfs diff --git a/packaging/tarball/build.sh b/packaging/tarball/build.sh index e58c5f3..711aa32 100755 --- a/packaging/tarball/build.sh +++ b/packaging/tarball/build.sh @@ -32,6 +32,8 @@ install -Dm644 "$repo/packaging/io.narl.proton-drive-linux-tray.desktop" \ "$root/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop" install -Dm644 "$repo/packaging/io.narl.proton-drive-linux.svg" \ "$root/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg" +install -Dm644 "$repo/packaging/io.narl.proton-drive-linux.policy" \ + "$root/share/polkit-1/actions/io.narl.proton-drive-linux.policy" install -Dm644 "$repo/packaging/proton-drive.service" \ "$root/lib/systemd/user/proton-drive.service" install -Dm644 "$repo/LICENSE" "$root/share/licenses/proton-drive-linux/LICENSE"