rechrome 1.14.0 → 1.15.0
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/extension/lib/background.mjs +5 -8
- package/package.json +1 -1
- package/serve.js +13 -8
- package/serve.ts +13 -8
|
@@ -366,9 +366,9 @@ async function openRelayConnection(mcpRelayUrl, protocolVersion) {
|
|
|
366
366
|
throw new Error(message);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
const PLAYWRIGHT_GROUP_TITLE = "
|
|
369
|
+
const PLAYWRIGHT_GROUP_TITLE = "pw";
|
|
370
370
|
const PLAYWRIGHT_GROUP_COLOR = "green";
|
|
371
|
-
const
|
|
371
|
+
const MAX_GROUP_TITLE_LEN = 7;
|
|
372
372
|
const NON_DEBUGGABLE_SCHEMES = ["chrome:", "edge:", "devtools:"];
|
|
373
373
|
const CONNECTED_BADGE = { text: "✓", color: "#4CAF50", title: "Connected to Playwright client" };
|
|
374
374
|
function isNonDebuggableUrl(url) {
|
|
@@ -381,20 +381,17 @@ function urlDomain(url) {
|
|
|
381
381
|
const u = new URL(url);
|
|
382
382
|
if (u.protocol !== "http:" && u.protocol !== "https:")
|
|
383
383
|
return void 0;
|
|
384
|
-
return u.hostname.replace(/^www\./, "");
|
|
384
|
+
return u.hostname.replace(/^www\./, "").split(".")[0];
|
|
385
385
|
} catch {
|
|
386
386
|
return void 0;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
function groupTitle(clientName, seedUrl) {
|
|
390
|
-
return
|
|
390
|
+
return (clientName || urlDomain(seedUrl) || PLAYWRIGHT_GROUP_TITLE).slice(0, MAX_GROUP_TITLE_LEN);
|
|
391
391
|
}
|
|
392
392
|
async function cleanupStalePlaywrightGroups() {
|
|
393
393
|
try {
|
|
394
|
-
const groups =
|
|
395
|
-
var _a;
|
|
396
|
-
return (_a = g.title) == null ? void 0 : _a.startsWith(PLAYWRIGHT_GROUP_MARK);
|
|
397
|
-
});
|
|
394
|
+
const groups = await chrome.tabGroups.query({ color: PLAYWRIGHT_GROUP_COLOR });
|
|
398
395
|
const tabsPerGroup = await Promise.all(groups.map((g) => chrome.tabs.query({ groupId: g.id })));
|
|
399
396
|
const tabIds = tabsPerGroup.flat().map((t) => t.id).filter((id) => id !== void 0);
|
|
400
397
|
if (tabIds.length)
|
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -14,18 +14,23 @@ import {
|
|
|
14
14
|
const TAILSCALE_BIN = process.env.TAILSCALE_BIN || "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
|
|
15
15
|
const CERT_RENEW_THRESHOLD_DAYS = 7;
|
|
16
16
|
|
|
17
|
-
// Short
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
17
|
+
// Short label for a client identity, used as the Chrome tab-group name (the tab
|
|
18
|
+
// strip is space-constrained, so cap at 7 chars). gitUrl ".../owner/repo/tree/branch"
|
|
19
|
+
// -> "rep:bra" (3+3); "host:/path/to/dir" -> "dir"; bare host/IP -> as-is. Strips a
|
|
20
|
+
// trailing "@profile" suffix first.
|
|
21
|
+
const MAX_GROUP_LABEL_LEN = 7;
|
|
21
22
|
function shortClientLabel(raw: string): string {
|
|
22
23
|
if (!raw) return raw;
|
|
23
24
|
const baseId = raw.includes("@") ? raw.slice(0, raw.indexOf("@")) : raw;
|
|
24
25
|
const git = baseId.match(/^https?:\/\/[^/]+\/[^/]+\/([^/]+?)(?:\/tree\/(.+))?$/);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
let label: string;
|
|
27
|
+
if (git)
|
|
28
|
+
label = git[2] ? `${git[1].slice(0, 3)}:${git[2].slice(0, 3)}` : git[1];
|
|
29
|
+
else {
|
|
30
|
+
const hostCwd = baseId.match(/^[^:]+:(.+)$/);
|
|
31
|
+
label = hostCwd ? (hostCwd[1].split("/").filter(Boolean).pop() || baseId) : baseId;
|
|
32
|
+
}
|
|
33
|
+
return label.slice(0, MAX_GROUP_LABEL_LEN);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
async function renewCertIfNeeded(certPath: string, keyPath: string): Promise<boolean> {
|
package/serve.ts
CHANGED
|
@@ -14,18 +14,23 @@ import {
|
|
|
14
14
|
const TAILSCALE_BIN = process.env.TAILSCALE_BIN || "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
|
|
15
15
|
const CERT_RENEW_THRESHOLD_DAYS = 7;
|
|
16
16
|
|
|
17
|
-
// Short
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
17
|
+
// Short label for a client identity, used as the Chrome tab-group name (the tab
|
|
18
|
+
// strip is space-constrained, so cap at 7 chars). gitUrl ".../owner/repo/tree/branch"
|
|
19
|
+
// -> "rep:bra" (3+3); "host:/path/to/dir" -> "dir"; bare host/IP -> as-is. Strips a
|
|
20
|
+
// trailing "@profile" suffix first.
|
|
21
|
+
const MAX_GROUP_LABEL_LEN = 7;
|
|
21
22
|
function shortClientLabel(raw: string): string {
|
|
22
23
|
if (!raw) return raw;
|
|
23
24
|
const baseId = raw.includes("@") ? raw.slice(0, raw.indexOf("@")) : raw;
|
|
24
25
|
const git = baseId.match(/^https?:\/\/[^/]+\/[^/]+\/([^/]+?)(?:\/tree\/(.+))?$/);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
let label: string;
|
|
27
|
+
if (git)
|
|
28
|
+
label = git[2] ? `${git[1].slice(0, 3)}:${git[2].slice(0, 3)}` : git[1];
|
|
29
|
+
else {
|
|
30
|
+
const hostCwd = baseId.match(/^[^:]+:(.+)$/);
|
|
31
|
+
label = hostCwd ? (hostCwd[1].split("/").filter(Boolean).pop() || baseId) : baseId;
|
|
32
|
+
}
|
|
33
|
+
return label.slice(0, MAX_GROUP_LABEL_LEN);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
async function renewCertIfNeeded(certPath: string, keyPath: string): Promise<boolean> {
|