cdp-tunnel 2.5.1 → 2.5.2
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.
|
@@ -132,7 +132,9 @@ var SpecialHandler = (function() {
|
|
|
132
132
|
function addTabToAutomationGroup(tabId, clientId) {
|
|
133
133
|
Logger.info('[TabGroup] Starting addTabToAutomationGroup for tabId:', tabId, 'clientId:', clientId);
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
setTimeout(function() {
|
|
136
|
+
muteTabIfNeeded(tabId);
|
|
137
|
+
}, 200);
|
|
136
138
|
|
|
137
139
|
var groupClientId = clientId;
|
|
138
140
|
if (!groupClientId) {
|
|
@@ -141,44 +143,46 @@ var SpecialHandler = (function() {
|
|
|
141
143
|
}
|
|
142
144
|
var baseName = CDPUtils.getGroupBaseName(groupClientId);
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
146
|
+
setTimeout(function() {
|
|
147
|
+
Logger.info('[TabGroup] Executing group operation for:', baseName);
|
|
148
|
+
|
|
149
|
+
chrome.tabGroups.query({}, function(allGroups) {
|
|
150
|
+
var existing = CDPUtils.findGroupByName(allGroups, baseName);
|
|
151
|
+
if (existing) {
|
|
152
|
+
chrome.tabs.group({ tabIds: tabId, groupId: existing.id }, function(result) {
|
|
153
|
+
if (chrome.runtime.lastError) {
|
|
154
|
+
Logger.error('[TabGroup] Failed to add tab to group:', chrome.runtime.lastError.message);
|
|
155
|
+
} else {
|
|
156
|
+
State.setGroupIdForClient(groupClientId, existing.id);
|
|
157
|
+
updateTabGroupName(groupClientId);
|
|
158
|
+
Logger.info('[TabGroup] Tab', tabId, 'added to existing group:', existing.id);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
chrome.tabs.group({ tabIds: tabId }, function(groupId) {
|
|
163
|
+
if (chrome.runtime.lastError) {
|
|
164
|
+
Logger.error('[TabGroup] Failed to create group:', chrome.runtime.lastError.message);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (groupId) {
|
|
168
|
+
chrome.tabGroups.update(groupId, {
|
|
169
|
+
title: baseName,
|
|
170
|
+
color: CDPUtils.getGroupColorForClient(groupClientId),
|
|
171
|
+
collapsed: true
|
|
172
|
+
}, function() {
|
|
173
|
+
if (chrome.runtime.lastError) {
|
|
174
|
+
Logger.error('[TabGroup] Failed to update group:', chrome.runtime.lastError.message);
|
|
175
|
+
} else {
|
|
176
|
+
State.setGroupIdForClient(groupClientId, groupId);
|
|
177
|
+
updateTabGroupName(groupClientId);
|
|
178
|
+
Logger.info('[TabGroup] Created new group:', groupId, 'with tab:', tabId);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}, 500);
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
function updateTabGroupName(clientId) {
|
package/package.json
CHANGED