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.
@@ -366,9 +366,9 @@ async function openRelayConnection(mcpRelayUrl, protocolVersion) {
366
366
  throw new Error(message);
367
367
  }
368
368
  }
369
- const PLAYWRIGHT_GROUP_TITLE = "Playwright";
369
+ const PLAYWRIGHT_GROUP_TITLE = "pw";
370
370
  const PLAYWRIGHT_GROUP_COLOR = "green";
371
- const PLAYWRIGHT_GROUP_MARK = "🎭";
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 `${PLAYWRIGHT_GROUP_MARK} ${clientName || urlDomain(seedUrl) || PLAYWRIGHT_GROUP_TITLE}`;
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 = (await chrome.tabGroups.query({})).filter((g) => {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rechrome",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snomiao/rechrome.git"
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, human-friendly label for a client identity, used as the Chrome tab-group
18
- // name so concurrent sessions on one profile are distinguishable.
19
- // gitUrl ".../owner/repo/tree/branch" -> "repo:branch"; "host:/path/to/dir" -> "dir";
20
- // bare host/IP -> as-is. Strips a trailing "@profile" (email) suffix first.
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
- if (git) return git[2] ? `${git[1]}:${git[2]}` : git[1];
26
- const hostCwd = baseId.match(/^[^:]+:(.+)$/);
27
- if (hostCwd) return hostCwd[1].split("/").filter(Boolean).pop() || baseId;
28
- return baseId;
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, human-friendly label for a client identity, used as the Chrome tab-group
18
- // name so concurrent sessions on one profile are distinguishable.
19
- // gitUrl ".../owner/repo/tree/branch" -> "repo:branch"; "host:/path/to/dir" -> "dir";
20
- // bare host/IP -> as-is. Strips a trailing "@profile" (email) suffix first.
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
- if (git) return git[2] ? `${git[1]}:${git[2]}` : git[1];
26
- const hostCwd = baseId.match(/^[^:]+:(.+)$/);
27
- if (hostCwd) return hostCwd[1].split("/").filter(Boolean).pop() || baseId;
28
- return baseId;
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> {