@decentnetwork/beagle 0.1.93 → 0.1.95
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/dist/desktop/app.js +20 -5
- package/dist/server.js +7 -4
- package/package.json +1 -1
package/dist/desktop/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__DK_UI_VERSION="0.1.
|
|
1
|
+
window.__DK_UI_VERSION="0.1.95";
|
|
2
2
|
"use strict";
|
|
3
3
|
(() => {
|
|
4
4
|
// packages/beagle-ui/dist/beagle-ui.js
|
|
@@ -539,6 +539,10 @@ window.__DK_UI_VERSION="0.1.93";
|
|
|
539
539
|
setFromDeepLink(true);
|
|
540
540
|
}
|
|
541
541
|
}, [prefillAddr]);
|
|
542
|
+
const dismissDeepLink = () => {
|
|
543
|
+
setFromDeepLink(false);
|
|
544
|
+
onPrefillConsumed && onPrefillConsumed();
|
|
545
|
+
};
|
|
542
546
|
const submitAddr = () => {
|
|
543
547
|
const v = addr.trim();
|
|
544
548
|
if (!v || addState && addState.kind === "sending")
|
|
@@ -551,9 +555,11 @@ window.__DK_UI_VERSION="0.1.93";
|
|
|
551
555
|
onPrefillConsumed && onPrefillConsumed();
|
|
552
556
|
setAddState({ kind: "ok", msg: T.addSent });
|
|
553
557
|
} else {
|
|
558
|
+
dismissDeepLink();
|
|
554
559
|
setAddState({ kind: "err", msg: r && r.error ? `${T.addFailed}: ${r.error}` : T.addFailed });
|
|
555
560
|
}
|
|
556
561
|
}).catch((e) => {
|
|
562
|
+
dismissDeepLink();
|
|
557
563
|
setAddState({ kind: "err", msg: `${T.addFailed}: ${e && e.message || e}` });
|
|
558
564
|
}).finally(() => {
|
|
559
565
|
setTimeout(() => setAddState((s) => s && s.kind !== "sending" ? null : s), 6e3);
|
|
@@ -579,8 +585,11 @@ window.__DK_UI_VERSION="0.1.93";
|
|
|
579
585
|
background: "color-mix(in oklab, var(--accent), transparent 88%)",
|
|
580
586
|
border: "1px solid var(--accent)",
|
|
581
587
|
borderRadius: 8,
|
|
582
|
-
padding: "7px 10px"
|
|
583
|
-
|
|
588
|
+
padding: "7px 10px",
|
|
589
|
+
display: "flex",
|
|
590
|
+
alignItems: "flex-start",
|
|
591
|
+
gap: 8
|
|
592
|
+
} }, /* @__PURE__ */ React.createElement("span", { style: { flex: 1 } }, T.deepLinkConfirm || "\u901A\u8FC7\u94FE\u63A5\u6DFB\u52A0\u8FD9\u4F4D\u597D\u53CB? \u70B9\u300C\u6DFB\u52A0\u300D\u53D1\u9001\u597D\u53CB\u8BF7\u6C42 / Add this contact from the link? Tap Add to send a friend request."), /* @__PURE__ */ React.createElement(Btn, { size: "sm", icon: "x", title: T.cancel || "Dismiss", onClick: dismissDeepLink, style: { flexShrink: 0 } })), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 7 } }, /* @__PURE__ */ React.createElement(
|
|
584
593
|
"input",
|
|
585
594
|
{
|
|
586
595
|
value: addr,
|
|
@@ -5167,10 +5176,16 @@ ${peer.address}`
|
|
|
5167
5176
|
window.addEventListener("hashchange", onHash);
|
|
5168
5177
|
return () => window.removeEventListener("hashchange", onHash);
|
|
5169
5178
|
}, []);
|
|
5179
|
+
const jumpedFor = React.useRef("");
|
|
5170
5180
|
React.useEffect(() => {
|
|
5171
|
-
if (!pendingAddr)
|
|
5181
|
+
if (!pendingAddr) {
|
|
5182
|
+
jumpedFor.current = "";
|
|
5172
5183
|
return;
|
|
5173
|
-
|
|
5184
|
+
}
|
|
5185
|
+
if (jumpedFor.current !== pendingAddr) {
|
|
5186
|
+
jumpedFor.current = pendingAddr;
|
|
5187
|
+
setTab("chat");
|
|
5188
|
+
}
|
|
5174
5189
|
if (!peers || !peers.length)
|
|
5175
5190
|
return;
|
|
5176
5191
|
const hit = peers.find((p) => p.address && p.address === pendingAddr);
|
package/dist/server.js
CHANGED
|
@@ -2016,6 +2016,7 @@ export function startBeagleServer(opts) {
|
|
|
2016
2016
|
const sess = sessByUserid.get(uid);
|
|
2017
2017
|
const status = f.status;
|
|
2018
2018
|
const stamp = stamps.get(uid);
|
|
2019
|
+
const acceptedAt = f.lastSeen ?? stamp?.acceptedAt ?? 0;
|
|
2019
2020
|
const online = status === "connected" || status === "online";
|
|
2020
2021
|
const realName = typeof f.name === "string" && f.name !== uid ? f.name : undefined;
|
|
2021
2022
|
const lm = f.lastMessage;
|
|
@@ -2029,11 +2030,13 @@ export function startBeagleServer(opts) {
|
|
|
2029
2030
|
online,
|
|
2030
2031
|
// Friendship not yet accepted by the other side. Only trusted when
|
|
2031
2032
|
// the backend states it explicitly: the embedded host's `accepted`,
|
|
2032
|
-
// or the SDK status "requested"
|
|
2033
|
-
//
|
|
2033
|
+
// or — on the daemon — SDK status "requested" WITH no acceptedAt.
|
|
2034
|
+
// Status alone is not enough: the daemon keeps "requested" on a
|
|
2035
|
+
// friend who accepted but has never connected since, and reading
|
|
2036
|
+
// it as pending put the waiting banner on 22 of 65 friends.
|
|
2034
2037
|
// Anything else defaults to established, so the banner can never
|
|
2035
2038
|
// wrongly appear on an old backend.
|
|
2036
|
-
pending: f.accepted === false || status === "requested",
|
|
2039
|
+
pending: f.accepted === false || (status === "requested" && !acceptedAt),
|
|
2037
2040
|
via: online ? viaFromTransport(sess?.transport) : null,
|
|
2038
2041
|
ping: null,
|
|
2039
2042
|
ip: ipByUserid.get(uid) ?? "",
|
|
@@ -2058,7 +2061,7 @@ export function startBeagleServer(opts) {
|
|
|
2058
2061
|
// daemon backend gives only lastSeen (its acceptedAt) and nothing
|
|
2059
2062
|
// for a request we sent, which left a just-added friend with no
|
|
2060
2063
|
// stamp at all.
|
|
2061
|
-
acceptedAt
|
|
2064
|
+
acceptedAt,
|
|
2062
2065
|
requestedAt: f.requestedAt ?? stamp?.requestedAt ?? 0,
|
|
2063
2066
|
wire: "163",
|
|
2064
2067
|
avatarUrl: ensPub.get(uid)?.avatarUrl ?? null,
|
package/package.json
CHANGED