correction + regexp
This commit is contained in:
@ -119,12 +119,23 @@ pub fn start_server(db: Arc<Mutex<Database>>, crypto: Arc<Crypto>, socket_path:
|
||||
}
|
||||
|
||||
IpcRequest::SetClipboard { content } => {
|
||||
let actual =
|
||||
if content.starts_with("enc:") || content.starts_with("enc2:") {
|
||||
crypto_clone.decrypt(&content).unwrap_or(content)
|
||||
} else {
|
||||
content
|
||||
};
|
||||
let actual = if Crypto::is_legacy_encrypted(&content) {
|
||||
crypto_clone.decrypt(&content).unwrap_or_else(|e| {
|
||||
eprintln!("Impossible de déchiffrer l'entrée enc: : {e}");
|
||||
content.clone()
|
||||
})
|
||||
} else if Crypto::is_password_encrypted(&content) {
|
||||
reply(
|
||||
&mut stream,
|
||||
IpcResponse::Error(
|
||||
"Entrée chiffrée par mot de passe : déchiffrez-la côté client avant de coller"
|
||||
.to_string(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
content
|
||||
};
|
||||
|
||||
match arboard::Clipboard::new() {
|
||||
Ok(mut cb) => {
|
||||
@ -142,6 +153,14 @@ pub fn start_server(db: Arc<Mutex<Database>>, crypto: Arc<Crypto>, socket_path:
|
||||
height: h,
|
||||
bytes: std::borrow::Cow::Owned(rgba.into_raw()),
|
||||
});
|
||||
} else {
|
||||
reply(
|
||||
&mut stream,
|
||||
IpcResponse::Error(format!(
|
||||
"Image introuvable : {actual}"
|
||||
)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user