dshmarket 1.16.2 → 1.16.3
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/client/client.js +19 -3
- package/client/client.js.map +1 -1
- package/lib/dsh-cli.js +7 -1
- package/lib/types/dsh-cli.d.ts +12 -0
- package/package.json +1 -1
- package/src/client/MarketSection.tsx +42 -2
- package/src/client/market-data.ts +8 -1
- package/src/dsh-cli.ts +7 -1
package/client/client.js
CHANGED
|
@@ -770,8 +770,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
770
770
|
}
|
|
771
771
|
/** Heuristic: plugins that target a terminal surface rather than the web UI. */
|
|
772
772
|
function looksTerminal(plugin, lang) {
|
|
773
|
-
const
|
|
774
|
-
return /\b(tui|cli|tty|terminal)\b|终端|命令行/i.test(plugin.name + " " +
|
|
773
|
+
const positiveDesc = (plugin.description && (plugin.description[lang] || plugin.description.en) || "").replace(/\b(?:no|without)\b[^.!?;:,。!?;\n]{0,80}\b(?:tui|cli|tty|terminal)\b/gi, "").replace(/(?:无需|无须|不需要|不用)[^。!?;\n]{0,48}(?:tui|cli|tty|terminal|终端|命令行)/gi, "");
|
|
774
|
+
return /\b(tui|cli|tty|terminal)\b|终端|命令行/i.test(plugin.name + " " + positiveDesc);
|
|
775
775
|
}
|
|
776
776
|
/** Days per TimeRange (`all` has no cutoff and is handled by the caller). */
|
|
777
777
|
const TIME_RANGE_DAYS = {
|
|
@@ -3719,6 +3719,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
3719
3719
|
const [busyUrl, setBusyUrl] = (0, react.useState)(null);
|
|
3720
3720
|
/** Consecutive idle polls with a pending install that never landed (#32). */
|
|
3721
3721
|
const idleStrikes = (0, react.useRef)(0);
|
|
3722
|
+
/** Same idle-strike bookkeeping for an update whose response was lost. */
|
|
3723
|
+
const updateIdleStrikes = (0, react.useRef)(0);
|
|
3722
3724
|
const [doneUrls, setDoneUrls] = (0, react.useState)([]);
|
|
3723
3725
|
const [installError, setInstallError] = (0, react.useState)(null);
|
|
3724
3726
|
const [compatibilityNotice, setCompatibilityNotice] = (0, react.useState)(null);
|
|
@@ -4001,6 +4003,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
4001
4003
|
(0, react.useEffect)(() => {
|
|
4002
4004
|
const pending = readSession("dshm-pending");
|
|
4003
4005
|
if (pending !== null && typeof pending.url === "string") setBusyUrl(pending.url);
|
|
4006
|
+
const updating = readSession("dshm-updating");
|
|
4007
|
+
if (updating !== null && typeof updating.name === "string" && updating.name !== "") setUpdatingName(updating.name);
|
|
4004
4008
|
}, []);
|
|
4005
4009
|
(0, react.useEffect)(() => {
|
|
4006
4010
|
if (busyUrl === null && updatingName === null) {
|
|
@@ -4055,6 +4059,14 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
4055
4059
|
setInstallError(t("installFail") + " — " + t("exportLog"));
|
|
4056
4060
|
}
|
|
4057
4061
|
}
|
|
4062
|
+
if (updatingName !== null && status.busy !== true) {
|
|
4063
|
+
if (++updateIdleStrikes.current >= 2) {
|
|
4064
|
+
updateIdleStrikes.current = 0;
|
|
4065
|
+
sessionStorage.removeItem("dshm-updating");
|
|
4066
|
+
setUpdatingName(null);
|
|
4067
|
+
refreshInstalled();
|
|
4068
|
+
}
|
|
4069
|
+
} else updateIdleStrikes.current = 0;
|
|
4058
4070
|
}
|
|
4059
4071
|
}).catch(() => {});
|
|
4060
4072
|
}, 2e3);
|
|
@@ -4404,6 +4416,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
4404
4416
|
setActivationWarnings([]);
|
|
4405
4417
|
setStaleName(null);
|
|
4406
4418
|
setUpdatingName(name);
|
|
4419
|
+
updateIdleStrikes.current = 0;
|
|
4420
|
+
sessionStorage.setItem("dshm-updating", JSON.stringify({ name }));
|
|
4407
4421
|
return fetch("/dsh-market/update", {
|
|
4408
4422
|
method: "POST",
|
|
4409
4423
|
headers: { "content-type": "application/json" },
|
|
@@ -4415,6 +4429,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
4415
4429
|
status: res.status,
|
|
4416
4430
|
body
|
|
4417
4431
|
}))).then(({ status, body }) => {
|
|
4432
|
+
sessionStorage.removeItem("dshm-updating");
|
|
4433
|
+
setUpdatingName(null);
|
|
4418
4434
|
if (body.cancelled === true) {
|
|
4419
4435
|
refreshInstalled();
|
|
4420
4436
|
if (body.partial === true) setInstallError(t("partialNote"));
|
|
@@ -4447,7 +4463,7 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
|
|
|
4447
4463
|
const detail = text(body.error) || humanOutput([text(body.stderr), text(body.stdout)].filter(Boolean).join("\n")) || "exit " + body.exitCode;
|
|
4448
4464
|
setInstallError(t("updateFail") + ": " + name + " — " + detail.trim().slice(-600));
|
|
4449
4465
|
}
|
|
4450
|
-
}).catch((
|
|
4466
|
+
}).catch(() => {});
|
|
4451
4467
|
}, [refreshInstalled, t]);
|
|
4452
4468
|
const doUseSkin = (0, react.useCallback)((name) => {
|
|
4453
4469
|
setInstallError(null);
|