Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua committed Jan 29, 2024
1 parent e992809 commit 1f34633
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion soda_resource_tools_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ directories = "5.0.1"
reqwest = { version = "0.11.23", features = ["blocking", "json"] }
serde_json = "1.0.111"
serde = { version = "1.0.195", features = ["derive"] }
magic-crypt = "3.1.13"
# magic-crypt = "3.1.13"
chrono = "0.4.32"
8 changes: 4 additions & 4 deletions soda_resource_tools_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};

use directories::ProjectDirs;
use magic_crypt::{new_magic_crypt, MagicCryptTrait};
// use magic_crypt::{new_magic_crypt, MagicCryptTrait};
use serde_json::Value;
use soda_resource_tools_lib::soda::{
self,
Expand Down Expand Up @@ -181,13 +181,13 @@ fn main() {
}

fn init_lib_config(local_soda_config: &Value, config_dir: &Path, cache_dir: &Path, rename_style: &RenameStyle) {
let mc = new_magic_crypt!("biezhihua_soda", 256);
// let mc = new_magic_crypt!("biezhihua_soda", 256);

let bin_path_name = local_soda_config.get("bin").unwrap().as_str().unwrap();
let soda_config_bin_path = config_dir.join(bin_path_name);
let soda_config_bin_content = fs::read_to_string(&soda_config_bin_path).unwrap();
let soda_config_bin = mc.decrypt_base64_to_string(&soda_config_bin_content).unwrap();
let soda_config_bin_json: Value = serde_json::from_str(&soda_config_bin).unwrap();
//let soda_config_bin = mc.decrypt_base64_to_string(&soda_config_bin_content).unwrap();
let soda_config_bin_json: Value = serde_json::from_str(&soda_config_bin_content).unwrap();

let mt_strong_match_rules_tv = soda_config_bin_json.get("mt_strong_match_rules_tv").unwrap();
let mt_strong_match_rules_movie = soda_config_bin_json.get("mt_strong_match_rules_movie").unwrap();
Expand Down
10 changes: 5 additions & 5 deletions soda_resource_tools_lib/tests/config_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ mod config_tests {
combined_json["mt_strong_match_name_map"] = value;
}

let mut bin_out_file = File::create(current_path.parent().unwrap().parent().unwrap().join("soda_cl").join("soda_config.bin")).unwrap();
let mut bin_out_file = File::create(current_path.parent().unwrap().parent().unwrap().join("soda_cl").join("soda_config_rule.json")).unwrap();

let combined_str = serde_json::to_string(&combined_json).unwrap();

let mc = new_magic_crypt!("biezhihua_soda", 256);
// let mc = new_magic_crypt!("biezhihua_soda", 256);

let encoded = mc.encrypt_str_to_base64(combined_str);
// let encoded = mc.encrypt_str_to_base64(combined_str);

bin_out_file.write_all(encoded.as_bytes()).unwrap();
bin_out_file.write_all(combined_str.as_bytes()).unwrap();

let soda_config_json = json!({
"version": 0,
"bin": "soda_config.bin",
"bin": "soda_config_rule.json",
"enable_cli": true,
});

Expand Down

0 comments on commit 1f34633

Please sign in to comment.