@decentnetwork/beagle 0.1.109 → 0.1.110
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 +72 -2
- package/package.json +2 -2
package/dist/desktop/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__DK_UI_VERSION="0.1.
|
|
1
|
+
window.__DK_UI_VERSION="0.1.110";
|
|
2
2
|
"use strict";
|
|
3
3
|
(() => {
|
|
4
4
|
// packages/beagle-ui/dist/beagle-ui.js
|
|
@@ -869,6 +869,12 @@ window.__DK_UI_VERSION="0.1.109";
|
|
|
869
869
|
kind: "node",
|
|
870
870
|
role: "server"
|
|
871
871
|
},
|
|
872
|
+
{
|
|
873
|
+
userid: "5SxEBHAx49Hknq1VzrA1HDtZHjW31vetX3iMEi4P6pK3",
|
|
874
|
+
name: "gfax118",
|
|
875
|
+
kind: "node",
|
|
876
|
+
role: "server"
|
|
877
|
+
},
|
|
872
878
|
{
|
|
873
879
|
userid: "72a4A7awtn6BqZnBt3eNhZH9MdYXRkM6Ht5HG2sqoiKR",
|
|
874
880
|
name: "nv4090-wsl",
|
|
@@ -1377,6 +1383,8 @@ ${cands.map((c) => `- ${nameOf(c)}`).join("\n")}`;
|
|
|
1377
1383
|
}, [append, lang, onReloadFriends]);
|
|
1378
1384
|
return { thread, handle, removeFriends };
|
|
1379
1385
|
}
|
|
1386
|
+
var DK_CMD_HIST_KEY = "beagle.assistant.history";
|
|
1387
|
+
var DK_CMD_HIST_MAX = 50;
|
|
1380
1388
|
function RequestsBlock({ T, requests, onAct }) {
|
|
1381
1389
|
const [acted, setActed] = React.useState({});
|
|
1382
1390
|
const [failed, setFailed] = React.useState({});
|
|
@@ -2778,6 +2786,59 @@ ${cands.map((c) => `- ${nameOf(c)}`).join("\n")}`;
|
|
|
2778
2786
|
setSelMode(false);
|
|
2779
2787
|
};
|
|
2780
2788
|
const [draft, setDraft] = React.useState("");
|
|
2789
|
+
const [hist, setHist] = React.useState([]);
|
|
2790
|
+
const histIdx = React.useRef(null);
|
|
2791
|
+
const histStash = React.useRef("");
|
|
2792
|
+
React.useEffect(() => {
|
|
2793
|
+
histIdx.current = null;
|
|
2794
|
+
histStash.current = "";
|
|
2795
|
+
if (!peer.app) {
|
|
2796
|
+
setHist([]);
|
|
2797
|
+
return;
|
|
2798
|
+
}
|
|
2799
|
+
try {
|
|
2800
|
+
setHist(JSON.parse(localStorage.getItem(DK_CMD_HIST_KEY) || "[]"));
|
|
2801
|
+
} catch (e) {
|
|
2802
|
+
setHist([]);
|
|
2803
|
+
}
|
|
2804
|
+
}, [peer.id, peer.app]);
|
|
2805
|
+
const rememberCommand = (text) => {
|
|
2806
|
+
setHist((h) => {
|
|
2807
|
+
const next = (h[h.length - 1] === text ? h : h.concat(text)).slice(-DK_CMD_HIST_MAX);
|
|
2808
|
+
if (peer.app) {
|
|
2809
|
+
try {
|
|
2810
|
+
localStorage.setItem(DK_CMD_HIST_KEY, JSON.stringify(next));
|
|
2811
|
+
} catch (e) {
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
return next;
|
|
2815
|
+
});
|
|
2816
|
+
histIdx.current = null;
|
|
2817
|
+
histStash.current = "";
|
|
2818
|
+
};
|
|
2819
|
+
const walkHistory = (dir) => {
|
|
2820
|
+
if (!hist.length)
|
|
2821
|
+
return false;
|
|
2822
|
+
let i = histIdx.current;
|
|
2823
|
+
if (i === null) {
|
|
2824
|
+
if (dir > 0)
|
|
2825
|
+
return false;
|
|
2826
|
+
histStash.current = draft;
|
|
2827
|
+
i = hist.length - 1;
|
|
2828
|
+
} else {
|
|
2829
|
+
i += dir;
|
|
2830
|
+
if (i >= hist.length) {
|
|
2831
|
+
histIdx.current = null;
|
|
2832
|
+
setDraft(histStash.current);
|
|
2833
|
+
return true;
|
|
2834
|
+
}
|
|
2835
|
+
if (i < 0)
|
|
2836
|
+
i = 0;
|
|
2837
|
+
}
|
|
2838
|
+
histIdx.current = i;
|
|
2839
|
+
setDraft(hist[i]);
|
|
2840
|
+
return true;
|
|
2841
|
+
};
|
|
2781
2842
|
const [dragOver, setDragOver] = React.useState(false);
|
|
2782
2843
|
const [sending, setSending] = React.useState(null);
|
|
2783
2844
|
const [theater, setTheater] = React.useState(null);
|
|
@@ -2800,6 +2861,7 @@ ${cands.map((c) => `- ${nameOf(c)}`).join("\n")}`;
|
|
|
2800
2861
|
const sendDraft = () => {
|
|
2801
2862
|
if (draft.trim()) {
|
|
2802
2863
|
followScrollRef.current = true;
|
|
2864
|
+
rememberCommand(draft.trim());
|
|
2803
2865
|
onSend(draft);
|
|
2804
2866
|
setDraft("");
|
|
2805
2867
|
requestAnimationFrame(scrollToBottom);
|
|
@@ -2985,11 +3047,19 @@ ${peer.address}`
|
|
|
2985
3047
|
"input",
|
|
2986
3048
|
{
|
|
2987
3049
|
value: draft,
|
|
2988
|
-
onChange: (e) =>
|
|
3050
|
+
onChange: (e) => {
|
|
3051
|
+
histIdx.current = null;
|
|
3052
|
+
setDraft(e.target.value);
|
|
3053
|
+
},
|
|
2989
3054
|
onKeyDown: (e) => {
|
|
2990
3055
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2991
3056
|
e.preventDefault();
|
|
2992
3057
|
sendDraft();
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
3061
|
+
if (walkHistory(e.key === "ArrowUp" ? -1 : 1))
|
|
3062
|
+
e.preventDefault();
|
|
2993
3063
|
}
|
|
2994
3064
|
},
|
|
2995
3065
|
placeholder: phone ? `${T.message}\u2026` : `${T.message} ${peer.alias || shortKey(peer.userId, 6, 4)}\u2026`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/beagle",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.110",
|
|
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"yargs": "^17.7.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@decentnetwork/beagle-ui": "^0.2.
|
|
38
|
+
"@decentnetwork/beagle-ui": "^0.2.24",
|
|
39
39
|
"@types/js-yaml": "^4.0.9",
|
|
40
40
|
"@types/node": "^20.11.0",
|
|
41
41
|
"@types/yargs": "^17.0.32",
|