From 2abcfe7de2902e108d95bab27db7e075b11b9a8f Mon Sep 17 00:00:00 2001 From: cilame Date: Thu, 21 Oct 2021 21:29:37 +0800 Subject: [PATCH] add --- background.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index affd0f9..f3f5d34 100644 --- a/background.js +++ b/background.js @@ -36,10 +36,10 @@ chrome.debugger.onEvent.addListener(function (source, method, params){ if (result.body !== undefined){ // 收到的 result.body 是 base64(代码) 的代码,使用时需要解码一下 chrome.storage.local.get(["config-fetch_hook"], function (res) { try{ - var respboby = atob(result.body) + var respboby = decodeURIComponent(escape(atob(result.body))) var replacer = eval((res["config-fetch_hook"]||'')+';fetch_hook') if (params.resourceType == 'Script'){ var replbody = btoa(replacer(respboby, params.request.url)) } - if (params.resourceType == 'Document'){ var replbody = btoa(html_script_replacer(respboby, replacer, params.request.url)) } + if (params.resourceType == 'Document'){ var replbody = btoa(unescape(encodeURIComponent(html_script_replacer(respboby, replacer, params.request.url)))) } fillfunc(replbody) } catch(e){ send_error_info_to_front(e.stack, currtab.tabId)