dsh-life-pack 0.3.1 → 0.3.2
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/client.js +30 -55
- package/dist/client.js.map +1 -1
- package/dist/update-client.d.ts +7 -1
- package/dist/update-client.d.ts.map +1 -1
- package/dist/update-client.js +7 -1
- package/dist/update-client.js.map +1 -1
- package/dist/update-view.d.ts +7 -9
- package/dist/update-view.d.ts.map +1 -1
- package/dist/update-view.js +8 -13
- package/dist/update-view.js.map +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -310,7 +310,13 @@ window.__ModuleLoader__.load({
|
|
|
310
310
|
version
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
-
/** 装上更新:查新版 → 提交安装 → 有界轮询查状态到任务收尾;凭证过期重查一次再提交。
|
|
313
|
+
/** 装上更新:查新版 → 提交安装 → 有界轮询查状态到任务收尾;凭证过期重查一次再提交。
|
|
314
|
+
*
|
|
315
|
+
* **第一句那次 `checkTarget` 不是多余的**(票 #740 第四轮):凭证是「这一刻的安装态」的凭据,
|
|
316
|
+
* 更新包提交时拿它跟当时读到的安装态比(`service.js:309`/`:325`),不一样就拒。
|
|
317
|
+
* 而面板**从来只提交这一刻现签的凭证**——这就是「刚在本面板装过别家,这一家照样点得动
|
|
318
|
+
* 「装上更新」」的全部依据:旧快照只用来显示版本,不参与提交。(第四轮以前面板还把别家整行
|
|
319
|
+
* 换成「重新检查」——那是白挡一次本来会成功的点击,已删。) */
|
|
314
320
|
async function updateInstalled(call, target, pollMs) {
|
|
315
321
|
if (!target.phones) return failure("bad-request", { target: target.key });
|
|
316
322
|
const first = await checkTarget(call, target);
|
|
@@ -418,25 +424,14 @@ window.__ModuleLoader__.load({
|
|
|
418
424
|
if (verdict?.action) return verdict.action;
|
|
419
425
|
return phase === "failed" ? "recheck" : null;
|
|
420
426
|
}
|
|
421
|
-
/**
|
|
422
|
-
*
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
/** 把除 `keepKey` 之外的行全标成过期(票 #740):装成一家 ⇒ 七家共用的安装清单被改写,
|
|
431
|
-
* 其余各家的旧快照再拿去装必然被守卫拦下。纯函数:状态源与单测共用同一份判据,
|
|
432
|
-
* 不关心行里还有什么(泛型只要求有 `stale` 这一格)。 */
|
|
433
|
-
function markStaleOthers(rows, keepKey) {
|
|
434
|
-
const next = {};
|
|
435
|
-
for (const [key, row] of Object.entries(rows)) next[key] = key === keepKey ? row : {
|
|
436
|
-
...row,
|
|
437
|
-
stale: true
|
|
438
|
-
};
|
|
439
|
-
return next;
|
|
427
|
+
/** 这一行要不要摊出那条手工命令(票 #740 第三轮定的形状,第四轮补的这一格)。
|
|
428
|
+
*
|
|
429
|
+
* 三种情形摊:① 上一次装失败(`failed`);② 这句话自己指着「下面这条命令」(`manualHint`)。
|
|
430
|
+
* **待重启**与 `incompatible-node` 不摊:它们那时该做的是**重启**(或升级 Node),不是重装一次。
|
|
431
|
+
* (第四轮维护者真机截图逮到:待重启那张卡下面挂着一条「dsh plugin … add」——点它等于把刚装好的
|
|
432
|
+
* 那一版再装一遍,纯噪声,还会让人以为状态不对。) */
|
|
433
|
+
function showManualOf(verdict, phase) {
|
|
434
|
+
return phase === "failed" || verdict?.manualHint === true;
|
|
440
435
|
}
|
|
441
436
|
/** 把快照翻成一行结论:还没查 / 已是最新 / 有新版 / 待重启 / 装不了(附人话原因与下一步)。 */
|
|
442
437
|
function verdictOf(target, snapshot) {
|
|
@@ -823,10 +818,6 @@ window.__ModuleLoader__.load({
|
|
|
823
818
|
[key]: next
|
|
824
819
|
}));
|
|
825
820
|
}, []);
|
|
826
|
-
/** 装成一家 ⇒ 其余各家的旧快照一律作废(票 #740):判据见 `markStaleOthers`。 */
|
|
827
|
-
const staleOthers = react.useCallback((keepKey) => {
|
|
828
|
-
setRows((previous) => markStaleOthers(previous, keepKey));
|
|
829
|
-
}, []);
|
|
830
821
|
return {
|
|
831
822
|
targets,
|
|
832
823
|
rows,
|
|
@@ -842,21 +833,18 @@ window.__ModuleLoader__.load({
|
|
|
842
833
|
for (const target of list) patch(target.key, {
|
|
843
834
|
phase: "checking",
|
|
844
835
|
outcome: rows[target.key]?.outcome ?? null,
|
|
845
|
-
failure: null
|
|
846
|
-
stale: false
|
|
836
|
+
failure: null
|
|
847
837
|
});
|
|
848
838
|
Promise.all(list.map(async (target) => {
|
|
849
839
|
const result = await checkTarget(getCall(), target);
|
|
850
840
|
patch(target.key, result.ok ? {
|
|
851
841
|
phase: "ready",
|
|
852
842
|
outcome: result.value,
|
|
853
|
-
failure: null
|
|
854
|
-
stale: false
|
|
843
|
+
failure: null
|
|
855
844
|
} : {
|
|
856
845
|
phase: "failed",
|
|
857
846
|
outcome: null,
|
|
858
|
-
failure: result
|
|
859
|
-
stale: false
|
|
847
|
+
failure: result
|
|
860
848
|
});
|
|
861
849
|
})).finally(() => setChecking(false));
|
|
862
850
|
}, [
|
|
@@ -871,21 +859,18 @@ window.__ModuleLoader__.load({
|
|
|
871
859
|
patch(target.key, {
|
|
872
860
|
phase: "checking",
|
|
873
861
|
outcome: current.outcome,
|
|
874
|
-
failure: null
|
|
875
|
-
stale: false
|
|
862
|
+
failure: null
|
|
876
863
|
});
|
|
877
864
|
(async () => {
|
|
878
865
|
const checked = await checkTarget(getCall(), target);
|
|
879
866
|
patch(target.key, checked.ok ? {
|
|
880
867
|
phase: "ready",
|
|
881
868
|
outcome: checked.value,
|
|
882
|
-
failure: null
|
|
883
|
-
stale: false
|
|
869
|
+
failure: null
|
|
884
870
|
} : {
|
|
885
871
|
phase: "failed",
|
|
886
872
|
outcome: null,
|
|
887
|
-
failure: checked
|
|
888
|
-
stale: false
|
|
873
|
+
failure: checked
|
|
889
874
|
});
|
|
890
875
|
})();
|
|
891
876
|
return;
|
|
@@ -893,8 +878,7 @@ window.__ModuleLoader__.load({
|
|
|
893
878
|
patch(target.key, {
|
|
894
879
|
...current,
|
|
895
880
|
phase: "installing",
|
|
896
|
-
failure: null
|
|
897
|
-
stale: false
|
|
881
|
+
failure: null
|
|
898
882
|
});
|
|
899
883
|
(async () => {
|
|
900
884
|
const absent = isAbsent(target);
|
|
@@ -905,36 +889,29 @@ window.__ModuleLoader__.load({
|
|
|
905
889
|
patch(target.key, {
|
|
906
890
|
phase: "failed",
|
|
907
891
|
outcome: null,
|
|
908
|
-
failure: checked
|
|
909
|
-
stale: false
|
|
892
|
+
failure: checked
|
|
910
893
|
});
|
|
911
894
|
return;
|
|
912
895
|
}
|
|
913
896
|
patch(target.key, {
|
|
914
897
|
phase: "installing",
|
|
915
898
|
outcome: checked.value,
|
|
916
|
-
failure: null
|
|
917
|
-
stale: false
|
|
899
|
+
failure: null
|
|
918
900
|
});
|
|
919
901
|
version = checked.value.snapshot.latestVersion;
|
|
920
902
|
}
|
|
921
903
|
const result = absent ? await installAbsent(getCall(), target, version ?? "") : await updateInstalled(getCall(), target, pollMs);
|
|
922
904
|
if (result.ok) {
|
|
923
|
-
const before = current.outcome?.snapshot.installedVersion ?? null;
|
|
924
905
|
const refreshed = await checkTarget(getCall(), target, target.phones?.status);
|
|
925
|
-
const after = refreshed.ok ? refreshed.value.snapshot.installedVersion ?? null : null;
|
|
926
906
|
patch(target.key, refreshed.ok ? {
|
|
927
907
|
phase: "ready",
|
|
928
908
|
outcome: refreshed.value,
|
|
929
|
-
failure: null
|
|
930
|
-
stale: false
|
|
909
|
+
failure: null
|
|
931
910
|
} : {
|
|
932
911
|
phase: "failed",
|
|
933
912
|
outcome: null,
|
|
934
|
-
failure: refreshed
|
|
935
|
-
stale: false
|
|
913
|
+
failure: refreshed
|
|
936
914
|
});
|
|
937
|
-
if (after !== null && after !== before) staleOthers(target.key);
|
|
938
915
|
await reload();
|
|
939
916
|
return;
|
|
940
917
|
}
|
|
@@ -944,8 +921,7 @@ window.__ModuleLoader__.load({
|
|
|
944
921
|
failure: {
|
|
945
922
|
...result,
|
|
946
923
|
manual: result.manual ?? current.outcome?.manual ?? null
|
|
947
|
-
}
|
|
948
|
-
stale: false
|
|
924
|
+
}
|
|
949
925
|
});
|
|
950
926
|
})();
|
|
951
927
|
}, [
|
|
@@ -953,8 +929,7 @@ window.__ModuleLoader__.load({
|
|
|
953
929
|
patch,
|
|
954
930
|
pollMs,
|
|
955
931
|
reload,
|
|
956
|
-
rows
|
|
957
|
-
staleOthers
|
|
932
|
+
rows
|
|
958
933
|
])
|
|
959
934
|
};
|
|
960
935
|
}
|
|
@@ -1007,10 +982,10 @@ window.__ModuleLoader__.load({
|
|
|
1007
982
|
const body = shown.map((target) => {
|
|
1008
983
|
const row = rows[target.key];
|
|
1009
984
|
const snapshot = row.outcome?.snapshot ?? null;
|
|
1010
|
-
const verdict =
|
|
985
|
+
const verdict = snapshot ? verdictOf(target, snapshot) : null;
|
|
1011
986
|
const manual = manualForDisplay(target, row.failure?.manual ?? row.outcome?.manual ?? null);
|
|
1012
987
|
const busy = row.phase === "installing";
|
|
1013
|
-
const showManual = manual !== null && (row.phase
|
|
988
|
+
const showManual = manual !== null && showManualOf(verdict, row.phase);
|
|
1014
989
|
const buttonAction = cardActionOf(verdict, row.phase);
|
|
1015
990
|
const tone = rowToneOf(row, verdict);
|
|
1016
991
|
const paint = ROW_TONE[tone];
|