some log movearounds

This commit is contained in:
beerpiss 2024-06-27 00:38:49 +07:00
parent 9105491454
commit 8a0507f03c

View File

@ -97,14 +97,14 @@ static UPSERT_USER_ALL_API: OnceLock<String> = OnceLock::new();
static CONFIG: OnceLock<SaekawaConfig> = OnceLock::new(); static CONFIG: OnceLock<SaekawaConfig> = OnceLock::new();
pub fn hook_init() -> Result<(), HookError> { pub fn hook_init() -> Result<(), HookError> {
info!("Reading hook configuration"); debug!("Reading hook configuration");
let config = SaekawaConfig::load().context(ConfigSnafu)?; let config = SaekawaConfig::load().context(ConfigSnafu)?;
if config.cards.is_empty() { if config.cards.is_empty() {
return Err(HookError::NoCardsError); return Err(HookError::NoCardsError);
} }
info!("Loaded tokens for {} access codes", config.cards.len()); info!("Loaded API keys for {} access code(s).", config.cards.len());
if let Some(d) = &config.general.failed_import_dir { if let Some(d) = &config.general.failed_import_dir {
if d.exists() && !d.is_dir() { if d.exists() && !d.is_dir() {
@ -124,7 +124,7 @@ pub fn hook_init() -> Result<(), HookError> {
let info = get_project_conf()?; let info = get_project_conf()?;
info!( info!(
"Running on {} {}.{}.{}", "Running on {} {}.{:0>2}.{:0>2}",
info.game_id, info.major, info.minor, info.build info.game_id, info.major, info.minor, info.build
); );
@ -139,18 +139,19 @@ pub fn hook_init() -> Result<(), HookError> {
debug!("Checking if network requests are encrypted"); debug!("Checking if network requests are encrypted");
setup_network_encryption(&info)?; setup_network_encryption(&info)?;
info!("Enabling hooks");
crochet::enable!(winhttpwritedata_hook).context(CrochetSnafu)?; crochet::enable!(winhttpwritedata_hook).context(CrochetSnafu)?;
info!("Hooks enabled.");
Ok(()) Ok(())
} }
pub fn hook_release() -> Result<(), HookError> { pub fn hook_release() -> Result<(), HookError> {
if crochet::is_enabled!(winhttpwritedata_hook) { if crochet::is_enabled!(winhttpwritedata_hook) {
info!("Disabling hooks");
crochet::disable!(winhttpwritedata_hook).context(CrochetSnafu)?; crochet::disable!(winhttpwritedata_hook).context(CrochetSnafu)?;
} }
info!("Hooks disabled.");
Ok(()) Ok(())
} }