Skip to content

Commit

Permalink
fix: 修复xml提取问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Ackites committed Aug 12, 2024
1 parent e3a0830 commit 5fe279a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions internal/unpack/uxml.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,18 @@ func (p *XmlParser) Parse(option config.WxapkgInfo) error {
codeStr := string(code)
scriptCode := codeStr

scriptCode = strings.Replace(scriptCode, "var setCssToHead =", "var setCssToHead2 =", 1)
scriptCode = strings.Replace(scriptCode, "var noCss", "var noCss2", -1)

// 防止报错
patch := `var noCss=true;var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};document={};function define(){};function require(){};`
patch := `var noCss=true;var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};
document={getElementsByTagName:()=>{}};function define(){};function require(){};`

// 如果是 html 文件,提取 script 代码
if strings.HasSuffix(frameFile, ".html") {
scriptCode = matchScripts(codeStr)
}

scriptCode = strings.Replace(scriptCode, "var setCssToHead =", "var setCssToHead2 =", 1)
scriptCode = strings.Replace(scriptCode, "var noCss", "var noCss2", -1)

// 正则匹配生成函数
getFuc(scriptCode, gwx)

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
| |\ \| | | | \ / / /_/ / (_| \__ \ <| | | |
\_| \_/_|_|_| \/ \__,_|\__,_|___/_|\_\_| |_|
Wxapkg Decompiler Tool v2.2.1
Wxapkg Decompiler Tool v2.3.0
`
fmt.Println(banner)

Expand Down

0 comments on commit 5fe279a

Please sign in to comment.