feat: update osssendfile-rs
This commit is contained in:
@@ -42,6 +42,8 @@ const OSS_SEND_FILE_CONFIG_FILE: &str = "~/.jssp/config/osssendfile.json";
|
||||
const CREATE_STS_URL: &str = "https://global.hatter.ink/oidc/create_sts.json";
|
||||
const ADD_DOC_URL: &str = "https://play.hatter.me/doc/addDoc.jsonp";
|
||||
|
||||
const ENV_OSS_SEND_FILE_CONFIG: &str = "OSS_SEND_FILE_CONFIG";
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "osssendfile-rs", bin_name = "osssendfile.rs")]
|
||||
#[command(about = "OSS send file Rust edition", long_about = None)]
|
||||
@@ -250,7 +252,11 @@ async fn main() -> XResult<()> {
|
||||
}
|
||||
|
||||
fn load_config(config: &Option<String>) -> XResult<OssSendFileConfig> {
|
||||
if let Some(config_str) = config {
|
||||
let config = match config {
|
||||
Some(config) => Some(config.clone()),
|
||||
None => std::env::var(ENV_OSS_SEND_FILE_CONFIG).ok(),
|
||||
};
|
||||
if let Some(config_str) = &config {
|
||||
if let Ok(oss_send_config) = serde_json::from_str::<OssSendFileConfig>(config_str) {
|
||||
return Ok(oss_send_config);
|
||||
}
|
||||
@@ -264,7 +270,7 @@ fn load_config(config: &Option<String>) -> XResult<OssSendFileConfig> {
|
||||
}
|
||||
|
||||
let config_file_opt = util_file::read_config(
|
||||
config.clone(),
|
||||
config,
|
||||
&[OSS_SEND_FILE_CONFIG_FILE.to_string()],
|
||||
);
|
||||
let config_file = opt_value_result!(config_file_opt, "Config file not found.");
|
||||
@@ -394,5 +400,5 @@ async fn parse_sts_response(response: Response) -> XResult<Sts> {
|
||||
Ok(sts)
|
||||
}
|
||||
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20251013T233142+08:00.MEQCIAJA6GipLx8rl7COAqr6
|
||||
// tn8fjlnwNyfgKsqJ9xq/ESefAiAIuLmVwnSAe20Rz4YCf2yd1OQpueEDh4yaaj5pFSuxdA==
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20251015T193822+08:00.MEYCIQCHVvU0SXeLuxIAD19G
|
||||
// PbuX9ZsYWBpsHL2aSo7MeelVhAIhAPMrEXIaiyaEDB8YtQfun1Sb+nwiAUeJvIOc9pKd5NwM
|
||||
|
||||
Reference in New Issue
Block a user