@decentnetwork/beagle 0.1.146 → 0.1.147

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.
Files changed (2) hide show
  1. package/dist/desktop/app.js +13 -11
  2. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.146";
1
+ window.__DK_UI_VERSION="0.1.147";
2
2
  "use strict";
3
3
  (() => {
4
4
  // packages/beagle-ui/dist/beagle-ui.js
@@ -504,7 +504,7 @@ window.__DK_UI_VERSION="0.1.146";
504
504
  return "[" + word + "] " + media.name;
505
505
  }
506
506
  var SENT_TIME_MIN_EARLY_MS = 2 * 6e4;
507
- var MARKER_MAX_EARLY_MS = 6 * 36e5;
507
+ var UTC_MARKER_CUTOFF_MS = Date.UTC(2026, 10, 24, 20, 31, 0);
508
508
  function parseMarkerUtc(s) {
509
509
  const m = /^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{2}):(\d{2})$/.exec(String(s || "").trim());
510
510
  if (!m)
@@ -522,18 +522,18 @@ window.__DK_UI_VERSION="0.1.146";
522
522
  return Math.floor(n);
523
523
  return Math.floor(n * 1e3);
524
524
  }
525
- function pickSentTime(arrivalMs, sentMs, maxEarlyMs = Infinity) {
525
+ function pickSentTime(arrivalMs, sentMs, notBeforeMs = -Infinity) {
526
526
  if (!arrivalMs || sentMs == null)
527
527
  return arrivalMs;
528
+ if (sentMs < notBeforeMs)
529
+ return arrivalMs;
528
530
  const early = arrivalMs - sentMs;
529
531
  if (early < SENT_TIME_MIN_EARLY_MS)
530
532
  return arrivalMs;
531
- if (early > maxEarlyMs)
532
- return arrivalMs;
533
533
  return sentMs;
534
534
  }
535
535
  function groupSentTime(row) {
536
- var _a, _b, _c, _d;
536
+ var _a, _b, _c;
537
537
  const arrival = row && row.ts;
538
538
  if (!row || row.dir === "out" || !arrival)
539
539
  return { ts: arrival, key: null };
@@ -547,19 +547,21 @@ window.__DK_UI_VERSION="0.1.146";
547
547
  }
548
548
  const msg = j && j.message;
549
549
  if (msg && typeof msg === "object") {
550
- const raw = (_b = (_a = msg.file && msg.file.sent_at_ms) != null ? _a : msg.sent_at_ms) != null ? _b : msg.timestamp;
550
+ const meta = (_a = msg.file && msg.file.sent_at_ms) != null ? _a : msg.sent_at_ms;
551
+ const raw = meta != null ? meta : msg.timestamp;
551
552
  const sent2 = epochMs(raw);
552
553
  const origin = j.origin && (j.origin.userid || j.origin.friendid || j.origin.nickname) || "";
553
554
  const body = typeof msg.text === "string" ? msg.text : msg.file ? JSON.stringify(msg.file) : "";
554
- return { ts: pickSentTime(arrival, sent2), key: sent2 != null ? `cgp1|${origin}|${raw}|${body}` : null };
555
+ const ts = pickSentTime(arrival, sent2, meta != null ? UTC_MARKER_CUTOFF_MS : -Infinity);
556
+ return { ts, key: sent2 != null ? `cgp1|${origin}|${raw}|${body}` : null };
555
557
  }
556
558
  }
557
559
  if (row.file) {
558
- const raw = (_d = (_c = row.sent_at_ms) != null ? _c : row.file.sent_at_ms) != null ? _d : row.origin && row.origin.sent_at_ms;
560
+ const raw = (_c = (_b = row.sent_at_ms) != null ? _b : row.file.sent_at_ms) != null ? _c : row.origin && row.origin.sent_at_ms;
559
561
  const sent2 = epochMs(raw);
560
562
  if (sent2 != null) {
561
563
  const who = row.origin && (row.origin.userid || row.origin.nickname) || "";
562
- return { ts: pickSentTime(arrival, sent2), key: `file|${who}|${raw}|${row.file.name}|${row.file.size}` };
564
+ return { ts: pickSentTime(arrival, sent2, UTC_MARKER_CUTOFF_MS), key: `file|${who}|${raw}|${row.file.name}|${row.file.size}` };
563
565
  }
564
566
  return { ts: arrival, key: null };
565
567
  }
@@ -567,7 +569,7 @@ window.__DK_UI_VERSION="0.1.146";
567
569
  const sent = marker ? parseMarkerUtc(marker) : null;
568
570
  if (sent == null)
569
571
  return { ts: arrival, key: null };
570
- return { ts: pickSentTime(arrival, sent, MARKER_MAX_EARLY_MS), key: `relay|${text}` };
572
+ return { ts: pickSentTime(arrival, sent, UTC_MARKER_CUTOFF_MS), key: `relay|${text}` };
571
573
  }
572
574
  function datedThread(rows) {
573
575
  const seen = /* @__PURE__ */ new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/beagle",
3
- "version": "0.1.146",
3
+ "version": "0.1.147",
4
4
  "description": "Beagle — P2P chat, file transfer and calls for regular users, on the Decent Network. No admin privilege required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "start": "node dist/cli.js"
27
27
  },
28
28
  "dependencies": {
29
- "@decentnetwork/beagle-ui": "^0.2.48",
29
+ "@decentnetwork/beagle-ui": "^0.2.49",
30
30
  "@decentnetwork/chat-components": "^0.1.3",
31
31
  "@decentnetwork/lan": "^0.1.316",
32
32
  "@decentnetwork/peer": "^0.1.178",