whistle 2.10.9 → 2.10.11
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/assets/js/log.js +4 -0
- package/bin/api.js +3 -1
- package/bin/util.js +1 -1
- package/bin/whistle.js +5 -0
- package/biz/webui/cgi-bin/get-data.js +0 -1
- package/biz/webui/cgi-bin/init.js +0 -1
- package/biz/webui/cgi-bin/status.js +2 -1
- package/biz/webui/cgi-bin/util.js +1 -1
- package/biz/webui/cgi-bin/values/add.js +15 -13
- package/biz/webui/htdocs/index.html +1 -1
- package/biz/webui/htdocs/js/index.js +50 -51
- package/biz/webui/lib/index.js +39 -30
- package/index.js +10 -12
- package/lib/config.js +25 -79
- package/lib/handlers/file-proxy.js +1 -1
- package/lib/https/ca.js +18 -17
- package/lib/https/h2.js +54 -35
- package/lib/https/index.js +124 -107
- package/lib/inspectors/data.js +9 -3
- package/lib/inspectors/log.js +14 -33
- package/lib/inspectors/req.js +3 -6
- package/lib/inspectors/res.js +2 -5
- package/lib/inspectors/rules.js +11 -6
- package/lib/inspectors/weinre.js +1 -1
- package/lib/plugins/index.js +45 -54
- package/lib/plugins/load-plugin.js +31 -40
- package/lib/rules/dns.js +1 -1
- package/lib/rules/index.js +3 -1
- package/lib/rules/protocols.js +2 -4
- package/lib/rules/rules.js +3 -5
- package/lib/rules/util.js +2 -7
- package/lib/service/compose-data.js +2 -1
- package/lib/service/composer.js +12 -10
- package/lib/service/service.js +3 -5
- package/lib/socket-mgr.js +5 -2
- package/lib/tunnel.js +9 -5
- package/lib/util/common.js +190 -37
- package/lib/util/data-server.js +5 -1
- package/lib/util/drain.js +5 -6
- package/lib/util/file-mgr.js +1 -1
- package/lib/util/http-mgr.js +6 -2
- package/lib/util/index.js +48 -69
- package/lib/util/speed-transform.js +2 -2
- package/lib/util/transproto.js +4 -3
- package/lib/util/whistle-transform.js +2 -2
- package/lib/util/zlib.js +1 -1
- package/package.json +4 -4
package/assets/js/log.js
CHANGED
|
@@ -243,6 +243,10 @@
|
|
|
243
243
|
var cacheList = [];
|
|
244
244
|
var origin = (location.origin || (location.protocol + '//' + location.host)) + '/';
|
|
245
245
|
|
|
246
|
+
try {
|
|
247
|
+
LOG_ID = decodeURIComponent(LOG_ID);
|
|
248
|
+
} catch(e) {}
|
|
249
|
+
|
|
246
250
|
function setLog() {
|
|
247
251
|
if (!cacheList.length) {
|
|
248
252
|
return;
|
package/bin/api.js
CHANGED
|
@@ -139,7 +139,8 @@ exports.network = {
|
|
|
139
139
|
* - `Font`:字体文件
|
|
140
140
|
* - `Img`:图片资源
|
|
141
141
|
* - `Media`:音视频媒体
|
|
142
|
-
* - `WS`:WebSocket
|
|
142
|
+
* - `WS`:WebSocket 请求
|
|
143
|
+
* - `SSE`:Server-Sent Events 请求
|
|
143
144
|
* - `Tunnel`:隧道连接(如 WebSocket 升级)
|
|
144
145
|
* - `Wasm`:WebAssembly 模块
|
|
145
146
|
* - `Mock`:Mock 数据
|
|
@@ -527,6 +528,7 @@ function getTimings(session) {
|
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
exports.utils = {
|
|
531
|
+
createPattern: common.createPattern,
|
|
530
532
|
isUtf8: isUtf8,
|
|
531
533
|
getText: getText,
|
|
532
534
|
getUtf8Buf: getUtf8Buf,
|
package/bin/util.js
CHANGED
|
@@ -193,7 +193,7 @@ exports.getBody = function (res, callback, isRaw) {
|
|
|
193
193
|
res.on('data', function(data) {
|
|
194
194
|
resBody.push(data);
|
|
195
195
|
});
|
|
196
|
-
res.
|
|
196
|
+
res.once('end', function() {
|
|
197
197
|
resBody = Buffer.concat(resBody);
|
|
198
198
|
try {
|
|
199
199
|
callback(null, isRaw ? resBody : JSON.parse(resBody.toString()));
|
package/bin/whistle.js
CHANGED
|
@@ -15,6 +15,11 @@ var colors = require('colors');
|
|
|
15
15
|
var error = util.error;
|
|
16
16
|
var info = util.info;
|
|
17
17
|
var OPTIONS = util.DEFAULT_OPTIONS;
|
|
18
|
+
var version = process.version;
|
|
19
|
+
|
|
20
|
+
if (+version.substring(1).split('.')[0] < 16) {
|
|
21
|
+
error('[!] Node.js@' + version + ' is too old, please upgrade to v16 or above: https://nodejs.org/');
|
|
22
|
+
}
|
|
18
23
|
|
|
19
24
|
function getLatestVersion(options, cb, index) {
|
|
20
25
|
var done;
|
|
@@ -36,7 +36,6 @@ module.exports = function(req, res) {
|
|
|
36
36
|
custom2: properties.get('Custom2'),
|
|
37
37
|
custom1Key: properties.get('Custom1Key'),
|
|
38
38
|
custom2Key: properties.get('Custom2Key'),
|
|
39
|
-
supportH2: config.enableH2,
|
|
40
39
|
hasInvalidCerts: ca.hasInvalidCerts,
|
|
41
40
|
clientIp: clientIp,
|
|
42
41
|
mrulesClientId: config.mrulesClientId,
|
|
@@ -21,7 +21,6 @@ module.exports = function(req, res) {
|
|
|
21
21
|
custom1: properties.get('Custom1'),
|
|
22
22
|
custom2: properties.get('Custom2'),
|
|
23
23
|
hasInvalidCerts: ca.hasInvalidCerts,
|
|
24
|
-
supportH2: config.enableH2,
|
|
25
24
|
lastSvrLogId: lastSvrLog && lastSvrLog.id,
|
|
26
25
|
lastDataId: proxy.getLastDataId(),
|
|
27
26
|
clientId: util.getClientId(),
|
|
@@ -2,9 +2,10 @@ var config = require('../../../lib/config');
|
|
|
2
2
|
|
|
3
3
|
module.exports = function(_, res) {
|
|
4
4
|
res.json({
|
|
5
|
+
whistlePath: config.WHISTLE_PATH,
|
|
6
|
+
whistleName: config.whistleName,
|
|
5
7
|
storage: config.storage || '',
|
|
6
8
|
client: config.client,
|
|
7
|
-
whistleName: config.whistleName,
|
|
8
9
|
name: config.name,
|
|
9
10
|
version: config.version
|
|
10
11
|
});
|
|
@@ -6,21 +6,23 @@ module.exports = function(req, res) {
|
|
|
6
6
|
var body = req.body;
|
|
7
7
|
var list;
|
|
8
8
|
var exists = values.exists(body.name);
|
|
9
|
-
if (
|
|
10
|
-
if (
|
|
11
|
-
if (body.
|
|
12
|
-
|
|
9
|
+
if (!exists || !body.graceful) {
|
|
10
|
+
if (values.add(body.name, body.value, body.clientId) != null) {
|
|
11
|
+
if (isGroup(body.name)) {
|
|
12
|
+
if (body.focusName) {
|
|
13
|
+
values.moveTo(body.name, body.focusName, body.clientId);
|
|
14
|
+
}
|
|
15
|
+
} else if (body.groupName) {
|
|
16
|
+
values.moveToGroup(body.name, body.groupName);
|
|
17
|
+
} else if (!exists) {
|
|
18
|
+
var group = values.getFirstGroup();
|
|
19
|
+
group && values.moveTo(body.name, group.name, body.clientId, null, true);
|
|
13
20
|
}
|
|
14
|
-
} else if (body.groupName) {
|
|
15
|
-
values.moveToGroup(body.name, body.groupName);
|
|
16
|
-
} else if (!exists) {
|
|
17
|
-
var group = values.getFirstGroup();
|
|
18
|
-
group && values.moveTo(body.name, group.name, body.clientId, null, true);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (body.recycleFilename) {
|
|
23
|
+
recycleBin.remove(body.recycleFilename);
|
|
24
|
+
list = recycleBin.list();
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
res.json({
|
|
26
28
|
ec: 0,
|