Skip to content

Commit

Permalink
Merge pull request #47 from lifo9/fix-regex-helper-obj-name-2
Browse files Browse the repository at this point in the history
Fix REGEX_HELPER_OBJ_NAME - round 2
  • Loading branch information
techmetx11 authored Dec 17, 2024
2 parents 23932bf + 3b0c081 commit 74e879b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub static REGEX_SIGNATURE_FUNCTION: Lazy<Regex> = Lazy::new(|| {
r#")"#
)).unwrap()
});
pub static REGEX_HELPER_OBJ_NAME: &Lazy<Regex> = regex!(r"([A-Za-z0-9_\$]{1,})=function\(");
pub static REGEX_HELPER_OBJ_NAME: &Lazy<Regex> = regex!(r"function\(([a-zA-Z_$][a-zA-Z0-9_$]*)\)|([a-zA-Z_$][a-zA-Z0-9_$]*)\.[A-Za-z_$]");

pub static NSIG_FUNCTION_NAME: &str = "decrypt_nsig";
pub static SIG_FUNCTION_NAME: &str = "decrypt_sig";
7 changes: 3 additions & 4 deletions src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,9 @@ pub async fn fetch_update(state: Arc<GlobalState>) -> Result<(), FetchUpdateStat
// Get the helper object
let helper_object_name = REGEX_HELPER_OBJ_NAME
.captures(sig_function_body)
.unwrap()
.get(1)
.unwrap()
.as_str();
.and_then(|cap| cap.get(1).or_else(|| cap.get(2)))
.map(|m| m.as_str())
.unwrap_or_default();

let mut helper_object_body_regex_str = String::new();
helper_object_body_regex_str += "(var ";
Expand Down

0 comments on commit 74e879b

Please sign in to comment.