mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
added new s3 params
This commit is contained in:
committed by
Christian Visintin
parent
c5eba4b56a
commit
f28dba7660
@@ -227,11 +227,12 @@ impl AuthActivity {
|
||||
|
||||
fn load_bookmark_s3_into_gui(&mut self, params: AwsS3Params) {
|
||||
self.mount_s3_bucket(params.bucket_name.as_str());
|
||||
self.mount_s3_region(params.region.as_str());
|
||||
self.mount_s3_region(params.region.as_deref().unwrap_or(""));
|
||||
self.mount_s3_profile(params.profile.as_deref().unwrap_or(""));
|
||||
self.mount_s3_access_key(params.access_key.as_deref().unwrap_or(""));
|
||||
self.mount_s3_secret_access_key(params.secret_access_key.as_deref().unwrap_or(""));
|
||||
self.mount_s3_security_token(params.security_token.as_deref().unwrap_or(""));
|
||||
self.mount_s3_session_token(params.session_token.as_deref().unwrap_or(""));
|
||||
// TODO: add mount
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,9 +88,6 @@ impl AuthActivity {
|
||||
if params.bucket_name.is_empty() {
|
||||
return Err("Invalid bucket");
|
||||
}
|
||||
if params.region.is_empty() {
|
||||
return Err("Invalid region");
|
||||
}
|
||||
Ok(FileTransferParams {
|
||||
protocol: FileTransferProtocol::AwsS3,
|
||||
params: ProtocolParams::AwsS3(params),
|
||||
|
||||
@@ -726,12 +726,13 @@ impl AuthActivity {
|
||||
/// Collect s3 input values from view
|
||||
pub(super) fn get_s3_params_input(&self) -> AwsS3Params {
|
||||
let bucket: String = self.get_input_s3_bucket();
|
||||
let region: String = self.get_input_s3_region();
|
||||
let region: Option<String> = self.get_input_s3_region();
|
||||
let profile: Option<String> = self.get_input_s3_profile();
|
||||
let access_key = self.get_input_s3_access_key();
|
||||
let secret_access_key = self.get_input_s3_secret_access_key();
|
||||
let security_token = self.get_input_s3_security_token();
|
||||
let session_token = self.get_input_s3_session_token();
|
||||
// TODO: collect
|
||||
AwsS3Params::new(bucket, region, profile)
|
||||
.access_key(access_key)
|
||||
.secret_access_key(secret_access_key)
|
||||
@@ -777,10 +778,10 @@ impl AuthActivity {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn get_input_s3_region(&self) -> String {
|
||||
pub(super) fn get_input_s3_region(&self) -> Option<String> {
|
||||
match self.app.state(&Id::S3Region) {
|
||||
Ok(State::One(StateValue::String(x))) => x,
|
||||
_ => String::new(),
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,8 +864,12 @@ impl AuthActivity {
|
||||
None => String::default(),
|
||||
};
|
||||
format!(
|
||||
"{}://{} ({}) {}",
|
||||
protocol, s3.bucket_name, s3.region, profile
|
||||
"{}://{}{} ({}) {}",
|
||||
protocol,
|
||||
s3.endpoint.unwrap_or_default(),
|
||||
s3.bucket_name,
|
||||
s3.region.as_deref().unwrap_or("custom"),
|
||||
profile
|
||||
)
|
||||
}
|
||||
ProtocolParams::Generic(params) => {
|
||||
|
||||
@@ -147,8 +147,10 @@ impl FileTransferActivity {
|
||||
}
|
||||
ProtocolParams::AwsS3(params) => {
|
||||
info!(
|
||||
"Client is not connected to remote; connecting to {} ({})",
|
||||
params.bucket_name, params.region
|
||||
"Client is not connected to remote; connecting to {}{} ({})",
|
||||
params.endpoint.as_deref().unwrap_or(""),
|
||||
params.bucket_name,
|
||||
params.region.as_deref().unwrap_or("custom")
|
||||
);
|
||||
format!("Connecting to {}…", params.bucket_name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user