whistle 2.8.8 → 2.8.9
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/inspector.html +124 -0
- package/assets/menu.html +13 -10
- package/biz/webui/htdocs/index.html +1 -1
- package/biz/webui/htdocs/js/index.js +44 -44
- package/biz/webui/lib/index.js +27 -18
- package/lib/config.js +1 -4
- package/lib/https/index.js +1 -1
- package/lib/inspectors/data.js +14 -9
- package/lib/plugins/get-plugins-sync.js +4 -1
- package/lib/plugins/index.js +4 -0
- package/lib/plugins/load-plugin.js +8 -6
- package/lib/tunnel.js +1 -1
- package/lib/util/index.js +28 -5
- package/package.json +1 -1
- package/CHANGELOG.md +0 -2076
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
;(function() {
|
|
3
|
+
var config = window.whistleInspectorConfig;
|
|
4
|
+
var activeList = [];
|
|
5
|
+
var stateList = [1];
|
|
6
|
+
var getActiveSession;
|
|
7
|
+
var getSelectedSessionList;
|
|
8
|
+
var listenersList = [];
|
|
9
|
+
|
|
10
|
+
function initState(flag) {
|
|
11
|
+
stateList[1] = flag;
|
|
12
|
+
stateList[2] = flag;
|
|
13
|
+
stateList[3] = flag;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function updateState(item) {
|
|
17
|
+
if (!item || item.lost || item.endTime) {
|
|
18
|
+
return initState(1);
|
|
19
|
+
}
|
|
20
|
+
initState();
|
|
21
|
+
if (item.responseTime) {
|
|
22
|
+
stateList[2] = 1;
|
|
23
|
+
}
|
|
24
|
+
if (item.requestTime) {
|
|
25
|
+
stateList[1] = 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function emitListeners(item, state) {
|
|
30
|
+
if (stateList[state] && item !== activeList[state]) {
|
|
31
|
+
activeList[state] = item;
|
|
32
|
+
var listeners = listenersList[state];
|
|
33
|
+
listeners.forEach(function(l) {
|
|
34
|
+
l(item);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function emitAll(item) {
|
|
40
|
+
updateState(item);
|
|
41
|
+
emitListeners(item, 0);
|
|
42
|
+
emitListeners(item, 1);
|
|
43
|
+
emitListeners(item, 2);
|
|
44
|
+
emitListeners(item, 3);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
window.__pushWhistle5b6af7b9884e1165SessionActive__ = emitAll;
|
|
48
|
+
|
|
49
|
+
function getAddEventHandler(state) {
|
|
50
|
+
state = state || 0;
|
|
51
|
+
listenersList[state] = [];
|
|
52
|
+
return function(l) {
|
|
53
|
+
if (typeof l !== 'function') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var item = getActiveSession();
|
|
57
|
+
emitAll(item);
|
|
58
|
+
activeList[state] = item;
|
|
59
|
+
if (stateList[state]) {
|
|
60
|
+
l(item);
|
|
61
|
+
}
|
|
62
|
+
var listeners = listenersList[state];
|
|
63
|
+
listeners.indexOf(l) === -1 && listeners.push(l);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getRemoveEventListener(state) {
|
|
68
|
+
state = state || 0;
|
|
69
|
+
return function(l) {
|
|
70
|
+
var listeners = listenersList[state];
|
|
71
|
+
var index = listeners.indexOf(l);
|
|
72
|
+
index !== -1 && listeners.splice(index, 1);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getRemoveEventListeners(state) {
|
|
77
|
+
state = state || 0;
|
|
78
|
+
return function(l) {
|
|
79
|
+
listenersList[state] = [];
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var toast = {};
|
|
84
|
+
var whistleBridge = {
|
|
85
|
+
config: config,
|
|
86
|
+
toast: toast,
|
|
87
|
+
addSessionActiveListener: getAddEventHandler(),
|
|
88
|
+
removeSessionActiveListener: getRemoveEventListener(),
|
|
89
|
+
removeSessionActiveListeners: getRemoveEventListeners(),
|
|
90
|
+
addSessionRequestListener: getAddEventHandler(1),
|
|
91
|
+
removeSessionRequestListener: getRemoveEventListener(1),
|
|
92
|
+
removeSessionRequestListeners: getRemoveEventListeners(1),
|
|
93
|
+
addSessionResponseListener: getAddEventHandler(2),
|
|
94
|
+
removeSessionResponseListener: getRemoveEventListener(2),
|
|
95
|
+
removeSessionResponseListeners: getRemoveEventListeners(2),
|
|
96
|
+
addSessionCompleteListener: getAddEventHandler(3),
|
|
97
|
+
removeSessionCompleteListener: getRemoveEventListener(3),
|
|
98
|
+
removeSessionCompleteListeners: getRemoveEventListeners(3)
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
window.parent.onWhistleInspectorCustomTabReady(function(options) {
|
|
103
|
+
Object.keys(options.msgBox).forEach(function(name) {
|
|
104
|
+
toast[name] = options.msgBox[name];
|
|
105
|
+
});
|
|
106
|
+
getActiveSession = options.getActiveSession;
|
|
107
|
+
getSelectedSessionList = options.getSelectedSessionList;
|
|
108
|
+
whistleBridge.decodeBase64 = options.decodeBase64;
|
|
109
|
+
whistleBridge.importSessions = options.importSessions;
|
|
110
|
+
whistleBridge.request = options.request;
|
|
111
|
+
whistleBridge.createRequest = options.createRequest;
|
|
112
|
+
whistleBridge.showModal = options.showModal;
|
|
113
|
+
whistleBridge.getSelectedSessionList = getSelectedSessionList;
|
|
114
|
+
whistleBridge.getActiveSession = whistleBridge.getSession = whistleBridge.getSelectedSession = getActiveSession;
|
|
115
|
+
whistleBridge.importRules = options.importRules;
|
|
116
|
+
whistleBridge.importValues = options.importValues;
|
|
117
|
+
whistleBridge.getServerInfo = options.getServerInfo;
|
|
118
|
+
whistleBridge.alert = options.alert;
|
|
119
|
+
whistleBridge.confirm = options.confirm;
|
|
120
|
+
});
|
|
121
|
+
} catch (e) {}
|
|
122
|
+
window.whistleBridge = whistleBridge;
|
|
123
|
+
})();
|
|
124
|
+
</script>
|
package/assets/menu.html
CHANGED
|
@@ -53,10 +53,8 @@
|
|
|
53
53
|
window.addEventListener('load', delayOnLoad);
|
|
54
54
|
} catch (e) {}
|
|
55
55
|
var toast = {};
|
|
56
|
-
var
|
|
57
|
-
window.whistleBridge = {
|
|
56
|
+
var whistleBridge = {
|
|
58
57
|
config: config,
|
|
59
|
-
modal: modal,
|
|
60
58
|
toast: toast,
|
|
61
59
|
addNetworkListener: function(l) {
|
|
62
60
|
if (typeof l === 'function' && networkListeners.indexOf(l) === -1) {
|
|
@@ -107,15 +105,20 @@
|
|
|
107
105
|
Object.keys(options.msgBox).forEach(function(name) {
|
|
108
106
|
toast[name] = options.msgBox[name];
|
|
109
107
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
whistleBridge.decodeBase64 = options.decodeBase64;
|
|
109
|
+
whistleBridge.importSessions = options.importSessions;
|
|
110
|
+
whistleBridge.request = options.request;
|
|
111
|
+
whistleBridge.createRequest = options.createRequest;
|
|
112
|
+
whistleBridge.showModal = options.showModal;
|
|
113
|
+
whistleBridge.createModal = options.createModal;
|
|
114
|
+
whistleBridge.importRules = options.importRules;
|
|
115
|
+
whistleBridge.importValues = options.importValues;
|
|
116
|
+
whistleBridge.getServerInfo = options.getServerInfo;
|
|
117
|
+
whistleBridge.alert = options.alert;
|
|
118
|
+
whistleBridge.confirm = options.confirm;
|
|
117
119
|
};
|
|
118
120
|
window.parent.onPluginContextMenuReady(window);
|
|
119
121
|
} catch (e) {}
|
|
122
|
+
window.whistleBridge = whistleBridge;
|
|
120
123
|
})();
|
|
121
124
|
</script>
|