whistle 2.9.76 → 2.9.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![Test coverage](https://codecov.io/gh/avwo/whistle/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/avwo/whistle)
11
11
  [![npm download](https://img.shields.io/npm/dm/whistle.svg?style=flat-square)](https://npmjs.org/package/whistle)
12
12
  [![NPM count](https://img.shields.io/npm/dt/whistle.svg?style=flat-square)](https://www.npmjs.com/package/whistle)
13
- [![License](https://img.shields.io/npm/l/whistle.svg?style=flat-square)](https://www.npmjs.com/package/whistle)
13
+ [![License](https://img.shields.io/aur/license/whistle?style=flat-square)](https://www.npmjs.com/package/whistle)
14
14
 
15
15
  **Mac 或 Windows 系统推荐使用客户端版本:https://github.com/avwo/whistle-client**
16
16
 
@@ -29,7 +29,8 @@ Whistle 是基于 Node 实现的跨平台抓包调试工具,其主要特点:
29
29
  * 项目可以自带代理规则配置并一键设置到本地 Whistle 代理,也可以通过定制插件简化操作
30
30
 
31
31
  # 一键安装
32
- > 已安装 `brew` 的 PC,可以省略以下 1、2 步骤,直接通过以下方式一键安装:`brew install whistle && w2 start --init`(arm64 平台尝试用 `brew install node && npm i -g whistle && w2 start --init`)
32
+ > 已安装 `brew` 的 PC,可以省略以下 1、2 步骤,直接通过以下方式一键安装:`brew install whistle && w2 start --init`
33
+
33
34
  1. 安装 Node(建议安装**最新的 LTS 版本**,如已安装忽略此步骤):https://nodejs.org/
34
35
  2. 一键安装,在命令行执行以下命令:
35
36
  ``` sh
package/assets/js/log.js CHANGED
@@ -220,6 +220,22 @@
220
220
 
221
221
  return obj === undefined ? 'undefined' : obj;
222
222
  }
223
+ var prefixPath;
224
+ function getPathPrefix() {
225
+ if (prefixPath) {
226
+ return prefixPath;
227
+ }
228
+ prefixPath = window.__WHISTLE_PATH_PREFIX__;
229
+ if (/^\/[\w./-]+$/.test(prefixPath) && prefixPath.length <= 128) {
230
+ var len = prefixPath.length - 1;
231
+ if (prefixPath[len] === '/') {
232
+ prefixPath = prefixPath.substring(0, len);
233
+ }
234
+ } else {
235
+ prefixPath = '';
236
+ }
237
+ return prefixPath;
238
+ }
223
239
 
224
240
  var index = 0;
225
241
  var MAX_LEN = 1024 * 56;
@@ -237,7 +253,8 @@
237
253
  logStr = logStr.substring(0, percIndex);
238
254
  }
239
255
  }
240
- img.src ='$LOG_CGI?id=$LOG_ID&level=' + level + '&text=' + logStr
256
+ var baseUrl = '$BASE_URL' + getPathPrefix();
257
+ img.src = baseUrl + '$LOG_CGI?id=$LOG_ID&level=' + level + '&text=' + logStr
241
258
  + '&t=' + new Date().getTime() + '&' + ++index;
242
259
  var preventGC = function() {
243
260
  img.onload = img.onerror = null;
@@ -3,12 +3,22 @@
3
3
  if (typeof window === 'undefined' || window.WeinreServerURL) {
4
4
  return;
5
5
  }
6
- window.WeinreServerURL = '$WEINRE_PATH';
6
+ var prefixPath = window.__WHISTLE_PATH_PREFIX__;
7
+ if (/^\/[\w./-]+$/.test(prefixPath) && prefixPath.length <= 128) {
8
+ var len = prefixPath.length - 1;
9
+ if (prefixPath[len] === '/') {
10
+ prefixPath = prefixPath.substring(0, len);
11
+ }
12
+ } else {
13
+ prefixPath = '';
14
+ }
15
+ var baseUrl = '$BASE_URL' + prefixPath;
16
+ window.WeinreServerURL = baseUrl + '$WEINRE_PATH';
7
17
  var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement;
8
18
  var script = document.createElement('script');
9
19
  script.async = true;
10
20
  script.charset = 'utf8';
11
- script.src = '$WEINRE_URL';
21
+ script.src = baseUrl + '$WEINRE_URL';
12
22
  if (head.firstChild) {
13
23
  head.insertBefore(script, head.firstChild);
14
24
  } else {
@@ -8,6 +8,6 @@
8
8
  </head>
9
9
  <body style="overscroll-behavior-x: none;">
10
10
  <div id="container" class="main"></div>
11
- <script src="js/index.js?v=2.9.75"></script>
11
+ <script src="js/index.js?v=2.9.78"></script>
12
12
  </body>
13
13
  </html>