cdp-tunnel 1.3.0 → 1.3.1

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.
@@ -135,6 +135,39 @@ var LocalHandler = (function() {
135
135
  return {};
136
136
  }
137
137
 
138
+ function tabGetMuteStatus(params) {
139
+ var cdpOnly = params && params.cdpOnly;
140
+ var attachedTabIds = State.getAttachedTabIds();
141
+
142
+ return new Promise(function(resolve) {
143
+ chrome.tabs.query({}, function(tabs) {
144
+ if (chrome.runtime.lastError) {
145
+ resolve({ tabs: [] });
146
+ return;
147
+ }
148
+
149
+ var result = tabs;
150
+ if (cdpOnly) {
151
+ result = tabs.filter(function(t) {
152
+ return attachedTabIds.indexOf(t.id) !== -1;
153
+ });
154
+ }
155
+
156
+ resolve({
157
+ tabs: result.map(function(tab) {
158
+ return {
159
+ id: tab.id,
160
+ url: tab.url || '',
161
+ title: tab.title || '',
162
+ muted: tab.mutedInfo ? tab.mutedInfo.muted : false,
163
+ mutedReason: tab.mutedInfo ? (tab.mutedInfo.reason || '') : ''
164
+ };
165
+ })
166
+ });
167
+ });
168
+ });
169
+ }
170
+
138
171
  function getTargetInfos() {
139
172
  return chrome.debugger.getTargets().then(function(targets) {
140
173
  // 为每个有 tabId 的 target 查询 openerTabId
@@ -274,6 +307,7 @@ var LocalHandler = (function() {
274
307
  emptyObject: emptyObject,
275
308
  getTargetInfos: getTargetInfos,
276
309
  getTargetInfoById: getTargetInfoById,
277
- mapToTargetInfo: mapToTargetInfo
310
+ mapToTargetInfo: mapToTargetInfo,
311
+ tabGetMuteStatus: tabGetMuteStatus
278
312
  };
279
313
  })();
@@ -22,6 +22,8 @@ var CDP_HANDLERS = {
22
22
  'Target.getBrowserContexts': { type: 'LOCAL', handler: LocalHandler.targetGetBrowserContexts },
23
23
  'Target.attachToBrowserTarget': { type: 'LOCAL', handler: LocalHandler.targetAttachToBrowserTarget },
24
24
 
25
+ 'Tab.getMuteStatus': { type: 'LOCAL', handler: LocalHandler.tabGetMuteStatus },
26
+
25
27
  'SystemInfo.getInfo': { type: 'LOCAL', handler: LocalHandler.systemInfoGetInfo },
26
28
  'SystemInfo.getProcessInfo': { type: 'LOCAL', handler: LocalHandler.systemInfoGetProcessInfo },
27
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-tunnel",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Chrome Extension CDP Proxy - 通过 Chrome 扩展将 chrome.debugger API 暴露为 WebSocket 端点",
5
5
  "main": "server/proxy-server.js",
6
6
  "bin": "./cli/index.js",