whistle 2.10.2 → 2.10.4
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/menu.html +2 -0
- package/assets/modal.html +2 -0
- package/assets/tab.html +3 -3
- package/bin/proxy.js +2 -2
- package/bin/whistle.js +5 -5
- package/biz/webui/cgi-bin/add-rules-values.js +1 -1
- package/biz/webui/cgi-bin/check-update.js +0 -1
- package/biz/webui/cgi-bin/do-not-show-again.js +1 -1
- package/biz/webui/cgi-bin/download.js +1 -1
- package/biz/webui/cgi-bin/enable-http2.js +1 -1
- package/biz/webui/cgi-bin/get-matched-rules.js +14 -0
- package/biz/webui/cgi-bin/hide-https-connects.js +1 -1
- package/biz/webui/cgi-bin/intercept-https-connects.js +1 -1
- package/biz/webui/cgi-bin/plugins/disable-all-plugins.js +1 -1
- package/biz/webui/cgi-bin/reset-local-address.js +1 -1
- package/biz/webui/cgi-bin/rules/allow-multiple-choice.js +1 -1
- package/biz/webui/cgi-bin/rules/clear-dns-cache.js +7 -0
- package/biz/webui/cgi-bin/rules/disable-all-rules.js +1 -1
- package/biz/webui/cgi-bin/rules/disable-default.js +1 -1
- package/biz/webui/cgi-bin/rules/enable-back-rules-first.js +1 -1
- package/biz/webui/cgi-bin/rules/enable-default.js +1 -1
- package/biz/webui/cgi-bin/rules/move-to.js +1 -1
- package/biz/webui/cgi-bin/rules/remove.js +1 -1
- package/biz/webui/cgi-bin/rules/rename.js +1 -1
- package/biz/webui/cgi-bin/rules/select.js +1 -1
- package/biz/webui/cgi-bin/rules/set-sys-hosts.js +1 -1
- package/biz/webui/cgi-bin/rules/unselect.js +1 -1
- package/biz/webui/cgi-bin/values/move-to.js +1 -1
- package/biz/webui/cgi-bin/values/remove.js +1 -1
- package/biz/webui/cgi-bin/values/rename.js +1 -1
- package/biz/webui/htdocs/index.html +1 -1
- package/biz/webui/htdocs/js/index.js +54 -52
- package/biz/webui/lib/index.js +32 -2
- package/lib/config.js +4 -4
- package/lib/handlers/file-proxy.js +1 -1
- package/lib/https/ca.js +31 -0
- package/lib/https/index.js +4 -2
- package/lib/index.js +0 -2
- package/lib/inspectors/data.js +120 -13
- package/lib/inspectors/req.js +5 -3
- package/lib/plugins/get-plugins-sync.js +15 -11
- package/lib/plugins/get-plugins.js +11 -12
- package/lib/plugins/load-plugin.js +1 -1
- package/lib/plugins/module-paths.js +4 -0
- package/lib/plugins/util.js +8 -0
- package/lib/rules/dns.js +4 -0
- package/lib/rules/rules.js +7 -8
- package/lib/service/composer.js +86 -39
- package/lib/service/service.js +14 -10
- package/lib/service/util.js +3 -42
- package/lib/socket-mgr.js +2 -16
- package/lib/tunnel.js +3 -0
- package/lib/upgrade.js +1 -0
- package/lib/util/common.js +54 -10
- package/lib/util/data-server.js +10 -0
- package/lib/util/index.js +38 -19
- package/package.json +2 -2
- package/biz/webui/cgi-bin/import-remote.js +0 -37
package/assets/menu.html
CHANGED
|
@@ -189,6 +189,8 @@
|
|
|
189
189
|
toast[name] = options.msgBox[name];
|
|
190
190
|
});
|
|
191
191
|
whistleBridge.getSelectedSessionList = options.getSelectedSessionList;
|
|
192
|
+
whistleBridge.getRawRequest = options.getRawRequest;
|
|
193
|
+
whistleBridge.getRawResponse = options.getRawResponse;
|
|
192
194
|
whistleBridge.getActiveSession = whistleBridge.getSession = whistleBridge.getSelectedSession = options.getActiveSession;
|
|
193
195
|
whistleBridge.showOption = options.showOption;
|
|
194
196
|
whistleBridge.hideOption = options.hideOption;
|
package/assets/modal.html
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
toast[name] = options.msgBox[name];
|
|
13
13
|
});
|
|
14
14
|
whistleBridge.getSelectedSessionList = options.getSelectedSessionList;
|
|
15
|
+
whistleBridge.getRawRequest = options.getRawRequest;
|
|
16
|
+
whistleBridge.getRawResponse = options.getRawResponse;
|
|
15
17
|
whistleBridge.getActiveSession = whistleBridge.getSession = whistleBridge.getSelectedSession = options.getActiveSession;
|
|
16
18
|
whistleBridge.showOption = options.showOption;
|
|
17
19
|
whistleBridge.hideOption = options.hideOption;
|
package/assets/tab.html
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
var activeList = [];
|
|
6
6
|
var stateList = [1];
|
|
7
7
|
var getActiveSession;
|
|
8
|
-
var getSelectedSessionList;
|
|
9
8
|
var listenersList = [];
|
|
10
9
|
var frameChangeListeners = [];
|
|
11
10
|
var composeListeners = [];
|
|
@@ -282,7 +281,9 @@
|
|
|
282
281
|
toast[name] = options.msgBox[name];
|
|
283
282
|
});
|
|
284
283
|
getActiveSession = options.getActiveSession;
|
|
285
|
-
getSelectedSessionList = options.getSelectedSessionList;
|
|
284
|
+
whistleBridge.getSelectedSessionList = options.getSelectedSessionList;
|
|
285
|
+
whistleBridge.getRawRequest = options.getRawRequest;
|
|
286
|
+
whistleBridge.getRawResponse = options.getRawResponse;
|
|
286
287
|
whistleBridge.showOption = options.showOption;
|
|
287
288
|
whistleBridge.hideOption = options.hideOption;
|
|
288
289
|
whistleBridge.updateUI = options.updateUI;
|
|
@@ -324,7 +325,6 @@
|
|
|
324
325
|
whistleBridge.createRequest = options.createRequest;
|
|
325
326
|
whistleBridge.parseRules = options.parseRules;
|
|
326
327
|
whistleBridge.showModal = options.showModal;
|
|
327
|
-
whistleBridge.getSelectedSessionList = getSelectedSessionList;
|
|
328
328
|
whistleBridge.getActiveSession = whistleBridge.getSession = whistleBridge.getSelectedSession = getActiveSession;
|
|
329
329
|
whistleBridge.importRules = options.importRules;
|
|
330
330
|
whistleBridge.importValues = options.importValues;
|
package/bin/proxy.js
CHANGED
|
@@ -24,9 +24,9 @@ function enableProxy(options) {
|
|
|
24
24
|
try {
|
|
25
25
|
var host = util.joinIpPort(options.host, options.port);
|
|
26
26
|
if (proxy.enableProxy(options)) {
|
|
27
|
-
showInfo('Successfully
|
|
27
|
+
showInfo('Successfully enabled system proxy (' + host + ')');
|
|
28
28
|
} else {
|
|
29
|
-
showError('Failed to
|
|
29
|
+
showError('Failed to enable system proxy (' + host + ')');
|
|
30
30
|
}
|
|
31
31
|
} catch (e) {
|
|
32
32
|
showError(e.message);
|
package/bin/whistle.js
CHANGED
|
@@ -129,7 +129,7 @@ program
|
|
|
129
129
|
.description('Display running status');
|
|
130
130
|
program
|
|
131
131
|
.command('add')
|
|
132
|
-
.description('Add rules from local JS file (.whistle.js
|
|
132
|
+
.description('Add rules from local JS file (default: .whistle.js in current directory)');
|
|
133
133
|
program.command('proxy')
|
|
134
134
|
.description('Configure system proxy settings');
|
|
135
135
|
program.command('ca')
|
|
@@ -144,18 +144,18 @@ program.command('exec')
|
|
|
144
144
|
program
|
|
145
145
|
.option('-D, --baseDir [baseDir]', 'set storage root path', String, undefined)
|
|
146
146
|
.option('-z, --certDir [directory]', 'set custom certificate directory', String, undefined)
|
|
147
|
-
.option('-l, --localUIHost [hostname]', 'set web UI domain (' + config.localUIHost + '
|
|
148
|
-
.option('-L, --pluginHost [hostname]', 'set plugin UI domains (
|
|
147
|
+
.option('-l, --localUIHost [hostname]', 'set web UI domain (default: ' + config.localUIHost + ')', String, undefined)
|
|
148
|
+
.option('-L, --pluginHost [hostname]', 'set plugin UI domains (e.g., "script=a.b.com&vase=x.y.com")', String, undefined)
|
|
149
149
|
.option('-n, --username [username]', 'set web UI username', String, undefined)
|
|
150
150
|
.option('-w, --password [password]', 'set web UI password', String, undefined)
|
|
151
151
|
.option('-N, --guestName [username]', 'set web UI guest username (read-only)', String, undefined)
|
|
152
152
|
.option('-W, --guestPassword [password]', 'set web UI guest password (read-only)', String, undefined)
|
|
153
|
-
.option('-s, --sockets [number]', 'set max cached connections per domain (' + config.sockets + '
|
|
153
|
+
.option('-s, --sockets [number]', 'set max cached connections per domain (default: ' + config.sockets + ')', parseInt, undefined)
|
|
154
154
|
.option('-S, --storage [newStorageDir]', 'set configuration storage directory', String, undefined)
|
|
155
155
|
.option('-C, --copy [storageDir]', 'copy configuration from specified directory', String, undefined)
|
|
156
156
|
.option('-c, --dnsCache [time]', 'set DNS cache time (default: 60000ms)', String, undefined)
|
|
157
157
|
.option('-H, --host [boundHost]', 'set bound host (default: INADDR_ANY)', String, undefined)
|
|
158
|
-
.option('-p, --port [proxyPort]', 'set proxy port (default: ' + config.port + '
|
|
158
|
+
.option('-p, --port [proxyPort]', 'set proxy port (default: ' + config.port + ')', String, undefined)
|
|
159
159
|
.option('-P, --uiport [uiport]', 'set web UI port', String, undefined)
|
|
160
160
|
.option('-m, --middlewares [script path or module name]', 'set startup middlewares (format: xx,yy/zz.js)', String, undefined)
|
|
161
161
|
.option('-M, --mode [mode]', 'set startup mode (options: pureProxy|debug|multiEnv|capture|disableH2|network|rules|plugins|prod)', String, undefined)
|
|
@@ -11,7 +11,6 @@ module.exports = function(req, res) {
|
|
|
11
11
|
|
|
12
12
|
res.json({
|
|
13
13
|
ec: 0,
|
|
14
|
-
em: 'success',
|
|
15
14
|
showUpdate: !config.disableUpdateTips && hasNewVersion > 1 && common.compareVersion(latestVersion, doNotShowAgainVersion) > 1,
|
|
16
15
|
hasNewVersion: hasNewVersion > 0,
|
|
17
16
|
hasUpdater: config.hasUpdater,
|
|
@@ -17,7 +17,7 @@ module.exports = function(req, res) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (!filename || typeof filename !== 'string') {
|
|
20
|
-
filename = (type === 'mock' ? '
|
|
20
|
+
filename = (type === 'mock' ? 'rules_items_' : 'text_') + util.formatDate() + suffix;
|
|
21
21
|
} else if (!/\.\w+$/.test(filename)) {
|
|
22
22
|
filename += suffix;
|
|
23
23
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var proxy = require('../lib/proxy');
|
|
2
|
+
var util = require('./util');
|
|
3
|
+
|
|
4
|
+
module.exports = function(req, res) {
|
|
5
|
+
var testId = req.query.testId;
|
|
6
|
+
var item = testId && proxy.getTestItem(testId);
|
|
7
|
+
if (!item) {
|
|
8
|
+
return res.json({});
|
|
9
|
+
}
|
|
10
|
+
util.sendGzip(req, res, {
|
|
11
|
+
realUrl: item.realUrl,
|
|
12
|
+
rules: item.rules
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -5,7 +5,7 @@ module.exports = function(req, res) {
|
|
|
5
5
|
var enable = req.body.allowMultipleChoice == 1;
|
|
6
6
|
properties.set('allowMultipleChoice', enable);
|
|
7
7
|
proxy.emit('rulesDataChange', 'allowMultipleChoice', enable);
|
|
8
|
-
res.json({ec: 0
|
|
8
|
+
res.json({ec: 0});
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
|
|
@@ -2,5 +2,5 @@ var rules = require('../../../../lib/rules/util').rules;
|
|
|
2
2
|
|
|
3
3
|
module.exports = function(req, res) {
|
|
4
4
|
rules.disableDefault();
|
|
5
|
-
res.json({ec: 0,
|
|
5
|
+
res.json({ec: 0, defaultRulesIsDisabled: rules.defaultRulesIsDisabled(), list: rules.getSelectedList()});
|
|
6
6
|
};
|
|
@@ -3,5 +3,5 @@ var rules = require('../../../../lib/rules/util').rules;
|
|
|
3
3
|
module.exports = function(req, res) {
|
|
4
4
|
rules.enableDefault();
|
|
5
5
|
rules.setDefault(req.body.value, req.body.clientId);
|
|
6
|
-
res.json({ec: 0,
|
|
6
|
+
res.json({ec: 0, defaultRulesIsDisabled: rules.defaultRulesIsDisabled(), list: rules.getSelectedList()});
|
|
7
7
|
};
|
|
@@ -3,5 +3,5 @@ var rules = require('../../../../lib/rules/util').rules;
|
|
|
3
3
|
module.exports = function(req, res) {
|
|
4
4
|
var body = req.body;
|
|
5
5
|
var result = rules.moveTo(body.from, body.to, body.clientId, body.group === 'true', body.toTop === 'true');
|
|
6
|
-
res.json({ec: result ? 0 : 2
|
|
6
|
+
res.json({ec: result ? 0 : 2});
|
|
7
7
|
};
|
|
@@ -12,5 +12,5 @@ module.exports = function(req, res) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
rules.select(req.body.name);
|
|
15
|
-
res.json({ec: 0,
|
|
15
|
+
res.json({ec: 0, defaultRulesIsDisabled: rules.defaultRulesIsDisabled(), list: rules.getSelectedList(), changed: changed});
|
|
16
16
|
};
|
|
@@ -2,6 +2,6 @@ var rules = require('../../../../lib/rules/util').rules;
|
|
|
2
2
|
|
|
3
3
|
module.exports = function(req, res) {
|
|
4
4
|
rules.setSysHosts(req.body.hosts, function(err) {
|
|
5
|
-
res.json({ec: err ? 2 : 0, em: err ? err.stack :
|
|
5
|
+
res.json({ec: err ? 2 : 0, em: err ? err.stack : undefined});
|
|
6
6
|
});
|
|
7
7
|
};
|
|
@@ -3,5 +3,5 @@ var rules = require('../../../../lib/rules/util').rules;
|
|
|
3
3
|
module.exports = function(req, res) {
|
|
4
4
|
rules.add(req.body.name, req.body.value);
|
|
5
5
|
rules.unselect(req.body.name);
|
|
6
|
-
res.json({ec: 0,
|
|
6
|
+
res.json({ec: 0, defaultRulesIsDisabled: rules.defaultRulesIsDisabled(), list: rules.getSelectedList()});
|
|
7
7
|
};
|
|
@@ -3,5 +3,5 @@ var values = require('../../../../lib/rules/util').values;
|
|
|
3
3
|
module.exports = function(req, res) {
|
|
4
4
|
var body = req.body;
|
|
5
5
|
var result = values.moveTo(body.from, body.to, body.clientId, body.group === 'true');
|
|
6
|
-
res.json({ec: result ? 0 : 2
|
|
6
|
+
res.json({ec: result ? 0 : 2});
|
|
7
7
|
};
|