dsh-life-pack 0.3.40 → 0.3.42
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 +735 -1089
- package/dist/client.js.map +1 -1
- package/dist/config-panel-view.d.ts.map +1 -1
- package/dist/config-panel-view.js +11 -0
- package/dist/config-panel-view.js.map +1 -1
- package/dist/seal-paper-schemes.d.ts +67 -0
- package/dist/seal-paper-schemes.d.ts.map +1 -0
- package/dist/seal-paper-schemes.js +135 -0
- package/dist/seal-paper-schemes.js.map +1 -0
- package/dist/seal-scroll.d.ts +9 -1
- package/dist/seal-scroll.d.ts.map +1 -1
- package/dist/seal-scroll.js +59 -8
- package/dist/seal-scroll.js.map +1 -1
- package/dist/seal-stamp.d.ts.map +1 -1
- package/dist/seal-stamp.js +4 -2
- package/dist/seal-stamp.js.map +1 -1
- package/dist/update-dialog.d.ts +7 -6
- package/dist/update-dialog.d.ts.map +1 -1
- package/dist/update-dialog.js +12 -26
- package/dist/update-dialog.js.map +1 -1
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -153,27 +153,78 @@ window.__ModuleLoader__.load({
|
|
|
153
153
|
path: "/api/ilife-manager"
|
|
154
154
|
};
|
|
155
155
|
//#endregion
|
|
156
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
157
|
-
const DEFAULT_PANEL_POLL_MS = 1e3;
|
|
156
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/config.js
|
|
158
157
|
function assertPrefix(value, role) {
|
|
159
158
|
if (typeof value !== "string" || value.length === 0) throw new Error("[dsh-plugin-update] " + role + " 非法:须为非空字符串(收到 " + JSON.stringify(value) + ")");
|
|
160
159
|
if (value.includes(".") || value.includes("/") || value.includes("\\") || /\s/.test(value)) throw new Error("[dsh-plugin-update] " + role + " 非法:不得含有点、路径分隔符或空白(收到 " + JSON.stringify(value) + ")");
|
|
161
160
|
return value;
|
|
162
161
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/redaction.js
|
|
164
|
+
const COPY_BUDGET_CHARS = 1500;
|
|
165
|
+
const REDACTED_PATH = "<路径>";
|
|
166
|
+
const REDACTED_SECRET = "<脱敏>";
|
|
167
|
+
const ABSOLUTE_PATH_RE = /[A-Za-z]:\\[^\s"']*|\\\\[^\s"'()\[\];]+|(^|[\s"'(\[=,])\/\/[^\s"'()\[\];]+|(^|[\s"'(\[=:,])\/(?!\/)[^\s"'()\[\];]+/g;
|
|
168
|
+
const URL_USERINFO_RE = /[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s/]*@/;
|
|
169
|
+
const NPM_TOKEN_RE = /\bnpm_[A-Za-z0-9_-]{8,}/g;
|
|
170
|
+
const GITHUB_TOKEN_RE = /\b(?:gh[pousr]_[A-Za-z0-9]{8,}|github_pat_[A-Za-z0-9_]{10,})/g;
|
|
171
|
+
const SK_TOKEN_RE = /\bsk-[A-Za-z0-9_-]{6,}/g;
|
|
172
|
+
const BEARER_TOKEN_RE = /(\bbearer\s+)[A-Za-z0-9._~+/-=]{6,}/gi;
|
|
173
|
+
const CRED_PAIR_RE = /(\b(?:token|password|passwd|pwd|api[_-]?key|access[_-]?key|auth[_-]?token|secret|cookie)\s*[:=]\s*)("[^"]+"|'[^']+'|[^\s'";,)\]]+)/gi;
|
|
174
|
+
const EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
|
|
175
|
+
function flattenWhitespace(text) {
|
|
176
|
+
return String(text ?? "").replace(/\s+/g, " ").trim();
|
|
177
|
+
}
|
|
178
|
+
function applyPathRule(text) {
|
|
179
|
+
ABSOLUTE_PATH_RE.lastIndex = 0;
|
|
180
|
+
return text.replace(ABSOLUTE_PATH_RE, (_whole, g1, g2) => {
|
|
181
|
+
return `${g1 ?? g2 ?? ""}${REDACTED_PATH}`;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function applyTokenRule(text) {
|
|
185
|
+
NPM_TOKEN_RE.lastIndex = 0;
|
|
186
|
+
GITHUB_TOKEN_RE.lastIndex = 0;
|
|
187
|
+
SK_TOKEN_RE.lastIndex = 0;
|
|
188
|
+
BEARER_TOKEN_RE.lastIndex = 0;
|
|
189
|
+
return text.replace(NPM_TOKEN_RE, REDACTED_SECRET).replace(GITHUB_TOKEN_RE, REDACTED_SECRET).replace(SK_TOKEN_RE, REDACTED_SECRET).replace(BEARER_TOKEN_RE, (_whole, prefix) => `${prefix}${REDACTED_SECRET}`);
|
|
190
|
+
}
|
|
191
|
+
function applyCredPairRule(text) {
|
|
192
|
+
CRED_PAIR_RE.lastIndex = 0;
|
|
193
|
+
return text.replace(CRED_PAIR_RE, (_whole, head) => `${head}${REDACTED_SECRET}`);
|
|
194
|
+
}
|
|
195
|
+
function applyEmailRule(text) {
|
|
196
|
+
EMAIL_RE.lastIndex = 0;
|
|
197
|
+
return text.replace(EMAIL_RE, REDACTED_SECRET);
|
|
198
|
+
}
|
|
199
|
+
function hasUserinfo(text) {
|
|
200
|
+
URL_USERINFO_RE.lastIndex = 0;
|
|
201
|
+
return URL_USERINFO_RE.test(text);
|
|
202
|
+
}
|
|
203
|
+
function truncateToWordBoundary(text, max) {
|
|
204
|
+
const input = String(text ?? "");
|
|
205
|
+
if (input.length <= max) return input;
|
|
206
|
+
const slice = input.slice(0, max);
|
|
207
|
+
const lastSpace = slice.lastIndexOf(" ");
|
|
208
|
+
let cut = lastSpace > 0 ? slice.slice(0, lastSpace) : slice;
|
|
209
|
+
const lastOpen = cut.lastIndexOf("<");
|
|
210
|
+
if (lastOpen > cut.lastIndexOf(">")) cut = cut.slice(0, lastOpen).trimEnd();
|
|
211
|
+
if (!cut) cut = slice;
|
|
212
|
+
return `${cut}\u2026`;
|
|
213
|
+
}
|
|
214
|
+
function truncateForCopy(text) {
|
|
215
|
+
return truncateToWordBoundary(text, COPY_BUDGET_CHARS);
|
|
171
216
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
217
|
+
function scrubWithoutBudget(text) {
|
|
218
|
+
return applyEmailRule(applyCredPairRule(applyTokenRule(applyPathRule(text))));
|
|
219
|
+
}
|
|
220
|
+
function sanitizeForCopy(text) {
|
|
221
|
+
const flat = flattenWhitespace(String(text ?? ""));
|
|
222
|
+
if (!flat) return "";
|
|
223
|
+
if (hasUserinfo(flat)) return "";
|
|
224
|
+
return truncateForCopy(scrubWithoutBudget(flat));
|
|
174
225
|
}
|
|
175
226
|
//#endregion
|
|
176
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
227
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/service.js
|
|
177
228
|
function updateError(code) {
|
|
178
229
|
return Object.assign(new Error(code), { code });
|
|
179
230
|
}
|
|
@@ -260,7 +311,7 @@ window.__ModuleLoader__.load({
|
|
|
260
311
|
return 0;
|
|
261
312
|
}
|
|
262
313
|
//#endregion
|
|
263
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
314
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/changelog.js
|
|
264
315
|
const CHANGELOG_NEUTRAL_LINE = "作者未提供更新说明,安装不受影响。";
|
|
265
316
|
const CHANGELOG_MAX_CHARS = 65536;
|
|
266
317
|
const CHANGELOG_ALL_CATEGORIES = [
|
|
@@ -708,153 +759,15 @@ ${blocks.join("\n")}
|
|
|
708
759
|
return renderChangelogNeutral();
|
|
709
760
|
}
|
|
710
761
|
}
|
|
711
|
-
function isTerminalPhase(phase) {
|
|
712
|
-
return phase === "done" || phase === "failed" || phase === "skipped" || phase === "current";
|
|
713
|
-
}
|
|
714
|
-
function asMillis(value, fallback) {
|
|
715
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
716
|
-
}
|
|
717
|
-
function isNonEmptyString(value) {
|
|
718
|
-
return typeof value === "string" && value.length > 0;
|
|
719
|
-
}
|
|
720
|
-
const PHASES = [
|
|
721
|
-
"pending",
|
|
722
|
-
"checking",
|
|
723
|
-
"ready",
|
|
724
|
-
"installing",
|
|
725
|
-
"current",
|
|
726
|
-
"done",
|
|
727
|
-
"failed",
|
|
728
|
-
"skipped"
|
|
729
|
-
];
|
|
730
|
-
function asPhase(value) {
|
|
731
|
-
return typeof value === "string" && PHASES.includes(value) ? value : "pending";
|
|
732
|
-
}
|
|
733
|
-
function batchRequestId(sessionId, key) {
|
|
734
|
-
return "batch:" + sessionId + ":" + key;
|
|
735
|
-
}
|
|
736
|
-
function emptyBatchSession() {
|
|
737
|
-
return {
|
|
738
|
-
version: 1,
|
|
739
|
-
id: "",
|
|
740
|
-
selfKey: null,
|
|
741
|
-
stopOnFailure: false,
|
|
742
|
-
order: [],
|
|
743
|
-
entries: [],
|
|
744
|
-
createdAt: 0,
|
|
745
|
-
updatedAt: 0
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
function normalizeBatchSession(raw) {
|
|
749
|
-
try {
|
|
750
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return emptyBatchSession();
|
|
751
|
-
const input = raw;
|
|
752
|
-
if (input["version"] !== 1) return emptyBatchSession();
|
|
753
|
-
const id = isNonEmptyString(input["id"]) ? input["id"] : "";
|
|
754
|
-
const selfKey = isNonEmptyString(input["selfKey"]) ? input["selfKey"] : null;
|
|
755
|
-
const entries = [];
|
|
756
|
-
const seen = /* @__PURE__ */ new Set();
|
|
757
|
-
const rawEntries = input["entries"];
|
|
758
|
-
if (Array.isArray(rawEntries)) for (const item of rawEntries) {
|
|
759
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
760
|
-
const e = item;
|
|
761
|
-
const key = e["key"];
|
|
762
|
-
if (!isNonEmptyString(key) || seen.has(key)) continue;
|
|
763
|
-
seen.add(key);
|
|
764
|
-
const requestId = isNonEmptyString(e["requestId"]) ? e["requestId"] : batchRequestId(id, key);
|
|
765
|
-
entries.push({
|
|
766
|
-
key,
|
|
767
|
-
phase: asPhase(e["phase"]),
|
|
768
|
-
requestId,
|
|
769
|
-
targetVersion: isNonEmptyString(e["targetVersion"]) ? e["targetVersion"] : null,
|
|
770
|
-
restartRequired: e["restartRequired"] === true,
|
|
771
|
-
error: isNonEmptyString(e["error"]) ? e["error"] : null,
|
|
772
|
-
updatedAt: asMillis(e["updatedAt"], 0)
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
const order = entries.map((e) => e.key);
|
|
776
|
-
return {
|
|
777
|
-
version: 1,
|
|
778
|
-
id,
|
|
779
|
-
selfKey: selfKey && seen.has(selfKey) ? selfKey : null,
|
|
780
|
-
stopOnFailure: input["stopOnFailure"] === true,
|
|
781
|
-
order,
|
|
782
|
-
entries,
|
|
783
|
-
createdAt: asMillis(input["createdAt"], 0),
|
|
784
|
-
updatedAt: asMillis(input["updatedAt"], 0)
|
|
785
|
-
};
|
|
786
|
-
} catch {
|
|
787
|
-
return emptyBatchSession();
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
762
|
//#endregion
|
|
791
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
792
|
-
const
|
|
793
|
-
const
|
|
794
|
-
const
|
|
795
|
-
const ABSOLUTE_PATH_RE = /[A-Za-z]:\\[^\s"']*|\\\\[^\s"'()\[\];]+|(^|[\s"'(\[=,])\/\/[^\s"'()\[\];]+|(^|[\s"'(\[=:,])\/(?!\/)[^\s"'()\[\];]+/g;
|
|
796
|
-
const URL_USERINFO_RE = /[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s/]*@/;
|
|
797
|
-
const NPM_TOKEN_RE = /\bnpm_[A-Za-z0-9_-]{8,}/g;
|
|
798
|
-
const GITHUB_TOKEN_RE = /\b(?:gh[pousr]_[A-Za-z0-9]{8,}|github_pat_[A-Za-z0-9_]{10,})/g;
|
|
799
|
-
const SK_TOKEN_RE = /\bsk-[A-Za-z0-9_-]{6,}/g;
|
|
800
|
-
const BEARER_TOKEN_RE = /(\bbearer\s+)[A-Za-z0-9._~+/-=]{6,}/gi;
|
|
801
|
-
const CRED_PAIR_RE = /(\b(?:token|password|passwd|pwd|api[_-]?key|access[_-]?key|auth[_-]?token|secret|cookie)\s*[:=]\s*)("[^"]+"|'[^']+'|[^\s'";,)\]]+)/gi;
|
|
802
|
-
const EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g;
|
|
803
|
-
function flattenWhitespace(text) {
|
|
804
|
-
return String(text ?? "").replace(/\s+/g, " ").trim();
|
|
805
|
-
}
|
|
806
|
-
function applyPathRule(text) {
|
|
807
|
-
ABSOLUTE_PATH_RE.lastIndex = 0;
|
|
808
|
-
return text.replace(ABSOLUTE_PATH_RE, (_whole, g1, g2) => {
|
|
809
|
-
return `${g1 ?? g2 ?? ""}${REDACTED_PATH}`;
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
function applyTokenRule(text) {
|
|
813
|
-
NPM_TOKEN_RE.lastIndex = 0;
|
|
814
|
-
GITHUB_TOKEN_RE.lastIndex = 0;
|
|
815
|
-
SK_TOKEN_RE.lastIndex = 0;
|
|
816
|
-
BEARER_TOKEN_RE.lastIndex = 0;
|
|
817
|
-
return text.replace(NPM_TOKEN_RE, REDACTED_SECRET).replace(GITHUB_TOKEN_RE, REDACTED_SECRET).replace(SK_TOKEN_RE, REDACTED_SECRET).replace(BEARER_TOKEN_RE, (_whole, prefix) => `${prefix}${REDACTED_SECRET}`);
|
|
818
|
-
}
|
|
819
|
-
function applyCredPairRule(text) {
|
|
820
|
-
CRED_PAIR_RE.lastIndex = 0;
|
|
821
|
-
return text.replace(CRED_PAIR_RE, (_whole, head) => `${head}${REDACTED_SECRET}`);
|
|
822
|
-
}
|
|
823
|
-
function applyEmailRule(text) {
|
|
824
|
-
EMAIL_RE.lastIndex = 0;
|
|
825
|
-
return text.replace(EMAIL_RE, REDACTED_SECRET);
|
|
826
|
-
}
|
|
827
|
-
function hasUserinfo(text) {
|
|
828
|
-
URL_USERINFO_RE.lastIndex = 0;
|
|
829
|
-
return URL_USERINFO_RE.test(text);
|
|
830
|
-
}
|
|
831
|
-
function truncateToWordBoundary(text, max) {
|
|
832
|
-
const input = String(text ?? "");
|
|
833
|
-
if (input.length <= max) return input;
|
|
834
|
-
const slice = input.slice(0, max);
|
|
835
|
-
const lastSpace = slice.lastIndexOf(" ");
|
|
836
|
-
let cut = lastSpace > 0 ? slice.slice(0, lastSpace) : slice;
|
|
837
|
-
const lastOpen = cut.lastIndexOf("<");
|
|
838
|
-
if (lastOpen > cut.lastIndexOf(">")) cut = cut.slice(0, lastOpen).trimEnd();
|
|
839
|
-
if (!cut) cut = slice;
|
|
840
|
-
return `${cut}\u2026`;
|
|
841
|
-
}
|
|
842
|
-
function truncateForCopy(text) {
|
|
843
|
-
return truncateToWordBoundary(text, COPY_BUDGET_CHARS);
|
|
844
|
-
}
|
|
845
|
-
function scrubWithoutBudget(text) {
|
|
846
|
-
return applyEmailRule(applyCredPairRule(applyTokenRule(applyPathRule(text))));
|
|
847
|
-
}
|
|
848
|
-
function sanitizeForCopy(text) {
|
|
849
|
-
const flat = flattenWhitespace(String(text ?? ""));
|
|
850
|
-
if (!flat) return "";
|
|
851
|
-
if (hasUserinfo(flat)) return "";
|
|
852
|
-
return truncateForCopy(scrubWithoutBudget(flat));
|
|
853
|
-
}
|
|
763
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/log-events.js
|
|
764
|
+
const LOG_EVENT_CALL = "host.call";
|
|
765
|
+
const LOG_EVENT_CALL_FAIL = "host.call.fail";
|
|
766
|
+
const LOG_EVENT_INSTALL_EXEC = "update.install.exec";
|
|
854
767
|
//#endregion
|
|
855
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
768
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/panel.js
|
|
856
769
|
function normalizePanelTheme(value) {
|
|
857
|
-
return value === "
|
|
770
|
+
return value === "archive" || value === "d5-paper" ? "archive" : "default";
|
|
858
771
|
}
|
|
859
772
|
const BLOCKED_COPY = {
|
|
860
773
|
"unknown-profile": {
|
|
@@ -974,109 +887,6 @@ ${blocks.join("\n")}
|
|
|
974
887
|
if (manual) lines.push(`\u624B\u5DE5\u547D\u4EE4\uFF1A${manual}`);
|
|
975
888
|
return redactForCopy(lines.join("\n"));
|
|
976
889
|
}
|
|
977
|
-
const DIAG_KNOWN_TYPES = {
|
|
978
|
-
v: "number",
|
|
979
|
-
stage: "string",
|
|
980
|
-
route: "string",
|
|
981
|
-
method: "string",
|
|
982
|
-
httpStatus: "number",
|
|
983
|
-
exitCode: "number",
|
|
984
|
-
latencyMs: "number",
|
|
985
|
-
detail: "string",
|
|
986
|
-
targetPackageName: "string",
|
|
987
|
-
runningVersion: "string",
|
|
988
|
-
latestVersion: "string",
|
|
989
|
-
environmentKind: "string",
|
|
990
|
-
requestId: "string",
|
|
991
|
-
checkId: "string",
|
|
992
|
-
registryHost: "string",
|
|
993
|
-
action: "string"
|
|
994
|
-
};
|
|
995
|
-
function readDiagTolerant(diag) {
|
|
996
|
-
const empty = {
|
|
997
|
-
stage: null,
|
|
998
|
-
route: null,
|
|
999
|
-
method: null,
|
|
1000
|
-
httpStatus: null,
|
|
1001
|
-
exitCode: null,
|
|
1002
|
-
latencyMs: null,
|
|
1003
|
-
detail: null,
|
|
1004
|
-
targetPackageName: null,
|
|
1005
|
-
runningVersion: null,
|
|
1006
|
-
latestVersion: null,
|
|
1007
|
-
environmentKind: null,
|
|
1008
|
-
requestId: null,
|
|
1009
|
-
checkId: null,
|
|
1010
|
-
registryHost: null,
|
|
1011
|
-
action: null,
|
|
1012
|
-
unknownKeys: []
|
|
1013
|
-
};
|
|
1014
|
-
if (!diag || typeof diag !== "object" || Array.isArray(diag)) return empty;
|
|
1015
|
-
const raw = diag;
|
|
1016
|
-
const out = {
|
|
1017
|
-
...empty,
|
|
1018
|
-
unknownKeys: []
|
|
1019
|
-
};
|
|
1020
|
-
for (const key of Object.keys(DIAG_KNOWN_TYPES)) {
|
|
1021
|
-
if (!Object.prototype.hasOwnProperty.call(raw, key)) continue;
|
|
1022
|
-
const v = raw[key];
|
|
1023
|
-
if (v === void 0 || v === null) continue;
|
|
1024
|
-
if (typeof v !== DIAG_KNOWN_TYPES[key]) continue;
|
|
1025
|
-
out[key] = v;
|
|
1026
|
-
}
|
|
1027
|
-
for (const key of Object.keys(raw)) if (!Object.prototype.hasOwnProperty.call(DIAG_KNOWN_TYPES, key)) out.unknownKeys.push(key);
|
|
1028
|
-
return out;
|
|
1029
|
-
}
|
|
1030
|
-
function pickText(value, fallback) {
|
|
1031
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
1032
|
-
return fallback;
|
|
1033
|
-
}
|
|
1034
|
-
function queueTextOf(queuePosition, _diagQueuePos) {
|
|
1035
|
-
const pos = typeof queuePosition === "number" ? queuePosition : null;
|
|
1036
|
-
if (pos === 0) return "正在安装";
|
|
1037
|
-
if (typeof pos === "number") return `\u6392\u961F\u7B2C ${pos} \u4F4D`;
|
|
1038
|
-
return "不在队列里";
|
|
1039
|
-
}
|
|
1040
|
-
function buildUpdateDiagCopy(input) {
|
|
1041
|
-
const rawCode = String(input.code ?? "").trim() || "internal";
|
|
1042
|
-
const copy = failureCopy(rawCode) ?? UNKNOWN_FAILURE_COPY;
|
|
1043
|
-
const diag = readDiagTolerant(input.diag);
|
|
1044
|
-
const detail = redactForCopy(diag.detail ?? input.detail ?? "") || "(本回包没有带诊断摘要,等电话侧 diag 落定后补齐)";
|
|
1045
|
-
const pluginName = pickText(diag.targetPackageName ?? input.pluginId, "(未知包)");
|
|
1046
|
-
const runVer = pickText(diag.runningVersion ?? input.runningVersion, "?");
|
|
1047
|
-
const instVer = pickText(input.installedVersion ?? diag.latestVersion, "?");
|
|
1048
|
-
const host = pickText(diag.environmentKind ?? input.hostKind, "未知");
|
|
1049
|
-
const routeRaw = diag.route ?? input.route;
|
|
1050
|
-
const requestRaw = diag.requestId ?? input.requestId;
|
|
1051
|
-
const checkRaw = diag.checkId ?? input.checkId;
|
|
1052
|
-
const queue = queueTextOf(input.queuePosition ?? null);
|
|
1053
|
-
const prov = [
|
|
1054
|
-
`\u63D2\u4EF6=${pluginName}`,
|
|
1055
|
-
`\u7248\u672C=${runVer}\u2192${instVer}`,
|
|
1056
|
-
`\u5BBF\u4E3B=${host}`
|
|
1057
|
-
];
|
|
1058
|
-
if (typeof routeRaw === "string" && routeRaw.trim()) prov.push(`\u8DEF\u7531=${routeRaw.trim()}`);
|
|
1059
|
-
if (diag.stage) prov.push(`\u9636\u6BB5=${diag.stage}`);
|
|
1060
|
-
if (diag.method) prov.push(`\u65B9\u6CD5=${diag.method}`);
|
|
1061
|
-
if (typeof diag.httpStatus === "number") prov.push(`HTTP=${diag.httpStatus}`);
|
|
1062
|
-
if (typeof diag.exitCode === "number") prov.push(`exit=${diag.exitCode}`);
|
|
1063
|
-
if (typeof diag.latencyMs === "number") prov.push(`\u8017\u65F6=${diag.latencyMs}ms`);
|
|
1064
|
-
if (diag.registryHost) prov.push(`\u6E90=${diag.registryHost}`);
|
|
1065
|
-
else prov.push("源=未知(非官方源时省略本身即信息)");
|
|
1066
|
-
if (diag.action) prov.push(`\u5EFA\u8BAE=${diag.action}`);
|
|
1067
|
-
if (typeof requestRaw === "string" && requestRaw.trim()) prov.push(`\u8BF7\u6C42=${requestRaw.trim()}`);
|
|
1068
|
-
if (typeof checkRaw === "string" && checkRaw.trim()) prov.push(`\u68C0\u67E5=${checkRaw.trim()}`);
|
|
1069
|
-
prov.push(`\u961F\u5217=${queue}`);
|
|
1070
|
-
const format = input.format === "line" ? "line" : "block";
|
|
1071
|
-
const provLine = redactForCopy(prov.join(" · "));
|
|
1072
|
-
if (format === "line") return redactForCopy(`[update-diag] code=${rawCode} \xB7 ${copy.zh} \xB7 \u6458\u8981=${detail} \xB7 ${provLine} \xB7 \u600E\u4E48\u529E=${copy.act}`);
|
|
1073
|
-
return [
|
|
1074
|
-
`[update-diag] ${rawCode} \u2014 ${copy.zh}`,
|
|
1075
|
-
` \u6458\u8981\uFF1A${detail}`,
|
|
1076
|
-
` \u6765\u6E90\uFF1A${provLine}`,
|
|
1077
|
-
` \u600E\u4E48\u529E\uFF1A${copy.act}`
|
|
1078
|
-
].join("\n");
|
|
1079
|
-
}
|
|
1080
890
|
const PANEL_SKIPPED_MAX = 50;
|
|
1081
891
|
function panelSkipKey(pluginId) {
|
|
1082
892
|
return `dsh-upd-skipped/${String(pluginId)}`;
|
|
@@ -1388,8 +1198,8 @@ ${blocks.join("\n")}
|
|
|
1388
1198
|
".dsh-upd-banner[data-kind=\"update\"]{border-color:var(--dsh-upd-ok-line);background:var(--dsh-upd-ok-bg)}",
|
|
1389
1199
|
".dsh-upd-banner[data-kind=\"busy\"]{border-color:var(--dsh-upd-busy-line);background:var(--dsh-upd-busy-bg)}",
|
|
1390
1200
|
".dsh-upd code{font-family:Consolas,Menlo,monospace;font-size:12px;word-break:break-all}",
|
|
1391
|
-
".dsh-upd-manual,.dsh-upd-queue,.dsh-upd-log{margin:
|
|
1392
|
-
".dsh-upd-changelog-wrap{margin:
|
|
1201
|
+
".dsh-upd-manual,.dsh-upd-queue,.dsh-upd-log{margin:4px 0;font-size:13px}",
|
|
1202
|
+
".dsh-upd-changelog-wrap{margin:4px 0 0;font-size:13px}",
|
|
1393
1203
|
".dsh-upd-changelog-title{font-weight:700;margin:0 0 4px}",
|
|
1394
1204
|
".dsh-upd-changelog-version{margin:6px 0}",
|
|
1395
1205
|
".dsh-upd-changelog-catname{font-weight:600;margin:6px 0 2px}",
|
|
@@ -1405,7 +1215,13 @@ ${blocks.join("\n")}
|
|
|
1405
1215
|
".dsh-upd-changelog-more-note{font-size:12px;opacity:.7;margin:2px 0 4px}",
|
|
1406
1216
|
".dsh-upd-changelog-neutral{color:inherit;opacity:.8}",
|
|
1407
1217
|
".dsh-upd-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;z-index:9999}",
|
|
1408
|
-
".dsh-upd-overlay .dsh-upd{background:var(--dsh-upd-bg,#ffffff);max-height:85vh;overflow:
|
|
1218
|
+
".dsh-upd-overlay .dsh-upd{background:var(--dsh-upd-bg,#ffffff);max-height:85vh;display:flex;flex-direction:column;overflow:hidden}",
|
|
1219
|
+
".dsh-upd-body{min-height:0}",
|
|
1220
|
+
".dsh-upd-overlay .dsh-upd-body{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--dsh-upd-line,#e5e7eb) transparent}",
|
|
1221
|
+
".dsh-upd-overlay .dsh-upd-body::-webkit-scrollbar{width:8px}",
|
|
1222
|
+
".dsh-upd-overlay .dsh-upd-body::-webkit-scrollbar-thumb{background:var(--dsh-upd-line,#e5e7eb);border-radius:4px}",
|
|
1223
|
+
".dsh-upd-overlay .dsh-upd-body::-webkit-scrollbar-track{background:transparent}",
|
|
1224
|
+
".dsh-upd-overlay .dsh-upd-body .dsh-upd-chap-head{position:sticky;top:0;z-index:1;background:var(--dsh-upd-bg,#ffffff);padding-top:2px}",
|
|
1409
1225
|
".dsh-upd-head{display:flex;gap:12px;align-items:baseline;flex-wrap:wrap}",
|
|
1410
1226
|
".dsh-upd-masthead{display:none}",
|
|
1411
1227
|
".dsh-upd-name{font-weight:700}",
|
|
@@ -1417,6 +1233,9 @@ ${blocks.join("\n")}
|
|
|
1417
1233
|
".dsh-upd-strip-k{display:block;font-size:11px;letter-spacing:.14em;opacity:.7}",
|
|
1418
1234
|
".dsh-upd-strip-v{font-family:Consolas,Menlo,monospace;font-size:12.5px}",
|
|
1419
1235
|
".dsh-upd-chapter{margin-top:14px;padding-top:10px;border-top:1px solid var(--dsh-upd-line,#e5e7eb)}",
|
|
1236
|
+
".dsh-upd-footer{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:14px;padding-top:10px;border-top:1px solid var(--dsh-upd-line,#e5e7eb)}",
|
|
1237
|
+
".dsh-upd-foot-note{margin-right:auto;font-size:12px;opacity:.7}",
|
|
1238
|
+
".dsh-upd-footer button{margin:0}",
|
|
1420
1239
|
".dsh-upd-chap-head{display:flex;align-items:baseline;gap:10px;margin-bottom:6px}",
|
|
1421
1240
|
".dsh-upd-chap-no{font-size:13px;font-style:italic;opacity:.6}",
|
|
1422
1241
|
".dsh-upd-chap-title{font-size:14px;margin:0}",
|
|
@@ -1448,10 +1267,16 @@ ${blocks.join("\n")}
|
|
|
1448
1267
|
".dsh-upd button:active:not(:disabled){transform:translateY(1px)}",
|
|
1449
1268
|
".dsh-upd button[aria-busy=\"true\"]{cursor:wait;animation:dsh-upd-pulse 1s ease-in-out infinite}",
|
|
1450
1269
|
"@keyframes dsh-upd-pulse{0%,100%{opacity:1}50%{opacity:.55}}",
|
|
1270
|
+
".dsh-upd-banner{animation:dsh-upd-fadein .22s ease}",
|
|
1271
|
+
"@keyframes dsh-upd-fadein{from{opacity:.35;transform:translateY(2px)}}",
|
|
1272
|
+
".dsh-upd-changelog-foldbox{display:grid;grid-template-rows:1fr;opacity:1;transition:grid-template-rows .22s ease,opacity .18s ease}",
|
|
1273
|
+
".dsh-upd-changelog-foldbox-inner{min-height:0;overflow:hidden}",
|
|
1274
|
+
".dsh-upd-changelog-foldbox[data-open=\"0\"]{grid-template-rows:0fr;opacity:0}",
|
|
1451
1275
|
".dsh-upd button[aria-busy=\"true\"]::after{content:\"\";display:inline-block;width:11px;height:11px;margin-left:8px;vertical-align:-1px;",
|
|
1452
1276
|
"border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:dsh-upd-spin .8s linear infinite}",
|
|
1453
1277
|
"@keyframes dsh-upd-spin{to{transform:rotate(360deg)}}",
|
|
1454
|
-
"@media (prefers-reduced-motion: reduce){.dsh-upd button{transition:none}.dsh-upd button:active:not(:disabled){transform:none}.dsh-upd button[aria-busy=\"true\"]{animation:none}.dsh-upd-skv{animation:none}}",
|
|
1278
|
+
"@media (prefers-reduced-motion: reduce){.dsh-upd button{transition:none}.dsh-upd button:active:not(:disabled){transform:none}.dsh-upd button[aria-busy=\"true\"]{animation:none}.dsh-upd-skv{animation:none}.dsh-upd-banner{animation:none}.dsh-upd-changelog-foldbox{transition:none}}",
|
|
1279
|
+
"@media (forced-colors: active){.dsh-upd-overlay .dsh-upd-body .dsh-upd-chap-head{background:Canvas}}",
|
|
1455
1280
|
"@media (prefers-color-scheme: dark){.dsh-upd{--dsh-upd-fg:#e5e7eb;--dsh-upd-bg:#111827;--dsh-upd-line:#374151;",
|
|
1456
1281
|
"--dsh-upd-btn:#1f2937;--dsh-upd-soft:#1f2937;--dsh-upd-primary:#3b82f6;--dsh-upd-focus:#93c5fd;",
|
|
1457
1282
|
"--dsh-upd-ok-bg:rgba(16,185,129,.14);--dsh-upd-ok-line:#34d399;",
|
|
@@ -1461,7 +1286,7 @@ ${blocks.join("\n")}
|
|
|
1461
1286
|
].join("\n");
|
|
1462
1287
|
const UPDATE_PANEL_D5_CSS = [
|
|
1463
1288
|
"/* D5 档案卷可选主题:只换颜色/字体/间距;内核 DOM 顺序一字不动,不断复制诊断。 */",
|
|
1464
|
-
".dsh-upd[data-theme=\"
|
|
1289
|
+
".dsh-upd[data-theme=\"archive\"]{--d5-bg:#f7f3ea;--d5-card:#fffdf6;--d5-ink:#1a1a1a;--d5-muted:#6f675a;",
|
|
1465
1290
|
"--d5-line:#e3d9c4;--d5-line-strong:#c4b896;--d5-accent:#c8402a;--d5-accent-deep:#9c2e1d;",
|
|
1466
1291
|
"--d5-ok:#1a7f37;--d5-ok-bg:#e9f4ea;--d5-warn:#8a5a00;--d5-warn-bg:#fbf0d0;",
|
|
1467
1292
|
"--d5-bad:#b3261e;--d5-bad-bg:#fbe9e5;",
|
|
@@ -1471,93 +1296,98 @@ ${blocks.join("\n")}
|
|
|
1471
1296
|
"--d5-shadow:0 1px 2px rgba(60,40,20,.08),0 12px 32px rgba(60,40,20,.10);",
|
|
1472
1297
|
"font-family:var(--d5-sans);color:var(--d5-ink);background:var(--d5-card);",
|
|
1473
1298
|
"border:1px solid var(--d5-line-strong);border-radius:4px;box-shadow:var(--d5-shadow)}",
|
|
1474
|
-
".dsh-upd[data-theme=\"
|
|
1475
|
-
".dsh-upd[data-theme=\"
|
|
1476
|
-
".dsh-upd[data-theme=\"
|
|
1477
|
-
".dsh-upd[data-theme=\"
|
|
1478
|
-
".dsh-upd[data-theme=\"
|
|
1479
|
-
".dsh-upd[data-theme=\"
|
|
1480
|
-
".dsh-upd[data-theme=\"
|
|
1481
|
-
".dsh-upd[data-theme=\"
|
|
1482
|
-
".dsh-upd[data-theme=\"
|
|
1483
|
-
".dsh-upd[data-theme=\"
|
|
1484
|
-
".dsh-upd[data-theme=\"
|
|
1485
|
-
".dsh-upd[data-theme=\"
|
|
1486
|
-
".dsh-upd[data-theme=\"
|
|
1487
|
-
".dsh-upd[data-theme=\"
|
|
1488
|
-
".dsh-upd[data-theme=\"
|
|
1489
|
-
".dsh-upd[data-theme=\"
|
|
1490
|
-
".dsh-upd[data-theme=\"
|
|
1299
|
+
".dsh-upd[data-theme=\"archive\"] button{border-color:var(--d5-line-strong);background:var(--d5-card);color:var(--d5-ink);border-radius:3px;font-family:var(--d5-sans)}",
|
|
1300
|
+
".dsh-upd[data-theme=\"archive\"] button:hover:not(:disabled){border-color:var(--d5-accent);color:var(--d5-accent)}",
|
|
1301
|
+
".dsh-upd[data-theme=\"archive\"] button[data-primary=\"1\"]{background:var(--d5-accent);border-color:var(--d5-accent);color:#fff}",
|
|
1302
|
+
".dsh-upd[data-theme=\"archive\"] button[data-primary=\"1\"]:hover:not(:disabled){background:var(--d5-accent-deep);color:#fff}",
|
|
1303
|
+
".dsh-upd[data-theme=\"archive\"] button:focus-visible{outline:2px solid var(--d5-accent);outline-offset:2px}",
|
|
1304
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner{background:var(--d5-bg);border-color:var(--d5-line-strong)}",
|
|
1305
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"update\"]{border-color:var(--d5-ok);background:var(--d5-ok-bg)}",
|
|
1306
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"busy\"]{border-color:var(--d5-warn);background:var(--d5-warn-bg)}",
|
|
1307
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"restart\"]{border-color:var(--d5-warn);background:var(--d5-warn-bg);font-family:var(--d5-serif);border-width:2px}",
|
|
1308
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"failed\"],.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"blocked\"]{border-color:var(--d5-bad);background:var(--d5-bad-bg)}",
|
|
1309
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"done\"]{border-color:var(--d5-ok);background:var(--d5-ok-bg)}",
|
|
1310
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-changelog-yanked{border-color:var(--d5-warn);background:var(--d5-warn-bg);color:var(--d5-ink)}",
|
|
1311
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-breaking-badge{color:var(--d5-accent);border-color:var(--d5-accent)}",
|
|
1312
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-changelog-count{color:var(--d5-muted)}",
|
|
1313
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-changelog-more-note{color:var(--d5-muted)}",
|
|
1314
|
+
".dsh-upd[data-theme=\"archive\"]{position:relative;padding:16px 20px 14px}",
|
|
1315
|
+
".dsh-upd[data-theme=\"archive\"]::before{content:attr(data-seal);position:absolute;top:20px;right:24px;width:88px;height:88px;",
|
|
1491
1316
|
"display:flex;align-items:center;justify-content:center;text-align:center;letter-spacing:.18em;text-indent:.18em;line-height:1.35;",
|
|
1492
1317
|
"border:3px solid currentColor;border-radius:14px;transform:rotate(-7deg);font-family:var(--d5-serif);font-weight:700;font-size:21px;",
|
|
1493
1318
|
"background:color-mix(in srgb,currentColor 8%,transparent);user-select:none;pointer-events:none;",
|
|
1494
1319
|
"box-shadow:inset 0 0 0 5px var(--d5-card),inset 0 0 0 6px currentColor,0 2px 6px rgba(0,0,0,.12)}",
|
|
1495
|
-
".dsh-upd[data-theme=\"
|
|
1496
|
-
".dsh-upd[data-theme=\"
|
|
1497
|
-
".dsh-upd[data-theme=\"
|
|
1498
|
-
".dsh-upd[data-theme=\"
|
|
1499
|
-
".dsh-upd[data-theme=\"
|
|
1500
|
-
".dsh-upd[data-theme=\"
|
|
1501
|
-
".dsh-upd[data-theme=\"
|
|
1502
|
-
".dsh-upd[data-theme=\"
|
|
1503
|
-
".dsh-upd[data-theme=\"
|
|
1504
|
-
".dsh-upd[data-theme=\"
|
|
1505
|
-
".dsh-upd[data-theme=\"
|
|
1506
|
-
".dsh-upd[data-theme=\"
|
|
1507
|
-
".dsh-upd[data-theme=\"
|
|
1508
|
-
".dsh-upd[data-theme=\"
|
|
1509
|
-
".dsh-upd[data-theme=\"
|
|
1510
|
-
".dsh-upd
|
|
1511
|
-
".dsh-upd
|
|
1512
|
-
".dsh-upd[data-theme=\"
|
|
1320
|
+
".dsh-upd[data-theme=\"archive\"][data-seal-tone=\"ink\"]::before{color:var(--d5-muted)}",
|
|
1321
|
+
".dsh-upd[data-theme=\"archive\"][data-seal-tone=\"green\"]::before{color:var(--d5-ok)}",
|
|
1322
|
+
".dsh-upd[data-theme=\"archive\"][data-seal-tone=\"yellow\"]::before{color:var(--d5-warn)}",
|
|
1323
|
+
".dsh-upd[data-theme=\"archive\"][data-seal-tone=\"red\"]::before{color:var(--d5-bad)}",
|
|
1324
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-masthead{display:block;padding:0 0 8px;margin:0 0 8px;border-bottom:1px solid var(--d5-line)}",
|
|
1325
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-masthead-kicker{display:block;font-size:11px;letter-spacing:.35em;color:var(--d5-muted);margin-bottom:3px}",
|
|
1326
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-masthead-title{font-family:var(--d5-serif);font-size:26px;font-weight:700;line-height:1.2}",
|
|
1327
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-masthead-title i{color:var(--d5-accent);font-style:normal}",
|
|
1328
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-qrow{padding:6px 0}",
|
|
1329
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-qk{width:66px;letter-spacing:.18em}",
|
|
1330
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-qv{font-family:var(--d5-serif);font-size:16px}",
|
|
1331
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-qn{font-family:var(--d5-mono);font-size:11.5px;color:var(--d5-muted)}",
|
|
1332
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-qseq{color:var(--d5-muted)}",
|
|
1333
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-chap-note{color:var(--d5-muted)}",
|
|
1334
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-body .dsh-upd-chap-head{background:var(--d5-card)}",
|
|
1335
|
+
".dsh-upd-overlay .dsh-upd[data-theme=\"archive\"] .dsh-upd-body{scrollbar-color:var(--d5-line-strong) transparent}",
|
|
1336
|
+
".dsh-upd-overlay .dsh-upd[data-theme=\"archive\"] .dsh-upd-body::-webkit-scrollbar-thumb{background:var(--d5-line-strong)}",
|
|
1337
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"loading\"]::before,.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"idle\"]::before,",
|
|
1338
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"update\"]::before,.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"busy\"]::before,",
|
|
1339
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"blocked\"]::before,.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"failed\"]::before,",
|
|
1340
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"done\"]::before{content:attr(data-mini);display:inline-flex;align-items:center;justify-content:center;",
|
|
1513
1341
|
"width:30px;height:30px;margin-right:10px;vertical-align:middle;border:2px solid currentColor;border-radius:7px;",
|
|
1514
1342
|
"font-family:var(--d5-serif);font-weight:700;font-size:16px;line-height:26px;transform:rotate(-5deg);flex:none;color:var(--d5-muted)}",
|
|
1515
|
-
".dsh-upd[data-theme=\"
|
|
1516
|
-
".dsh-upd[data-theme=\"
|
|
1517
|
-
".dsh-upd[data-theme=\"
|
|
1518
|
-
".dsh-upd[data-theme=\"
|
|
1519
|
-
".dsh-upd[data-theme=\"
|
|
1520
|
-
".dsh-upd[data-theme=\"
|
|
1521
|
-
".dsh-upd[data-theme=\"
|
|
1522
|
-
".dsh-upd[data-theme=\"
|
|
1343
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"update\"]::before{color:var(--d5-ok)}",
|
|
1344
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"busy\"]::before{color:var(--d5-warn)}",
|
|
1345
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"blocked\"]::before,.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"failed\"]::before{color:var(--d5-bad)}",
|
|
1346
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"done\"]::before{color:var(--d5-ok)}",
|
|
1347
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-log code{font-family:var(--d5-mono);font-size:11px;color:var(--d5-muted);border:1px solid var(--d5-line-strong);border-radius:3px;padding:0 6px;letter-spacing:.06em}",
|
|
1348
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-manual code{display:block;background:var(--d5-ink);color:var(--d5-bg);font-family:var(--d5-mono);font-size:12.5px;padding:12px 14px;border-radius:4px;white-space:pre-wrap;word-break:break-all}",
|
|
1349
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"restart\"]>div:first-child{display:flex;gap:10px;align-items:flex-start}",
|
|
1350
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"restart\"]>div:first-child::before{content:\"\";flex:none;width:20px;height:20px;margin-top:3px;",
|
|
1523
1351
|
"background:url(\"data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2720%27 height=%2720%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%238a5a00%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z%27/%3E%3Cline x1=%2712%27 y1=%279%27 x2=%2712%27 y2=%2713%27/%3E%3Cline x1=%2712%27 y1=%2717%27 x2=%2712.01%27 y2=%2717%27/%3E%3C/svg%3E\") no-repeat center/20px 20px}",
|
|
1524
|
-
".dsh-upd[data-theme=\"
|
|
1525
|
-
".dsh-upd[data-theme=\"
|
|
1526
|
-
".dsh-upd[data-theme=\"
|
|
1527
|
-
".dsh-upd[data-theme=\"
|
|
1528
|
-
".dsh-upd[data-theme=\"
|
|
1529
|
-
".dsh-upd[data-theme=\"
|
|
1530
|
-
".dsh-upd[data-theme=\"
|
|
1531
|
-
".dsh-upd[data-theme=\"
|
|
1532
|
-
".dsh-upd[data-theme=\"
|
|
1533
|
-
".dsh-upd[data-theme=\"
|
|
1534
|
-
".dsh-upd[data-theme=\"
|
|
1535
|
-
".dsh-upd[data-theme=\"
|
|
1536
|
-
".dsh-upd[data-theme=\"
|
|
1537
|
-
".dsh-upd[data-theme=\"
|
|
1538
|
-
".dsh-upd[data-theme=\"
|
|
1539
|
-
".dsh-upd[data-theme=\"
|
|
1540
|
-
".dsh-upd[data-theme=\"
|
|
1541
|
-
".dsh-upd[data-theme=\"
|
|
1542
|
-
".dsh-upd[data-theme=\"
|
|
1543
|
-
".dsh-upd[data-theme=\"
|
|
1544
|
-
".dsh-upd[data-theme=\"
|
|
1545
|
-
".dsh-upd[data-theme=\"
|
|
1546
|
-
".dsh-upd[data-theme=\"
|
|
1547
|
-
".dsh-upd[data-theme=\"
|
|
1548
|
-
".dsh-upd[data-theme=\"
|
|
1549
|
-
".dsh-upd[data-theme=\"
|
|
1550
|
-
"
|
|
1551
|
-
"
|
|
1352
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>div:first-child{overflow:hidden;text-overflow:ellipsis}",
|
|
1353
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-actions{flex-wrap:wrap}",
|
|
1354
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-footer{margin-top:14px;padding-top:10px;border-top:1px solid var(--d5-line)}",
|
|
1355
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-foot-note{color:var(--d5-muted)}",
|
|
1356
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-head{display:flex;gap:16px;align-items:baseline;flex-wrap:wrap;padding-right:120px}",
|
|
1357
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-name{font-family:var(--d5-serif);font-size:22px;font-weight:700}",
|
|
1358
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-meta{width:100%;font-size:12.5px;color:var(--d5-muted)}",
|
|
1359
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-meta b{color:var(--d5-ink);font-weight:600}",
|
|
1360
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-proftag{font-family:var(--d5-mono);font-size:11px;color:var(--d5-muted);border:1px solid var(--d5-line-strong);border-radius:3px;padding:0 6px;margin-left:8px;letter-spacing:.06em}",
|
|
1361
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-strip{display:flex;flex-wrap:wrap;margin:8px 0 0;border:1px solid var(--d5-line);border-radius:4px;overflow:hidden;font-size:12.5px}",
|
|
1362
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-strip>div{flex:1 1 120px;padding:6px 10px;border-left:1px solid var(--d5-line)}",
|
|
1363
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-strip>div:first-child{border-left:0}",
|
|
1364
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-strip-k{display:block;font-size:11px;letter-spacing:.2em;color:var(--d5-muted)}",
|
|
1365
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-strip-v{font-family:var(--d5-mono);font-size:13px}",
|
|
1366
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-chapter{margin-top:16px;padding-top:10px;border-top:1px solid var(--d5-line)}",
|
|
1367
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-chap-head{display:flex;align-items:baseline;gap:12px;margin-bottom:6px}",
|
|
1368
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-chap-no{font-family:var(--d5-serif);font-style:italic;font-size:15px;color:var(--d5-muted)}",
|
|
1369
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-chap-title{font-family:var(--d5-serif);font-size:17px;margin:0;letter-spacing:.1em}",
|
|
1370
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-chap-rule{flex:1;border-top:1px solid var(--d5-line);transform:translateY(-4px)}",
|
|
1371
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner{border:2px solid var(--d5-line-strong);border-radius:4px;padding:10px 12px;font-size:14.5px;font-family:var(--d5-serif);display:flex;gap:10px;align-items:center;flex-wrap:wrap}",
|
|
1372
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>div:first-child{flex:1 1 auto;min-width:0}",
|
|
1373
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>div:first-child strong{font-family:var(--d5-serif);font-size:27px;font-weight:700;line-height:1.25}",
|
|
1374
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-prog{height:8px;background:var(--d5-line);border-radius:4px;overflow:hidden;margin:10px 0 4px}",
|
|
1375
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-prog-bar{display:block;height:100%;background:var(--d5-accent);transition:width .3s}",
|
|
1376
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-progtxt{font-size:12.5px;color:var(--d5-muted)}",
|
|
1377
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-skipline{font-size:13px;margin-top:8px}",
|
|
1378
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-tag{display:inline-block;border:1px dashed var(--d5-line-strong);border-radius:3px;padding:1px 8px;margin-right:8px;font-family:var(--d5-mono);font-size:12px}",
|
|
1379
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-err{font-size:13px;margin:0 0 6px;color:var(--d5-muted)}",
|
|
1380
|
+
"@media (max-width:640px){.dsh-upd[data-theme=\"archive\"]{padding:10px 12px}.dsh-upd[data-theme=\"archive\"]::before{top:12px;right:12px;width:56px;height:56px;font-size:15px;box-shadow:inset 0 0 0 4px var(--d5-card),inset 0 0 0 5px currentColor}.dsh-upd[data-theme=\"archive\"] .dsh-upd-masthead-title{font-size:19px}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner{padding-right:16px}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner::before{width:24px;height:24px;font-size:14px;line-height:20px;flex:none}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>div:first-child{white-space:normal}}",
|
|
1381
|
+
"@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"archive\"]{--d5-bg:#141210;--d5-card:#1e1a15;--d5-ink:#ece5d3;--d5-muted:#a89c83;",
|
|
1552
1382
|
"--d5-line:#3a3226;--d5-line-strong:#5c4e3b;--d5-accent:#e0684e;--d5-accent-deep:#f0866b;",
|
|
1553
1383
|
"--d5-ok:#8fd6a4;--d5-ok-bg:rgba(80,180,120,.12);--d5-warn:#e8c15a;--d5-warn-bg:rgba(232,193,90,.12);",
|
|
1554
1384
|
"--d5-bad:#ef8a7d;--d5-bad-bg:rgba(239,138,125,.12);--d5-shadow:0 1px 2px rgba(0,0,0,.4),0 12px 32px rgba(0,0,0,.45)}}",
|
|
1555
|
-
"@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"
|
|
1556
|
-
"@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"
|
|
1557
|
-
"@media (forced-colors: active){.dsh-upd[data-theme=\"
|
|
1558
|
-
"@media (prefers-reduced-motion: reduce){.dsh-upd[data-theme=\"
|
|
1385
|
+
"@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"archive\"] button[data-primary=\"1\"]{color:#141210}.dsh-upd[data-theme=\"archive\"] button:focus-visible{outline-color:var(--d5-accent-deep)}}",
|
|
1386
|
+
"@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"restart\"]>div:first-child::before{background-image:url(\"data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2720%27 height=%2720%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23e8c15a%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z%27/%3E%3Cline x1=%2712%27 y1=%279%27 x2=%2712%27 y2=%2713%27/%3E%3Cline x1=%2712%27 y1=%2717%27 x2=%2712.01%27 y2=%2717%27/%3E%3C/svg%3E\")}}",
|
|
1387
|
+
"@media (forced-colors: active){.dsh-upd[data-theme=\"archive\"]{box-shadow:none}.dsh-upd[data-theme=\"archive\"]::before{background:none;box-shadow:none;border-color:CanvasText;color:CanvasText}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner{border:1px solid CanvasText}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner::before{border-color:CanvasText;color:CanvasText;background:Canvas}.dsh-upd[data-theme=\"archive\"] button{border:1px solid ButtonText}.dsh-upd[data-theme=\"archive\"] button[data-primary=\"1\"]{background:ButtonFace;color:ButtonText;border-color:ButtonText}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner[data-kind=\"restart\"]>div:first-child::before{background-image:none;content:\"⚠\"}}",
|
|
1388
|
+
"@media (prefers-reduced-motion: reduce){.dsh-upd[data-theme=\"archive\"] *{transition:none !important;animation:none !important}}"
|
|
1559
1389
|
].join("\n");
|
|
1560
|
-
function escapeHtml$
|
|
1390
|
+
function escapeHtml$3(text) {
|
|
1561
1391
|
return String(text).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1562
1392
|
}
|
|
1563
1393
|
const CHAPTER_TITLES = [
|
|
@@ -1567,18 +1397,27 @@ ${blocks.join("\n")}
|
|
|
1567
1397
|
"错误信息",
|
|
1568
1398
|
"手工命令"
|
|
1569
1399
|
];
|
|
1400
|
+
function formatLatchTime(atMs) {
|
|
1401
|
+
if (typeof atMs !== "number" || !Number.isFinite(atMs) || atMs <= 0) return null;
|
|
1402
|
+
try {
|
|
1403
|
+
const s = new Date(atMs).toLocaleTimeString("zh-CN", { hour12: false });
|
|
1404
|
+
return s ? s : null;
|
|
1405
|
+
} catch {
|
|
1406
|
+
return null;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1570
1409
|
function chapterOf(index, inner, note = "") {
|
|
1571
1410
|
const no = String(index).padStart(2, "0");
|
|
1572
1411
|
const title = CHAPTER_TITLES[index - 1];
|
|
1573
|
-
return `<section class="dsh-upd-chapter" data-chapter="${no}"><div class="dsh-upd-chap-head"><span class="dsh-upd-chap-no">${no}</span><h3 class="dsh-upd-chap-title">${escapeHtml$
|
|
1412
|
+
return `<section class="dsh-upd-chapter" data-chapter="${no}"><div class="dsh-upd-chap-head"><span class="dsh-upd-chap-no">${no}</span><h3 class="dsh-upd-chap-title">${escapeHtml$3(title)}</h3><span class="dsh-upd-chap-rule"></span>${note}</div>${inner}</section>`;
|
|
1574
1413
|
}
|
|
1575
1414
|
function skeletonStrip(loading) {
|
|
1576
1415
|
if (!loading) return "";
|
|
1577
|
-
const cell = (k) => `<div><span class="dsh-upd-strip-k">${escapeHtml$
|
|
1416
|
+
const cell = (k) => `<div><span class="dsh-upd-strip-k">${escapeHtml$3(k)}</span><span class="dsh-upd-strip-v dsh-upd-skv" aria-hidden="true">\u2026</span></div>`;
|
|
1578
1417
|
return `<div class="dsh-upd-strip" aria-hidden="true">` + cell("运行") + cell("磁盘") + cell("远端") + `</div>`;
|
|
1579
1418
|
}
|
|
1580
1419
|
function versionStrip(snapshot) {
|
|
1581
|
-
const cell = (k, v) => `<div><span class="dsh-upd-strip-k">${escapeHtml$
|
|
1420
|
+
const cell = (k, v) => `<div><span class="dsh-upd-strip-k">${escapeHtml$3(k)}</span><span class="dsh-upd-strip-v">${escapeHtml$3(v ?? "未知")}</span></div>`;
|
|
1582
1421
|
if (!snapshot) return "";
|
|
1583
1422
|
return `<div class="dsh-upd-strip">` + cell("运行", snapshot.runningVersion) + cell("磁盘", snapshot.installedVersion) + cell("远端", snapshot.latestVersion) + `</div>`;
|
|
1584
1423
|
}
|
|
@@ -1588,7 +1427,7 @@ ${blocks.join("\n")}
|
|
|
1588
1427
|
const state = String(job.state);
|
|
1589
1428
|
if (state !== "installing" && state !== "verifying") return "";
|
|
1590
1429
|
const width = state === "installing" ? 60 : 90;
|
|
1591
|
-
return `<div class="dsh-upd-prog" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${width}"><i class="dsh-upd-prog-bar" style="width:${width}%"></i></div><div class="dsh-upd-progtxt">${escapeHtml$
|
|
1430
|
+
return `<div class="dsh-upd-prog" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${width}"><i class="dsh-upd-prog-bar" style="width:${width}%"></i></div><div class="dsh-upd-progtxt">${escapeHtml$3(state === "installing" ? "正在安装新版…" : "正在校验安装结果…")}</div>`;
|
|
1592
1431
|
}
|
|
1593
1432
|
function renderUpdatePanelKernel(input, view) {
|
|
1594
1433
|
const { snapshot, manual, queue, mode, showOthers, pluginId, copyNotice } = input;
|
|
@@ -1598,10 +1437,10 @@ ${blocks.join("\n")}
|
|
|
1598
1437
|
const seal = view.seal;
|
|
1599
1438
|
const parts = [];
|
|
1600
1439
|
parts.push("<div class=\"dsh-upd-masthead\"><span class=\"dsh-upd-masthead-kicker\">插件更新</span><span class=\"dsh-upd-masthead-title\">更新档案 <i>卷</i></span></div>");
|
|
1601
|
-
parts.push(`<div class="dsh-upd-head"><span class="dsh-upd-name">${escapeHtml$
|
|
1602
|
-
parts.push(`<div class="dsh-upd-banner" data-kind="${b.kind}" data-mini="${escapeHtml$
|
|
1603
|
-
parts.push(`<div><strong>${escapeHtml$
|
|
1604
|
-
if (b.action) parts.push(`<div>${escapeHtml$
|
|
1440
|
+
parts.push(`<div class="dsh-upd-head"><span class="dsh-upd-name">${escapeHtml$3(pluginId)}</span><span class="dsh-upd-meta">\u4F7F\u7528\u8303\u56F4 <b>${escapeHtml$3(profileName ?? "未知")}</b><span class="dsh-upd-proftag">profile</span></span></div>`);
|
|
1441
|
+
parts.push(`<div class="dsh-upd-banner" data-kind="${b.kind}" data-mini="${escapeHtml$3(seal.mini)}" role="status" aria-live="polite">`);
|
|
1442
|
+
parts.push(`<div><strong>${escapeHtml$3(b.title)}</strong></div>`);
|
|
1443
|
+
if (b.action) parts.push(`<div>${escapeHtml$3(b.action)}</div>`);
|
|
1605
1444
|
parts.push("</div>");
|
|
1606
1445
|
parts.push(snapshot ? versionStrip(snapshot) : skeletonStrip(view.banner.kind === "loading"));
|
|
1607
1446
|
const showActions = input.actions !== "none";
|
|
@@ -1611,20 +1450,22 @@ ${blocks.join("\n")}
|
|
|
1611
1450
|
const checkBusy = busyAct === "check";
|
|
1612
1451
|
const installBusy = busyAct === "install";
|
|
1613
1452
|
actions.push("<div class=\"dsh-upd-actions\">");
|
|
1614
|
-
actions.push((checkBusy ? `<button type="button" data-action="check" disabled aria-busy="true" title="\u6B63\u5728\u5411\u5B98\u65B9\u6E90\u67E5\u8BE2\uFF0C\u8BF7\u7A0D\u5019">\u6B63\u5728\u67E5\u65B0\u7248\u2026</button>` : `<button type="button" data-action="check" title="\u91CD\u65B0\u5411\u5B98\u65B9\u6E90\u67E5\u4E00\u6B21\u65B0\u7248\uFF08\u53EA\u8BFB\uFF0C\u4E0D\u5B89\u88C5\uFF09">\u67E5\u65B0\u7248</button>`) + (installBusy ? `<button type="button" data-action="install" data-primary="1" disabled aria-busy="true" title="\u6B63\u5728\u5B89\u88C5\uFF0C\u8BF7\u7A0D\u5019">\u6B63\u5728\u5B89\u88C5\u2026</button>` : `<button type="button" data-action="install" data-primary="1" title="\u7528\u7CBE\u786E\u7248\u672C\u5B89\u88C5\uFF1B\u540C\u4E00\u4F7F\u7528\u8303\u56F4\u540C\u65F6\u53EA\u88C5\u4E00\u4E2A"${view.installEnabled ? "" : " disabled"}>${escapeHtml$
|
|
1453
|
+
actions.push((checkBusy ? `<button type="button" data-action="check" disabled aria-busy="true" title="\u6B63\u5728\u5411\u5B98\u65B9\u6E90\u67E5\u8BE2\uFF0C\u8BF7\u7A0D\u5019">\u6B63\u5728\u67E5\u65B0\u7248\u2026</button>` : `<button type="button" data-action="check" title="\u91CD\u65B0\u5411\u5B98\u65B9\u6E90\u67E5\u4E00\u6B21\u65B0\u7248\uFF08\u53EA\u8BFB\uFF0C\u4E0D\u5B89\u88C5\uFF09">\u67E5\u65B0\u7248</button>`) + (installBusy ? `<button type="button" data-action="install" data-primary="1" disabled aria-busy="true" title="\u6B63\u5728\u5B89\u88C5\uFF0C\u8BF7\u7A0D\u5019">\u6B63\u5728\u5B89\u88C5\u2026</button>` : `<button type="button" data-action="install" data-primary="1" title="\u7528\u7CBE\u786E\u7248\u672C\u5B89\u88C5\uFF1B\u540C\u4E00\u4F7F\u7528\u8303\u56F4\u540C\u65F6\u53EA\u88C5\u4E00\u4E2A"${view.installEnabled ? "" : " disabled"}>${escapeHtml$3(view.installLabel)}</button>`));
|
|
1615
1454
|
if (snapshot?.latestVersion && !view.skippedLatest && view.banner.kind === "update") actions.push(`<button type="button" data-action="skip" title="\u8BE5\u7248\u672C\u4E0D\u518D\u63D0\u9192\uFF1B\u6709\u66F4\u65B0\u7684\u65B0\u7248\u672C\u7167\u5E38\u63D0\u9192">\u8DF3\u8FC7\u8BE5\u7248\u672C</button>`);
|
|
1616
|
-
if (view.showReset && snapshot?.latestVersion) actions.push(`<button type="button" data-action="reset-skip" title="\u64A4\u9500\u8DF3\u8FC7\uFF0C\u8BE5\u7248\u672C\u91CD\u65B0\u63D0\u9192">\u6062\u590D\uFF08${escapeHtml$
|
|
1455
|
+
if (view.showReset && snapshot?.latestVersion) actions.push(`<button type="button" data-action="reset-skip" title="\u64A4\u9500\u8DF3\u8FC7\uFF0C\u8BE5\u7248\u672C\u91CD\u65B0\u63D0\u9192">\u6062\u590D\uFF08${escapeHtml$3(snapshot.latestVersion)}\uFF09</button>`);
|
|
1617
1456
|
if (view.showManual && manual) actions.push(`<button type="button" data-action="copy-manual" title="\u590D\u5236\u624B\u5DE5\u547D\u4EE4\uFF0C\u7C98\u5230\u7EC8\u7AEF\u6574\u884C\u6267\u884C">\u590D\u5236\u624B\u5DE5\u547D\u4EE4</button>`);
|
|
1618
1457
|
if (b.kind === "restart") actions.push(`<button type="button" data-action="restart-hint" data-primary="1" title="\u5BBF\u4E3B\u6CA1\u6709\u81EA\u91CD\u542F\u7535\u8BDD\uFF1A\u8BF7\u624B\u52A8\u91CD\u542F\u5BBF\u4E3B">\u91CD\u542F\u5BBF\u4E3B</button>`);
|
|
1458
|
+
if (b.kind === "failed") actions.push(`<button type="button" data-action="dismiss-failure" title="\u786E\u8BA4\u5DF2\u77E5\u6653\u8BE5\u5931\u8D25\uFF1A\u56DE\u5230\u53EF\u88C5\u9875\uFF0C\u4E0B\u6B21\u67E5/\u88C5\u5C06\u91CD\u65B0\u8BC4\u4F30">\u77E5\u9053\u4E86</button>`);
|
|
1619
1459
|
if (snapshot) actions.push(`<button type="button" data-action="copy-diag" title="\u590D\u5236\u5DF2\u8131\u654F\u8BCA\u65AD\uFF0C\u76F4\u63A5\u7C98\u7ED9\u63D2\u4EF6\u4F5C\u8005">\u590D\u5236\u8BCA\u65AD</button>`);
|
|
1620
|
-
if (mode === "dialog") actions.push(`<button type="button" data-action="close-view" title="\u5173\u95ED\u9762\u677F\uFF08\u5B89\u88C5\u5728\u5BBF\u4E3B\u4FA7\u7EE7\u7EED\u8DD1\uFF0C\u53EF\u91CD\u5F00\u6062\u590D\u663E\u793A\uFF09">\u5173\u95ED</button>`);
|
|
1621
1460
|
actions.push("</div>");
|
|
1622
1461
|
}
|
|
1623
1462
|
actions.push(progressBar(snapshot));
|
|
1624
|
-
if (view.skippedLatest && snapshot?.latestVersion) actions.push(`<div class="dsh-upd-skipline"><span class="dsh-upd-tag">\u5DF2\u8DF3\u8FC7 ${escapeHtml$
|
|
1625
|
-
|
|
1463
|
+
if (view.skippedLatest && snapshot?.latestVersion) actions.push(`<div class="dsh-upd-skipline"><span class="dsh-upd-tag">\u5DF2\u8DF3\u8FC7 ${escapeHtml$3(snapshot.latestVersion)}</span>\u70B9\u300C\u6062\u590D\u300D\u53EF\u64A4\u9500\uFF0C\u4E4B\u540E\u8FD9\u4E00\u7248\u8FD8\u4F1A\u518D\u63D0\u9192\u3002</div>`);
|
|
1464
|
+
const chapters = [];
|
|
1465
|
+
chapters.push(chapterOf(1, actions.join("")));
|
|
1626
1466
|
{
|
|
1627
1467
|
let inner = "";
|
|
1468
|
+
let hasLog = false;
|
|
1628
1469
|
if (snapshot && snapshot.latestVersion) try {
|
|
1629
1470
|
const ranged = changelogForUpdate(parseChangelog(typeof changelogMarkdown === "string" ? changelogMarkdown : ""), snapshot.runningVersion, snapshot.latestVersion, snapshot.installedVersion);
|
|
1630
1471
|
const changelogHTML = renderChangelogHTML(ranged);
|
|
@@ -1644,14 +1485,18 @@ ${blocks.join("\n")}
|
|
|
1644
1485
|
} catch {
|
|
1645
1486
|
yankedBanner = "";
|
|
1646
1487
|
}
|
|
1647
|
-
|
|
1488
|
+
const logOpen = input.changelogCollapsed !== true;
|
|
1489
|
+
inner = `<div class="dsh-upd-changelog-wrap"><div>${escapeHtml$3(rangeTitle)}</div><div class="dsh-upd-changelog-foldbox" data-open="${logOpen ? "1" : "0"}"><div class="dsh-upd-changelog-foldbox-inner">${yankedBanner}
|
|
1648
1490
|
${changelogHTML}
|
|
1649
|
-
</div>`;
|
|
1491
|
+
</div></div></div>`;
|
|
1492
|
+
hasLog = Array.isArray(ranged) && ranged.length > 0;
|
|
1650
1493
|
} catch {
|
|
1651
1494
|
inner = "";
|
|
1652
1495
|
}
|
|
1653
|
-
if (!inner) inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$
|
|
1654
|
-
|
|
1496
|
+
if (!inner) inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(snapshot && snapshot.latestVersion ? "日志读不出来,安装不受影响。" : "还没查到新版;查到后再显示日志。")}</div></div>`;
|
|
1497
|
+
const logCollapsed = input.changelogCollapsed === true;
|
|
1498
|
+
const logNote = showActions && hasLog ? `<span class="dsh-upd-chap-note"><button type="button" data-action="toggle-changelog" title="\u5C55\u5F00\u6216\u6536\u8D77\u66F4\u65B0\u65E5\u5FD7">${logCollapsed ? "展开更新日志" : "收起更新日志"}</button></span>` : "";
|
|
1499
|
+
chapters.push(chapterOf(2, inner, logNote));
|
|
1655
1500
|
}
|
|
1656
1501
|
if (!!queue && (queue.busy || queue.waiting.length > 0) && queue) {
|
|
1657
1502
|
const busy = queue.busy;
|
|
@@ -1665,504 +1510,390 @@ ${changelogHTML}
|
|
|
1665
1510
|
const pos = typeof queue.position === "number" ? queue.position : null;
|
|
1666
1511
|
const posText = pos === null ? "未排队" : `\u7B2C ${pos} \u4F4D`;
|
|
1667
1512
|
const posNote = pos === null ? "" : pos === 1 ? "下一个就是你" : `\u524D\u65B9 ${pos - 1} \u4E2A`;
|
|
1668
|
-
const rows = [`<div class="dsh-upd-qrow"><span class="dsh-upd-qdot" data-tone="${busy ? "busy" : "idle"}"></span><span class="dsh-upd-qk">\u6B63\u5728\u5B89\u88C5</span><span class="dsh-upd-qv">${escapeHtml$
|
|
1513
|
+
const rows = [`<div class="dsh-upd-qrow"><span class="dsh-upd-qdot" data-tone="${busy ? "busy" : "idle"}"></span><span class="dsh-upd-qk">\u6B63\u5728\u5B89\u88C5</span><span class="dsh-upd-qv">${escapeHtml$3(ownerShown + ownerVer)}</span><span class="dsh-upd-qn">${busy ? "装完自动轮到你" : "同一使用范围一次只装一个"}</span></div>`, `<div class="dsh-upd-qrow"><span class="dsh-upd-qdot" data-tone="you"></span><span class="dsh-upd-qk">\u4F60\u7684\u987A\u4F4D</span><span class="dsh-upd-qv">${escapeHtml$3(posText)}</span><span class="dsh-upd-qn">${escapeHtml$3(posNote)}</span></div>`];
|
|
1669
1514
|
if (reveal && queue.waiting.length > 0) {
|
|
1670
1515
|
const seq = queue.waiting.map((e) => `${e.pluginId}${e.targetVersion ? `@${e.targetVersion}` : ""}`).join(" → ");
|
|
1671
|
-
rows.push(`<div class="dsh-upd-qrow"><span class="dsh-upd-qdot"></span><span class="dsh-upd-qk">\u6392\u961F\u987A\u5E8F</span><span class="dsh-upd-qseq">${escapeHtml$
|
|
1516
|
+
rows.push(`<div class="dsh-upd-qrow"><span class="dsh-upd-qdot"></span><span class="dsh-upd-qk">\u6392\u961F\u987A\u5E8F</span><span class="dsh-upd-qseq">${escapeHtml$3(seq)}</span></div>`);
|
|
1672
1517
|
}
|
|
1673
1518
|
const note = showActions ? `<span class="dsh-upd-chap-note"><button type="button" data-action="toggle-queue">${reveal ? "隐藏他人明细" : "显示其他插件"}</button></span>` : "";
|
|
1674
|
-
|
|
1675
|
-
} else
|
|
1519
|
+
chapters.push(chapterOf(3, `<div class="dsh-upd-queue">${rows.join("")}</div>`, note));
|
|
1520
|
+
} else chapters.push(chapterOf(3, `<div class="dsh-upd-queue"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(view.queueNote ?? "当前没有排队任务,同一使用范围一次只装一个。")}</div></div>`));
|
|
1676
1521
|
{
|
|
1677
1522
|
const errLines = [];
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
if (
|
|
1681
|
-
|
|
1523
|
+
const failedNow = b.kind === "failed" || b.kind === "blocked";
|
|
1524
|
+
const failRef = input.failure;
|
|
1525
|
+
if (failedNow) {
|
|
1526
|
+
const shownCode = b.kind === "blocked" ? snapshot?.blockedReason ?? b.kind : typeof input.lastError === "string" && input.lastError.trim() ? input.lastError : "install-failed";
|
|
1527
|
+
errLines.push(`<div class="dsh-upd-err">\u7A33\u5B9A\u7801 <code>${escapeHtml$3(String(shownCode))}</code>\uFF1A\u4E0A\u4E00\u6761\u4E2D\u6587\u8BF4\u660E\u5C31\u662F\u8981\u7528\u6237\u505A\u7684\u4E8B\uFF1B\u8981\u5F80\u4E0A\u6E38\u62A5\uFF0C\u7528\u300C\u590D\u5236\u8BCA\u65AD\u300D\u6574\u6BB5\u7C98\uFF08\u5DF2\u8131\u654F\uFF09\u3002</div>`);
|
|
1528
|
+
if (b.kind === "failed" && failRef) {
|
|
1529
|
+
const keys = [];
|
|
1530
|
+
if (typeof failRef.requestId === "string" && failRef.requestId) keys.push(`\u8BF7\u6C42 <code>${escapeHtml$3(failRef.requestId)}</code>`);
|
|
1531
|
+
if (typeof failRef.checkId === "string" && failRef.checkId) keys.push(`\u68C0\u67E5 <code>${escapeHtml$3(failRef.checkId)}</code>`);
|
|
1532
|
+
const at = formatLatchTime(failRef.atMs);
|
|
1533
|
+
if (at) keys.push(`\u5931\u8D25\u4E8E ${escapeHtml$3(at)}`);
|
|
1534
|
+
if (keys.length > 0) errLines.push(`<div class="dsh-upd-err">\u672C\u6B21\u67E5\u8BE2\u952E\uFF1A${keys.join(" · ")}\uFF08\u62FF\u7740\u5B83\u4EEC\u53BB\u65E5\u5FD7\u91CC\u5BF9\uFF09\u3002</div>`);
|
|
1535
|
+
if (!failRef.volatile) errLines.push(`<div class="dsh-upd-err">\u8BC1\u636E\u5DF2\u51BB\u7ED3\uFF1A\u590D\u5236\u8BCA\u65AD\u91CC\u7684\u7801\u3001\u7248\u672C\u3001\u7F16\u53F7\u90FD\u53D6\u81EA\u5931\u8D25\u65F6\u523B\uFF0C\u4E0D\u968F\u8F6E\u8BE2\u5237\u65B0\uFF1B\u4E0B\u4E00\u6B21\u67E5\u65B0\u7248\u6216\u5B89\u88C5\u4F1A\u66F4\u65B0\u5B83\u3002</div>`);
|
|
1536
|
+
else errLines.push(`<div class="dsh-upd-err">\u8BFB\u6570\u77AC\u6001\u5931\u8D25\uFF1A\u4E0B\u4E00\u6B21\u6210\u529F\u8BFB\u6570\u4F1A\u81EA\u52A8\u89E3\u9664\uFF1B\u4E00\u76F4\u51FA\u73B0\u518D\u6309\u7A33\u5B9A\u7801\u6392\u67E5\u3002</div>`);
|
|
1537
|
+
}
|
|
1538
|
+
} else errLines.push(`<div class="dsh-upd-changelog-neutral">\u6682\u65E0\u5931\u8D25\uFF1A\u6B64\u65F6\u590D\u5236\u8BCA\u65AD\u7ED9\u51FA\u7684\u662F\u5F53\u524D\u72B6\u6001\u5FEB\u7167\u3002</div>`);
|
|
1539
|
+
if (input.showLogHint !== false) {
|
|
1540
|
+
errLines.push(`<div class="dsh-upd-log">\u6DF1\u6316\u770B\u65E5\u5FD7\uFF1A\u6309\u63D2\u4EF6\u6807\u8BC6 <code>${escapeHtml$3(pluginId)}</code> \u8FC7\u6EE4 <code>${LOG_EVENT_CALL}</code>\u3001<code>${LOG_EVENT_CALL_FAIL}</code>\u3001<code>${LOG_EVENT_INSTALL_EXEC}</code> \u4E09\u4E2A\u4E8B\u4EF6\u3002</div>`);
|
|
1541
|
+
if (b.kind === "failed" && failRef && (failRef.requestId || failRef.checkId)) errLines.push(`<div class="dsh-upd-log">\u51ED\u4E0A\u9762\u7684\u8BF7\u6C42\uFF0F\u68C0\u67E5\u7F16\u53F7\u5728 <code>${LOG_EVENT_CALL_FAIL}</code> \u91CC\u5BF9\u4E0A\uFF1B\u57FA\u7EBF\u8017\u65F6\u770B <code>${LOG_EVENT_CALL}</code>\uFF0C\u6267\u884C\u7ED3\u679C\u770B <code>${LOG_EVENT_INSTALL_EXEC}</code>\u3002</div>`);
|
|
1542
|
+
}
|
|
1543
|
+
if (copyNotice) errLines.push(`<div class="dsh-upd-copy" role="status">${escapeHtml$3(copyNotice)}</div>`);
|
|
1544
|
+
chapters.push(chapterOf(4, errLines.join("")));
|
|
1682
1545
|
}
|
|
1683
|
-
|
|
1546
|
+
chapters.push(chapterOf(5, view.showManual && manual ? `<div class="dsh-upd-manual"><div>\u624B\u5DE5\u515C\u5E95\u547D\u4EE4\uFF08\u590D\u5236\u6574\u884C\u6267\u884C\uFF09\uFF1A</div><code>${escapeHtml$3(manual)}</code></div>` : `<div class="dsh-upd-manual"><div class="dsh-upd-changelog-neutral">\u5F53\u524D\u6CA1\u6709\u53EF\u7528\u7684\u624B\u5DE5\u547D\u4EE4\uFF08\u8BA4\u4E0D\u51FA\u4F7F\u7528\u8303\u56F4\u6216\u5C5E\u6E90\u7801\u5B89\u88C5\u65F6\u4E0D\u7ED9\uFF09\u3002</div></div>`));
|
|
1547
|
+
parts.push("<div class=\"dsh-upd-body\">" + chapters.join("\n") + "</div>");
|
|
1548
|
+
if (showActions && mode === "dialog") parts.push(`<div class="dsh-upd-footer"><span class="dsh-upd-foot-note">\u5173\u95ED\u4E0D\u5F71\u54CD\u66F4\u65B0\uFF0C\u53EF\u968F\u65F6\u56DE\u6765\u67E5\u770B</span><button type="button" data-action="close-view" title="\u5173\u95ED\u7A97\u53E3\uFF0C\u66F4\u65B0\u4E0D\u53D7\u5F71\u54CD">\u5173\u95ED</button></div>`);
|
|
1684
1549
|
return parts.join("\n");
|
|
1685
1550
|
}
|
|
1686
1551
|
function renderUpdatePanelHTML(input) {
|
|
1687
1552
|
const view = panelViewModel(input);
|
|
1688
1553
|
const kernel = renderUpdatePanelKernel(input, view);
|
|
1689
|
-
const d5 = normalizePanelTheme(input.theme) === "
|
|
1690
|
-
const attr = d5 ? " data-theme=\"
|
|
1691
|
-
const sealAttr = ` data-seal="${escapeHtml$
|
|
1692
|
-
const body = input.mode === "dialog" ? `<div class="dsh-upd-overlay" data-mode="dialog"><div class="dsh-upd" data-mode="dialog" data-plugin="${escapeHtml$
|
|
1554
|
+
const d5 = normalizePanelTheme(input.theme) === "archive";
|
|
1555
|
+
const attr = d5 ? " data-theme=\"archive\"" : "";
|
|
1556
|
+
const sealAttr = ` data-seal="${escapeHtml$3(view.seal.text)}" data-seal-tone="${view.seal.tone}"`;
|
|
1557
|
+
const body = input.mode === "dialog" ? `<div class="dsh-upd-overlay" data-mode="dialog"><div class="dsh-upd" data-mode="dialog" data-plugin="${escapeHtml$3(input.pluginId)}"${sealAttr}${attr}>
|
|
1693
1558
|
${kernel}
|
|
1694
|
-
</div></div>` : `<div class="dsh-upd" data-mode="embedded" data-plugin="${escapeHtml$
|
|
1559
|
+
</div></div>` : `<div class="dsh-upd" data-mode="embedded" data-plugin="${escapeHtml$3(input.pluginId)}"${sealAttr}${attr}>
|
|
1695
1560
|
${kernel}
|
|
1696
1561
|
</div>`;
|
|
1697
1562
|
return `<style>${d5 ? `${UPDATE_PANEL_CSS}
|
|
1698
1563
|
${UPDATE_PANEL_D5_CSS}` : UPDATE_PANEL_CSS}</style>
|
|
1699
1564
|
${body}`;
|
|
1700
1565
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
if (
|
|
1708
|
-
if (
|
|
1709
|
-
return
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1566
|
+
//#endregion
|
|
1567
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/lang.js
|
|
1568
|
+
function normalizeLangTag(tag) {
|
|
1569
|
+
if (typeof tag !== "string") return "zh";
|
|
1570
|
+
const s = tag.trim().toLowerCase().replace(/_/g, "-");
|
|
1571
|
+
if (!s) return "zh";
|
|
1572
|
+
if (s === "zh" || s.startsWith("zh-")) return "zh";
|
|
1573
|
+
if (s === "en" || s.startsWith("en-")) return "en";
|
|
1574
|
+
if (/^[a-z]{2,3}(-[a-z0-9]+)*$/.test(s)) return "en";
|
|
1575
|
+
return "zh";
|
|
1576
|
+
}
|
|
1577
|
+
function readDocumentLang() {
|
|
1578
|
+
try {
|
|
1579
|
+
const v = globalThis.document?.documentElement?.lang;
|
|
1580
|
+
if (typeof v === "string" && v.trim()) return v;
|
|
1581
|
+
} catch {}
|
|
1582
|
+
return null;
|
|
1714
1583
|
}
|
|
1715
|
-
function
|
|
1584
|
+
function readNavigatorLangs() {
|
|
1716
1585
|
try {
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1586
|
+
const nav = globalThis.navigator;
|
|
1587
|
+
if (!nav) return [];
|
|
1588
|
+
const out = [];
|
|
1589
|
+
if (Array.isArray(nav.languages)) {
|
|
1590
|
+
for (const c of nav.languages) if (typeof c === "string" && c.trim()) out.push(c);
|
|
1591
|
+
}
|
|
1592
|
+
if (typeof nav.language === "string" && nav.language.trim()) out.push(nav.language);
|
|
1593
|
+
return out;
|
|
1719
1594
|
} catch {
|
|
1720
|
-
return
|
|
1595
|
+
return [];
|
|
1721
1596
|
}
|
|
1722
1597
|
}
|
|
1723
|
-
function
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
clear: (h) => clear(h)
|
|
1730
|
-
};
|
|
1731
|
-
const setT = g["setTimeout"];
|
|
1732
|
-
const clearT = g["clearTimeout"];
|
|
1733
|
-
return {
|
|
1734
|
-
set: (fn, ms) => setT(fn, ms),
|
|
1735
|
-
clear: (h) => clearT(h)
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
async function defaultCopyText$1(text) {
|
|
1739
|
-
try {
|
|
1740
|
-
const clip = globalThis["navigator"]?.clipboard;
|
|
1741
|
-
const write = clip?.writeText;
|
|
1742
|
-
if (clip && typeof write === "function") {
|
|
1743
|
-
await write.call(clip, text);
|
|
1744
|
-
return;
|
|
1598
|
+
function resolveLang(override) {
|
|
1599
|
+
if (override !== null && typeof override === "object") try {
|
|
1600
|
+
const fn = override.getActive;
|
|
1601
|
+
if (typeof fn === "function") {
|
|
1602
|
+
const v = fn.call(override);
|
|
1603
|
+
if (typeof v === "string" && v.trim()) return normalizeLangTag(v);
|
|
1745
1604
|
}
|
|
1746
1605
|
} catch {}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
if (
|
|
1750
|
-
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
let mode = options.mode ?? "embedded";
|
|
1766
|
-
if (mode !== "embedded" && mode !== "dialog") throw new Error(`[dsh-plugin-update] \u6446\u653E\u5F62\u6001\u975E\u6CD5\uFF1A\u53EA\u6536 embedded \u6216 dialog\uFF08\u6536\u5230 ${JSON.stringify(options.mode)}\uFF09`);
|
|
1767
|
-
if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive" && options.theme !== "d5-paper") throw new Error(`[dsh-plugin-update] \u4E3B\u9898\u975E\u6CD5\uFF1A\u53EA\u6536 default \u6216 archive\uFF08d5-paper \u4E3A\u65E7\u522B\u540D\u4ECD\u53EF\u7528\uFF09\uFF08\u6536\u5230 ${JSON.stringify(options.theme)}\uFF09`);
|
|
1768
|
-
let theme = normalizePanelTheme(options.theme ?? "default");
|
|
1769
|
-
let showOthers = options.showOthers === true;
|
|
1770
|
-
const call = options.call;
|
|
1771
|
-
const onRestartRequested = options.onRestartRequested;
|
|
1772
|
-
const onCloseRequested = typeof options.onCloseRequested === "function" ? options.onCloseRequested : null;
|
|
1773
|
-
let lastHTML = "";
|
|
1774
|
-
const copyText = options.copyText ?? defaultCopyText$1;
|
|
1775
|
-
const skipStore = options.skipStore ?? createBrowserSkipStore(pluginId);
|
|
1776
|
-
const hostKind = typeof options.hostKind === "string" && options.hostKind ? options.hostKind : null;
|
|
1777
|
-
const profileNameOption = typeof options.profileName === "string" && options.profileName ? options.profileName : null;
|
|
1778
|
-
const diagCopyFormat = options.diagCopyFormat === "line" ? "line" : "block";
|
|
1779
|
-
let changelogMarkdown = typeof options.changelogMarkdown === "string" ? options.changelogMarkdown : null;
|
|
1780
|
-
let snapshot = null;
|
|
1781
|
-
let manual = null;
|
|
1782
|
-
let queue = null;
|
|
1783
|
-
let receipt = null;
|
|
1784
|
-
let requestId = null;
|
|
1785
|
-
let lastError = null;
|
|
1786
|
-
let lastErrorKind = null;
|
|
1787
|
-
let lastDiag = null;
|
|
1788
|
-
let copyNotice = null;
|
|
1789
|
-
let noticeExpiresAt = 0;
|
|
1790
|
-
let busyAct = null;
|
|
1791
|
-
let mounted = true;
|
|
1792
|
-
let envProfileName = null;
|
|
1793
|
-
let envHostKind = null;
|
|
1794
|
-
function sayCopy(text) {
|
|
1795
|
-
copyNotice = text;
|
|
1796
|
-
try {
|
|
1797
|
-
noticeExpiresAt = Date.now() + 5e3;
|
|
1798
|
-
} catch {
|
|
1799
|
-
noticeExpiresAt = 0;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
function queueArgs() {
|
|
1803
|
-
return {
|
|
1804
|
-
includeQueue: true,
|
|
1805
|
-
includeEnv: true,
|
|
1806
|
-
showOthers,
|
|
1807
|
-
...requestId ? { requestId } : {}
|
|
1808
|
-
};
|
|
1809
|
-
}
|
|
1810
|
-
function render() {
|
|
1811
|
-
if (!mounted) return;
|
|
1812
|
-
if (!copyNotice) noticeExpiresAt = 0;
|
|
1813
|
-
else if (noticeExpiresAt && Date.now() > noticeExpiresAt) {
|
|
1814
|
-
copyNotice = null;
|
|
1815
|
-
noticeExpiresAt = 0;
|
|
1816
|
-
}
|
|
1817
|
-
const latest = snapshot?.latestVersion ?? null;
|
|
1818
|
-
const skippedLatest = !!latest && validReleaseVersion(latest) && skipStore.has(latest);
|
|
1819
|
-
const nextHTML = renderUpdatePanelHTML({
|
|
1820
|
-
snapshot,
|
|
1821
|
-
manual,
|
|
1822
|
-
queue,
|
|
1823
|
-
busyAct,
|
|
1824
|
-
skippedLatest,
|
|
1825
|
-
lastError,
|
|
1826
|
-
errorKind: lastErrorKind,
|
|
1827
|
-
changelogMarkdown,
|
|
1828
|
-
mode,
|
|
1829
|
-
showOthers,
|
|
1830
|
-
pluginId,
|
|
1831
|
-
copyNotice,
|
|
1832
|
-
theme,
|
|
1833
|
-
profileName: profileNameOption ?? envProfileName,
|
|
1834
|
-
hostKind: hostKind ?? envHostKind
|
|
1606
|
+
else if (typeof override === "string" && override.trim()) return normalizeLangTag(override);
|
|
1607
|
+
const docLang = readDocumentLang();
|
|
1608
|
+
if (docLang !== null) return normalizeLangTag(docLang);
|
|
1609
|
+
const navs = readNavigatorLangs();
|
|
1610
|
+
for (const c of navs) return normalizeLangTag(c);
|
|
1611
|
+
return "zh";
|
|
1612
|
+
}
|
|
1613
|
+
const entries = /* @__PURE__ */ new Set();
|
|
1614
|
+
let mo = null;
|
|
1615
|
+
function ensureGlobalObserver() {
|
|
1616
|
+
if (mo !== null) return;
|
|
1617
|
+
try {
|
|
1618
|
+
const g = globalThis;
|
|
1619
|
+
const docEl = g.document?.documentElement;
|
|
1620
|
+
const MO = g.MutationObserver;
|
|
1621
|
+
if (!docEl || typeof MO !== "function") return;
|
|
1622
|
+
const obs = new MO(() => {
|
|
1623
|
+
notifyAll();
|
|
1835
1624
|
});
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
function applyStatusReply(reply) {
|
|
1842
|
-
if (!isObject$2(reply)) return;
|
|
1843
|
-
if (reply["ok"] === true) {
|
|
1844
|
-
const s = asSnapshot$1(reply["snapshot"]);
|
|
1845
|
-
if (s) snapshot = s;
|
|
1846
|
-
manual = typeof reply["manual"] === "string" ? reply["manual"] : null;
|
|
1847
|
-
if (reply["receipt"] && isObject$2(reply["receipt"]) && typeof reply["receipt"]["checkId"] === "string") receipt = { checkId: reply["receipt"]["checkId"] };
|
|
1848
|
-
const q = asQueue(reply["queue"]);
|
|
1849
|
-
if (q) queue = q;
|
|
1850
|
-
const env = reply["env"];
|
|
1851
|
-
if (isObject$2(env)) {
|
|
1852
|
-
const pn = env["profileName"];
|
|
1853
|
-
const hk = env["environmentKind"];
|
|
1854
|
-
if (typeof pn === "string" && pn) envProfileName = pn;
|
|
1855
|
-
if (typeof hk === "string" && hk) envHostKind = hk;
|
|
1856
|
-
}
|
|
1857
|
-
lastError = null;
|
|
1858
|
-
lastErrorKind = null;
|
|
1859
|
-
lastDiag = Object.prototype.hasOwnProperty.call(reply, "diag") ? reply["diag"] : null;
|
|
1860
|
-
} else {
|
|
1861
|
-
lastError = typeof reply["error"] === "string" ? reply["error"] : "check-failed";
|
|
1862
|
-
lastErrorKind = typeof reply["errorKind"] === "string" && reply["errorKind"].trim() ? reply["errorKind"].trim() : null;
|
|
1863
|
-
lastDiag = Object.prototype.hasOwnProperty.call(reply, "diag") ? reply["diag"] : null;
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
function pendingAutoChangelogVersion() {
|
|
1867
|
-
if (!autoChangelogEnabled || manualChangelogOverride || !mounted) return null;
|
|
1868
|
-
const v = snapshot?.latestVersion ?? null;
|
|
1869
|
-
if (typeof v !== "string" || !validReleaseVersion(v)) return null;
|
|
1870
|
-
if (!snapshot || snapshot.canInstall !== true) return null;
|
|
1871
|
-
try {
|
|
1872
|
-
if (skipStore.has(v)) return null;
|
|
1873
|
-
} catch {}
|
|
1874
|
-
if (changelogInflight.has(v)) return null;
|
|
1875
|
-
const hasCache = changelogCache.has(v);
|
|
1876
|
-
const failedAt = changelogFailedAt.has(v) ? changelogFailedAt.get(v) : null;
|
|
1877
|
-
let nowMs = 0;
|
|
1878
|
-
try {
|
|
1879
|
-
nowMs = Date.now();
|
|
1880
|
-
} catch {
|
|
1881
|
-
nowMs = 0;
|
|
1882
|
-
}
|
|
1883
|
-
if (!shouldFetchChangelog({
|
|
1884
|
-
hasCache,
|
|
1885
|
-
failedAt,
|
|
1886
|
-
now: nowMs,
|
|
1887
|
-
isManual: false
|
|
1888
|
-
})) return null;
|
|
1889
|
-
return v;
|
|
1890
|
-
}
|
|
1891
|
-
function maybeAutoChangelog() {
|
|
1892
|
-
const v = pendingAutoChangelogVersion();
|
|
1893
|
-
if (v === null) return;
|
|
1894
|
-
changelogInflight.add(v);
|
|
1895
|
-
const seq = autoSeq;
|
|
1896
|
-
Promise.resolve().then(() => call(changelogPhone, { version: v })).then((reply) => {
|
|
1897
|
-
changelogInflight.delete(v);
|
|
1898
|
-
if (!mounted || seq !== autoSeq) return;
|
|
1899
|
-
if (!reply || typeof reply !== "object" || reply["ok"] !== true) {
|
|
1900
|
-
try {
|
|
1901
|
-
changelogFailedAt.set(v, Date.now());
|
|
1902
|
-
} catch {
|
|
1903
|
-
try {
|
|
1904
|
-
changelogFailedAt.set(v, 0);
|
|
1905
|
-
} catch {}
|
|
1906
|
-
}
|
|
1907
|
-
return;
|
|
1908
|
-
}
|
|
1909
|
-
const md = reply["markdown"];
|
|
1910
|
-
changelogCache.set(v, typeof md === "string" ? md : null);
|
|
1911
|
-
if (typeof md === "string") {
|
|
1912
|
-
changelogMarkdown = md;
|
|
1913
|
-
render();
|
|
1914
|
-
}
|
|
1915
|
-
}, () => {
|
|
1916
|
-
changelogInflight.delete(v);
|
|
1917
|
-
if (mounted && seq === autoSeq) try {
|
|
1918
|
-
changelogFailedAt.set(v, Date.now());
|
|
1919
|
-
} catch {
|
|
1920
|
-
try {
|
|
1921
|
-
changelogFailedAt.set(v, 0);
|
|
1922
|
-
} catch {}
|
|
1923
|
-
}
|
|
1625
|
+
obs.observe(docEl, {
|
|
1626
|
+
attributes: true,
|
|
1627
|
+
attributeFilter: ["lang"]
|
|
1924
1628
|
});
|
|
1629
|
+
mo = obs;
|
|
1630
|
+
} catch {
|
|
1631
|
+
mo = null;
|
|
1925
1632
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
if (!mounted) return;
|
|
1934
|
-
lastError = "check-failed";
|
|
1935
|
-
lastErrorKind = null;
|
|
1936
|
-
lastDiag = null;
|
|
1937
|
-
}
|
|
1938
|
-
render();
|
|
1939
|
-
maybeAutoChangelog();
|
|
1940
|
-
}
|
|
1941
|
-
async function act(kind, arg) {
|
|
1942
|
-
if (!mounted) return;
|
|
1943
|
-
copyNotice = null;
|
|
1944
|
-
switch (kind) {
|
|
1945
|
-
case "check":
|
|
1946
|
-
if (busyAct) return;
|
|
1947
|
-
busyAct = "check";
|
|
1948
|
-
copyNotice = "正在查新版…";
|
|
1949
|
-
render();
|
|
1950
|
-
try {
|
|
1951
|
-
const reply = await call(phoneNames.updateCheck, queueArgs());
|
|
1952
|
-
if (!mounted) return;
|
|
1953
|
-
applyStatusReply(reply);
|
|
1954
|
-
changelogFailedAt.clear();
|
|
1955
|
-
} catch {
|
|
1956
|
-
if (!mounted) return;
|
|
1957
|
-
lastError = "check-failed";
|
|
1958
|
-
lastErrorKind = null;
|
|
1959
|
-
lastDiag = null;
|
|
1960
|
-
} finally {
|
|
1961
|
-
busyAct = null;
|
|
1962
|
-
if (copyNotice === "正在查新版…") copyNotice = null;
|
|
1963
|
-
}
|
|
1964
|
-
render();
|
|
1965
|
-
maybeAutoChangelog();
|
|
1966
|
-
return;
|
|
1967
|
-
case "install":
|
|
1968
|
-
if (busyAct) return;
|
|
1969
|
-
busyAct = "install";
|
|
1970
|
-
copyNotice = "正在安装…";
|
|
1971
|
-
render();
|
|
1972
|
-
try {
|
|
1973
|
-
if (!receipt) {
|
|
1974
|
-
const checked = await call(phoneNames.updateCheck, queueArgs());
|
|
1975
|
-
if (!mounted) return;
|
|
1976
|
-
applyStatusReply(checked);
|
|
1977
|
-
}
|
|
1978
|
-
if (!mounted) return;
|
|
1979
|
-
if (!receipt) {
|
|
1980
|
-
lastError = "check-expired";
|
|
1981
|
-
lastErrorKind = "check-expired";
|
|
1982
|
-
lastDiag = null;
|
|
1983
|
-
render();
|
|
1984
|
-
return;
|
|
1985
|
-
}
|
|
1986
|
-
requestId = randomRequestId();
|
|
1987
|
-
const reply = await call(phoneNames.updateInstall, {
|
|
1988
|
-
checkId: receipt.checkId,
|
|
1989
|
-
requestId,
|
|
1990
|
-
...queueArgs()
|
|
1991
|
-
});
|
|
1992
|
-
if (!mounted) return;
|
|
1993
|
-
applyStatusReply(reply);
|
|
1994
|
-
} catch {
|
|
1995
|
-
if (!mounted) return;
|
|
1996
|
-
lastError = "check-failed";
|
|
1997
|
-
lastErrorKind = null;
|
|
1998
|
-
lastDiag = null;
|
|
1999
|
-
} finally {
|
|
2000
|
-
busyAct = null;
|
|
2001
|
-
if (copyNotice === "正在安装…") copyNotice = null;
|
|
2002
|
-
}
|
|
2003
|
-
render();
|
|
2004
|
-
maybeAutoChangelog();
|
|
2005
|
-
return;
|
|
2006
|
-
case "skip": {
|
|
2007
|
-
const v = snapshot?.latestVersion ?? null;
|
|
2008
|
-
if (v && validReleaseVersion(v)) try {
|
|
2009
|
-
skipStore.skip(v);
|
|
2010
|
-
} catch {}
|
|
2011
|
-
render();
|
|
2012
|
-
return;
|
|
2013
|
-
}
|
|
2014
|
-
case "reset-skip":
|
|
2015
|
-
try {
|
|
2016
|
-
skipStore.reset(arg ?? snapshot?.latestVersion ?? void 0);
|
|
2017
|
-
} catch {}
|
|
2018
|
-
await refresh();
|
|
2019
|
-
return;
|
|
2020
|
-
case "copy-manual":
|
|
2021
|
-
if (manual) try {
|
|
2022
|
-
await copyText(manual);
|
|
2023
|
-
sayCopy("手工命令已复制,粘到终端整行执行即可。");
|
|
2024
|
-
} catch {
|
|
2025
|
-
sayCopy("复制失败,请手动选中上面的命令。");
|
|
2026
|
-
}
|
|
2027
|
-
render();
|
|
2028
|
-
return;
|
|
2029
|
-
case "copy-diag": {
|
|
2030
|
-
const jobCode = snapshot?.job?.state === "failed" ? messageCodeOf(snapshot.job.message) || "install-failed" : "";
|
|
2031
|
-
const code = failureCodeOf({
|
|
2032
|
-
error: lastError,
|
|
2033
|
-
errorKind: lastErrorKind
|
|
2034
|
-
}, jobCode || snapshot?.blockedReason || "check-failed");
|
|
2035
|
-
const detail = snapshot?.job?.message && snapshot.job.message.includes(":") ? snapshot.job.message.slice(snapshot.job.message.indexOf(":") + 1) : snapshot?.job?.message;
|
|
2036
|
-
const text = buildUpdateDiagCopy({
|
|
2037
|
-
pluginId,
|
|
2038
|
-
code,
|
|
2039
|
-
detail,
|
|
2040
|
-
runningVersion: snapshot?.runningVersion ?? null,
|
|
2041
|
-
installedVersion: snapshot?.installedVersion ?? null,
|
|
2042
|
-
latestVersion: snapshot?.latestVersion ?? null,
|
|
2043
|
-
hostKind,
|
|
2044
|
-
queuePosition: queue?.position ?? null,
|
|
2045
|
-
requestId,
|
|
2046
|
-
checkId: receipt?.checkId ?? null,
|
|
2047
|
-
route: null,
|
|
2048
|
-
diag: lastDiag,
|
|
2049
|
-
manual,
|
|
2050
|
-
format: diagCopyFormat
|
|
2051
|
-
});
|
|
2052
|
-
try {
|
|
2053
|
-
await copyText(text);
|
|
2054
|
-
sayCopy("诊断已复制,直接粘给插件作者即可(已脱敏)。");
|
|
2055
|
-
} catch {
|
|
2056
|
-
sayCopy("复制失败,请手动选中上面的信息。");
|
|
2057
|
-
}
|
|
2058
|
-
render();
|
|
2059
|
-
return;
|
|
2060
|
-
}
|
|
2061
|
-
case "toggle-queue":
|
|
2062
|
-
showOthers = !showOthers;
|
|
2063
|
-
await refresh();
|
|
2064
|
-
return;
|
|
2065
|
-
case "restart-hint":
|
|
2066
|
-
try {
|
|
2067
|
-
if (typeof onRestartRequested === "function") {
|
|
2068
|
-
await onRestartRequested();
|
|
2069
|
-
sayCopy("已按调用方的重启流程处理;重启后新版生效。");
|
|
2070
|
-
} else sayCopy("本宿主未提供重启入口:请手动重启宿主,重启后新版生效。");
|
|
2071
|
-
} catch {
|
|
2072
|
-
sayCopy("重启入口调用失败:请手动重启宿主,重启后新版生效。");
|
|
2073
|
-
}
|
|
2074
|
-
render();
|
|
2075
|
-
return;
|
|
2076
|
-
case "close-view":
|
|
2077
|
-
await requestDialogClose();
|
|
2078
|
-
return;
|
|
1633
|
+
}
|
|
1634
|
+
function notifyAll() {
|
|
1635
|
+
for (const e of [...entries]) try {
|
|
1636
|
+
const next = resolveLang(e.override);
|
|
1637
|
+
if (next !== e.last) {
|
|
1638
|
+
e.last = next;
|
|
1639
|
+
e.cb(next);
|
|
2079
1640
|
}
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
showOthers = show === true;
|
|
2093
|
-
await refresh();
|
|
2094
|
-
}
|
|
2095
|
-
function onClick(ev) {
|
|
2096
|
-
try {
|
|
2097
|
-
const t = ev;
|
|
2098
|
-
const btn = t?.target && typeof t.target.closest === "function" ? t.target.closest("[data-action]") : null;
|
|
2099
|
-
const kind = btn?.getAttribute ? btn.getAttribute("data-action") : null;
|
|
2100
|
-
if (!kind) return;
|
|
2101
|
-
act(kind);
|
|
2102
|
-
} catch {}
|
|
2103
|
-
}
|
|
2104
|
-
async function requestDialogClose() {
|
|
2105
|
-
if (!mounted || mode !== "dialog") return;
|
|
2106
|
-
if (onCloseRequested) try {
|
|
2107
|
-
await onCloseRequested();
|
|
2108
|
-
} catch {}
|
|
2109
|
-
unmount();
|
|
2110
|
-
}
|
|
2111
|
-
function onKeyDown(ev) {
|
|
2112
|
-
try {
|
|
2113
|
-
const e = ev;
|
|
2114
|
-
if (!mounted || mode !== "dialog" || !e || e.key !== "Escape") return;
|
|
2115
|
-
requestDialogClose();
|
|
2116
|
-
} catch {}
|
|
2117
|
-
}
|
|
2118
|
-
function setChangelogMarkdown(markdown) {
|
|
2119
|
-
changelogMarkdown = typeof markdown === "string" ? markdown : null;
|
|
2120
|
-
if (typeof markdown === "string") manualChangelogOverride = true;
|
|
2121
|
-
render();
|
|
2122
|
-
}
|
|
2123
|
-
function unmount() {
|
|
2124
|
-
if (!mounted) return;
|
|
2125
|
-
mounted = false;
|
|
2126
|
-
autoSeq++;
|
|
2127
|
-
changelogInflight.clear();
|
|
2128
|
-
try {
|
|
2129
|
-
timer.clear(handle);
|
|
2130
|
-
} catch {}
|
|
2131
|
-
try {
|
|
2132
|
-
container.removeEventListener?.("click", onClick);
|
|
2133
|
-
} catch {}
|
|
2134
|
-
try {
|
|
2135
|
-
container.removeEventListener?.("keydown", onKeyDown);
|
|
2136
|
-
} catch {}
|
|
2137
|
-
}
|
|
2138
|
-
render();
|
|
2139
|
-
try {
|
|
2140
|
-
container.addEventListener?.("click", onClick);
|
|
2141
|
-
} catch {}
|
|
2142
|
-
try {
|
|
2143
|
-
container.addEventListener?.("keydown", onKeyDown);
|
|
2144
|
-
} catch {}
|
|
2145
|
-
const timer = getTimer$1();
|
|
2146
|
-
const handle = timer.set(() => {
|
|
2147
|
-
refresh();
|
|
2148
|
-
}, pollMs);
|
|
1641
|
+
} catch {}
|
|
1642
|
+
}
|
|
1643
|
+
function subscribeLang(cb, override) {
|
|
1644
|
+
if (typeof cb !== "function") throw new Error("[dsh-plugin-update] subscribeLang needs a function");
|
|
1645
|
+
const entry = {
|
|
1646
|
+
cb,
|
|
1647
|
+
override: override ?? void 0,
|
|
1648
|
+
last: resolveLang(override),
|
|
1649
|
+
serviceUnsub: null
|
|
1650
|
+
};
|
|
1651
|
+
entries.add(entry);
|
|
1652
|
+
ensureGlobalObserver();
|
|
2149
1653
|
try {
|
|
2150
|
-
|
|
2151
|
-
|
|
1654
|
+
if (entry.override !== null && typeof entry.override === "object") {
|
|
1655
|
+
const sub = entry.override.subscribe;
|
|
1656
|
+
if (typeof sub === "function") {
|
|
1657
|
+
const un = sub.call(entry.override, () => {
|
|
1658
|
+
try {
|
|
1659
|
+
const next = resolveLang(entry.override);
|
|
1660
|
+
if (next !== entry.last) {
|
|
1661
|
+
entry.last = next;
|
|
1662
|
+
entry.cb(next);
|
|
1663
|
+
}
|
|
1664
|
+
} catch {}
|
|
1665
|
+
});
|
|
1666
|
+
if (typeof un === "function") entry.serviceUnsub = un;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
2152
1669
|
} catch {}
|
|
2153
|
-
|
|
1670
|
+
let done = false;
|
|
1671
|
+
return () => {
|
|
1672
|
+
if (done) return;
|
|
1673
|
+
done = true;
|
|
1674
|
+
entries.delete(entry);
|
|
1675
|
+
try {
|
|
1676
|
+
entry.serviceUnsub?.();
|
|
1677
|
+
} catch {}
|
|
1678
|
+
entry.serviceUnsub = null;
|
|
1679
|
+
if (entries.size === 0) {
|
|
1680
|
+
try {
|
|
1681
|
+
mo?.disconnect();
|
|
1682
|
+
} catch {}
|
|
1683
|
+
mo = null;
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
//#endregion
|
|
1688
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/bilingual.js
|
|
1689
|
+
const BILINGUAL_STRINGS = {
|
|
1690
|
+
"entry.label.idle": {
|
|
1691
|
+
en: "Check for updates",
|
|
1692
|
+
zh: "检查更新",
|
|
1693
|
+
draft: true
|
|
1694
|
+
},
|
|
1695
|
+
"entry.label.failed": {
|
|
1696
|
+
en: "Update failed — View details",
|
|
1697
|
+
zh: "更新失败,点此查看",
|
|
1698
|
+
draft: true
|
|
1699
|
+
},
|
|
1700
|
+
"entry.label.busy": {
|
|
1701
|
+
en: "Installing…",
|
|
1702
|
+
zh: "正在安装…",
|
|
1703
|
+
draft: true
|
|
1704
|
+
},
|
|
1705
|
+
"entry.label.restart": {
|
|
1706
|
+
en: "Restart required",
|
|
1707
|
+
zh: "待重启",
|
|
1708
|
+
draft: true
|
|
1709
|
+
},
|
|
1710
|
+
"entry.label.has-update": {
|
|
1711
|
+
en: "Update available {version}",
|
|
1712
|
+
zh: "有新版 {version}",
|
|
1713
|
+
draft: true
|
|
1714
|
+
},
|
|
1715
|
+
"entry.action.checking": {
|
|
1716
|
+
en: "Checking for updates…",
|
|
1717
|
+
zh: "正在查新版…",
|
|
1718
|
+
draft: true
|
|
1719
|
+
},
|
|
1720
|
+
"entry.note.up-to-date": {
|
|
1721
|
+
en: "Up to date {version}",
|
|
1722
|
+
zh: "已是最新 {version}",
|
|
1723
|
+
draft: true
|
|
1724
|
+
},
|
|
1725
|
+
"batch-entry.label.idle": {
|
|
1726
|
+
en: "Check for updates",
|
|
1727
|
+
zh: "检查更新",
|
|
1728
|
+
draft: true
|
|
1729
|
+
},
|
|
1730
|
+
"batch-entry.label.update": {
|
|
1731
|
+
en: "{count} updates available",
|
|
1732
|
+
zh: "{count} 家可更新",
|
|
1733
|
+
draft: true
|
|
1734
|
+
},
|
|
1735
|
+
"batch-entry.label.busy": {
|
|
1736
|
+
en: "Installing…",
|
|
1737
|
+
zh: "正在安装…",
|
|
1738
|
+
draft: true
|
|
1739
|
+
},
|
|
1740
|
+
"batch-entry.label.restart": {
|
|
1741
|
+
en: "{count} restarts required",
|
|
1742
|
+
zh: "{count} 家待重启",
|
|
1743
|
+
draft: true
|
|
1744
|
+
},
|
|
1745
|
+
"batch-entry.label.failed": {
|
|
1746
|
+
en: "{count} failed — View details",
|
|
1747
|
+
zh: "{count} 家失败,点此查看",
|
|
1748
|
+
draft: true
|
|
1749
|
+
},
|
|
1750
|
+
"batch-entry.action.checking": {
|
|
1751
|
+
en: "Checking for updates…",
|
|
1752
|
+
zh: "正在查新版…",
|
|
1753
|
+
draft: true
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
function escapeHtml$2(value) {
|
|
1757
|
+
return String(value ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1758
|
+
}
|
|
1759
|
+
function formatTemplate(template, values) {
|
|
1760
|
+
const vals = values ?? {};
|
|
1761
|
+
return String(template).replace(/\{([A-Za-z0-9_]+)\}/g, (_, name) => {
|
|
1762
|
+
const v = vals[name];
|
|
1763
|
+
if (v === null || v === void 0) return "";
|
|
1764
|
+
return String(v).trim();
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
function bilingualEntry(key) {
|
|
1768
|
+
const hit = BILINGUAL_STRINGS[key];
|
|
1769
|
+
if (!hit) throw new Error("[dsh-plugin-update] 未知文案 key:" + String(key));
|
|
1770
|
+
return hit;
|
|
1771
|
+
}
|
|
1772
|
+
function copyText(key, lang, values) {
|
|
1773
|
+
const l = normalizeLangTag(lang ?? "zh");
|
|
1774
|
+
const e = bilingualEntry(key);
|
|
1775
|
+
return formatTemplate(l === "en" ? e.en : e.zh, values);
|
|
1776
|
+
}
|
|
1777
|
+
function copyHTML(key, lang, values) {
|
|
1778
|
+
const l = normalizeLangTag(lang ?? "zh");
|
|
1779
|
+
const e = bilingualEntry(key);
|
|
1780
|
+
const text = escapeHtml$2(formatTemplate(l === "en" ? e.en : e.zh, values));
|
|
1781
|
+
return "<span class=\"dsh-upd-bi\"><span lang=\"" + l + "\">" + text + "</span></span>";
|
|
1782
|
+
}
|
|
1783
|
+
const BILINGUAL_CSS = [".dsh-upd-bi{display:inline;overflow-wrap:anywhere}", ".dsh-upd-bi [lang]{overflow-wrap:anywhere}"].join("\n");
|
|
1784
|
+
//#endregion
|
|
1785
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/entry.js
|
|
1786
|
+
const UPDATE_ENTRY_CSS = [
|
|
1787
|
+
".dsh-upd-entry{display:inline-flex;align-items:center;gap:8px;font:13px/1.6 system-ui,\"Microsoft YaHei\",sans-serif;color:var(--dsh-upd-fg,#1f2937)}",
|
|
1788
|
+
".dsh-upd-entry-btn{font:inherit;border:1px solid var(--dsh-upd-line,#d1d5db);border-radius:6px;",
|
|
1789
|
+
"background:var(--dsh-upd-btn,#f9fafb);color:inherit;padding:4px 12px;cursor:pointer}",
|
|
1790
|
+
".dsh-upd-entry-btn:hover{border-color:var(--dsh-upd-primary,#2563eb)}",
|
|
1791
|
+
".dsh-upd-entry-btn,.dsh-upd-entry-dot{transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .06s ease}",
|
|
1792
|
+
".dsh-upd-entry-btn:active:not(:disabled){transform:translateY(1px)}",
|
|
1793
|
+
".dsh-upd-entry-btn:disabled,.dsh-upd-entry-dot:disabled{opacity:.55;cursor:wait}",
|
|
1794
|
+
".dsh-upd-entry-btn[aria-busy=\"true\"]::after{content:\"\";display:inline-block;width:10px;height:10px;margin-left:7px;vertical-align:-1px;",
|
|
1795
|
+
"border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:dsh-upd-entry-spin .8s linear infinite}",
|
|
1796
|
+
"@keyframes dsh-upd-entry-spin{to{transform:rotate(360deg)}}",
|
|
1797
|
+
"@media (prefers-reduced-motion: reduce){.dsh-upd-entry-btn,.dsh-upd-entry-dot{transition:none}.dsh-upd-entry-btn[aria-busy=\"true\"]::after{animation:none}}",
|
|
1798
|
+
".dsh-upd-entry-btn:focus-visible,.dsh-upd-entry-dot:focus-visible{outline:2px solid var(--dsh-upd-focus,#2563eb);outline-offset:1px}",
|
|
1799
|
+
".dsh-upd-entry[data-state=\"update\"] .dsh-upd-entry-btn{border-color:var(--dsh-upd-ok-line,#059669);color:var(--dsh-upd-ok-line,#059669)}",
|
|
1800
|
+
".dsh-upd-entry[data-state=\"restart\"] .dsh-upd-entry-btn{border-color:var(--dsh-upd-warn-line,#d97706);color:var(--dsh-upd-warn-line,#d97706)}",
|
|
1801
|
+
".dsh-upd-entry[data-state=\"failed\"] .dsh-upd-entry-btn{border-color:var(--dsh-upd-bad-line,#dc2626);color:var(--dsh-upd-bad-line,#dc2626)}",
|
|
1802
|
+
".dsh-upd-entry-dot{width:10px;height:10px;padding:0;border:0;border-radius:50%;background:var(--dsh-upd-line,#9ca3af);cursor:pointer}",
|
|
1803
|
+
".dsh-upd-entry[data-state=\"update\"] .dsh-upd-entry-dot{background:var(--dsh-upd-ok-line,#059669)}",
|
|
1804
|
+
".dsh-upd-entry[data-state=\"busy\"] .dsh-upd-entry-dot,.dsh-upd-entry[data-state=\"restart\"] .dsh-upd-entry-dot{background:var(--dsh-upd-warn-line,#d97706)}",
|
|
1805
|
+
".dsh-upd-entry[data-state=\"failed\"] .dsh-upd-entry-dot{background:var(--dsh-upd-bad-line,#dc2626)}",
|
|
1806
|
+
".dsh-upd-entry-note{font-size:12.5px;opacity:.9;background:var(--dsh-upd-bg,#ffffff);border:1px solid var(--dsh-upd-line,#e5e7eb);border-radius:4px;padding:1px 8px}",
|
|
1807
|
+
".dsh-upd-entry[data-theme=\"archive\"] .dsh-upd-entry-note{background:var(--d5-card);border-color:var(--d5-line-strong);color:var(--d5-ink)}",
|
|
1808
|
+
".dsh-upd-entry[data-theme=\"archive\"]{--d5-ink:#1a1a1a;--d5-muted:#6f675a;--d5-line-strong:#c4b896;--d5-accent:#c8402a;--d5-card:#fffdf6;",
|
|
1809
|
+
"font-family:Georgia,\"Songti SC\",\"STSong\",\"SimSun\",serif;color:var(--d5-ink)}",
|
|
1810
|
+
".dsh-upd-entry[data-theme=\"archive\"] .dsh-upd-entry-btn{border-color:var(--d5-line-strong);background:var(--d5-card);color:var(--d5-ink);border-radius:3px}",
|
|
1811
|
+
".dsh-upd-entry[data-theme=\"archive\"] .dsh-upd-entry-btn:hover{border-color:var(--d5-accent);color:var(--d5-accent)}",
|
|
1812
|
+
"@media (prefers-color-scheme: dark){.dsh-upd-entry[data-theme=\"archive\"]{--d5-ink:#ece5d3;--d5-muted:#a89c83;--d5-line-strong:#5c4e3b;--d5-accent:#e0684e;--d5-card:#1e1a15}}",
|
|
1813
|
+
"@media (prefers-color-scheme: dark){.dsh-upd-entry{color:#e5e7eb}",
|
|
1814
|
+
".dsh-upd-entry-btn{--dsh-upd-btn:#1f2937;--dsh-upd-line:#374151}}"
|
|
1815
|
+
].join("\n");
|
|
1816
|
+
function isTerminalPhase(phase) {
|
|
1817
|
+
return phase === "done" || phase === "failed" || phase === "skipped" || phase === "current";
|
|
1818
|
+
}
|
|
1819
|
+
function asMillis(value, fallback) {
|
|
1820
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
1821
|
+
}
|
|
1822
|
+
function isNonEmptyString(value) {
|
|
1823
|
+
return typeof value === "string" && value.length > 0;
|
|
1824
|
+
}
|
|
1825
|
+
const PHASES = [
|
|
1826
|
+
"pending",
|
|
1827
|
+
"checking",
|
|
1828
|
+
"ready",
|
|
1829
|
+
"installing",
|
|
1830
|
+
"current",
|
|
1831
|
+
"done",
|
|
1832
|
+
"failed",
|
|
1833
|
+
"skipped"
|
|
1834
|
+
];
|
|
1835
|
+
function asPhase(value) {
|
|
1836
|
+
return typeof value === "string" && PHASES.includes(value) ? value : "pending";
|
|
1837
|
+
}
|
|
1838
|
+
function batchRequestId(sessionId, key) {
|
|
1839
|
+
return "batch:" + sessionId + ":" + key;
|
|
1840
|
+
}
|
|
1841
|
+
function emptyBatchSession() {
|
|
2154
1842
|
return {
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
1843
|
+
version: 1,
|
|
1844
|
+
id: "",
|
|
1845
|
+
selfKey: null,
|
|
1846
|
+
stopOnFailure: false,
|
|
1847
|
+
order: [],
|
|
1848
|
+
entries: [],
|
|
1849
|
+
createdAt: 0,
|
|
1850
|
+
updatedAt: 0
|
|
2162
1851
|
};
|
|
2163
1852
|
}
|
|
1853
|
+
function normalizeBatchSession(raw) {
|
|
1854
|
+
try {
|
|
1855
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return emptyBatchSession();
|
|
1856
|
+
const input = raw;
|
|
1857
|
+
if (input["version"] !== 1) return emptyBatchSession();
|
|
1858
|
+
const id = isNonEmptyString(input["id"]) ? input["id"] : "";
|
|
1859
|
+
const selfKey = isNonEmptyString(input["selfKey"]) ? input["selfKey"] : null;
|
|
1860
|
+
const entries = [];
|
|
1861
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1862
|
+
const rawEntries = input["entries"];
|
|
1863
|
+
if (Array.isArray(rawEntries)) for (const item of rawEntries) {
|
|
1864
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) continue;
|
|
1865
|
+
const e = item;
|
|
1866
|
+
const key = e["key"];
|
|
1867
|
+
if (!isNonEmptyString(key) || seen.has(key)) continue;
|
|
1868
|
+
seen.add(key);
|
|
1869
|
+
const requestId = isNonEmptyString(e["requestId"]) ? e["requestId"] : batchRequestId(id, key);
|
|
1870
|
+
entries.push({
|
|
1871
|
+
key,
|
|
1872
|
+
phase: asPhase(e["phase"]),
|
|
1873
|
+
requestId,
|
|
1874
|
+
targetVersion: isNonEmptyString(e["targetVersion"]) ? e["targetVersion"] : null,
|
|
1875
|
+
restartRequired: e["restartRequired"] === true,
|
|
1876
|
+
error: isNonEmptyString(e["error"]) ? e["error"] : null,
|
|
1877
|
+
updatedAt: asMillis(e["updatedAt"], 0)
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
const order = entries.map((e) => e.key);
|
|
1881
|
+
return {
|
|
1882
|
+
version: 1,
|
|
1883
|
+
id,
|
|
1884
|
+
selfKey: selfKey && seen.has(selfKey) ? selfKey : null,
|
|
1885
|
+
stopOnFailure: input["stopOnFailure"] === true,
|
|
1886
|
+
order,
|
|
1887
|
+
entries,
|
|
1888
|
+
createdAt: asMillis(input["createdAt"], 0),
|
|
1889
|
+
updatedAt: asMillis(input["updatedAt"], 0)
|
|
1890
|
+
};
|
|
1891
|
+
} catch {
|
|
1892
|
+
return emptyBatchSession();
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
2164
1895
|
//#endregion
|
|
2165
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
1896
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/panel-batch.js
|
|
2166
1897
|
const BATCH_PANEL_POLL = {
|
|
2167
1898
|
defaultMs: 1500,
|
|
2168
1899
|
minMs: 250
|
|
@@ -2269,7 +2000,7 @@ ${body}`;
|
|
|
2269
2000
|
parts.push("<div class=\"dsh-upd-batch-macros\">");
|
|
2270
2001
|
parts.push("<button type=\"button\" data-act=\"check\"" + disabled + " title=\"重新读取批量状态(只读)\">检查更新</button>");
|
|
2271
2002
|
parts.push("<button type=\"button\" data-act=\"install\" data-primary=\"1\"" + disabled + " title=\"把有新版的几家一次提交;同一会话同一幂等编号\">全部更新</button>");
|
|
2272
|
-
if (mode === "dialog") parts.push("<button type=\"button\" data-act=\"close\" title=\"
|
|
2003
|
+
if (mode === "dialog") parts.push("<button type=\"button\" data-act=\"close\" title=\"关闭窗口,批量更新不受影响\">关闭</button>");
|
|
2273
2004
|
parts.push("</div>");
|
|
2274
2005
|
parts.push("</div>");
|
|
2275
2006
|
const summary = loaded ? batchSummaryText(counts, rows, total, installing, lastError !== null) : "正在读取批量更新状态…";
|
|
@@ -2299,8 +2030,8 @@ ${body}`;
|
|
|
2299
2030
|
}
|
|
2300
2031
|
if (notice !== null && detailNoticeKey === null) parts.push("<div class=\"dsh-upd-batch-notice\" role=\"status\">" + escapeHtml$1(notice) + "</div>");
|
|
2301
2032
|
const kernel = parts.join(String.fromCharCode(10));
|
|
2302
|
-
const d5 = normalizePanelTheme(theme) === "
|
|
2303
|
-
const attr = d5 ? " data-theme=\"
|
|
2033
|
+
const d5 = normalizePanelTheme(theme) === "archive";
|
|
2034
|
+
const attr = d5 ? " data-theme=\"archive\"" : "";
|
|
2304
2035
|
const seal = batchSealOf(counts);
|
|
2305
2036
|
const root = "<div class=\"dsh-upd dsh-upd-batch\" data-mode=\"" + mode + "\" data-seal=\"" + escapeHtml$1(seal.text) + "\" data-seal-tone=\"" + seal.tone + "\"" + attr + ">\n" + kernel + "\n</div>";
|
|
2306
2037
|
const body = mode === "dialog" ? "<div class=\"dsh-upd-overlay\" data-mode=\"dialog\">" + root + "</div>" : root;
|
|
@@ -2471,21 +2202,23 @@ ${body}`;
|
|
|
2471
2202
|
".dsh-upd-bdetail{margin:2px 0 10px;overflow:visible}",
|
|
2472
2203
|
".dsh-upd .dsh-upd-bdetail .dsh-upd{max-width:none}",
|
|
2473
2204
|
".dsh-upd-overlay .dsh-upd-bdetail .dsh-upd{max-height:none;overflow:visible}",
|
|
2205
|
+
".dsh-upd-overlay .dsh-upd-bdetail .dsh-upd-body{overflow:visible}",
|
|
2206
|
+
".dsh-upd-overlay .dsh-upd-bdetail .dsh-upd-body .dsh-upd-chap-head{position:static}",
|
|
2474
2207
|
"@media (prefers-color-scheme: dark){.dsh-upd-batch-title i{color:var(--dsh-upd-focus,#93c5fd)}}",
|
|
2475
2208
|
"@media (prefers-reduced-motion: reduce){.dsh-upd-batch *{transition:none !important;animation:none !important}}"
|
|
2476
2209
|
].join(String.fromCharCode(10));
|
|
2477
2210
|
const UPDATE_BATCH_PANEL_D5_CSS = [
|
|
2478
2211
|
"/* 批量面板的 D5 皮肤:只换颜色/字体/间距;根上的大印章由 UPDATE_PANEL_D5_CSS 负责。 */",
|
|
2479
|
-
".dsh-upd[data-theme=\"
|
|
2480
|
-
".dsh-upd[data-theme=\"
|
|
2481
|
-
".dsh-upd[data-theme=\"
|
|
2482
|
-
".dsh-upd[data-theme=\"
|
|
2483
|
-
".dsh-upd[data-theme=\"
|
|
2484
|
-
".dsh-upd[data-theme=\"
|
|
2485
|
-
".dsh-upd[data-theme=\"
|
|
2486
|
-
".dsh-upd[data-theme=\"
|
|
2487
|
-
".dsh-upd[data-theme=\"
|
|
2488
|
-
".dsh-upd[data-theme=\"
|
|
2212
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-head{padding-right:120px}",
|
|
2213
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-title{font-family:var(--d5-serif);font-size:21px;letter-spacing:.04em}",
|
|
2214
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-title i{color:var(--d5-accent)}",
|
|
2215
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-main{background:transparent;border:0;color:var(--d5-ink)}",
|
|
2216
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-main:hover{color:var(--d5-accent)}",
|
|
2217
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-bname{font-family:var(--d5-serif)}",
|
|
2218
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-bver{font-family:var(--d5-mono);color:var(--d5-muted)}",
|
|
2219
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-ledger{color:var(--d5-muted)}",
|
|
2220
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-sum{color:var(--d5-ink)}",
|
|
2221
|
+
".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-set{border-top-color:var(--d5-line)}"
|
|
2489
2222
|
].join(String.fromCharCode(10));
|
|
2490
2223
|
function escapeHtml$1(text) {
|
|
2491
2224
|
return String(text).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -2701,6 +2434,7 @@ ${body}`;
|
|
|
2701
2434
|
const call = options.call;
|
|
2702
2435
|
const titles = options.titles && typeof options.titles === "object" ? options.titles : {};
|
|
2703
2436
|
const onRestartRequested = options.onRestartRequested;
|
|
2437
|
+
const onCloseRequested = typeof options.onCloseRequested === "function" ? options.onCloseRequested : null;
|
|
2704
2438
|
const copyText = options.copyText ?? defaultCopyText;
|
|
2705
2439
|
const skipStores = /* @__PURE__ */ new Map();
|
|
2706
2440
|
const autoChangelogEnabled = options.autoChangelog !== false;
|
|
@@ -3025,21 +2759,28 @@ ${body}`;
|
|
|
3025
2759
|
render();
|
|
3026
2760
|
return;
|
|
3027
2761
|
case "close":
|
|
3028
|
-
|
|
2762
|
+
await requestDialogClose();
|
|
3029
2763
|
return;
|
|
3030
2764
|
default: return;
|
|
3031
2765
|
}
|
|
3032
2766
|
}
|
|
2767
|
+
async function requestDialogClose() {
|
|
2768
|
+
if (!mounted || mode !== "dialog") return;
|
|
2769
|
+
if (onCloseRequested) try {
|
|
2770
|
+
await onCloseRequested();
|
|
2771
|
+
} catch {}
|
|
2772
|
+
unmount();
|
|
2773
|
+
}
|
|
3033
2774
|
function onKeyDown(ev) {
|
|
3034
2775
|
try {
|
|
3035
2776
|
const e = ev;
|
|
3036
2777
|
if (!mounted || mode !== "dialog" || !e || e.key !== "Escape") return;
|
|
3037
|
-
|
|
2778
|
+
requestDialogClose();
|
|
3038
2779
|
} catch {}
|
|
3039
2780
|
}
|
|
3040
2781
|
function setTheme(next) {
|
|
3041
|
-
if (next !== "default" && next !== "d5-paper") throw new Error("[dsh-plugin-update] 主题非法:只收 default 或 d5-paper
|
|
3042
|
-
theme = next;
|
|
2782
|
+
if (next !== "default" && next !== "archive" && next !== "d5-paper") throw new Error("[dsh-plugin-update] 主题非法:只收 default 或 archive(d5-paper 为旧别名仍可用)(收到 " + JSON.stringify(next) + ")");
|
|
2783
|
+
theme = normalizePanelTheme(next);
|
|
3043
2784
|
render();
|
|
3044
2785
|
}
|
|
3045
2786
|
function setMode(next) {
|
|
@@ -3104,108 +2845,117 @@ ${body}`;
|
|
|
3104
2845
|
};
|
|
3105
2846
|
}
|
|
3106
2847
|
//#endregion
|
|
3107
|
-
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.
|
|
3108
|
-
const LABEL_IDLE = "检查更新";
|
|
3109
|
-
const LABEL_FAILED = "更新失败,点此查看";
|
|
3110
|
-
const LABEL_BUSY = "正在安装…";
|
|
3111
|
-
const LABEL_RESTART = "待重启";
|
|
3112
|
-
function hasUpdateOf(snapshot) {
|
|
3113
|
-
if (!snapshot) return false;
|
|
3114
|
-
const latest = snapshot.latestVersion;
|
|
3115
|
-
if (typeof latest !== "string" || !latest.trim()) return false;
|
|
3116
|
-
return latest.trim() !== snapshot.runningVersion;
|
|
3117
|
-
}
|
|
3118
|
-
function entryStateKind(state) {
|
|
3119
|
-
const snapshot = state?.snapshot ?? null;
|
|
3120
|
-
const job = snapshot?.job ?? null;
|
|
3121
|
-
if (job && (job.state === "installing" || job.state === "verifying")) return "busy";
|
|
3122
|
-
if (snapshot && (snapshot.blockedReason === "pending-restart" || job?.state === "restart-required")) return "restart";
|
|
3123
|
-
if (state && state.error || job && (job.state === "failed" || job.state === "interrupted")) return "failed";
|
|
3124
|
-
if (hasUpdateOf(snapshot)) return "update";
|
|
3125
|
-
return "idle";
|
|
3126
|
-
}
|
|
3127
|
-
function entryLabelFor(state) {
|
|
3128
|
-
switch (entryStateKind(state)) {
|
|
3129
|
-
case "busy": return LABEL_BUSY;
|
|
3130
|
-
case "restart": return LABEL_RESTART;
|
|
3131
|
-
case "failed": return LABEL_FAILED;
|
|
3132
|
-
case "update": {
|
|
3133
|
-
const latest = state?.snapshot?.latestVersion;
|
|
3134
|
-
return typeof latest === "string" && latest.trim() ? `\u6709\u65B0\u7248 ${latest.trim()}` : LABEL_IDLE;
|
|
3135
|
-
}
|
|
3136
|
-
default: return LABEL_IDLE;
|
|
3137
|
-
}
|
|
3138
|
-
}
|
|
3139
|
-
const UPDATE_ENTRY_CSS = [
|
|
3140
|
-
".dsh-upd-entry{display:inline-flex;align-items:center;gap:8px;font:13px/1.6 system-ui,\"Microsoft YaHei\",sans-serif;color:var(--dsh-upd-fg,#1f2937)}",
|
|
3141
|
-
".dsh-upd-entry-btn{font:inherit;border:1px solid var(--dsh-upd-line,#d1d5db);border-radius:6px;",
|
|
3142
|
-
"background:var(--dsh-upd-btn,#f9fafb);color:inherit;padding:4px 12px;cursor:pointer}",
|
|
3143
|
-
".dsh-upd-entry-btn:hover{border-color:var(--dsh-upd-primary,#2563eb)}",
|
|
3144
|
-
".dsh-upd-entry-btn,.dsh-upd-entry-dot{transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .06s ease}",
|
|
3145
|
-
".dsh-upd-entry-btn:active:not(:disabled){transform:translateY(1px)}",
|
|
3146
|
-
".dsh-upd-entry-btn:disabled,.dsh-upd-entry-dot:disabled{opacity:.55;cursor:wait}",
|
|
3147
|
-
".dsh-upd-entry-btn[aria-busy=\"true\"]::after{content:\"\";display:inline-block;width:10px;height:10px;margin-left:7px;vertical-align:-1px;",
|
|
3148
|
-
"border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:dsh-upd-entry-spin .8s linear infinite}",
|
|
3149
|
-
"@keyframes dsh-upd-entry-spin{to{transform:rotate(360deg)}}",
|
|
3150
|
-
"@media (prefers-reduced-motion: reduce){.dsh-upd-entry-btn,.dsh-upd-entry-dot{transition:none}.dsh-upd-entry-btn[aria-busy=\"true\"]::after{animation:none}}",
|
|
3151
|
-
".dsh-upd-entry-btn:focus-visible,.dsh-upd-entry-dot:focus-visible{outline:2px solid var(--dsh-upd-focus,#2563eb);outline-offset:1px}",
|
|
3152
|
-
".dsh-upd-entry[data-state=\"update\"] .dsh-upd-entry-btn{border-color:var(--dsh-upd-ok-line,#059669);color:var(--dsh-upd-ok-line,#059669)}",
|
|
3153
|
-
".dsh-upd-entry[data-state=\"restart\"] .dsh-upd-entry-btn{border-color:var(--dsh-upd-warn-line,#d97706);color:var(--dsh-upd-warn-line,#d97706)}",
|
|
3154
|
-
".dsh-upd-entry[data-state=\"failed\"] .dsh-upd-entry-btn{border-color:var(--dsh-upd-bad-line,#dc2626);color:var(--dsh-upd-bad-line,#dc2626)}",
|
|
3155
|
-
".dsh-upd-entry-dot{width:10px;height:10px;padding:0;border:0;border-radius:50%;background:var(--dsh-upd-line,#9ca3af);cursor:pointer}",
|
|
3156
|
-
".dsh-upd-entry[data-state=\"update\"] .dsh-upd-entry-dot{background:var(--dsh-upd-ok-line,#059669)}",
|
|
3157
|
-
".dsh-upd-entry[data-state=\"busy\"] .dsh-upd-entry-dot,.dsh-upd-entry[data-state=\"restart\"] .dsh-upd-entry-dot{background:var(--dsh-upd-warn-line,#d97706)}",
|
|
3158
|
-
".dsh-upd-entry[data-state=\"failed\"] .dsh-upd-entry-dot{background:var(--dsh-upd-bad-line,#dc2626)}",
|
|
3159
|
-
".dsh-upd-entry-note{font-size:12.5px;opacity:.9;background:var(--dsh-upd-bg,#ffffff);border:1px solid var(--dsh-upd-line,#e5e7eb);border-radius:4px;padding:1px 8px}",
|
|
3160
|
-
".dsh-upd-entry[data-theme=\"d5-paper\"] .dsh-upd-entry-note{background:var(--d5-card);border-color:var(--d5-line-strong);color:var(--d5-ink)}",
|
|
3161
|
-
".dsh-upd-entry[data-theme=\"d5-paper\"]{--d5-ink:#1a1a1a;--d5-muted:#6f675a;--d5-line-strong:#c4b896;--d5-accent:#c8402a;--d5-card:#fffdf6;",
|
|
3162
|
-
"font-family:Georgia,\"Songti SC\",\"STSong\",\"SimSun\",serif;color:var(--d5-ink)}",
|
|
3163
|
-
".dsh-upd-entry[data-theme=\"d5-paper\"] .dsh-upd-entry-btn{border-color:var(--d5-line-strong);background:var(--d5-card);color:var(--d5-ink);border-radius:3px}",
|
|
3164
|
-
".dsh-upd-entry[data-theme=\"d5-paper\"] .dsh-upd-entry-btn:hover{border-color:var(--d5-accent);color:var(--d5-accent)}",
|
|
3165
|
-
"@media (prefers-color-scheme: dark){.dsh-upd-entry[data-theme=\"d5-paper\"]{--d5-ink:#ece5d3;--d5-muted:#a89c83;--d5-line-strong:#5c4e3b;--d5-accent:#e0684e;--d5-card:#1e1a15}}",
|
|
3166
|
-
"@media (prefers-color-scheme: dark){.dsh-upd-entry{color:#e5e7eb}",
|
|
3167
|
-
".dsh-upd-entry-btn{--dsh-upd-btn:#1f2937;--dsh-upd-line:#374151}}"
|
|
3168
|
-
].join("\n");
|
|
3169
|
-
const ENTRY_ATTR = "data-dsh-upd-entry";
|
|
3170
|
-
const ENTRY_SELECTOR = "[data-dsh-upd-entry]";
|
|
2848
|
+
//#region ../../node_modules/.pnpm/dsh-plugin-update@0.5.8/node_modules/dsh-plugin-update/dist/entry-batch.js
|
|
3171
2849
|
function isObject(value) {
|
|
3172
2850
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
3173
2851
|
}
|
|
3174
|
-
function
|
|
3175
|
-
if (!
|
|
3176
|
-
if (typeof value["runningVersion"] !== "string") return null;
|
|
3177
|
-
if (typeof value["canInstall"] !== "boolean") return null;
|
|
2852
|
+
function asRows(value) {
|
|
2853
|
+
if (!Array.isArray(value)) return null;
|
|
3178
2854
|
return value;
|
|
3179
2855
|
}
|
|
3180
2856
|
function escapeHtml(value) {
|
|
3181
2857
|
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3182
2858
|
}
|
|
3183
|
-
function
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
const
|
|
3187
|
-
|
|
3188
|
-
if (
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
2859
|
+
function batchEntrySummary(state, lang) {
|
|
2860
|
+
const rows = state?.rows ?? null;
|
|
2861
|
+
const counts = batchLedgerCounts(Array.isArray(rows) ? rows : []);
|
|
2862
|
+
const total = Array.isArray(rows) ? rows.length : 0;
|
|
2863
|
+
let kind;
|
|
2864
|
+
if (!Array.isArray(rows) || rows.length === 0) kind = state?.error ? "failed" : "idle";
|
|
2865
|
+
else if (counts.installing > 0) kind = "busy";
|
|
2866
|
+
else if (counts.failed > 0) kind = "failed";
|
|
2867
|
+
else if (counts.restart > 0) kind = "restart";
|
|
2868
|
+
else if (counts.updatable > 0) kind = "update";
|
|
2869
|
+
else kind = "idle";
|
|
2870
|
+
if (kind !== "busy" && state?.error) {
|
|
2871
|
+
if (Array.isArray(rows) && rows.length > 0 && counts.failed === 0 && counts.installing === 0) kind = "failed";
|
|
2872
|
+
}
|
|
2873
|
+
const hasUpdate = counts.installing > 0 || counts.failed > 0 || counts.restart > 0 || counts.updatable > 0;
|
|
2874
|
+
const l = lang !== void 0 && lang !== null ? normalizeLangTag(lang) : resolveLang();
|
|
2875
|
+
let label;
|
|
2876
|
+
switch (kind) {
|
|
2877
|
+
case "busy":
|
|
2878
|
+
label = copyText("batch-entry.label.busy", l);
|
|
2879
|
+
break;
|
|
2880
|
+
case "failed":
|
|
2881
|
+
label = counts.failed > 0 ? copyText("batch-entry.label.failed", l, { count: String(counts.failed) }) : copyText("entry.label.failed", l);
|
|
2882
|
+
break;
|
|
2883
|
+
case "restart":
|
|
2884
|
+
label = copyText("batch-entry.label.restart", l, { count: String(counts.restart) });
|
|
2885
|
+
break;
|
|
2886
|
+
case "update":
|
|
2887
|
+
label = copyText("batch-entry.label.update", l, { count: String(counts.updatable) });
|
|
2888
|
+
break;
|
|
2889
|
+
default: label = copyText("batch-entry.label.idle", l);
|
|
2890
|
+
}
|
|
2891
|
+
return {
|
|
2892
|
+
kind,
|
|
2893
|
+
label,
|
|
2894
|
+
updatable: counts.updatable,
|
|
2895
|
+
installing: counts.installing,
|
|
2896
|
+
pending: counts.pending,
|
|
2897
|
+
restart: counts.restart,
|
|
2898
|
+
failed: counts.failed,
|
|
2899
|
+
skipped: counts.skipped,
|
|
2900
|
+
settled: counts.settled,
|
|
2901
|
+
total,
|
|
2902
|
+
hasUpdate
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
function batchEntryBilingualKeyFor(state) {
|
|
2906
|
+
const s = batchEntrySummary(state);
|
|
2907
|
+
switch (s.kind) {
|
|
2908
|
+
case "busy": return "batch-entry.label.busy";
|
|
2909
|
+
case "failed": return s.failed > 0 ? "batch-entry.label.failed" : "entry.label.failed";
|
|
2910
|
+
case "restart": return "batch-entry.label.restart";
|
|
2911
|
+
case "update": return "batch-entry.label.update";
|
|
2912
|
+
default: return "batch-entry.label.idle";
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
function batchEntryBilingualValuesFor(state) {
|
|
2916
|
+
const s = batchEntrySummary(state);
|
|
2917
|
+
switch (s.kind) {
|
|
2918
|
+
case "update": return { count: String(s.updatable) };
|
|
2919
|
+
case "restart": return { count: String(s.restart) };
|
|
2920
|
+
case "failed": return s.failed > 0 ? { count: String(s.failed) } : {};
|
|
2921
|
+
default: return {};
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
function mountUpdateBatchEntry(container, options) {
|
|
2925
|
+
if (!container || typeof container.innerHTML !== "string") throw new Error("[dsh-plugin-update] 挂批量入口件需要一个有 innerHTML 的容器");
|
|
2926
|
+
if (!options || typeof options !== "object") throw new Error("[dsh-plugin-update] 挂批量入口件缺少配置:批量电话前缀 prefix 必填");
|
|
2927
|
+
if (typeof options.call !== "function") throw new Error("[dsh-plugin-update] 挂批量入口件需要传输函数 call(入口件调宿主电话的唯一接触面)");
|
|
2928
|
+
const phones = buildBatchPhoneNames(options.prefix);
|
|
3192
2929
|
const variant = options.variant ?? "button";
|
|
3193
|
-
if (variant !== "button" && variant !== "badge" && variant !== "inline") throw new Error(
|
|
2930
|
+
if (variant !== "button" && variant !== "badge" && variant !== "inline") throw new Error("[dsh-plugin-update] 入口件形态非法:只收 button / badge / inline(收到 " + JSON.stringify(options.variant) + ")");
|
|
3194
2931
|
const autoCheck = options.autoCheck ?? "mount";
|
|
3195
|
-
if (autoCheck !== "mount" && autoCheck !== "never") throw new Error(
|
|
3196
|
-
const openOn = options.openOn ?? "
|
|
3197
|
-
if (openOn !== "has-update" && openOn !== "always" && openOn !== "manual" && openOn !== "direct") throw new Error(
|
|
3198
|
-
if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive" && options.theme !== "d5-paper") throw new Error(
|
|
2932
|
+
if (autoCheck !== "mount" && autoCheck !== "never") throw new Error("[dsh-plugin-update] 自动检查时机非法:只收 mount 或 never(收到 " + JSON.stringify(options.autoCheck) + ")");
|
|
2933
|
+
const openOn = options.openOn ?? "always";
|
|
2934
|
+
if (openOn !== "has-update" && openOn !== "always" && openOn !== "manual" && openOn !== "direct") throw new Error("[dsh-plugin-update] 点击去向非法:只收 has-update / always / manual / direct(收到 " + JSON.stringify(options.openOn) + ")");
|
|
2935
|
+
if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive" && options.theme !== "d5-paper") throw new Error("[dsh-plugin-update] 主题非法:只收 default 或 archive(d5-paper 为旧别名仍可用)(收到 " + JSON.stringify(options.theme) + ")");
|
|
3199
2936
|
let theme = normalizePanelTheme(options.theme ?? "default");
|
|
3200
2937
|
const pollMs = options.pollMs;
|
|
3201
|
-
if (pollMs !== void 0 && (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < 250)) throw new Error(
|
|
2938
|
+
if (pollMs !== void 0 && (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < 250)) throw new Error("[dsh-plugin-update] 面板轮询间隔非法:不得小于 250 毫秒(收到 " + JSON.stringify(options.pollMs) + ")");
|
|
3202
2939
|
const labelOverride = typeof options.label === "string" && options.label ? options.label : null;
|
|
3203
|
-
const
|
|
2940
|
+
const localeOpt = options.locale ?? void 0;
|
|
2941
|
+
if (localeOpt !== void 0 && localeOpt !== null) {
|
|
2942
|
+
const isStr = typeof localeOpt === "string";
|
|
2943
|
+
const isObj = typeof localeOpt === "object" && typeof localeOpt.getActive === "function";
|
|
2944
|
+
if (!isStr && !isObj) throw new Error("[dsh-plugin-update] invalid locale: expected zh / en / BCP47 or { getActive(), subscribe? }");
|
|
2945
|
+
if (isStr && !localeOpt.trim()) throw new Error("[dsh-plugin-update] invalid locale: empty string");
|
|
2946
|
+
}
|
|
2947
|
+
function currentLang() {
|
|
2948
|
+
return resolveLang(localeOpt);
|
|
2949
|
+
}
|
|
2950
|
+
const titles = options.titles && typeof options.titles === "object" ? options.titles : {};
|
|
3204
2951
|
const onActivate = typeof options.onActivate === "function" ? options.onActivate : null;
|
|
3205
2952
|
const call = options.call;
|
|
3206
|
-
|
|
2953
|
+
const ENTRY_ATTR = "data-dsh-upd-entry";
|
|
2954
|
+
const ENTRY_SELECTOR = "[data-dsh-upd-entry]";
|
|
2955
|
+
let rows = null;
|
|
3207
2956
|
let error = null;
|
|
3208
2957
|
let note = null;
|
|
2958
|
+
let loaded = false;
|
|
3209
2959
|
let activating = false;
|
|
3210
2960
|
let mounted = true;
|
|
3211
2961
|
let panel = null;
|
|
@@ -3230,28 +2980,29 @@ ${body}`;
|
|
|
3230
2980
|
}
|
|
3231
2981
|
function stateOf() {
|
|
3232
2982
|
return {
|
|
3233
|
-
|
|
2983
|
+
rows,
|
|
3234
2984
|
error
|
|
3235
2985
|
};
|
|
3236
2986
|
}
|
|
3237
|
-
function
|
|
3238
|
-
return
|
|
2987
|
+
function summaryOf() {
|
|
2988
|
+
return batchEntrySummary(stateOf(), currentLang());
|
|
3239
2989
|
}
|
|
3240
|
-
function
|
|
3241
|
-
return
|
|
2990
|
+
function currentLabel() {
|
|
2991
|
+
return labelOverride ?? summaryOf().label;
|
|
3242
2992
|
}
|
|
3243
2993
|
function phoneArgs() {
|
|
3244
2994
|
return {};
|
|
3245
2995
|
}
|
|
3246
2996
|
function entryHTML() {
|
|
3247
|
-
const
|
|
3248
|
-
const
|
|
2997
|
+
const lang = currentLang();
|
|
2998
|
+
const summary = batchEntrySummary(stateOf(), lang);
|
|
2999
|
+
const labelHTML = labelOverride ? escapeHtml(labelOverride) : activating ? copyHTML("batch-entry.action.checking", lang) : copyHTML(batchEntryBilingualKeyFor(stateOf()), lang, batchEntryBilingualValuesFor(stateOf()));
|
|
3000
|
+
const labelText = labelOverride ?? (activating ? copyText("batch-entry.action.checking", lang) : copyText(batchEntryBilingualKeyFor(stateOf()), lang, batchEntryBilingualValuesFor(stateOf())));
|
|
3249
3001
|
const busyAttr = activating ? " disabled aria-busy=\"true\"" : "";
|
|
3250
|
-
const themeAttr = theme === "
|
|
3251
|
-
const control = variant === "badge" ?
|
|
3252
|
-
const noteHTML = note ?
|
|
3253
|
-
return
|
|
3254
|
-
<span class="dsh-upd-entry" data-variant="${variant}" data-state="${kind}"${themeAttr}>${control}${noteHTML}</span>`;
|
|
3002
|
+
const themeAttr = theme === "archive" ? " data-theme=\"archive\"" : "";
|
|
3003
|
+
const control = variant === "badge" ? "<button type=\"button\" class=\"dsh-upd-entry-dot\" " + ENTRY_ATTR + "=\"activate\" title=\"" + escapeHtml(labelText) + "\" aria-label=\"" + escapeHtml(labelText) + "\"" + busyAttr + "></button>" : "<button type=\"button\" class=\"dsh-upd-entry-btn\" " + ENTRY_ATTR + "=\"activate\"" + busyAttr + ">" + labelHTML + "</button>";
|
|
3004
|
+
const noteHTML = note ? "<span class=\"dsh-upd-entry-note\" data-dsh-upd-note=\"1\">" + escapeHtml(note) + "</span>" : "";
|
|
3005
|
+
return "<style>" + UPDATE_ENTRY_CSS + "\n" + BILINGUAL_CSS + "</style>\n<span class=\"dsh-upd-entry\" data-variant=\"" + variant + "\" data-state=\"" + summary.kind + "\"" + themeAttr + ">" + control + noteHTML + "</span>";
|
|
3255
3006
|
}
|
|
3256
3007
|
function render() {
|
|
3257
3008
|
if (!mounted) return;
|
|
@@ -3263,14 +3014,15 @@ ${body}`;
|
|
|
3263
3014
|
error = failureCodeOf(isObject(reply) ? reply : null, "check-failed");
|
|
3264
3015
|
return;
|
|
3265
3016
|
}
|
|
3266
|
-
const next =
|
|
3267
|
-
if (next)
|
|
3017
|
+
const next = asRows(reply["rows"]);
|
|
3018
|
+
if (next) rows = next;
|
|
3268
3019
|
error = null;
|
|
3020
|
+
loaded = true;
|
|
3269
3021
|
}
|
|
3270
3022
|
async function refresh() {
|
|
3271
3023
|
if (!mounted) return;
|
|
3272
3024
|
try {
|
|
3273
|
-
const reply = await call(
|
|
3025
|
+
const reply = await call(phones.status, phoneArgs());
|
|
3274
3026
|
if (!mounted) return;
|
|
3275
3027
|
applyReply(reply);
|
|
3276
3028
|
} catch {
|
|
@@ -3281,7 +3033,7 @@ ${body}`;
|
|
|
3281
3033
|
}
|
|
3282
3034
|
async function checkNow() {
|
|
3283
3035
|
try {
|
|
3284
|
-
const reply = await call(
|
|
3036
|
+
const reply = await call(phones.check, phoneArgs());
|
|
3285
3037
|
if (!mounted) return;
|
|
3286
3038
|
applyReply(reply);
|
|
3287
3039
|
} catch {
|
|
@@ -3291,15 +3043,16 @@ ${body}`;
|
|
|
3291
3043
|
}
|
|
3292
3044
|
function mountPanel(mode) {
|
|
3293
3045
|
if (!mounted || panelMode !== null) return;
|
|
3294
|
-
panel =
|
|
3295
|
-
|
|
3296
|
-
prefix,
|
|
3046
|
+
panel = mountUpdateBatchPanel(panelHost, {
|
|
3047
|
+
prefix: options.prefix,
|
|
3297
3048
|
mode,
|
|
3298
3049
|
theme,
|
|
3299
3050
|
pollMs,
|
|
3300
|
-
|
|
3051
|
+
titles,
|
|
3052
|
+
onRestartRequested: options.onRestartRequested,
|
|
3053
|
+
copyText: options.copyText,
|
|
3301
3054
|
autoChangelog: options.autoChangelog,
|
|
3302
|
-
|
|
3055
|
+
locale: localeOpt,
|
|
3303
3056
|
onCloseRequested: () => close(),
|
|
3304
3057
|
call: panelCall
|
|
3305
3058
|
});
|
|
@@ -3340,23 +3093,29 @@ ${body}`;
|
|
|
3340
3093
|
}
|
|
3341
3094
|
if (!mounted) return;
|
|
3342
3095
|
if (variant === "badge" || openOn === "manual") {
|
|
3343
|
-
if (onActivate) onActivate(
|
|
3344
|
-
hasUpdate: hasUpdate(),
|
|
3345
|
-
latestVersion: snapshot?.latestVersion ?? null
|
|
3346
|
-
});
|
|
3096
|
+
if (onActivate) onActivate(summaryOf());
|
|
3347
3097
|
else openDialog();
|
|
3348
3098
|
render();
|
|
3349
3099
|
return;
|
|
3350
3100
|
}
|
|
3351
|
-
|
|
3101
|
+
const summary = summaryOf();
|
|
3102
|
+
if (openOn === "always" || summary.hasUpdate || !loaded || error) {
|
|
3352
3103
|
openDialog();
|
|
3353
3104
|
return;
|
|
3354
3105
|
}
|
|
3355
|
-
note =
|
|
3106
|
+
note = batchLedgerText({
|
|
3107
|
+
updatable: summary.updatable,
|
|
3108
|
+
installing: summary.installing,
|
|
3109
|
+
pending: summary.pending,
|
|
3110
|
+
restart: summary.restart,
|
|
3111
|
+
failed: summary.failed,
|
|
3112
|
+
skipped: summary.skipped,
|
|
3113
|
+
settled: summary.settled
|
|
3114
|
+
});
|
|
3356
3115
|
render();
|
|
3357
3116
|
}
|
|
3358
3117
|
function setTheme(next) {
|
|
3359
|
-
if (next !== "default" && next !== "archive" && next !== "d5-paper") throw new Error(
|
|
3118
|
+
if (next !== "default" && next !== "archive" && next !== "d5-paper") throw new Error("[dsh-plugin-update] 主题非法:只收 default 或 archive(d5-paper 为旧别名仍可用)(收到 " + JSON.stringify(next) + ")");
|
|
3360
3119
|
theme = normalizePanelTheme(next);
|
|
3361
3120
|
if (panel) panel.setTheme(theme);
|
|
3362
3121
|
else render();
|
|
@@ -3383,6 +3142,9 @@ ${body}`;
|
|
|
3383
3142
|
function unmount() {
|
|
3384
3143
|
if (!mounted) return;
|
|
3385
3144
|
mounted = false;
|
|
3145
|
+
try {
|
|
3146
|
+
unsubLang();
|
|
3147
|
+
} catch {}
|
|
3386
3148
|
const opened = panel;
|
|
3387
3149
|
panel = null;
|
|
3388
3150
|
panelMode = null;
|
|
@@ -3396,6 +3158,9 @@ ${body}`;
|
|
|
3396
3158
|
container.removeEventListener?.("keydown", onKeyDown);
|
|
3397
3159
|
} catch {}
|
|
3398
3160
|
}
|
|
3161
|
+
const unsubLang = subscribeLang(() => {
|
|
3162
|
+
render();
|
|
3163
|
+
}, localeOpt);
|
|
3399
3164
|
try {
|
|
3400
3165
|
container.addEventListener?.("click", onClick);
|
|
3401
3166
|
} catch {}
|
|
@@ -3410,42 +3175,14 @@ ${body}`;
|
|
|
3410
3175
|
open,
|
|
3411
3176
|
close,
|
|
3412
3177
|
label: currentLabel,
|
|
3178
|
+
summary: summaryOf,
|
|
3413
3179
|
setTheme,
|
|
3414
3180
|
unmount
|
|
3415
3181
|
};
|
|
3416
3182
|
}
|
|
3417
|
-
//#endregion
|
|
3418
|
-
//#region src/install.ts
|
|
3419
|
-
/** dsh-life-pack 安装口径(P10 脚手架,P1 #2 定案单命令双包)。
|
|
3420
|
-
*
|
|
3421
|
-
* 真相(#2 真机结论):dsh plugin 是 pnpm 薄转发,add 单品等价 pnpm add,
|
|
3422
|
-
* 传递依赖落盘是;激活否:reconcile 只扫直接 dependencies,传递的 manager
|
|
3423
|
-
* 不进 bundles;pnpm 隔离布局下从 profile 解析不到它。
|
|
3424
|
-
*
|
|
3425
|
-
* 口径:任何单品落地时总管必须已在位导航。实现为单命令双包:
|
|
3426
|
-
* dsh plugin add dsh-life-pack dsh-calorie
|
|
3427
|
-
* 两者皆直接依赖,由 reconcile 按序激活。单品 package 内保留对总管的
|
|
3428
|
-
* dependencies 只作本地开发兜底,不作为单 add 即激活的依据。
|
|
3429
|
-
* 不许单卸总管:缺席时总管对应 tab 显示推荐安装并提示补装(见 nav.ts)。
|
|
3430
|
-
* 安装验收以 bundles 双含为准,另加单 add 单品后 bundles 无总管的负向断言。
|
|
3431
|
-
*/
|
|
3432
|
-
const MANAGER_PACKAGE = "dsh-life-pack";
|
|
3433
|
-
//#endregion
|
|
3434
|
-
//#region src/update-targets.ts
|
|
3435
|
-
/** 七个更新目标(总管自己 + 六个单品),薄接线唯一定义地(票 1170)。
|
|
3436
|
-
*
|
|
3437
|
-
* 包名不新开第二源:六单品取自 nav.ts 的 MANAGER_TABS,总管自己取自 install.ts。
|
|
3438
|
-
* 七个 phonePrefix 必须互不相同,否则串台。
|
|
3439
|
-
*/
|
|
3440
|
-
const MANAGER_TARGET_KEY = "life-pack";
|
|
3441
3183
|
/** 批量电话前缀:宿主与面板共用,唯一定义地(面板 mount 参数与宿主登记同源)。 */
|
|
3442
3184
|
const BATCH_PREFIX = "life";
|
|
3443
|
-
|
|
3444
|
-
key: MANAGER_TARGET_KEY,
|
|
3445
|
-
title: "爱生活",
|
|
3446
|
-
packageName: MANAGER_PACKAGE,
|
|
3447
|
-
phonePrefix: "ilife-life-pack"
|
|
3448
|
-
}, ...MANAGER_TABS.map((tab) => ({
|
|
3185
|
+
[...MANAGER_TABS.map((tab) => ({
|
|
3449
3186
|
key: tab.skill,
|
|
3450
3187
|
title: tab.title,
|
|
3451
3188
|
packageName: tab.plugin,
|
|
@@ -3453,21 +3190,12 @@ ${body}`;
|
|
|
3453
3190
|
}))];
|
|
3454
3191
|
//#endregion
|
|
3455
3192
|
//#region src/update-dialog.ts
|
|
3456
|
-
/** 面板薄包装(票 1170
|
|
3193
|
+
/** 面板薄包装(票 1170 起,浏览器侧:无 node 内建,可进 client 束;完全上游 UI,本包零自家样式)。
|
|
3457
3194
|
*
|
|
3458
|
-
*
|
|
3459
|
-
|
|
3195
|
+
* 只定死三组参数,不自建文案与样式:批量入口形态 button、皮肤 archive、打开策略沿上游缺省 always
|
|
3196
|
+
*(查完总是开批量面板;0.5.4 #49 到达,manual 桥接已删);弹窗 dialog 由入口件内置(含关闭落地);
|
|
3460
3197
|
* 轮询与更新日志沿上游缺省,中文标题沿目标表(不传 titles 覆盖)。
|
|
3461
3198
|
*/
|
|
3462
|
-
/** 总管自己那一行的电话名前缀(入口件状态源,取自目标表,不手写字面量)。 */
|
|
3463
|
-
function managerPrefix() {
|
|
3464
|
-
const row = UPDATE_TARGETS.find((target) => target.key === MANAGER_TARGET_KEY);
|
|
3465
|
-
return row !== void 0 ? row.phonePrefix : "ilife-life-pack";
|
|
3466
|
-
}
|
|
3467
|
-
/** 总管自己在批量内的插件标识(与宿主侧上游缺省 batchPrefix-key 同口径)。 */
|
|
3468
|
-
function managerPluginId() {
|
|
3469
|
-
return "life-life-pack";
|
|
3470
|
-
}
|
|
3471
3199
|
/** 把 RpcCallFace 收成面板要的一参形状:上游回包原样透传(含失败回包的 errorKind 与 diag)。
|
|
3472
3200
|
*
|
|
3473
3201
|
* 宿主电话表把上游回包整体装进回执 value(成功失败皆如此,只有宿主级故障才走外层失败信封),
|
|
@@ -3514,29 +3242,18 @@ ${body}`;
|
|
|
3514
3242
|
};
|
|
3515
3243
|
};
|
|
3516
3244
|
}
|
|
3517
|
-
/**
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3245
|
+
/** 挂批量入口(一颗按钮看七家聚合,弹窗 dialog 由入口件内置,关闭落地自带)。
|
|
3246
|
+
*
|
|
3247
|
+
* 0.5.4 #49 到达:`prefix: life` 直调批量五电话,徽标与面板总账同一份数法;manual 桥接与容器事件同步已整段删除。
|
|
3248
|
+
*/
|
|
3249
|
+
function mountLifeBatchEntry(container, call, overrides) {
|
|
3250
|
+
return mountUpdateBatchEntry(container, {
|
|
3251
|
+
prefix: BATCH_PREFIX,
|
|
3522
3252
|
call,
|
|
3523
3253
|
variant: "button",
|
|
3524
|
-
openOn: "manual",
|
|
3525
3254
|
theme: "archive",
|
|
3526
3255
|
autoCheck: overrides?.autoCheck ?? "mount",
|
|
3527
|
-
label: overrides?.label
|
|
3528
|
-
onActivate: () => {
|
|
3529
|
-
onOpen();
|
|
3530
|
-
}
|
|
3531
|
-
});
|
|
3532
|
-
}
|
|
3533
|
-
/** 挂批量面板(内嵌形态进自家弹窗壳,离开时 unmount 只停轮询)。 */
|
|
3534
|
-
function mountLifeBatchPanel(container, call) {
|
|
3535
|
-
return mountUpdateBatchPanel(container, {
|
|
3536
|
-
prefix: BATCH_PREFIX,
|
|
3537
|
-
call,
|
|
3538
|
-
theme: "archive",
|
|
3539
|
-
mode: "embedded"
|
|
3256
|
+
label: overrides?.label
|
|
3540
3257
|
});
|
|
3541
3258
|
}
|
|
3542
3259
|
//#endregion
|
|
@@ -5327,48 +5044,13 @@ ${body}`;
|
|
|
5327
5044
|
display: "inline-flex",
|
|
5328
5045
|
color: "var(--dsw-alias-label-secondary, #9a9a9a)"
|
|
5329
5046
|
},
|
|
5330
|
-
/** 更新入口挂点:只占位,按钮本体由上游入口件渲染(票 1170
|
|
5047
|
+
/** 更新入口挂点:只占位,按钮本体由上游入口件渲染(票 1170);批量弹窗壳亦由上游提供,本包零自家样式。 */
|
|
5331
5048
|
updateEntrySlot: {
|
|
5332
5049
|
display: "inline-flex",
|
|
5333
5050
|
alignItems: "center"
|
|
5334
|
-
},
|
|
5335
|
-
/** 批量弹窗遮罩(自家壳:颜色走主题变量,按钮复用 interactionCss 同一缝)。 */
|
|
5336
|
-
updateBackdrop: {
|
|
5337
|
-
position: "fixed",
|
|
5338
|
-
inset: 0,
|
|
5339
|
-
display: "flex",
|
|
5340
|
-
alignItems: "center",
|
|
5341
|
-
justifyContent: "center",
|
|
5342
|
-
padding: 16,
|
|
5343
|
-
background: "rgba(0, 0, 0, 0.45)",
|
|
5344
|
-
zIndex: 1e3
|
|
5345
|
-
},
|
|
5346
|
-
updateBox: {
|
|
5347
|
-
position: "relative",
|
|
5348
|
-
width: "min(720px, 92vw)",
|
|
5349
|
-
maxHeight: "84vh",
|
|
5350
|
-
overflow: "auto",
|
|
5351
|
-
borderRadius: 12,
|
|
5352
|
-
border: "1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35))",
|
|
5353
|
-
background: "var(--dsw-alias-bg-layer-1, #232324)",
|
|
5354
|
-
color: "var(--dsw-alias-label-primary, inherit)",
|
|
5355
|
-
padding: "12px 12px 16px"
|
|
5356
|
-
},
|
|
5357
|
-
updateClose: {
|
|
5358
|
-
position: "sticky",
|
|
5359
|
-
top: 0,
|
|
5360
|
-
float: "right",
|
|
5361
|
-
marginLeft: 8,
|
|
5362
|
-
border: "1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.35))",
|
|
5363
|
-
background: "transparent",
|
|
5364
|
-
color: "var(--dsw-alias-label-primary, inherit)",
|
|
5365
|
-
borderRadius: 999,
|
|
5366
|
-
padding: "4px 12px",
|
|
5367
|
-
fontSize: 13,
|
|
5368
|
-
cursor: "pointer"
|
|
5369
5051
|
}
|
|
5370
5052
|
};
|
|
5371
|
-
/** 更新区(票 1170
|
|
5053
|
+
/** 更新区(票 1170 薄接线,完全上游 UI):标题行挂上游入口按钮,点开即上游 dialog 七目标批量面板;缺席页签仍显示静态推荐,不进批量 targets。 */
|
|
5372
5054
|
/** 标签解析(resolveSlotLabel 同形:thunk 跟活,无则空字串;见 slots lib:27-29)。 */
|
|
5373
5055
|
function resolveLabel(label) {
|
|
5374
5056
|
if (typeof label === "function") return label();
|
|
@@ -5421,7 +5103,7 @@ ${body}`;
|
|
|
5421
5103
|
}, react.createElement("span", { style: S.morePkg }, row.pkg), react.createElement("span", { style: S.moreDesc }, row.desc), react.createElement("span", { style: S.moreIcon }, react.createElement(ExternalIcon, null)))));
|
|
5422
5104
|
}
|
|
5423
5105
|
/** 版本胶囊那一行字:只在这里拼一次,屏上与用例读的是同一串。 */
|
|
5424
|
-
const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.
|
|
5106
|
+
const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.42";
|
|
5425
5107
|
/** 爱生活面板:总设置区 + 检查更新(七家)+ 爱生活页签条(slot 驱动)+ 技能设置页投影/缺席卡。 */
|
|
5426
5108
|
function LifePackSection(props) {
|
|
5427
5109
|
const tabsId = react.useId();
|
|
@@ -5440,40 +5122,18 @@ ${body}`;
|
|
|
5440
5122
|
})), Object.fromEntries(Object.entries(health.rows).map(([id, row]) => [id, row.report ?? void 0]))), [rows, health.rows]);
|
|
5441
5123
|
const lightOf = (id) => lights.find((light) => light.id === id);
|
|
5442
5124
|
const [activeId, setActiveId] = react.useState(void 0);
|
|
5443
|
-
/**
|
|
5444
|
-
const [batchOpen, setBatchOpen] = react.useState(false);
|
|
5125
|
+
/** 批量入口挂载位(一颗按钮看七家聚合;0.5.4 #49 到达,弹窗 dialog 由入口件内置,开关态亦归上游)。 */
|
|
5445
5126
|
const entryRef = react.useRef(null);
|
|
5446
|
-
const dialogRef = react.useRef(null);
|
|
5447
5127
|
const callReady = props.getCall() !== null;
|
|
5448
5128
|
/** 入口件挂载:连接后到才挂(取用器现取),卸载即 unmount(只停入口轮询)。 */
|
|
5449
5129
|
react.useEffect(() => {
|
|
5450
5130
|
const mount = entryRef.current;
|
|
5451
5131
|
if (mount === null || !callReady) return;
|
|
5452
|
-
const entry =
|
|
5453
|
-
setBatchOpen(true);
|
|
5454
|
-
});
|
|
5132
|
+
const entry = mountLifeBatchEntry(mount, managerCallAdapter(props.getCall()));
|
|
5455
5133
|
return () => {
|
|
5456
5134
|
entry.unmount();
|
|
5457
5135
|
};
|
|
5458
5136
|
}, [callReady]);
|
|
5459
|
-
/** 批量面板挂载:弹窗开才挂,关即 unmount(只停轮询,宿主侧安装继续跑)。 */
|
|
5460
|
-
react.useEffect(() => {
|
|
5461
|
-
const mount = dialogRef.current;
|
|
5462
|
-
if (mount === null || !batchOpen || !callReady) return;
|
|
5463
|
-
const panel = mountLifeBatchPanel(mount, managerCallAdapter(props.getCall()));
|
|
5464
|
-
return () => {
|
|
5465
|
-
panel.unmount();
|
|
5466
|
-
};
|
|
5467
|
-
}, [batchOpen, callReady]);
|
|
5468
|
-
function closeBatch() {
|
|
5469
|
-
setBatchOpen(false);
|
|
5470
|
-
}
|
|
5471
|
-
function onDialogKeyDown(event) {
|
|
5472
|
-
if (event.key === "Escape") {
|
|
5473
|
-
event.stopPropagation();
|
|
5474
|
-
setBatchOpen(false);
|
|
5475
|
-
}
|
|
5476
|
-
}
|
|
5477
5137
|
const [visitedIds, setVisitedIds] = react.useState(() => /* @__PURE__ */ new Set());
|
|
5478
5138
|
const active = MANAGER_TABS.some((t) => t.plugin === activeId) ? activeId : MANAGER_TABS[0].plugin;
|
|
5479
5139
|
react.useEffect(() => {
|
|
@@ -5707,21 +5367,7 @@ ${body}`;
|
|
|
5707
5367
|
const reco = recoFor(tab);
|
|
5708
5368
|
return react.createElement("div", { style: S.reco }, reco.hint, react.createElement("span", { style: S.cmd }, reco.installCmd));
|
|
5709
5369
|
})());
|
|
5710
|
-
}),
|
|
5711
|
-
role: "dialog",
|
|
5712
|
-
"aria-modal": "true",
|
|
5713
|
-
"aria-label": "批量更新",
|
|
5714
|
-
style: S.updateBackdrop,
|
|
5715
|
-
onKeyDown: onDialogKeyDown
|
|
5716
|
-
}, react.createElement("style", { "data-ilife-interaction": "t1" }, interactionCss()), react.createElement("div", { style: S.updateBox }, react.createElement("button", {
|
|
5717
|
-
type: "button",
|
|
5718
|
-
"data-ilife-press": "",
|
|
5719
|
-
style: S.updateClose,
|
|
5720
|
-
"aria-label": "关闭更新面板(批量推进在宿主侧继续跑)",
|
|
5721
|
-
onClick: closeBatch
|
|
5722
|
-
}, "关闭"), react.createElement("div", { ref: (element) => {
|
|
5723
|
-
dialogRef.current = element;
|
|
5724
|
-
} }))) : null, react.createElement(MorePluginsCard, null));
|
|
5370
|
+
}), react.createElement(MorePluginsCard, null));
|
|
5725
5371
|
}
|
|
5726
5372
|
function apply(ctx) {
|
|
5727
5373
|
const getCall = () => ctx.connection?.rpc?.call ?? null;
|