dsh-vault 1.10.0 → 1.10.2-rc.1

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 CHANGED
@@ -17,111 +17,111 @@ window.__ModuleLoader__.load({
17
17
  document.head.appendChild(tag);
18
18
  }
19
19
  var VaultSection_module_css_default = {
20
- "tabs": "t_j5va_tabs",
21
- "kindChip": "t_j5va_kindChip",
22
- "clearButton": "t_j5va_clearButton",
23
- "pwStrong": "t_j5va_pwStrong",
24
- "tabActive": "t_j5va_tabActive",
25
- "genHist": "t_j5va_genHist",
20
+ "rowActions": "t_j5va_rowActions",
26
21
  "pwHistTime": "t_j5va_pwHistTime",
27
- "emptyBox": "t_j5va_emptyBox",
28
- "bulkBar": "t_j5va_bulkBar",
29
- "totpRing": "t_j5va_totpRing",
30
- "revealButton": "t_j5va_revealButton",
31
- "reportBox": "t_j5va_reportBox",
32
- "rowDue": "t_j5va_rowDue",
33
- "saveButton": "t_j5va_saveButton",
34
- "deleteButton": "t_j5va_deleteButton",
35
- "identity": "t_j5va_identity",
36
- "rowMain": "t_j5va_rowMain",
37
- "editorBody": "t_j5va_editorBody",
38
22
  "detailBox": "t_j5va_detailBox",
39
- "dupGroup": "t_j5va_dupGroup",
40
- "row": "t_j5va_row",
41
- "modeAuto": "t_j5va_modeAuto",
42
- "kindFilter": "t_j5va_kindFilter",
43
- "kindIcon": "t_j5va_kindIcon",
44
- "rowSelected": "t_j5va_rowSelected",
45
- "auditIssues": "t_j5va_auditIssues",
46
- "lockedTag": "t_j5va_lockedTag",
47
- "tab": "t_j5va_tab",
48
- "retryButton": "t_j5va_retryButton",
49
- "policyBar": "t_j5va_policyBar",
50
- "dangerButton": "t_j5va_dangerButton",
51
- "emptyHint": "t_j5va_emptyHint",
52
- "rowActions": "t_j5va_rowActions",
53
- "modeAsk": "t_j5va_modeAsk",
54
- "highBadge": "t_j5va_highBadge",
55
- "checkField": "t_j5va_checkField",
56
- "trashButton": "t_j5va_trashButton",
57
- "searchBox": "t_j5va_searchBox",
58
- "section": "t_j5va_section",
59
- "title": "t_j5va_title",
23
+ "pwWeak": "t_j5va_pwWeak",
24
+ "backupButton": "t_j5va_backupButton",
25
+ "pwFair": "t_j5va_pwFair",
26
+ "pwLabel": "t_j5va_pwLabel",
60
27
  "scoreRing": "t_j5va_scoreRing",
61
- "healthBar": "t_j5va_healthBar",
62
- "copied": "t_j5va_copied",
63
- "badge": "t_j5va_badge",
64
28
  "selectActive": "t_j5va_selectActive",
65
- "editorActions": "t_j5va_editorActions",
66
- "field": "t_j5va_field",
29
+ "rowSelected": "t_j5va_rowSelected",
30
+ "moreButton": "t_j5va_moreButton",
31
+ "searchBox": "t_j5va_searchBox",
32
+ "modeReadonly": "t_j5va_modeReadonly",
33
+ "moreMenu": "t_j5va_moreMenu",
34
+ "emptyBox": "t_j5va_emptyBox",
35
+ "clearButton": "t_j5va_clearButton",
36
+ "rowExpired": "t_j5va_rowExpired",
37
+ "dupNames": "t_j5va_dupNames",
38
+ "dueBadge": "t_j5va_dueBadge",
39
+ "auditIssues": "t_j5va_auditIssues",
67
40
  "histAdd": "t_j5va_histAdd",
68
- "badgeDanger": "t_j5va_badgeDanger",
69
- "footer": "t_j5va_footer",
70
- "lockedBanner": "t_j5va_lockedBanner",
71
- "pwBar": "t_j5va_pwBar",
72
- "srOnly": "t_j5va_srOnly",
41
+ "pwMeter": "t_j5va_pwMeter",
42
+ "bulkItem": "t_j5va_bulkItem",
43
+ "identity": "t_j5va_identity",
44
+ "deleteButton": "t_j5va_deleteButton",
45
+ "totpRing": "t_j5va_totpRing",
73
46
  "editor": "t_j5va_editor",
74
- "pwHistPwd": "t_j5va_pwHistPwd",
75
- "detailItem": "t_j5va_detailItem",
76
- "list": "t_j5va_list",
77
- "reportTitle": "t_j5va_reportTitle",
78
- "reportLine": "t_j5va_reportLine",
47
+ "bulkBar": "t_j5va_bulkBar",
48
+ "modeAsk": "t_j5va_modeAsk",
49
+ "actionPrimary": "t_j5va_actionPrimary",
79
50
  "reportSub": "t_j5va_reportSub",
51
+ "badgeOk": "t_j5va_badgeOk",
52
+ "dangerButton": "t_j5va_dangerButton",
80
53
  "pinOn": "t_j5va_pinOn",
81
- "intro": "t_j5va_intro",
82
- "dupNames": "t_j5va_dupNames",
83
- "auditRow": "t_j5va_auditRow",
84
- "genOptRow": "t_j5va_genOptRow",
85
- "uriCode": "t_j5va_uriCode",
54
+ "histNeutral": "t_j5va_histNeutral",
55
+ "emptyHint": "t_j5va_emptyHint",
56
+ "healthBar": "t_j5va_healthBar",
57
+ "rowDue": "t_j5va_rowDue",
58
+ "pwStrong": "t_j5va_pwStrong",
59
+ "modeAuto": "t_j5va_modeAuto",
60
+ "dupGroup": "t_j5va_dupGroup",
61
+ "genHist": "t_j5va_genHist",
62
+ "tabs": "t_j5va_tabs",
63
+ "section": "t_j5va_section",
86
64
  "secretField": "t_j5va_secretField",
87
- "pwLabel": "t_j5va_pwLabel",
88
- "backupButton": "t_j5va_backupButton",
65
+ "pwBar": "t_j5va_pwBar",
66
+ "kindChip": "t_j5va_kindChip",
67
+ "tabPane": "t_j5va_tabPane",
68
+ "status": "t_j5va_status",
89
69
  "histDanger": "t_j5va_histDanger",
90
- "rowExpired": "t_j5va_rowExpired",
70
+ "histLink": "t_j5va_histLink",
91
71
  "rowCheck": "t_j5va_rowCheck",
92
- "moreButton": "t_j5va_moreButton",
93
- "moreMenu": "t_j5va_moreMenu",
72
+ "list": "t_j5va_list",
73
+ "lockedTag": "t_j5va_lockedTag",
74
+ "rowMain": "t_j5va_rowMain",
75
+ "kindIcon": "t_j5va_kindIcon",
76
+ "saveButton": "t_j5va_saveButton",
77
+ "kindFilter": "t_j5va_kindFilter",
94
78
  "moreWrap": "t_j5va_moreWrap",
95
- "healthSummary": "t_j5va_healthSummary",
96
- "modeReadonly": "t_j5va_modeReadonly",
79
+ "error": "t_j5va_error",
80
+ "highBadge": "t_j5va_highBadge",
81
+ "pwHistPwd": "t_j5va_pwHistPwd",
82
+ "intro": "t_j5va_intro",
83
+ "detailItem": "t_j5va_detailItem",
97
84
  "resultCount": "t_j5va_resultCount",
85
+ "auditRow": "t_j5va_auditRow",
86
+ "reportBox": "t_j5va_reportBox",
87
+ "genOptRow": "t_j5va_genOptRow",
88
+ "field": "t_j5va_field",
89
+ "lockedBanner": "t_j5va_lockedBanner",
90
+ "checkField": "t_j5va_checkField",
98
91
  "pwHistRow": "t_j5va_pwHistRow",
99
- "addButton": "t_j5va_addButton",
100
- "pwHistBox": "t_j5va_pwHistBox",
101
- "badgeOk": "t_j5va_badgeOk",
102
- "bulkItem": "t_j5va_bulkItem",
92
+ "policyBar": "t_j5va_policyBar",
93
+ "footer": "t_j5va_footer",
94
+ "retryButton": "t_j5va_retryButton",
95
+ "genOpts": "t_j5va_genOpts",
96
+ "editorBody": "t_j5va_editorBody",
97
+ "reportLine": "t_j5va_reportLine",
103
98
  "sortButton": "t_j5va_sortButton",
104
- "bulkCount": "t_j5va_bulkCount",
105
- "histNeutral": "t_j5va_histNeutral",
99
+ "tab": "t_j5va_tab",
100
+ "badgeWarn": "t_j5va_badgeWarn",
101
+ "tabActive": "t_j5va_tabActive",
106
102
  "empty": "t_j5va_empty",
107
- "histLink": "t_j5va_histLink",
108
- "error": "t_j5va_error",
103
+ "revealButton": "t_j5va_revealButton",
109
104
  "histUpdate": "t_j5va_histUpdate",
110
- "actionPrimary": "t_j5va_actionPrimary",
111
- "badgeWarn": "t_j5va_badgeWarn",
105
+ "editorActions": "t_j5va_editorActions",
106
+ "healthSummary": "t_j5va_healthSummary",
107
+ "trashButton": "t_j5va_trashButton",
108
+ "uriCode": "t_j5va_uriCode",
112
109
  "totp": "t_j5va_totp",
113
- "policyField": "t_j5va_policyField",
114
- "dueBadge": "t_j5va_dueBadge",
115
- "dupMerge": "t_j5va_dupMerge",
116
- "tabPane": "t_j5va_tabPane",
117
- "pwMeter": "t_j5va_pwMeter",
118
- "genOpts": "t_j5va_genOpts",
119
- "pwWeak": "t_j5va_pwWeak",
110
+ "badgeDanger": "t_j5va_badgeDanger",
111
+ "bulkCount": "t_j5va_bulkCount",
112
+ "srOnly": "t_j5va_srOnly",
120
113
  "pinStar": "t_j5va_pinStar",
114
+ "badge": "t_j5va_badge",
115
+ "copied": "t_j5va_copied",
116
+ "toolbar": "t_j5va_toolbar",
117
+ "row": "t_j5va_row",
118
+ "pwHistBox": "t_j5va_pwHistBox",
121
119
  "pinOff": "t_j5va_pinOff",
122
- "status": "t_j5va_status",
123
- "pwFair": "t_j5va_pwFair",
124
- "toolbar": "t_j5va_toolbar"
120
+ "dupMerge": "t_j5va_dupMerge",
121
+ "reportTitle": "t_j5va_reportTitle",
122
+ "title": "t_j5va_title",
123
+ "policyField": "t_j5va_policyField",
124
+ "addButton": "t_j5va_addButton"
125
125
  };
126
126
  //#endregion
127
127
  //#region src/client/VaultSection.tsx
@@ -1365,6 +1365,25 @@ window.__ModuleLoader__.load({
1365
1365
  totpMap,
1366
1366
  totp
1367
1367
  ]);
1368
+ (0, react.useEffect)(() => {
1369
+ if (state.status !== "ready") return;
1370
+ const targets = state.entries.filter((e) => e.hasOtp === true).filter((e) => {
1371
+ const info = totpMap[e.id];
1372
+ return info === void 0 || info.until <= 0 || info.code === t("error");
1373
+ }).slice(0, 25);
1374
+ for (const e of targets) totp(e.id).then((result) => setTotpMap((previous) => ({
1375
+ ...previous,
1376
+ [e.id]: {
1377
+ code: result.code,
1378
+ until: Date.now() + result.secondsRemaining * 1e3
1379
+ }
1380
+ })), () => {});
1381
+ }, [
1382
+ state.status === "ready" ? state.entries : null,
1383
+ totpMap,
1384
+ totp,
1385
+ t
1386
+ ]);
1368
1387
  (0, react.useEffect)(() => {
1369
1388
  if (expandedId === null) return;
1370
1389
  let current = true;
@@ -1670,7 +1689,24 @@ window.__ModuleLoader__.load({
1670
1689
  setBusy(false);
1671
1690
  }
1672
1691
  }
1673
- /** Copy a field value to the clipboard and flash the row. */
1692
+ /** Export the audit log (respecting the current filter) as a CSV file. */
1693
+ function exportAuditLog() {
1694
+ const rows = recentEvents.filter((ev) => auditFilter === "" || String(ev.action ?? "") === auditFilter).map((ev) => {
1695
+ const ts = Number(ev.at);
1696
+ const when = Number.isFinite(ts) && ts > 0 ? new Date(ts).toLocaleString() : "";
1697
+ return `${String(ev.action ?? "")},${String(ev.title ?? ev.id ?? "")},${when}`;
1698
+ });
1699
+ if (rows.length === 0) return;
1700
+ const blob = new Blob(["action,entry,time\n" + rows.join("\n")], { type: "text/csv;charset=utf-8" });
1701
+ const url = URL.createObjectURL(blob);
1702
+ const a = document.createElement("a");
1703
+ a.href = url;
1704
+ a.download = `dsh-vault-audit-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`;
1705
+ document.body.appendChild(a);
1706
+ a.click();
1707
+ a.remove();
1708
+ URL.revokeObjectURL(url);
1709
+ }
1674
1710
  const clipboardTimer = (0, react.useRef)(null);
1675
1711
  const CLIPBOARD_CLEAR_MS = 3e4;
1676
1712
  async function copyValue(id, value) {
@@ -3175,9 +3211,9 @@ window.__ModuleLoader__.load({
3175
3211
  className: VaultSection_module_css_default.reportTitle,
3176
3212
  children: t("recentActivity")
3177
3213
  }),
3178
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3214
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3179
3215
  className: VaultSection_module_css_default.toolbar,
3180
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
3216
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
3181
3217
  className: VaultSection_module_css_default.kindFilter,
3182
3218
  value: auditFilter,
3183
3219
  onChange: (e) => setAuditFilter(e.target.value),
@@ -3204,7 +3240,13 @@ window.__ModuleLoader__.load({
3204
3240
  children: t("auditRestore")
3205
3241
  })
3206
3242
  ]
3207
- })
3243
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3244
+ type: "button",
3245
+ className: VaultSection_module_css_default.dupMerge,
3246
+ onClick: exportAuditLog,
3247
+ disabled: recentEvents.length === 0,
3248
+ children: t("auditExport")
3249
+ })]
3208
3250
  }),
3209
3251
  recentEvents.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3210
3252
  className: VaultSection_module_css_default.empty,
@@ -3457,8 +3499,9 @@ window.__ModuleLoader__.load({
3457
3499
  children: uriMap[entry.id]
3458
3500
  })
3459
3501
  }),
3460
- code !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3502
+ entry.hasOtp === true && code !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3461
3503
  className: VaultSection_module_css_default.totp,
3504
+ title: t("totpInlineHint"),
3462
3505
  children: [
3463
3506
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
3464
3507
  className: VaultSection_module_css_default.totpRing,
@@ -4453,6 +4496,7 @@ window.__ModuleLoader__.load({
4453
4496
  auditDelete: "Delete",
4454
4497
  auditRestore: "Restore",
4455
4498
  auditJumpHint: "Jump to this entry",
4499
+ auditExport: "Export log",
4456
4500
  tabTrash: "Trash",
4457
4501
  sessionsIntro: "Log into any site in a real browser window, then save the session cookies here for automation (curl, requests, browser-less tools). HttpOnly cookies are captured too.",
4458
4502
  sessionUrlPrompt: "Site URL to open:",
@@ -4556,6 +4600,7 @@ window.__ModuleLoader__.load({
4556
4600
  copyCode: "Copy code",
4557
4601
  copied: "Copied",
4558
4602
  totp: "Code",
4603
+ totpInlineHint: "Current one-time password — auto-refreshes every 30 seconds. Click ⧉ to copy.",
4559
4604
  fieldTitle: "Title",
4560
4605
  fieldKind: "Kind",
4561
4606
  fieldUsername: "Username",
@@ -4816,6 +4861,7 @@ window.__ModuleLoader__.load({
4816
4861
  auditDelete: "删除",
4817
4862
  auditRestore: "恢复",
4818
4863
  auditJumpHint: "跳转到该条目",
4864
+ auditExport: "导出日志",
4819
4865
  tabTrash: "回收站",
4820
4866
  sessionsIntro: "在真实浏览器窗口中登录任意网站,然后把登录后的 session cookie 保存到这里,供自动化任务使用(curl、requests 等)。HttpOnly cookie 也能捕获。",
4821
4867
  sessionUrlPrompt: "要打开的网站地址:",
@@ -4919,6 +4965,7 @@ window.__ModuleLoader__.load({
4919
4965
  copyCode: "复制验证码",
4920
4966
  copied: "已复制",
4921
4967
  totp: "验证码",
4968
+ totpInlineHint: "当前一次性验证码, 每 30 秒自动刷新。点击 ⧉ 复制。",
4922
4969
  fieldTitle: "标题",
4923
4970
  fieldKind: "类型",
4924
4971
  fieldUsername: "用户名",