@decentnetwork/beagle 0.1.65 → 0.1.67
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 +1 -1
- package/dist/server.js +31 -10
- package/package.json +2 -2
package/dist/desktop/app.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -1582,15 +1582,28 @@ export function startBeagleServer(opts) {
|
|
|
1582
1582
|
// ── self-update: check (cached), run (localhost), restart (localhost) ──
|
|
1583
1583
|
if (req.method === "GET" && url === "/api/update-check") {
|
|
1584
1584
|
const force = new URL(req.url || "", "http://localhost").searchParams.get("force") === "1";
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1585
|
+
// Cache the REGISTRY lookups, never the answer. The whole body used to
|
|
1586
|
+
// be cached for six hours, and it is only invalidated by updating
|
|
1587
|
+
// THROUGH this app — so someone who ran the terminal command the card
|
|
1588
|
+
// itself told them to run saw the same "update available" for the rest
|
|
1589
|
+
// of the day, no matter how many times they ran it. The card sent
|
|
1590
|
+
// people in a loop it was creating.
|
|
1591
|
+
//
|
|
1592
|
+
// What is actually slow and rate-limited is npm; the running versions
|
|
1593
|
+
// come from the daemon and are already cached for 30s. So the rows are
|
|
1594
|
+
// rebuilt every call and only `latest` is held.
|
|
1595
|
+
if (force)
|
|
1596
|
+
updateCache = null;
|
|
1597
|
+
const cachedLatest = updateCache && Date.now() - updateCache.at < UPDATE_TTL_MS
|
|
1598
|
+
? updateCache.body.latest
|
|
1599
|
+
: undefined;
|
|
1600
|
+
const [beagleLatest, peerLatest, lanLatest] = cachedLatest
|
|
1601
|
+
? [cachedLatest.beagle ?? null, cachedLatest.peer ?? null, cachedLatest.lan ?? null]
|
|
1602
|
+
: await Promise.all([
|
|
1603
|
+
npmLatest(BEAGLE_PKG),
|
|
1604
|
+
npmLatest("@decentnetwork/peer"),
|
|
1605
|
+
npmLatest("@decentnetwork/lan"),
|
|
1606
|
+
]);
|
|
1594
1607
|
const running = await runningVersions(opts.call);
|
|
1595
1608
|
const curLan = running.lanVer || (opts.meExtra?.lanVer ?? "");
|
|
1596
1609
|
const row = (pkg, current, latest) => ({
|
|
@@ -1617,7 +1630,15 @@ export function startBeagleServer(opts) {
|
|
|
1617
1630
|
...(curLan && curLan !== "(none)" ? [row("@decentnetwork/lan", curLan, lanLatest)] : []),
|
|
1618
1631
|
],
|
|
1619
1632
|
};
|
|
1620
|
-
|
|
1633
|
+
// Keep only what npm told us, and only when it actually answered.
|
|
1634
|
+
// Caching a failed lookup as "null" would pin the panel to "up to
|
|
1635
|
+
// date" for six hours after one flaky request.
|
|
1636
|
+
if (!cachedLatest && (beagleLatest || peerLatest || lanLatest)) {
|
|
1637
|
+
updateCache = {
|
|
1638
|
+
at: Date.now(),
|
|
1639
|
+
body: { latest: { beagle: beagleLatest, peer: peerLatest, lan: lanLatest } },
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1621
1642
|
sendJson(res, 200, body);
|
|
1622
1643
|
return;
|
|
1623
1644
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/beagle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.67",
|
|
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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@decentnetwork/chat-components": "^0.1.3",
|
|
29
29
|
"@decentnetwork/lan": "^0.1.283",
|
|
30
|
-
"@decentnetwork/peer": "0.1.
|
|
30
|
+
"@decentnetwork/peer": "0.1.151",
|
|
31
31
|
"@decentnetwork/peer-webrtc": "^0.2.16",
|
|
32
32
|
"js-yaml": "^4.1.0",
|
|
33
33
|
"yargs": "^17.7.2"
|