feat: dependencies up-to-date

This commit is contained in:
veeso
2023-04-18 11:58:10 +02:00
parent f6b2c814c0
commit e1a2255a58
7 changed files with 739 additions and 395 deletions
+7
View File
@@ -1,6 +1,7 @@
# Changelog # Changelog
- [Changelog](#changelog) - [Changelog](#changelog)
- [0.11.2](#0112)
- [0.11.1](#0111) - [0.11.1](#0111)
- [0.11.0](#0110) - [0.11.0](#0110)
- [0.10.0](#0100) - [0.10.0](#0100)
@@ -28,6 +29,12 @@
--- ---
## 0.11.2
Released on 18/04/2023
- [Issue 154](https://github.com/veeso/termscp/issues/154): fixed SCP relative paths on Windows
## 0.11.1 ## 0.11.1
Released on 07/03/2022 Released on 07/03/2022
Generated
+692 -369
View File
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -10,7 +10,7 @@ license = "MIT"
name = "termscp" name = "termscp"
readme = "README.md" readme = "README.md"
repository = "https://github.com/veeso/termscp" repository = "https://github.com/veeso/termscp"
version = "0.11.1" version = "0.11.2"
[package.metadata.rpm] [package.metadata.rpm]
package = "termscp" package = "termscp"
@@ -32,27 +32,27 @@ path = "src/main.rs"
[dependencies] [dependencies]
argh = "^0.1" argh = "^0.1"
bitflags = "^1.3" bitflags = "^2.1"
bytesize = "^1.1" bytesize = "^1.1"
chrono = "^0.4" chrono = "^0.4"
content_inspector = "^0.2" content_inspector = "^0.2"
dirs = "^4.0" dirs = "^5.0"
edit = "^0.1" edit = "^0.1"
filetime = "^0.2" filetime = "^0.2"
hostname = "^0.3" hostname = "^0.3"
keyring = { version = "^1.2", optional = true } keyring = { version = "^2.0", optional = true }
lazy-regex = "^2.4" lazy-regex = "^2.5"
lazy_static = "^1.4" lazy_static = "^1.4"
log = "^0.4" log = "^0.4"
magic-crypt = "^3.1" magic-crypt = "^3.1"
notify = "^4.0" notify = "^4.0"
notify-rust = { version = "^4.5", default-features = false, features = [ "d" ] } notify-rust = { version = "^4.5", default-features = false, features = [ "d" ] }
open = "^3.0" open = "^4.0"
rand = "^0.8.5" rand = "^0.8.5"
remotefs = "^0.2.0" remotefs = "^0.2.0"
remotefs-aws-s3 = { version = "^0.2.1", default-features = false, features = [ "find", "rustls" ] } remotefs-aws-s3 = { version = "^0.2.1", default-features = false, features = [ "find", "rustls" ] }
rpassword = "^7.0" rpassword = "^7.0"
self_update = { version = "^0.35", default-features = false, features = [ "rustls", "archive-tar", "archive-zip", "compression-flate2", "compression-zip-deflate" ] } self_update = { version = "^0.36", default-features = false, features = [ "rustls", "archive-tar", "archive-zip", "compression-flate2", "compression-zip-deflate" ] }
serde = { version = "^1", features = [ "derive" ] } serde = { version = "^1", features = [ "derive" ] }
simplelog = "^0.12" simplelog = "^0.12"
ssh2-config = "^0.1.6" ssh2-config = "^0.1.6"
@@ -63,12 +63,12 @@ tui-realm-stdlib = "^1.2"
tuirealm = "^1.8.0" tuirealm = "^1.8.0"
unicode-width = "^0.1" unicode-width = "^0.1"
version-compare = "^0.1" version-compare = "^0.1"
whoami = "^1.2" whoami = "^1.4"
wildmatch = "^2.1" wildmatch = "^2.1"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "^1.3" pretty_assertions = "^1.3"
serial_test = "^0.9" serial_test = "^2.0"
[features] [features]
default = [ "with-keyring" ] default = [ "with-keyring" ]
+1 -2
View File
@@ -16,9 +16,8 @@ use std::str::FromStr;
use std::string::ToString; use std::string::ToString;
bitflags! { bitflags! {
/// ## ExplorerOpts
///
/// ExplorerOpts are bit options which provides different behaviours to `FileExplorer` /// ExplorerOpts are bit options which provides different behaviours to `FileExplorer`
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub(crate) struct ExplorerOpts: u32 { pub(crate) struct ExplorerOpts: u32 {
const SHOW_HIDDEN_FILES = 0b00000001; const SHOW_HIDDEN_FILES = 0b00000001;
} }
+1 -4
View File
@@ -113,10 +113,7 @@ mod tests {
let app_name: &str = "termscp"; let app_name: &str = "termscp";
let secret: &str = "Th15-15/My-Супер-Секрет"; let secret: &str = "Th15-15/My-Супер-Секрет";
// Secret should not exist // Secret should not exist
assert_eq!( assert!(storage.get_key(app_name).is_err());
storage.get_key(app_name).err().unwrap(),
KeyStorageError::NoSuchKey
);
// Write secret // Write secret
assert!(storage.set_key(app_name, secret).is_ok()); assert!(storage.set_key(app_name, secret).is_ok());
// Get secret // Get secret
+15 -10
View File
@@ -26,24 +26,26 @@ impl KeyStorage for KeyringStorage {
/// The key might be acccess through an identifier, which identifies /// The key might be acccess through an identifier, which identifies
/// the key in the storage /// the key in the storage
fn get_key(&self, storage_id: &str) -> Result<String, KeyStorageError> { fn get_key(&self, storage_id: &str) -> Result<String, KeyStorageError> {
let storage: Keyring = Keyring::new(storage_id, self.username.as_str()); let storage: Keyring = Keyring::new(storage_id, self.username.as_str())?;
match storage.get_password() { match storage.get_password() {
Ok(s) => Ok(s), Ok(s) => Ok(s),
Err(e) => match e { Err(e) => match e {
KeyringError::NoEntry => Err(KeyStorageError::NoSuchKey), KeyringError::NoEntry => Err(KeyStorageError::NoSuchKey),
KeyringError::PlatformFailure(_) KeyringError::PlatformFailure(_)
| KeyringError::NoStorageAccess(_) | KeyringError::NoStorageAccess(_)
| KeyringError::WrongCredentialPlatform => Err(KeyStorageError::ProviderError), | KeyringError::Invalid(_, _)
| KeyringError::Ambiguous(_) => Err(KeyStorageError::ProviderError),
KeyringError::BadEncoding(_) | KeyringError::TooLong(_, _) => { KeyringError::BadEncoding(_) | KeyringError::TooLong(_, _) => {
Err(KeyStorageError::BadSytax) Err(KeyStorageError::BadSytax)
} }
_ => Err(KeyStorageError::ProviderError),
}, },
} }
} }
/// Set the key into the key storage /// Set the key into the key storage
fn set_key(&self, storage_id: &str, key: &str) -> Result<(), KeyStorageError> { fn set_key(&self, storage_id: &str, key: &str) -> Result<(), KeyStorageError> {
let storage: Keyring = Keyring::new(storage_id, self.username.as_str()); let storage: Keyring = Keyring::new(storage_id, self.username.as_str())?;
match storage.set_password(key) { match storage.set_password(key) {
Ok(_) => Ok(()), Ok(_) => Ok(()),
Err(_) => Err(KeyStorageError::ProviderError), Err(_) => Err(KeyStorageError::ProviderError),
@@ -55,7 +57,13 @@ impl KeyStorage for KeyringStorage {
/// Returns whether the key storage is supported on the host system /// Returns whether the key storage is supported on the host system
fn is_supported(&self) -> bool { fn is_supported(&self) -> bool {
let dummy: String = String::from("dummy-service"); let dummy: String = String::from("dummy-service");
let storage: Keyring = Keyring::new(dummy.as_str(), self.username.as_str()); let storage: Keyring = match Keyring::new(dummy.as_str(), self.username.as_str()) {
Ok(s) => s,
Err(e) => {
error!("could not instantiate keyring {e}");
return false;
}
};
// Check what kind of error is returned // Check what kind of error is returned
match storage.get_password() { match storage.get_password() {
Ok(_) => true, Ok(_) => true,
@@ -79,21 +87,18 @@ mod tests {
assert!(storage.is_supported()); assert!(storage.is_supported());
let app_name: &str = "termscp-test2"; let app_name: &str = "termscp-test2";
let secret: &str = "Th15-15/My-Супер-Секрет"; let secret: &str = "Th15-15/My-Супер-Секрет";
let kring: Keyring = Keyring::new(app_name, username.as_str()); let kring: Keyring = Keyring::new(app_name, username.as_str()).unwrap();
let _ = kring.delete_password(); let _ = kring.delete_password();
drop(kring); drop(kring);
// Secret should not exist // Secret should not exist
assert_eq!( assert!(storage.get_key(app_name).is_err());
storage.get_key(app_name).err().unwrap(),
KeyStorageError::NoSuchKey
);
// Write secret // Write secret
assert!(storage.set_key(app_name, secret).is_ok()); assert!(storage.set_key(app_name, secret).is_ok());
// Get secret // Get secret
assert_eq!(storage.get_key(app_name).ok().unwrap().as_str(), secret); assert_eq!(storage.get_key(app_name).ok().unwrap().as_str(), secret);
// Delete the key manually... // Delete the key manually...
let kring: Keyring = Keyring::new(app_name, username.as_str()); let kring: Keyring = Keyring::new(app_name, username.as_str()).unwrap();
assert!(kring.delete_password().is_ok()); assert!(kring.delete_password().is_ok());
} }
} }
+14 -1
View File
@@ -9,8 +9,11 @@ pub mod keyringstorage;
// ext // ext
use thiserror::Error; use thiserror::Error;
#[cfg(feature = "with-keyring")]
use keyring::Error as KeyringError;
/// defines the error type for the `KeyStorage` /// defines the error type for the `KeyStorage`
#[derive(Debug, Error, PartialEq, Eq)] #[derive(Debug, Error)]
pub enum KeyStorageError { pub enum KeyStorageError {
#[cfg(feature = "with-keyring")] #[cfg(feature = "with-keyring")]
#[error("Key has a bad syntax")] #[error("Key has a bad syntax")]
@@ -19,6 +22,16 @@ pub enum KeyStorageError {
ProviderError, ProviderError,
#[error("No such key")] #[error("No such key")]
NoSuchKey, NoSuchKey,
#[cfg(feature = "with-keyring")]
#[error("keyring error: {0}")]
KeyringError(KeyringError),
}
#[cfg(feature = "with-keyring")]
impl From<KeyringError> for KeyStorageError {
fn from(e: KeyringError) -> Self {
Self::KeyringError(e)
}
} }
/// this traits provides the methods to communicate and interact with the key storage. /// this traits provides the methods to communicate and interact with the key storage.