Skip to content

Commit 1647e6a

Browse files
committed
Squashed 'vendor/whistle/' changes from c646ec656..5ae0a8249
5ae0a8249 refactor: refine code 747378001 refactor: refine code 02ee0c874 refactor: refine code 2a28aad8d Release v2.9.70 08abc15a6 feat: lineProps://module ... dc3b8cb33 feat: custom plugins context menu 823599b81 refactor: refine code d8991cf56 Release v2.9.69 e19218d24 feat: add SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 7dfa55700 feat: import data by dataUrl param cb1a1694a refactor: refine code 056d48b02 Release v2.9.68 43d075944 docs: update a8e4fcb76 refactor: refine ui cfc50afaa refactor: refine ui 7db11ba42 feat: enable://abortRes 1b8c42998 docs: typo 25a8da87c Release v2.9.67 d933cb47d feat: update ws-parser e6bef4551 Release v2.9.67 ca1f53abe refactor: refine code d3c613e4c feat: enable://requestWithMatchedRules enable://responseWithMatchedRules 8b6d3bbe2 feat: refine ui e7754c875 Release v2.9.66 beb08b5d5 Release v2.9.66 7629d69ee feat: filter logs by regexp 6b3fa21be feat: disable://captureHttp disable://captureHttps eefba5650 feat: allow to edit temp files 5916a52bb Release v2.9.65 ecdec0c42 feat: allow to edit temp files d43ddfb3b chore: ignore temp_files 74cf72fc4 Release v2.9.65 7f1cad6b4 Relese v2.9.64 570db1211 fix: avwo/whistle#1040 8ef57c9df Release v2.9.64 f556a7261 feat: refine Rules & Values group a615b16b8 feat: refine Rules & Values group 5eb817d5b Release v2.9.63 7240a9037 feat: Partitioned & ProxyRules 9a840687c feat: CopyAsCURL f360fa807 feat: support cookie partitioned props f72137824 Release v2.9.62 112c65df7 feat: openInModal 2a86679a0 feat: export & import Composer data e774483d0 feat: showOption & hideOption b1b6aa1a9 Release v2.9.62 11795a1c7 perf: optimize memory e36a40253 feat: import&export network settings 6b63969eb refactor: modify secret key 63f140af3 Release v2.9.61 c4e9e14cb refactor: refine composer 8b1d2d83f fix: avwo/whistle#1017 b5a775678 refactor: update set-global-proxy ee54302ea Release v2.9.60 9ee6cb82a feat: refine parseUrl 1d273d811 docs: typo dd8d64589 Release v2.9.59 15330b99e feat: get submatches from filter regexp pattern e61bfdb47 feat: support webview efb5a73f4 feat: add webview ee331663f feat: add webview 7dd832d92 Release v2.9.58 54b8413fd feat: add special path /_WHISTLE_5b6af7b9884e1165_/ 87e38a853 feat: import rules by plugins f0d3b0dbf feat: import rules edbd2ab19 feat: add specail path 44c579a78 feat: temp file 8f470eba4 chore: fix typo in data-center.js b4c7153ca refactor: refine ui a87806083 Release v2.9.57 899f54f64 feat: add uiExt option d7f6acc1e feat: add uiExt option cbeec82c8 feat: refine composer git-subtree-dir: vendor/whistle git-subtree-split: 5ae0a82491eec67bf8b6856be638e0991a22f0a2
1 parent 3e6d41e commit 1647e6a

File tree

128 files changed

+5141
-1553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+5141
-1553
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ coverage
6464
_book
6565
dist
6666
/.history
67+
/test/temp_files

CHANGELOG.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
# v2.9.70
2+
1. feat: 插件列表添加自定义右键菜单
3+
2. feat: 支持通过 `pattern jsAppend://[value|file|url] linePropslineProps://nomodule lineProps://module lineProps://defer lineProps://async lineProps://crossorigin` 设置标签属性
4+
5+
# v2.9.69
6+
1. fix: https://github.com/avwo/whistle/issues/1064
7+
2. feat: 支持通过 `http://local.whistlejs.com/?dataUrl=encodeURIComponent(dataUrl)` 导入 `dataUrl` 返回的数据
8+
9+
# v2.9.68
10+
1. feat: 新增 `enable://abortRes` 在响应阶段中断请求
11+
2. feat: 优化界面展示
12+
13+
# v2.9.67
14+
1. feat: 新增 `enable://requestWithMatchedRules``enable://responseWithMatchedRules` 支持在请求头或响应头带上当前匹配的规则
15+
2. feat: 调整 Tools/Console 日志的缓存大小
16+
3. feat: Values 的编辑器添加快捷键 `Shift + Ctrl[Command] + F``Shift + Ctrl[Command] + I` 分别用来格式化和通过 JSONView 查看 JSON 数据
17+
4. feat: Whistle 默认会对 WebSocket 压缩包进行解压,有[用户反馈存在解压bug][https://github.com/avwo/whistle/issues/1048],故新增 `wss://xxx disable://wsDecompress` 禁止解压数据包
18+
5. feat: WebSocket Frames 列表添加右键功能
19+
20+
# v2.9.66
21+
1. feat: 支持通过正则表达式搜索日志
22+
2. feat: 支持通过 `disable://captureHttp disable://captureHttps` 关闭 http 或 https 的 TUNNEL 请求
23+
24+
# v2.9.65
25+
1. feat: 支持 Rules 里面的 Values 和临时文件通过 Ctrl[Command] + 鼠标点击快速修改
26+
2. feat: 新增默认临时空白文件 `temp/blank`(支持自定义后缀 `temp/blank.xxx`
27+
> 可以通过在 Rules 新建文件 `protocol://temp/blank.xxx` 再通过Ctrl[Command] + 鼠标点击快速修改生成新的临时文件
28+
3. feat: Values 右键菜单新增 JSON / Inspect 查看 JSON 数据对象
29+
30+
# v2.9.64
31+
1. feat: Mock 功能支持对临时文件添加注释
32+
2. feat: 优化 Rules & Values 的拖拽功能
33+
3. fix: https://github.com/avwo/whistle/issues/1040
34+
35+
# v2.9.63
36+
1. feat: 支持 Cookie 的 `Partitioned` 属性(该属性需要跟 `Secure``SameSite=None` 一起使用)
37+
2. feat: Composer 添加 `CopyAsCURL` 按钮
38+
3. feat: Composer 添加 `ProxyRules` 选项,去选后可以禁用 Proxy (Whistle) 设置的所有规则(Proxy 里面的规则优先级高于 Composer Rules)
39+
40+
# v2.9.62
41+
1. chore: 更新 CodeMirror 版本
42+
2. feat: Network Settings 支持导入导出
43+
3. feat: Rules & Values 支持通过 `b:keyword` 搜索内容
44+
4. feat: Composer 支持导入导出
45+
5. feat: 插件 Option 支持设置 `openInModal` 以对话框形式打开
46+
6. feat: Network 列表新增 `Back to the bottom` 按钮
47+
48+
# v2.9.61
49+
1. fix: 在新版本 Node 可能存在 [pipe](https://wproxy.org/whistle/rules/pipe.html) 功能失效问题
50+
2. fix: https://github.com/avwo/whistle/issues/1017
51+
52+
# v2.9.60
53+
1. fix: https://github.com/avwo/whistle/issues/1012
54+
55+
# v2.9.59
56+
1. feat: 支持 https://github.com/avwo/whistle/issues/978
57+
2. feat: 客户端支持直接使用 WebView 预览抓包内容
58+
59+
60+
# v2.9.58
61+
1. feat: Network 右键菜单 Mock > Export,通过插件或拖拽导入 Mock 数据
62+
2. feat: 插件支持 `window.whistleBridge.download({name, value[, base64]})` 下载指定数据
63+
3. feat: 新增特殊路径 `/_WHISTLE_5b6af7b9884e1165_/`,Whistle 会自动将url 里面第一个此路径片段替换成 `/`
64+
65+
# v2.9.57
66+
1. feat: Composer 添加修改请求参数按钮 `Params`
67+
2. feat: Composer 面板优化
68+
3. feat: Composer 添加 Cookies 按钮方便获取当前抓包记录里面对应域名的 Cookie
69+
4. feat: 支持通过启动参数 `uiExt` 往页面注入 js 或 html (把 Whistle 作为第三方 npm 包使用时可用)
70+
``` js
71+
uiExt?: {
72+
required?: boolean;
73+
htmlPrepend?: string;
74+
htmlAppend?: string;
75+
jsPrepend?: string;
76+
jsAppend?: string;
77+
};
78+
```
179

280
# v2.9.56
381
1. feat: 支持通过 `Online / IPv6-only network` 强制 dns 获取 ipv6(命令行版本还可以通过 `-M ipv6Only` 开启)

assets/js/log.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@
279279
}
280280

281281
function stringifyObj(obj) {
282+
if (typeof obj === 'string') {
283+
return obj;
284+
}
282285
try {
283286
return JSON.stringify(obj);
284287
} catch(e) {}
@@ -392,7 +395,7 @@
392395
window.addEventListener('unhandledrejection', function(e) {
393396
var reason = 'UnhandledRejection';
394397
if (e) {
395-
e = e.reason || stringifyObj(e) || String(e);
398+
e = stringifyObj(e.reason || e) || String(e);
396399
reason += (/^[\w.-]*:/.test(e) ? ' ' : ': ') + e;
397400
}
398401
wConsole.error(reason);

assets/menu.html

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
var networkListeners = [];
66
var rulesListeners = [];
77
var valuesListeners = [];
8+
var pluginsListeners = [];
89
var handleOnLoad = function() {
910
timer = null;
1011
list.forEach(emit);
@@ -30,6 +31,9 @@
3031
case 'values':
3132
execListeners(valuesListeners, options);
3233
break;
34+
case 'plugins':
35+
execListeners(pluginsListeners, options);
36+
break;
3337
default:
3438
execListeners(networkListeners, options);
3539
}
@@ -95,6 +99,20 @@
9599
var removeAllValuesListeners = function() {
96100
valuesListeners = [];
97101
};
102+
var addPluginsListener = function(l) {
103+
if (typeof l === 'function' && pluginsListeners.indexOf(l) === -1) {
104+
pluginsListeners.push(l);
105+
}
106+
};
107+
var removePluginsListener = function(l) {
108+
l = pluginsListeners.indexOf(l);
109+
if (l !== -1) {
110+
pluginsListeners.splice(l, 1);
111+
}
112+
};
113+
var removeAllPluginsListeners = function(l) {
114+
pluginsListeners = [];
115+
};
98116

99117
function on(type, l) {
100118
if (typeof l !== 'function') {
@@ -107,6 +125,8 @@
107125
return addRulesListener(l);
108126
case 'values':
109127
return addValuesListener(l);
128+
case 'plugins':
129+
return addPluginsListener(l);
110130
}
111131
}
112132

@@ -133,6 +153,13 @@
133153
removeAllValuesListeners();
134154
}
135155
return;
156+
case 'plugins':
157+
if (l) {
158+
removePluginsListener(l);
159+
} else {
160+
removeAllPluginsListeners();
161+
}
162+
return;
136163
}
137164
}
138165

@@ -149,21 +176,32 @@
149176
removeAllRulesListeners: removeAllRulesListeners,
150177
addValuesListener: addValuesListener,
151178
removeValuesListener: removeValuesListener,
152-
removeAllValuesListeners: removeAllValuesListeners
179+
removeAllValuesListeners: removeAllValuesListeners,
180+
addPluginsListener: addPluginsListener,
181+
removePluginsListener: removePluginsListener,
182+
removeAllPluginsListeners: removeAllPluginsListeners
153183
};
154184
try {
155185
window.initWhistleBridge = function(options) {
156186
window.initWhistleBridge = function() {};
157187
Object.keys(options.msgBox).forEach(function(name) {
158188
toast[name] = options.msgBox[name];
159189
});
190+
whistleBridge.getSelectedSessionList = options.getSelectedSessionList;
191+
whistleBridge.getActiveSession = whistleBridge.getSession = whistleBridge.getSelectedSession = options.getActiveSession;
192+
whistleBridge.showOption = options.showOption;
193+
whistleBridge.hideOption = options.hideOption;
160194
whistleBridge.updateUI = options.updateUI;
161195
whistleBridge.copyText = options.copyText;
162196
whistleBridge.pageId = options.pageId;
163197
whistleBridge.compose = options.compose;
164198
whistleBridge.decodeBase64 = options.decodeBase64;
165199
whistleBridge.importSessions = options.importSessions;
166200
whistleBridge.exportSessions = options.exportSessions;
201+
whistleBridge.importMockData = options.importMockData;
202+
whistleBridge.download = options.download;
203+
whistleBridge.setNetworkSettings = options.setNetworkSettings;
204+
whistleBridge.setComposerData = options.setComposerData;
167205
whistleBridge.request = options.request;
168206
whistleBridge.createRequest = options.createRequest;
169207
whistleBridge.showModal = options.showModal;

assets/modal.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<script>
3+
;(function() {
4+
var toast = {};
5+
var whistleBridge = {
6+
toast: toast
7+
};
8+
try {
9+
window.parent.onWhistlePluginOptionModalReady(function(options) {
10+
Object.keys(options.msgBox).forEach(function(name) {
11+
toast[name] = options.msgBox[name];
12+
});
13+
whistleBridge.getSelectedSessionList = options.getSelectedSessionList;
14+
whistleBridge.getActiveSession = whistleBridge.getSession = whistleBridge.getSelectedSession = options.getActiveSession;
15+
whistleBridge.showOption = options.showOption;
16+
whistleBridge.hideOption = options.hideOption;
17+
whistleBridge.updateUI = options.updateUI;
18+
whistleBridge.copyText = options.copyText;
19+
whistleBridge.pageId = options.pageId;
20+
whistleBridge.compose = options.compose;
21+
whistleBridge.decodeBase64 = options.decodeBase64;
22+
whistleBridge.importSessions = options.importSessions;
23+
whistleBridge.exportSessions = options.exportSessions;
24+
whistleBridge.importMockData = options.importMockData;
25+
whistleBridge.download = options.download;
26+
whistleBridge.setNetworkSettings = options.setNetworkSettings;
27+
whistleBridge.setComposerData = options.setComposerData;
28+
whistleBridge.request = options.request;
29+
whistleBridge.createRequest = options.createRequest;
30+
whistleBridge.showModal = options.showModal;
31+
whistleBridge.importRules = options.importRules;
32+
whistleBridge.importValues = options.importValues;
33+
whistleBridge.getServerInfo = options.getServerInfo;
34+
whistleBridge.alert = options.alert;
35+
whistleBridge.confirm = options.confirm;
36+
whistleBridge.syncData = options.syncData;
37+
whistleBridge.syncRules = options.syncRules;
38+
whistleBridge.syncValues = options.syncValues;
39+
}, window);
40+
} catch (e) {}
41+
window.whistleBridge = whistleBridge;
42+
})();
43+
</script>

assets/tab.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,19 @@
282282
});
283283
getActiveSession = options.getActiveSession;
284284
getSelectedSessionList = options.getSelectedSessionList;
285+
whistleBridge.showOption = options.showOption;
286+
whistleBridge.hideOption = options.hideOption;
285287
whistleBridge.updateUI = options.updateUI;
286288
whistleBridge.copyText = options.copyText;
287289
whistleBridge.pageId = options.pageId;
288290
whistleBridge.compose = options.compose;
289291
whistleBridge.decodeBase64 = options.decodeBase64;
290292
whistleBridge.importSessions = options.importSessions;
291293
whistleBridge.exportSessions = options.exportSessions;
294+
whistleBridge.importMockData = options.importMockData;
295+
whistleBridge.download = options.download;
296+
whistleBridge.setNetworkSettings = options.setNetworkSettings;
297+
whistleBridge.setComposerData = options.setComposerData;
292298
whistleBridge.request = options.request;
293299
whistleBridge.createRequest = options.createRequest;
294300
whistleBridge.showModal = options.showModal;

bin/ca/cli.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ var config = require('../../lib/config');
1111
var NUM_RE = /^\d+$/;
1212
var HOST_SUFFIX_RE = /\:(\d+|auto)?$/;
1313
var HOST_RE = /^[a-z\d_-]+(?:\.[a-z\d_-]+)*$/i;
14-
var URL_RE = /^https?:\/\/./i;
1514
var MAX_LEN = 1024 * 1024;
1615

1716
function installCert(certFile, url) {
@@ -79,7 +78,7 @@ module.exports = function(argv) {
7978
} else {
8079
delete options.port;
8180
delete options.host;
82-
if (URL_RE.test(arg)) {
81+
if (commonUtil.isUrl(arg)) {
8382
options.addr = { url: arg };
8483
} else {
8584
options.addr = { file: arg };

bin/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var commonUtil = require('../lib/util/common');
99
var getWhistlePath = commonUtil.getWhistlePath;
1010
var REMOTE_URL_RE = commonUtil.REMOTE_URL_RE;
1111
var WHISTLE_PLUGIN_RE = commonUtil.WHISTLE_PLUGIN_RE;
12-
const getPlugins = commonUtil.getPlugins;
12+
var getPlugins = commonUtil.getPlugins;
1313
var CMD_SUFFIX = process.platform === 'win32' ? '.cmd' : '';
1414
var CUSTOM_PLUGIN_PATH = path.join(getWhistlePath(), 'custom_plugins');
1515
var DEFAULT_PATH = commonUtil.getDefaultWhistlePath();

bin/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function readConfigList() {
160160
exports.readConfig = readConfig;
161161
exports.readConfigList = readConfigList;
162162
exports.getHash = function(str) {
163-
var hmac = createHmac('sha256', 'a secret');
163+
var hmac = createHmac('sha256', '5b6af7b9884e1165');
164164
return hmac.update(str).digest('hex');
165165
};
166166

biz/webui/cgi-bin/add-rules-values.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ module.exports = function(req, res) {
99
if (rulesData) {
1010
if (rulesData.name === 'Default') {
1111
rules.setDefault(rulesData.value, clientId);
12+
rules.enableDefault();
1213
} else {
1314
rules.add(rulesData.name, rulesData.value, clientId);
15+
rules.select(rulesData.name);
1416
}
15-
rules.select(rulesData.name);
1617
}
1718
if (valuesData) {
1819
values.add(valuesData.name, valuesData.value, clientId);

0 commit comments

Comments
 (0)