From 1248016afdf0ed2b46b536beace8561e3dbc3273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Sat, 27 Apr 2024 22:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/proxy/middleware/InsertScriptMiddleware.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js b/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js index a399dd0..89730a1 100644 --- a/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js +++ b/packages/mitmproxy/src/lib/proxy/middleware/InsertScriptMiddleware.js @@ -124,7 +124,12 @@ module.exports = { return } const urlPath = rOptions.path - const filename = urlPath.replace(contextPath, '') + let filename = urlPath.replace(contextPath, '') + + // 重命名过,向下兼容 + if (filename === 'global') { + filename = 'tampermonkey' + } const script = monkey.get(setting.script.defaultDir)[filename] // log.info(`urlPath: ${urlPath}, fileName: ${filename}, script: ${script}`)