dsh-vault 1.9.9 → 1.10.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +165 -108
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -17,111 +17,111 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
document.head.appendChild(tag);
|
|
18
18
|
}
|
|
19
19
|
var VaultSection_module_css_default = {
|
|
20
|
-
"trashButton": "t_j5va_trashButton",
|
|
21
|
-
"saveButton": "t_j5va_saveButton",
|
|
22
|
-
"clearButton": "t_j5va_clearButton",
|
|
23
|
-
"badgeWarn": "t_j5va_badgeWarn",
|
|
24
|
-
"rowDue": "t_j5va_rowDue",
|
|
25
|
-
"identity": "t_j5va_identity",
|
|
26
|
-
"section": "t_j5va_section",
|
|
27
|
-
"row": "t_j5va_row",
|
|
28
|
-
"deleteButton": "t_j5va_deleteButton",
|
|
29
20
|
"error": "t_j5va_error",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
21
|
+
"intro": "t_j5va_intro",
|
|
22
|
+
"bulkItem": "t_j5va_bulkItem",
|
|
23
|
+
"trashButton": "t_j5va_trashButton",
|
|
24
|
+
"auditIssues": "t_j5va_auditIssues",
|
|
25
|
+
"histDanger": "t_j5va_histDanger",
|
|
35
26
|
"totp": "t_j5va_totp",
|
|
36
|
-
"pinOff": "t_j5va_pinOff",
|
|
37
|
-
"dueBadge": "t_j5va_dueBadge",
|
|
38
|
-
"rowCheck": "t_j5va_rowCheck",
|
|
39
|
-
"bulkCount": "t_j5va_bulkCount",
|
|
40
|
-
"rowActions": "t_j5va_rowActions",
|
|
41
|
-
"list": "t_j5va_list",
|
|
42
|
-
"histUpdate": "t_j5va_histUpdate",
|
|
43
|
-
"footer": "t_j5va_footer",
|
|
44
27
|
"sortButton": "t_j5va_sortButton",
|
|
45
|
-
"dupGroup": "t_j5va_dupGroup",
|
|
46
28
|
"dupMerge": "t_j5va_dupMerge",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"bulkBar": "t_j5va_bulkBar",
|
|
55
|
-
"highBadge": "t_j5va_highBadge",
|
|
29
|
+
"policyField": "t_j5va_policyField",
|
|
30
|
+
"searchBox": "t_j5va_searchBox",
|
|
31
|
+
"detailItem": "t_j5va_detailItem",
|
|
32
|
+
"pwHistPwd": "t_j5va_pwHistPwd",
|
|
33
|
+
"rowSelected": "t_j5va_rowSelected",
|
|
34
|
+
"emptyHint": "t_j5va_emptyHint",
|
|
35
|
+
"badgeWarn": "t_j5va_badgeWarn",
|
|
56
36
|
"moreMenu": "t_j5va_moreMenu",
|
|
57
|
-
"auditIssues": "t_j5va_auditIssues",
|
|
58
|
-
"badge": "t_j5va_badge",
|
|
59
|
-
"lockedBanner": "t_j5va_lockedBanner",
|
|
60
37
|
"pwWeak": "t_j5va_pwWeak",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"emptyHint": "t_j5va_emptyHint",
|
|
67
|
-
"secretField": "t_j5va_secretField",
|
|
68
|
-
"srOnly": "t_j5va_srOnly",
|
|
69
|
-
"kindFilter": "t_j5va_kindFilter",
|
|
70
|
-
"tabs": "t_j5va_tabs",
|
|
71
|
-
"intro": "t_j5va_intro",
|
|
72
|
-
"pwHistRow": "t_j5va_pwHistRow",
|
|
38
|
+
"pwHistTime": "t_j5va_pwHistTime",
|
|
39
|
+
"section": "t_j5va_section",
|
|
40
|
+
"dupGroup": "t_j5va_dupGroup",
|
|
41
|
+
"title": "t_j5va_title",
|
|
42
|
+
"bulkCount": "t_j5va_bulkCount",
|
|
73
43
|
"field": "t_j5va_field",
|
|
44
|
+
"pwHistRow": "t_j5va_pwHistRow",
|
|
45
|
+
"pinOff": "t_j5va_pinOff",
|
|
46
|
+
"kindFilter": "t_j5va_kindFilter",
|
|
47
|
+
"pinOn": "t_j5va_pinOn",
|
|
48
|
+
"clearButton": "t_j5va_clearButton",
|
|
74
49
|
"kindIcon": "t_j5va_kindIcon",
|
|
75
|
-
"
|
|
50
|
+
"retryButton": "t_j5va_retryButton",
|
|
51
|
+
"empty": "t_j5va_empty",
|
|
52
|
+
"modeAsk": "t_j5va_modeAsk",
|
|
53
|
+
"lockedTag": "t_j5va_lockedTag",
|
|
76
54
|
"genOpts": "t_j5va_genOpts",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
55
|
+
"toolbar": "t_j5va_toolbar",
|
|
56
|
+
"dangerButton": "t_j5va_dangerButton",
|
|
57
|
+
"tab": "t_j5va_tab",
|
|
58
|
+
"reportLine": "t_j5va_reportLine",
|
|
59
|
+
"dueBadge": "t_j5va_dueBadge",
|
|
60
|
+
"tabPane": "t_j5va_tabPane",
|
|
61
|
+
"addButton": "t_j5va_addButton",
|
|
62
|
+
"histAdd": "t_j5va_histAdd",
|
|
63
|
+
"pwFair": "t_j5va_pwFair",
|
|
64
|
+
"identity": "t_j5va_identity",
|
|
65
|
+
"list": "t_j5va_list",
|
|
80
66
|
"editor": "t_j5va_editor",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"pinStar": "t_j5va_pinStar",
|
|
86
|
-
"rowSelected": "t_j5va_rowSelected",
|
|
87
|
-
"empty": "t_j5va_empty",
|
|
88
|
-
"histDanger": "t_j5va_histDanger",
|
|
67
|
+
"rowDue": "t_j5va_rowDue",
|
|
68
|
+
"row": "t_j5va_row",
|
|
69
|
+
"reportTitle": "t_j5va_reportTitle",
|
|
70
|
+
"deleteButton": "t_j5va_deleteButton",
|
|
89
71
|
"histNeutral": "t_j5va_histNeutral",
|
|
90
|
-
"
|
|
72
|
+
"pwHistBox": "t_j5va_pwHistBox",
|
|
73
|
+
"bulkBar": "t_j5va_bulkBar",
|
|
74
|
+
"reportBox": "t_j5va_reportBox",
|
|
75
|
+
"histLink": "t_j5va_histLink",
|
|
91
76
|
"modeReadonly": "t_j5va_modeReadonly",
|
|
92
|
-
"
|
|
77
|
+
"lockedBanner": "t_j5va_lockedBanner",
|
|
78
|
+
"healthBar": "t_j5va_healthBar",
|
|
79
|
+
"selectActive": "t_j5va_selectActive",
|
|
80
|
+
"moreButton": "t_j5va_moreButton",
|
|
81
|
+
"emptyBox": "t_j5va_emptyBox",
|
|
82
|
+
"healthSummary": "t_j5va_healthSummary",
|
|
93
83
|
"checkField": "t_j5va_checkField",
|
|
94
|
-
"reportLine": "t_j5va_reportLine",
|
|
95
|
-
"reportSub": "t_j5va_reportSub",
|
|
96
|
-
"badgeDanger": "t_j5va_badgeDanger",
|
|
97
|
-
"dangerButton": "t_j5va_dangerButton",
|
|
98
|
-
"uriCode": "t_j5va_uriCode",
|
|
99
|
-
"tabPane": "t_j5va_tabPane",
|
|
100
|
-
"searchBox": "t_j5va_searchBox",
|
|
101
|
-
"status": "t_j5va_status",
|
|
102
|
-
"pwFair": "t_j5va_pwFair",
|
|
103
|
-
"actionPrimary": "t_j5va_actionPrimary",
|
|
104
84
|
"badgeOk": "t_j5va_badgeOk",
|
|
105
|
-
"
|
|
106
|
-
"
|
|
85
|
+
"actionPrimary": "t_j5va_actionPrimary",
|
|
86
|
+
"moreWrap": "t_j5va_moreWrap",
|
|
87
|
+
"totpRing": "t_j5va_totpRing",
|
|
88
|
+
"status": "t_j5va_status",
|
|
89
|
+
"secretField": "t_j5va_secretField",
|
|
90
|
+
"backupButton": "t_j5va_backupButton",
|
|
91
|
+
"revealButton": "t_j5va_revealButton",
|
|
107
92
|
"genOptRow": "t_j5va_genOptRow",
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
93
|
+
"rowExpired": "t_j5va_rowExpired",
|
|
94
|
+
"srOnly": "t_j5va_srOnly",
|
|
95
|
+
"pwMeter": "t_j5va_pwMeter",
|
|
96
|
+
"pwStrong": "t_j5va_pwStrong",
|
|
97
|
+
"kindChip": "t_j5va_kindChip",
|
|
98
|
+
"auditRow": "t_j5va_auditRow",
|
|
99
|
+
"rowCheck": "t_j5va_rowCheck",
|
|
100
|
+
"badgeDanger": "t_j5va_badgeDanger",
|
|
101
|
+
"footer": "t_j5va_footer",
|
|
102
|
+
"histUpdate": "t_j5va_histUpdate",
|
|
103
|
+
"uriCode": "t_j5va_uriCode",
|
|
104
|
+
"reportSub": "t_j5va_reportSub",
|
|
105
|
+
"modeAuto": "t_j5va_modeAuto",
|
|
106
|
+
"genHist": "t_j5va_genHist",
|
|
107
|
+
"tabs": "t_j5va_tabs",
|
|
108
|
+
"pwBar": "t_j5va_pwBar",
|
|
109
|
+
"saveButton": "t_j5va_saveButton",
|
|
110
|
+
"copied": "t_j5va_copied",
|
|
111
|
+
"policyBar": "t_j5va_policyBar",
|
|
112
|
+
"editorBody": "t_j5va_editorBody",
|
|
118
113
|
"dupNames": "t_j5va_dupNames",
|
|
114
|
+
"editorActions": "t_j5va_editorActions",
|
|
115
|
+
"rowActions": "t_j5va_rowActions",
|
|
119
116
|
"pwLabel": "t_j5va_pwLabel",
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
117
|
+
"badge": "t_j5va_badge",
|
|
118
|
+
"resultCount": "t_j5va_resultCount",
|
|
119
|
+
"tabActive": "t_j5va_tabActive",
|
|
120
|
+
"rowMain": "t_j5va_rowMain",
|
|
121
|
+
"highBadge": "t_j5va_highBadge",
|
|
122
|
+
"pinStar": "t_j5va_pinStar",
|
|
123
|
+
"detailBox": "t_j5va_detailBox",
|
|
124
|
+
"scoreRing": "t_j5va_scoreRing"
|
|
125
125
|
};
|
|
126
126
|
//#endregion
|
|
127
127
|
//#region src/client/VaultSection.tsx
|
|
@@ -1745,6 +1745,23 @@ window.__ModuleLoader__.load({
|
|
|
1745
1745
|
if (secs < 86400) return `${Math.floor(secs / 3600)}h`;
|
|
1746
1746
|
return `${Math.floor(secs / 86400)}d`;
|
|
1747
1747
|
}
|
|
1748
|
+
/** Card-expiry reminder badge: "卡到期 MM/YY" when within 3 months or past.
|
|
1749
|
+
* Returns '' when there is no expiry or it is far away. */
|
|
1750
|
+
function cardExpiryBadge(entry) {
|
|
1751
|
+
const raw = entry.cardExpiry;
|
|
1752
|
+
if (raw === void 0 || raw === "") return "";
|
|
1753
|
+
const m = /^(\d{2})\/(\d{2,4})$/.exec(raw.trim());
|
|
1754
|
+
if (!m) return "";
|
|
1755
|
+
const month = Number(m[1]) - 1;
|
|
1756
|
+
const year = Number(m[2]) + (m[2].length === 2 ? 2e3 : 0);
|
|
1757
|
+
const end = new Date(year, month + 1, 0, 23, 59, 59);
|
|
1758
|
+
if (Number.isNaN(end.getTime())) return "";
|
|
1759
|
+
const now = Date.now();
|
|
1760
|
+
const monthsLeft = (end.getTime() - now) / (720 * 3600 * 1e3);
|
|
1761
|
+
if (end.getTime() < now) return t("cardExpired") + " " + raw.trim();
|
|
1762
|
+
if (monthsLeft <= 3) return t("cardExpiring") + " " + raw.trim();
|
|
1763
|
+
return "";
|
|
1764
|
+
}
|
|
1748
1765
|
/** Human-friendly value formatting for the expanded detail box. */
|
|
1749
1766
|
function formatDetail(key, value) {
|
|
1750
1767
|
if (key === "expiresAt" || key === "updatedAt" || key === "createdAt") {
|
|
@@ -3416,6 +3433,11 @@ window.__ModuleLoader__.load({
|
|
|
3416
3433
|
title: t("ageHint"),
|
|
3417
3434
|
children: passwordAge(entry)
|
|
3418
3435
|
}),
|
|
3436
|
+
cardExpiryBadge(entry) !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3437
|
+
className: VaultSection_module_css_default.dueBadge,
|
|
3438
|
+
title: t("cardExpiryHint"),
|
|
3439
|
+
children: cardExpiryBadge(entry)
|
|
3440
|
+
}),
|
|
3419
3441
|
watchMap[entry.id] !== void 0 && watchMap[entry.id].verdict !== "good" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3420
3442
|
className: `${VaultSection_module_css_default.dueBadge} ${watchMap[entry.id].verdict === "poor" ? VaultSection_module_css_default.badgeDanger : VaultSection_module_css_default.badgeWarn}`,
|
|
3421
3443
|
title: t("watchFlagsTitle") + watchMap[entry.id].flags.join(", "),
|
|
@@ -4011,27 +4033,56 @@ window.__ModuleLoader__.load({
|
|
|
4011
4033
|
favorite: event.target.checked
|
|
4012
4034
|
}))
|
|
4013
4035
|
}), t("favoriteHint")]
|
|
4014
|
-
}) : field.key === "
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4036
|
+
}) : field.key === "cardNumber" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4037
|
+
type: "text",
|
|
4038
|
+
inputMode: "numeric",
|
|
4039
|
+
placeholder: "4111 1111 1111 1111",
|
|
4040
|
+
value: (form.cardNumber ?? "").replace(/(.{4})/g, "$1 ").trim(),
|
|
4041
|
+
onChange: (event) => {
|
|
4042
|
+
const digits = event.target.value.replace(/\D/g, "").slice(0, 19);
|
|
4043
|
+
setForm((previous) => ({
|
|
4020
4044
|
...previous,
|
|
4021
|
-
|
|
4022
|
-
}))
|
|
4023
|
-
}
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4045
|
+
cardNumber: digits
|
|
4046
|
+
}));
|
|
4047
|
+
}
|
|
4048
|
+
}) : field.key === "cardExpiry" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4049
|
+
type: "text",
|
|
4050
|
+
inputMode: "numeric",
|
|
4051
|
+
placeholder: "MM/YY",
|
|
4052
|
+
maxLength: 5,
|
|
4053
|
+
value: form.cardExpiry ?? "",
|
|
4054
|
+
onChange: (event) => {
|
|
4055
|
+
let raw = event.target.value.replace(/\D/g, "").slice(0, 4);
|
|
4056
|
+
if (raw.length >= 3) raw = raw.slice(0, 2) + "/" + raw.slice(2);
|
|
4057
|
+
setForm((previous) => ({
|
|
4058
|
+
...previous,
|
|
4059
|
+
cardExpiry: raw
|
|
4060
|
+
}));
|
|
4061
|
+
}
|
|
4062
|
+
}) : field.key === "cardCvv" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4063
|
+
type: "text",
|
|
4064
|
+
inputMode: "numeric",
|
|
4065
|
+
placeholder: "123",
|
|
4066
|
+
maxLength: 4,
|
|
4067
|
+
value: form.cardCvv ?? "",
|
|
4068
|
+
onChange: (event) => setForm((previous) => ({
|
|
4069
|
+
...previous,
|
|
4070
|
+
cardCvv: event.target.value.replace(/\D/g, "").slice(0, 4)
|
|
4071
|
+
}))
|
|
4072
|
+
}) : field.key === "cardHolder" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4073
|
+
type: "text",
|
|
4074
|
+
value: form.cardHolder ?? "",
|
|
4075
|
+
onChange: (event) => setForm((previous) => ({
|
|
4076
|
+
...previous,
|
|
4077
|
+
cardHolder: event.target.value
|
|
4078
|
+
}))
|
|
4079
|
+
}) : field.key === "username" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4080
|
+
type: "text",
|
|
4081
|
+
value: form[field.key] ?? "",
|
|
4082
|
+
onChange: (event) => setForm((previous) => ({
|
|
4083
|
+
...previous,
|
|
4084
|
+
[field.key]: event.target.value
|
|
4085
|
+
}))
|
|
4035
4086
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4036
4087
|
type: "text",
|
|
4037
4088
|
value: form[field.key] ?? "",
|
|
@@ -4303,6 +4354,9 @@ window.__ModuleLoader__.load({
|
|
|
4303
4354
|
lockedMsg: "Vault locked — unlock with vault_unlock",
|
|
4304
4355
|
ageToday: "new",
|
|
4305
4356
|
ageHint: "Updated days ago (password age)",
|
|
4357
|
+
cardExpired: "Card expired",
|
|
4358
|
+
cardExpiring: "Card expires",
|
|
4359
|
+
cardExpiryHint: "Card expiry reminder",
|
|
4306
4360
|
watchPoor: "⚠ high risk",
|
|
4307
4361
|
watchWarn: "⚠ attention",
|
|
4308
4362
|
watchScore: "{n}",
|
|
@@ -4663,6 +4717,9 @@ window.__ModuleLoader__.load({
|
|
|
4663
4717
|
lockedMsg: "保险库已锁定 —— 使用 vault_unlock 解锁",
|
|
4664
4718
|
ageToday: "新",
|
|
4665
4719
|
ageHint: "距上次更新天数(密码年龄)",
|
|
4720
|
+
cardExpired: "卡已过期",
|
|
4721
|
+
cardExpiring: "卡将到期",
|
|
4722
|
+
cardExpiryHint: "卡到期提醒",
|
|
4666
4723
|
watchPoor: "⚠ 高风险",
|
|
4667
4724
|
watchWarn: "⚠ 需关注",
|
|
4668
4725
|
watchScore: "{n}",
|