feat: update osssendfile-rs

This commit is contained in:
2025-10-15 19:38:49 +08:00
parent b0d9cbfb61
commit 2ea46e6df2
3 changed files with 15 additions and 9 deletions

View File

@@ -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

View File

@@ -82,11 +82,11 @@
},
"osssendfile.rs": {
"script_name": "osssendfile.rs",
"script_length": 14672,
"script_sha256": "a0fa65bd6d185a0d7fd0b6480e877ebc216816587f0d78625d6f9bb0886298c9",
"script_length": 14876,
"script_sha256": "a16d5f0d2da9f4c034a42ff7bb4caa434cc2673fd8f882fbb23dd16c21f18afa",
"script_full_url": "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/osssendfile-rs/src/main.rs",
"publish_time": 1737272563311,
"update_time": 1760369626453
"update_time": 1760528318233
},
"post.rs": {
"script_name": "post.rs",

View File

@@ -46,8 +46,8 @@
},
"osssendfile-rs": {
"script_name": "osssendfile-rs",
"script_length": 14672,
"script_sha256": "a0fa65bd6d185a0d7fd0b6480e877ebc216816587f0d78625d6f9bb0886298c9"
"script_length": 14876,
"script_sha256": "a16d5f0d2da9f4c034a42ff7bb4caa434cc2673fd8f882fbb23dd16c21f18afa"
},
"post-rs": {
"script_name": "post-rs",