feat: update osssendfile

This commit is contained in:
2025-10-13 23:33:56 +08:00
parent 5d215d3ca3
commit b0d9cbfb61
3 changed files with 20 additions and 7 deletions

View File

@@ -250,6 +250,19 @@ async fn main() -> XResult<()> {
} }
fn load_config(config: &Option<String>) -> XResult<OssSendFileConfig> { fn load_config(config: &Option<String>) -> XResult<OssSendFileConfig> {
if let Some(config_str) = config {
if let Ok(oss_send_config) = serde_json::from_str::<OssSendFileConfig>(config_str) {
return Ok(oss_send_config);
}
if let Ok(config_vec) = STANDARD.decode(config_str) {
if let Ok(config_str_ori) = String::from_utf8(config_vec) {
if let Ok(oss_send_config) = serde_json::from_str::<OssSendFileConfig>(&config_str_ori) {
return Ok(oss_send_config);
}
}
}
}
let config_file_opt = util_file::read_config( let config_file_opt = util_file::read_config(
config.clone(), config.clone(),
&[OSS_SEND_FILE_CONFIG_FILE.to_string()], &[OSS_SEND_FILE_CONFIG_FILE.to_string()],
@@ -381,5 +394,5 @@ async fn parse_sts_response(response: Response) -> XResult<Sts> {
Ok(sts) Ok(sts)
} }
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20251010T002421+08:00.MEQCIDpVktuwmcLXHLxEDQYk // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20251013T233142+08:00.MEQCIAJA6GipLx8rl7COAqr6
// C22TommHKEEhA6lpSqVGtIXqAiBMe7RqBUIfXYUd/+4Nu960nGuQq0m1Z6xcE527UOH0Zg== // tn8fjlnwNyfgKsqJ9xq/ESefAiAIuLmVwnSAe20Rz4YCf2yd1OQpueEDh4yaaj5pFSuxdA==

View File

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

View File

@@ -46,8 +46,8 @@
}, },
"osssendfile-rs": { "osssendfile-rs": {
"script_name": "osssendfile-rs", "script_name": "osssendfile-rs",
"script_length": 14153, "script_length": 14672,
"script_sha256": "48a41196a640a3f34a56a40c4b292cb71cf55dbab479a3bd032219af727895da" "script_sha256": "a0fa65bd6d185a0d7fd0b6480e877ebc216816587f0d78625d6f9bb0886298c9"
}, },
"post-rs": { "post-rs": {
"script_name": "post-rs", "script_name": "post-rs",