Switch to arboard for clipboard support

The clipboard crate has a few indirect vulnerabilities through a
dependency on xcb.
macos-click-through
MultisampledNight 3 years ago
parent 69902a4272
commit bdbef520f8
No known key found for this signature in database
GPG Key ID: C81EF9B053977241

218
Cargo.lock generated

@ -68,6 +68,25 @@ dependencies = [
"winapi",
]
[[package]]
name = "arboard"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc120354d1b5ec6d7aaf4876b602def75595937b5e15d356eb554ab5177e08bb"
dependencies = [
"clipboard-win",
"core-graphics 0.22.3",
"image 0.23.14",
"log",
"objc",
"objc-foundation",
"objc_id",
"parking_lot 0.12.0",
"thiserror",
"winapi",
"x11rb",
]
[[package]]
name = "async-trait"
version = "0.1.53"
@ -274,25 +293,14 @@ dependencies = [
"os_str_bytes",
]
[[package]]
name = "clipboard"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a904646c0340239dcf7c51677b33928bf24fdf424b79a57909c0109075b2e7"
dependencies = [
"clipboard-win",
"objc",
"objc-foundation",
"objc_id",
"x11-clipboard",
]
[[package]]
name = "clipboard-win"
version = "2.2.0"
version = "4.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3a093d6fed558e5fe24c3dfc85a68bb68f1c824f440d3ba5aca189e2998786b"
checksum = "2f3e1238132dc01f081e1cbb9dace14e5ef4c3a51ee244bd982275fb514605db"
dependencies = [
"error-code",
"str-buf",
"winapi",
]
@ -534,6 +542,16 @@ dependencies = [
"syn",
]
[[package]]
name = "deflate"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
dependencies = [
"adler32",
"byteorder",
]
[[package]]
name = "deflate"
version = "1.0.0"
@ -635,6 +653,16 @@ dependencies = [
"termcolor",
]
[[package]]
name = "error-code"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
dependencies = [
"libc",
"str-buf",
]
[[package]]
name = "euclid"
version = "0.22.7"
@ -665,7 +693,7 @@ dependencies = [
"cfg-if 1.0.0",
"crc32fast",
"libc",
"miniz_oxide",
"miniz_oxide 0.5.1",
]
[[package]]
@ -825,6 +853,16 @@ dependencies = [
"tokio-io",
]
[[package]]
name = "gethostname"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "getrandom"
version = "0.1.16"
@ -986,6 +1024,22 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "image"
version = "0.23.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"num-iter",
"num-rational 0.3.2",
"num-traits",
"png 0.16.8",
"tiff",
]
[[package]]
name = "image"
version = "0.24.1"
@ -996,9 +1050,9 @@ dependencies = [
"byteorder",
"color_quant",
"num-iter",
"num-rational",
"num-rational 0.4.0",
"num-traits",
"png",
"png 0.17.5",
]
[[package]]
@ -1050,6 +1104,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jpeg-decoder"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]]
name = "js-sys"
version = "0.3.57"
@ -1185,6 +1245,25 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
dependencies = [
"adler32",
]
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.5.1"
@ -1324,10 +1403,10 @@ checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121"
name = "neovide"
version = "0.9.0"
dependencies = [
"arboard",
"async-trait",
"cfg-if 1.0.0",
"clap 3.1.9",
"clipboard",
"derive-new",
"dirs",
"euclid",
@ -1335,7 +1414,7 @@ dependencies = [
"futures 0.3.21",
"gl",
"glutin",
"image",
"image 0.24.1",
"lazy_static",
"log",
"lru",
@ -1392,6 +1471,19 @@ dependencies = [
"libc",
]
[[package]]
name = "nix"
version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]
name = "nom"
version = "7.1.1"
@ -1438,6 +1530,17 @@ dependencies = [
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.4.0"
@ -1684,6 +1787,18 @@ version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]]
name = "png"
version = "0.16.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
dependencies = [
"bitflags",
"crc32fast",
"deflate 0.8.6",
"miniz_oxide 0.3.7",
]
[[package]]
name = "png"
version = "0.17.5"
@ -1692,8 +1807,8 @@ checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba"
dependencies = [
"bitflags",
"crc32fast",
"deflate",
"miniz_oxide",
"deflate 1.0.0",
"miniz_oxide 0.5.1",
]
[[package]]
@ -2134,6 +2249,12 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "str-buf"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
[[package]]
name = "strsim"
version = "0.8.0"
@ -2234,6 +2355,17 @@ dependencies = [
"syn",
]
[[package]]
name = "tiff"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437"
dependencies = [
"jpeg-decoder",
"miniz_oxide 0.4.4",
"weezl",
]
[[package]]
name = "time"
version = "0.3.9"
@ -2628,6 +2760,12 @@ dependencies = [
"webpki",
]
[[package]]
name = "weezl"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c97e489d8f836838d497091de568cf16b117486d529ec5579233521065bd5e4"
[[package]]
name = "which"
version = "4.2.5"
@ -2664,6 +2802,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "winapi-wsapoll"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@ -2758,15 +2905,6 @@ dependencies = [
"toml",
]
[[package]]
name = "x11-clipboard"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89bd49c06c9eb5d98e6ba6536cf64ac9f7ee3a009b2f53996d405b3944f6bcea"
dependencies = [
"xcb",
]
[[package]]
name = "x11-dl"
version = "2.19.1"
@ -2779,22 +2917,24 @@ dependencies = [
]
[[package]]
name = "xattr"
version = "0.2.2"
name = "x11rb"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a"
dependencies = [
"libc",
"gethostname",
"nix 0.22.3",
"winapi",
"winapi-wsapoll",
]
[[package]]
name = "xcb"
version = "0.8.2"
name = "xattr"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e917a3f24142e9ff8be2414e36c649d47d6cc2ba81f16201cdef96e533e02de"
checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
dependencies = [
"libc",
"log",
]
[[package]]

@ -16,10 +16,10 @@ default = []
embed-fonts = []
[dependencies]
arboard = "2.1.1"
async-trait = "0.1.53"
cfg-if = "1.0.0"
clap = { version = "3.1.9", features = ["cargo"] }
clipboard = "0.5.0"
derive-new = "0.5.9"
dirs = "4.0.0"
euclid = "0.22.7"

@ -257,3 +257,4 @@ snap install neovide
### Linux-specific
- If you recieve errors complaining about DRI3 settings, please reference issue [#44](https://github.com/neovide/neovide/issues/44#issuecomment-578618052).
- Wayland clipboard support requires Xwayland to be running (to be solved if [the egui contributors come back to arboard](https://github.com/emilk/egui/pull/1613#issuecomment-1130634147))

@ -2,12 +2,11 @@ use std::error::Error;
use rmpv::Value;
use clipboard::ClipboardContext;
use clipboard::ClipboardProvider;
use arboard::Clipboard;
pub fn get_remote_clipboard(format: Option<&str>) -> Result<Value, Box<dyn Error>> {
let mut ctx: ClipboardContext = ClipboardProvider::new()?;
let clipboard_raw = ctx.get_contents()?.replace('\r', "");
let mut clipboard_ctx = Clipboard::new()?;
let clipboard_raw = clipboard_ctx.get_text()?.replace('\r', "");
let lines = if let Some("dos") = format {
// add \r to lines of current file format is dos
@ -51,6 +50,7 @@ pub fn set_remote_clipboard(arguments: Vec<Value>) -> Result<(), Box<dyn Error>>
})
.ok_or("can't build string from provided text")?;
let mut ctx: ClipboardContext = ClipboardProvider::new()?;
ctx.set_contents(lines)
let mut clipboard_ctx = Clipboard::new()?;
clipboard_ctx.set_text(lines)?;
Ok(())
}

Loading…
Cancel
Save