diff --git a/strata-daemon/Cargo.lock b/strata-daemon/Cargo.lock index 9464eb4..26fac71 100644 --- a/strata-daemon/Cargo.lock +++ b/strata-daemon/Cargo.lock @@ -201,12 +201,6 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "bitflags" version = "2.11.1" @@ -1281,7 +1275,6 @@ name = "strata-daemon" version = "0.2.0" dependencies = [ "anyhow", - "base64", "blake3", "dirs", "image", diff --git a/strata-daemon/Cargo.toml b/strata-daemon/Cargo.toml index 8786467..54c3ca7 100644 --- a/strata-daemon/Cargo.toml +++ b/strata-daemon/Cargo.toml @@ -32,7 +32,6 @@ uuid = { version = "1", features = ["v4"] } # Image thumbnail generation (runs in spawn_blocking — never blocks async runtime) image = { version = "0.25", default-features = false, features = ["png", "jpeg"] } -base64 = { version = "0.22", features = ["std"] } # Fast content hashing for deduplication blake3 = "1" diff --git a/strata-daemon/src/dbus_service.rs b/strata-daemon/src/dbus_service.rs index e1cb17a..793f381 100644 --- a/strata-daemon/src/dbus_service.rs +++ b/strata-daemon/src/dbus_service.rs @@ -1,7 +1,6 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -use base64::Engine as _; use zbus::{interface, object_server::SignalContext}; use crate::db::{Db, RawItem}; @@ -112,7 +111,8 @@ impl StrataManager { /// Return the raw content of a clipboard item for GJS to write to clipboard. /// GJS uses St.Clipboard (text) or Meta.SelectionSourceMemory (images) /// because the Wayland data-control protocol is not accessible from non-compositor processes. - async fn get_item_content(&self, id: String) -> zbus::fdo::Result<(String, String)> { + /// Content is returned as a raw byte array (`ay`) — no base64 round-trip. + async fn get_item_content(&self, id: String) -> zbus::fdo::Result<(String, Vec)> { let db = self.db.clone(); let item: Option = tokio::task::spawn_blocking(move || db.get_raw_item(&id)) .await @@ -121,15 +121,15 @@ impl StrataManager { let item = item.ok_or_else(|| zbus::fdo::Error::Failed("Item not found".into()))?; - let content_b64 = if let Some(text) = item.content_text { - base64::engine::general_purpose::STANDARD.encode(text.as_bytes()) + let content = if let Some(text) = item.content_text { + text.into_bytes() } else if let Some(blob) = item.content_blob { - base64::engine::general_purpose::STANDARD.encode(&blob) + blob } else { return Err(zbus::fdo::Error::Failed("Item has no content".into())); }; - Ok((item.mime_type, content_b64)) + Ok((item.mime_type, content)) } /// Restore a clipboard item to the system clipboard. diff --git a/strata@edu4rdshl.dev/dbus.js b/strata@edu4rdshl.dev/dbus.js index 8dc3183..794e3de 100644 --- a/strata@edu4rdshl.dev/dbus.js +++ b/strata@edu4rdshl.dev/dbus.js @@ -30,9 +30,9 @@ const STRATA_IFACE_XML = ` - - - + + + diff --git a/strata@edu4rdshl.dev/ui/panel.js b/strata@edu4rdshl.dev/ui/panel.js index ede8a4f..c4a418e 100644 --- a/strata@edu4rdshl.dev/ui/panel.js +++ b/strata@edu4rdshl.dev/ui/panel.js @@ -471,8 +471,8 @@ export class StrataPanel { async _onItemActivated(id) { try { - const [mimeType, contentB64] = await this._proxy.GetItemContentAsync(id); - this._writeToClipboard(mimeType, GLib.base64_decode(contentB64)); + const [mimeType, content] = await this._proxy.GetItemContentAsync(id); + this._writeToClipboard(mimeType, content); } catch (e) { console.error('[Strata] Paste error:', e); }