@celljs/ta-nearby 4.19.0 → 4.20.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.
@@ -54,6 +54,22 @@ var TaHostUtil;
54
54
  }
55
55
  TaHostUtil2.role = role;
56
56
  })(TaHostUtil || (TaHostUtil = {}));
57
+ var TA_DOUBLE_LOOK = {
58
+ name: "@celljs/ta-web",
59
+ key: "assistant.species",
60
+ given: ["trex", "triceratops", "stegosaurus", "brachiosaurus", "velociraptor", "ankylosaurus", "pteranodon", "parasaurolophus"]
61
+ };
62
+ var TaDoubleLookUtil;
63
+ (function(TaDoubleLookUtil2) {
64
+ function given(id) {
65
+ let hash = 2166136261;
66
+ for (let i = 0;i < id.length; i++) {
67
+ hash = Math.imul(hash ^ id.charCodeAt(i), 16777619);
68
+ }
69
+ return TA_DOUBLE_LOOK.given[(hash >>> 0) % TA_DOUBLE_LOOK.given.length];
70
+ }
71
+ TaDoubleLookUtil2.given = given;
72
+ })(TaDoubleLookUtil || (TaDoubleLookUtil = {}));
57
73
  var TA_WITH_OTHERS_MARK = "[ta:speaks-with-others]";
58
74
  var TA_ASK_ENTRY = "ta-ask";
59
75
  var TaAskUtil;
package/host/index.mjs CHANGED
@@ -408,6 +408,36 @@ var RelayBytes;
408
408
  RelayBytes2.concat = concat;
409
409
  })(RelayBytes || (RelayBytes = {}));
410
410
 
411
+ // ../ta-relay/esm/common/relay-protocol.js
412
+ var RELAY_FRAME_CSP = "default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' https: data: blob:; style-src 'unsafe-inline' https: data:; img-src https: data: blob:; font-src https: data:; media-src https: data: blob:; connect-src 'none'; form-action 'none'";
413
+ var RELAY_FRAME_HEADER_CSP = `${RELAY_FRAME_CSP}; frame-ancestors 'self'; sandbox allow-scripts allow-popups allow-popups-to-escape-sandbox`;
414
+ var OPEN_IN_TA = `<p><a id="open" style="display:inline-block;padding:10px 18px;border-radius:20px;background:#111;color:#fff;text-decoration:none;font-weight:600">Open in Ta · 在 Ta 中打开</a></p>
415
+ <script>document.getElementById('open').href='ta://open?link='+encodeURIComponent(location.href)</script>`;
416
+ var RELAY_PAIR_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
417
+ <body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
418
+ <h1>Ta</h1><p>Open this link in the Ta app, or paste it there, to reach your Ta from this device.</p>
419
+ <p>打开 Ta 应用,粘贴这个链接,就能从这台设备连到你的 Ta。</p>${OPEN_IN_TA}</body>`;
420
+ var RELAY_SHARE_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
421
+ <body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
422
+ <h1>Ta</h1><p>Someone shared an extension of Ta. Scan the code in the Ta app, or paste this link in its Quick open, to open it.</p>
423
+ <p>有人分享了一个 Ta 扩展。在 Ta 应用里扫码,或把这个链接粘贴到“快捷打开”,就能打开它。</p>${OPEN_IN_TA}</body>`;
424
+ var RELAY_SHARE_MAX_BYTES = 8 * 1024 * 1024;
425
+ var RELAY_SHARE_CHUNK_BYTES = 192 * 1024;
426
+ var RELAY_CONTENT_MAX_BYTES = 8 * 1024 * 1024;
427
+ var RelayCloseCode;
428
+ (function(RelayCloseCode2) {
429
+ RelayCloseCode2[RelayCloseCode2["HOST_OFFLINE"] = 4404] = "HOST_OFFLINE";
430
+ RelayCloseCode2[RelayCloseCode2["REFUSED"] = 4401] = "REFUSED";
431
+ RelayCloseCode2[RelayCloseCode2["REPLACED"] = 4409] = "REPLACED";
432
+ RelayCloseCode2[RelayCloseCode2["CLOSED_BY_HOST"] = 4410] = "CLOSED_BY_HOST";
433
+ RelayCloseCode2[RelayCloseCode2["FULL"] = 4429] = "FULL";
434
+ RelayCloseCode2[RelayCloseCode2["TIMEOUT"] = 4408] = "TIMEOUT";
435
+ })(RelayCloseCode || (RelayCloseCode = {}));
436
+ var RELAY_PING = "ping";
437
+ var RELAY_HUB_MAX_VALUE = 96 * 1024;
438
+ var RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
439
+ var RELAY_PICTURE_MAX_CHARS = 16 * 1024;
440
+
411
441
  // ../ta-relay/esm/common/relay-identity.js
412
442
  var encoder = new TextEncoder;
413
443
  var decoder = new TextDecoder;
@@ -497,6 +527,10 @@ var RelayIdentityUtil;
497
527
  return typeof look === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(look);
498
528
  }
499
529
  RelayIdentityUtil2.isLook = isLook;
530
+ function isPicture(picture) {
531
+ return typeof picture === "string" && picture.length <= RELAY_PICTURE_MAX_CHARS && /^data:image\/(png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/.test(picture);
532
+ }
533
+ RelayIdentityUtil2.isPicture = isPicture;
500
534
  function withLook(value, look) {
501
535
  const { look: _, ...rest } = value;
502
536
  return isLook(look) ? { ...rest, look } : rest;
@@ -1702,35 +1736,6 @@ class NearbyServiceMeet extends NearbyServiceBase {
1702
1736
  // web-src/nearby-spot.ts
1703
1737
  import { createHash as createHash2, randomBytes as randomBytes3, randomInt } from "node:crypto";
1704
1738
 
1705
- // ../ta-relay/esm/common/relay-protocol.js
1706
- var RELAY_FRAME_CSP = "default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' https: data: blob:; style-src 'unsafe-inline' https: data:; img-src https: data: blob:; font-src https: data:; media-src https: data: blob:; connect-src 'none'; form-action 'none'";
1707
- var RELAY_FRAME_HEADER_CSP = `${RELAY_FRAME_CSP}; frame-ancestors 'self'; sandbox allow-scripts allow-popups allow-popups-to-escape-sandbox`;
1708
- var OPEN_IN_TA = `<p><a id="open" style="display:inline-block;padding:10px 18px;border-radius:20px;background:#111;color:#fff;text-decoration:none;font-weight:600">Open in Ta · 在 Ta 中打开</a></p>
1709
- <script>document.getElementById('open').href='ta://open?link='+encodeURIComponent(location.href)</script>`;
1710
- var RELAY_PAIR_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
1711
- <body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
1712
- <h1>Ta</h1><p>Open this link in the Ta app, or paste it there, to reach your Ta from this device.</p>
1713
- <p>打开 Ta 应用,粘贴这个链接,就能从这台设备连到你的 Ta。</p>${OPEN_IN_TA}</body>`;
1714
- var RELAY_SHARE_PAGE = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Ta</title>
1715
- <body style="font:16px system-ui;max-width:32em;margin:3em auto;padding:0 1em">
1716
- <h1>Ta</h1><p>Someone shared an extension of Ta. Scan the code in the Ta app, or paste this link in its Quick open, to open it.</p>
1717
- <p>有人分享了一个 Ta 扩展。在 Ta 应用里扫码,或把这个链接粘贴到“快捷打开”,就能打开它。</p>${OPEN_IN_TA}</body>`;
1718
- var RELAY_SHARE_MAX_BYTES = 8 * 1024 * 1024;
1719
- var RELAY_SHARE_CHUNK_BYTES = 192 * 1024;
1720
- var RELAY_CONTENT_MAX_BYTES = 8 * 1024 * 1024;
1721
- var RelayCloseCode;
1722
- (function(RelayCloseCode2) {
1723
- RelayCloseCode2[RelayCloseCode2["HOST_OFFLINE"] = 4404] = "HOST_OFFLINE";
1724
- RelayCloseCode2[RelayCloseCode2["REFUSED"] = 4401] = "REFUSED";
1725
- RelayCloseCode2[RelayCloseCode2["REPLACED"] = 4409] = "REPLACED";
1726
- RelayCloseCode2[RelayCloseCode2["CLOSED_BY_HOST"] = 4410] = "CLOSED_BY_HOST";
1727
- RelayCloseCode2[RelayCloseCode2["FULL"] = 4429] = "FULL";
1728
- RelayCloseCode2[RelayCloseCode2["TIMEOUT"] = 4408] = "TIMEOUT";
1729
- })(RelayCloseCode || (RelayCloseCode = {}));
1730
- var RELAY_PING = "ping";
1731
- var RELAY_HUB_MAX_VALUE = 96 * 1024;
1732
- var RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
1733
-
1734
1739
  // ../ta-relay/esm/common/relay-spot.js
1735
1740
  var RELAY_SPOT_PATH = "/v1/spot/";
1736
1741
  var RELAY_SPOT_JOIN_MS = 10 * 60000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-nearby",
3
- "version": "4.19.0",
3
+ "version": "4.20.0",
4
4
  "description": "A pi package for Ta: the other Ta around on the same network while you let them see you, known to Ta in your conversations, and rooms of those present made in a tap",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.19.0",
31
- "@celljs/ta-relay": "4.19.0",
32
- "@celljs/ta-web": "4.19.0",
30
+ "@celljs/ta-protocol": "4.20.0",
31
+ "@celljs/ta-relay": "4.20.0",
32
+ "@celljs/ta-web": "4.20.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {