diff --git a/internal/unpack/uxml.go b/internal/unpack/uxml.go index c1116db..5e9fa40 100644 --- a/internal/unpack/uxml.go +++ b/internal/unpack/uxml.go @@ -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) diff --git a/main.go b/main.go index 7def5c1..249d84d 100644 --- a/main.go +++ b/main.go @@ -50,7 +50,7 @@ func main() { | |\ \| | | | \ / / /_/ / (_| \__ \ <| | | | \_| \_/_|_|_| \/ \__,_|\__,_|___/_|\_\_| |_| - Wxapkg Decompiler Tool v2.2.1 + Wxapkg Decompiler Tool v2.3.0 ` fmt.Println(banner)