whistle 2.9.69 → 2.9.70

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
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
+
1
5
  # v2.9.69
2
6
  1. fix: https://github.com/avwo/whistle/issues/1064
3
7
  2. feat: 支持通过 `http://local.whistlejs.com/?dataUrl=encodeURIComponent(dataUrl)` 导入 `dataUrl` 返回的数据
package/assets/menu.html CHANGED
@@ -5,6 +5,7 @@
5
5
  var networkListeners = [];
6
6
  var rulesListeners = [];
7
7
  var valuesListeners = [];
8
+ var pluginsListeners = [];
8
9
  var handleOnLoad = function() {
9
10
  timer = null;
10
11
  list.forEach(emit);
@@ -30,6 +31,9 @@
30
31
  case 'values':
31
32
  execListeners(valuesListeners, options);
32
33
  break;
34
+ case 'plugins':
35
+ execListeners(pluginsListeners, options);
36
+ break;
33
37
  default:
34
38
  execListeners(networkListeners, options);
35
39
  }
@@ -95,6 +99,20 @@
95
99
  var removeAllValuesListeners = function() {
96
100
  valuesListeners = [];
97
101
  };
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
+ };
98
116
 
99
117
  function on(type, l) {
100
118
  if (typeof l !== 'function') {
@@ -107,6 +125,8 @@
107
125
  return addRulesListener(l);
108
126
  case 'values':
109
127
  return addValuesListener(l);
128
+ case 'plugins':
129
+ return addPluginsListener(l);
110
130
  }
111
131
  }
112
132
 
@@ -133,6 +153,13 @@
133
153
  removeAllValuesListeners();
134
154
  }
135
155
  return;
156
+ case 'plugins':
157
+ if (l) {
158
+ removePluginsListener(l);
159
+ } else {
160
+ removeAllPluginsListeners();
161
+ }
162
+ return;
136
163
  }
137
164
  }
138
165
 
@@ -149,7 +176,10 @@
149
176
  removeAllRulesListeners: removeAllRulesListeners,
150
177
  addValuesListener: addValuesListener,
151
178
  removeValuesListener: removeValuesListener,
152
- removeAllValuesListeners: removeAllValuesListeners
179
+ removeAllValuesListeners: removeAllValuesListeners,
180
+ addPluginsListener: addPluginsListener,
181
+ removePluginsListener: removePluginsListener,
182
+ removeAllPluginsListeners: removeAllPluginsListeners
153
183
  };
154
184
  try {
155
185
  window.initWhistleBridge = function(options) {
package/bin/plugin.js CHANGED
@@ -9,7 +9,7 @@ var commonUtil = require('../lib/util/common');
9
9
  var getWhistlePath = commonUtil.getWhistlePath;
10
10
  var REMOTE_URL_RE = commonUtil.REMOTE_URL_RE;
11
11
  var WHISTLE_PLUGIN_RE = commonUtil.WHISTLE_PLUGIN_RE;
12
- const getPlugins = commonUtil.getPlugins;
12
+ var getPlugins = commonUtil.getPlugins;
13
13
  var CMD_SUFFIX = process.platform === 'win32' ? '.cmd' : '';
14
14
  var CUSTOM_PLUGIN_PATH = path.join(getWhistlePath(), 'custom_plugins');
15
15
  var DEFAULT_PATH = commonUtil.getDefaultWhistlePath();
@@ -46,6 +46,7 @@ module.exports = function(req, res) {
46
46
  log: stopRecordConsole ? [] : proxy.getLogs(data.startLogTime, data.count, data.logId),
47
47
  svrLog: stopRecordSvrLog ? [] : logger.getLogs(data.startSvrLogTime, data.count),
48
48
  plugins: pluginMgr.getPlugins(),
49
+ pluginsRoot: config.PLUGIN_INSTALL_ROOT,
49
50
  disabledPlugins: !config.notAllowedDisablePlugins && properties.get('disabledPlugins') || {},
50
51
  allowMultipleChoice: properties.get('allowMultipleChoice'),
51
52
  backRulesFirst: properties.get('backRulesFirst'),
@@ -38,6 +38,7 @@ module.exports = function(req, res) {
38
38
  interceptHttpsConnects: properties.isEnableCapture(),
39
39
  enableHttp2: properties.isEnableHttp2(),
40
40
  plugins: pluginMgr.getPlugins(),
41
+ pluginsRoot: config.PLUGIN_INSTALL_ROOT,
41
42
  disabledPlugins: !config.notAllowedDisablePlugins && properties.get('disabledPlugins') || {},
42
43
  disabledAllPlugins: !config.notAllowedDisablePlugins && properties.get('disabledAllPlugins'),
43
44
  disabledAllRules: !config.notAllowedDisableRules && properties.get('disabledAllRules'),
@@ -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.69"></script>
11
+ <script src="js/index.js?v=2.9.70"></script>
12
12
  </body>
13
13
  </html>