From 5fe279a725a815918ed9e0133c6a16613455c8d4 Mon Sep 17 00:00:00 2001 From: Antkites Date: Mon, 12 Aug 2024 22:52:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dxml=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/unpack/uxml.go | 9 +++++---- main.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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)