@mysterycode-liwen/dsh-credential-vault 1.5.1 → 1.5.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/README.md +7 -1
- package/client.js +92 -14
- package/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,6 +126,12 @@ Host 侧工具在 Harness 启动时注册。重启 Harness,或在插件管理
|
|
|
126
126
|
|
|
127
127
|
## 更新日志 / Changelog
|
|
128
128
|
|
|
129
|
+
### 1.5.2 — 2026-11-28 — 账号关联凭据与类型改名
|
|
130
|
+
|
|
131
|
+
- **账号可关联其它凭据**:账号类型新增「关联凭据」字段,编辑时多选已有的 API Key / 密钥 / 其他凭据(不含账号自身);卡片上以可点击标签展示,点击直接跳转定位。
|
|
132
|
+
- **关联无损**:关联关系随 JSON / CSV / Markdown 三格式无损导回(显示为 `标题(id)`),删除凭据时自动清理其它条目对它的引用,不留死链。
|
|
133
|
+
- **「通用密钥」改名为「密钥」**:界面显示名全部更新,内部类型 key 保持 `secretKey`;旧导出文件中的「通用密钥」标签仍兼容识别。
|
|
134
|
+
|
|
129
135
|
### 1.5.1 — 2026-11-28 — 新增「通用密钥」类型
|
|
130
136
|
|
|
131
137
|
- **新增凭据类型「通用密钥」**(`secretKey`):标题 + 密钥名称 + 密钥值 + 备注,适合保存零散的 token / secret / 口令,密钥值默认脱敏。
|
|
@@ -186,7 +192,7 @@ Host 侧工具在 Harness 启动时注册。重启 Harness,或在插件管理
|
|
|
186
192
|
npm run check # 发布前自检:client.js 的模块 id 与 cordis.patch.yml 的 name 必须等于包名
|
|
187
193
|
npm pack --dry-run # 核对实际打包的文件清单
|
|
188
194
|
npm publish # publishConfig.access = public;会先自动跑一次 npm run check,不一致则中止
|
|
189
|
-
git tag v1.
|
|
195
|
+
git tag v1.5.2 && git push --tags
|
|
190
196
|
```
|
|
191
197
|
|
|
192
198
|
`client.js` 里 `window.__ModuleLoader__.load({ id })` 的 `id` **必须等于 `package.json` 的 `name`**:DSH 按包名去浏览器模块表里查找,不一致时浏览器端不会挂载,表现为侧边栏入口与设置页整块消失(Host 端仍然正常)。改包名或改 scope 时,三处要同步:`package.json` 的 `name`、`client.js` 的 `id`、`cordis.patch.yml` 的 `name`。
|
package/client.js
CHANGED
|
@@ -15,7 +15,7 @@ window.__ModuleLoader__.load({
|
|
|
15
15
|
// whatever port the Web GUI is on.
|
|
16
16
|
var API = 'dsh-credential-vault/';
|
|
17
17
|
/** Plugin version shown in Settings; keep in sync with package.json on release. */
|
|
18
|
-
var VERSION = '1.5.
|
|
18
|
+
var VERSION = '1.5.2';
|
|
19
19
|
|
|
20
20
|
// Compare two semver-ish strings: -1 (left older), 0 (equal), 1 (left newer).
|
|
21
21
|
// Used to decide "update available" against THIS client's version, so the
|
|
@@ -62,6 +62,7 @@ window.__ModuleLoader__.load({
|
|
|
62
62
|
fExpiry: 'Expires on (optional)',
|
|
63
63
|
fContent: 'Content / secret', fContentPh: 'Recovery codes, license key, certificate, PIN…',
|
|
64
64
|
fNotes: 'Notes (optional)', fNotesPh: 'Any extra info…',
|
|
65
|
+
fLinks: 'Linked credentials', linkNone: 'No API Key / Key / Other credentials yet', linkMissing: 'Linked credential no longer exists',
|
|
65
66
|
fAppId: 'AppID', fAppIdPh: 'wx…',
|
|
66
67
|
fAppSecret: 'AppSecret', fAppSecretPh: 'Application secret',
|
|
67
68
|
fToken: 'Server Token', fTokenPh: 'Token from server config',
|
|
@@ -169,7 +170,7 @@ window.__ModuleLoader__.load({
|
|
|
169
170
|
sort: '排序', sortRecent: '最近更新', sortTitle: '名称(A–Z)', sortCategory: '类型',
|
|
170
171
|
search: '搜索名称、账号、网址或备注…',
|
|
171
172
|
filterAll: '全部', filterAccount: '账号密码', filterApikey: 'API Key', filterOther: '其他',
|
|
172
|
-
filterWechatMp: '微信公众号', filterWechatMini: '微信小程序', filterSecretKey: '
|
|
173
|
+
filterWechatMp: '微信公众号', filterWechatMini: '微信小程序', filterSecretKey: '密钥',
|
|
173
174
|
localNotice: '数据仅保存在本机浏览器的 localStorage 中,不跨设备同步、不加密,请避免在公用/共享浏览器使用。',
|
|
174
175
|
show: '显示', hide: '隐藏', copy: '复制', visit: '访问', copied: '已复制到剪贴板', copyFail: '复制失败,请手动选择文本',
|
|
175
176
|
visitFail: '无法打开浏览器,请检查网址后重试。',
|
|
@@ -191,6 +192,7 @@ window.__ModuleLoader__.load({
|
|
|
191
192
|
fExpiry: '到期日期(可选)',
|
|
192
193
|
fContent: '内容 / 密钥', fContentPh: '恢复码、许可证、证书、PIN…',
|
|
193
194
|
fNotes: '备注(可选)', fNotesPh: '其他信息…',
|
|
195
|
+
fLinks: '关联凭据', linkNone: '还没有 API Key / 密钥 / 其他凭据', linkMissing: '关联的凭据已不存在',
|
|
194
196
|
fAppId: 'AppID', fAppIdPh: 'wx…',
|
|
195
197
|
fAppSecret: 'AppSecret', fAppSecretPh: '应用密钥',
|
|
196
198
|
fToken: '服务器 Token', fTokenPh: '服务器配置里的 Token',
|
|
@@ -201,7 +203,7 @@ window.__ModuleLoader__.load({
|
|
|
201
203
|
fKeyName: '密钥名称', fKeyNamePh: '例如:访问令牌、Webhook 密钥',
|
|
202
204
|
fKeyValue: '密钥值', fKeyValuePh: '粘贴令牌 / 密钥 / 口令',
|
|
203
205
|
catAccount: '账号密码', catApikey: 'API Key', catOther: '其他',
|
|
204
|
-
catWechatMp: '微信公众号', catWechatMini: '微信小程序', catSecretKey: '
|
|
206
|
+
catWechatMp: '微信公众号', catWechatMini: '微信小程序', catSecretKey: '密钥',
|
|
205
207
|
hintAccount: '用于保存网站 / 应用的登录账号与密码。',
|
|
206
208
|
hintApikey: '用于保存平台签发的 API Key、令牌与接口地址。',
|
|
207
209
|
hintOther: '用于保存恢复码、许可证、证书等任意文本。',
|
|
@@ -303,6 +305,7 @@ window.__ModuleLoader__.load({
|
|
|
303
305
|
{ key: 'username', label: 'fAccount', ph: 'fAccountPh', type: 'text', mono: true },
|
|
304
306
|
{ key: 'password', label: 'fPassword', ph: 'fPasswordPh', type: 'secret', mono: true, generatable: true },
|
|
305
307
|
{ key: 'url', label: 'fUrl', ph: 'fUrlPh', type: 'text', isUrl: true },
|
|
308
|
+
{ key: 'links', label: 'fLinks', type: 'links' },
|
|
306
309
|
{ key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
|
|
307
310
|
],
|
|
308
311
|
apikey: [
|
|
@@ -425,6 +428,12 @@ window.__ModuleLoader__.load({
|
|
|
425
428
|
'.cv-badge-wechatMp{background:#07c160;color:#fff}',
|
|
426
429
|
'.cv-badge-wechatMini{background:#10aec2;color:#fff}',
|
|
427
430
|
'.cv-badge-secretKey{background:#8b5cf6;color:#fff}',
|
|
431
|
+
'.cv-links{margin:10px 0 2px;padding-top:8px;border-top:1px dashed var(--cv-b1)}',
|
|
432
|
+
'.cv-link-chip{display:inline-flex;align-items:center;gap:3px;margin:3px 5px 0 0;padding:4px 9px;border:1px solid var(--cv-b1);border-radius:999px;background:var(--cv-l2);color:var(--cv-brand);font-size:11.5px;cursor:pointer;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
433
|
+
'.cv-link-chip:hover{border-color:var(--cv-brand)}',
|
|
434
|
+
'.cv-link-options{max-height:170px;overflow:auto;border:1px solid var(--cv-b1);border-radius:8px;padding:6px 9px;background:var(--cv-bg)}',
|
|
435
|
+
'.cv-link-opt{display:flex;align-items:center;gap:7px;padding:4px 0;font-size:12.5px;cursor:pointer}',
|
|
436
|
+
'.cv-link-empty{font-size:12px;color:var(--cv-t2)}',
|
|
428
437
|
'.cv-card-title{font-weight:600;font-size:14.5px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
429
438
|
'.cv-card-actions{display:flex;gap:4px}',
|
|
430
439
|
'.cv-icon-btn{width:28px;height:28px;border-radius:7px;border:1px solid transparent;background:transparent;color:var(--cv-t2);cursor:pointer;font-size:14px;line-height:1;display:flex;align-items:center;justify-content:center}',
|
|
@@ -569,6 +578,17 @@ window.__ModuleLoader__.load({
|
|
|
569
578
|
if (n.provider == null && n.username) n.provider = n.username;
|
|
570
579
|
if (n.endpoint == null && n.url) n.endpoint = n.url;
|
|
571
580
|
}
|
|
581
|
+
// Links are credential IDs. Accept arrays, the human-readable "Title(id)"
|
|
582
|
+
// form used in CSV/Markdown exports, and the legacy comma-separated form.
|
|
583
|
+
if (Array.isArray(n.links)) {
|
|
584
|
+
n.links = n.links.map(function (x) { return String(x); }).filter(Boolean);
|
|
585
|
+
} else if (typeof n.links === 'string' && n.links.trim()) {
|
|
586
|
+
var ids = [], lm, lre = /[((]([^())]+)[))]/g;
|
|
587
|
+
while ((lm = lre.exec(n.links)) !== null) ids.push(lm[1].trim());
|
|
588
|
+
n.links = ids.length ? ids : n.links.split(/[,,、]/).map(function (x) { return x.trim(); }).filter(Boolean);
|
|
589
|
+
} else {
|
|
590
|
+
delete n.links;
|
|
591
|
+
}
|
|
572
592
|
return sanitize(n);
|
|
573
593
|
}
|
|
574
594
|
function loadEntries() {
|
|
@@ -596,7 +616,7 @@ window.__ModuleLoader__.load({
|
|
|
596
616
|
// Large vaults: DEBOUNCE so a burst of edits results in one POST, not dozens
|
|
597
617
|
// of multi-megabyte payloads. A trailing timer always flushes the latest data.
|
|
598
618
|
var MIRROR_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'keyName', 'url', 'endpoint', 'expiry',
|
|
599
|
-
'appId', 'serverUrl', 'domains', 'notes', 'createdAt', 'updatedAt'];
|
|
619
|
+
'appId', 'serverUrl', 'domains', 'notes', 'links', 'createdAt', 'updatedAt'];
|
|
600
620
|
var MIRROR_SECRETS = ['password', 'apiKey', 'content', 'appSecret', 'token', 'encodingAesKey', 'uploadKey', 'keyValue'];
|
|
601
621
|
function toEnvelope(entry) {
|
|
602
622
|
var out = {};
|
|
@@ -775,7 +795,7 @@ window.__ModuleLoader__.load({
|
|
|
775
795
|
}
|
|
776
796
|
var EXPORT_COLS = ['id', 'title', 'category', 'username', 'password', 'url', 'provider', 'apiKey', 'endpoint', 'expiry', 'content', 'keyName', 'keyValue',
|
|
777
797
|
'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'uploadKey', 'domains',
|
|
778
|
-
'notes', 'createdAt', 'updatedAt'];
|
|
798
|
+
'notes', 'links', 'createdAt', 'updatedAt'];
|
|
779
799
|
|
|
780
800
|
// ---- Human-readable labels ------------------------------------------------
|
|
781
801
|
// CSV/Markdown use Chinese labels for people; every label maps back to its
|
|
@@ -786,18 +806,19 @@ window.__ModuleLoader__.load({
|
|
|
786
806
|
expiry: '有效期', content: '内容', keyName: '密钥名称', keyValue: '密钥值',
|
|
787
807
|
appId: 'AppID', appSecret: 'AppSecret', token: '服务器Token', encodingAesKey: 'EncodingAESKey',
|
|
788
808
|
serverUrl: '服务器地址', uploadKey: '代码上传密钥', domains: '服务器域名',
|
|
789
|
-
notes: '备注', createdAt: '创建时间', updatedAt: '更新时间'
|
|
809
|
+
notes: '备注', links: '关联凭据', createdAt: '创建时间', updatedAt: '更新时间'
|
|
790
810
|
};
|
|
791
811
|
var LABEL_FIELDS = {};
|
|
792
812
|
Object.keys(FIELD_LABELS).forEach(function (k) { LABEL_FIELDS[FIELD_LABELS[k]] = k; });
|
|
793
|
-
var CATEGORY_LABELS = { account: '账号', apikey: 'API Key', secretKey: '
|
|
813
|
+
var CATEGORY_LABELS = { account: '账号', apikey: 'API Key', secretKey: '密钥', other: '其他', wechatMp: '微信公众号', wechatMini: '微信小程序' };
|
|
794
814
|
var LABEL_CATEGORIES = {};
|
|
795
815
|
Object.keys(CATEGORY_LABELS).forEach(function (k) { LABEL_CATEGORIES[CATEGORY_LABELS[k]] = k; });
|
|
816
|
+
LABEL_CATEGORIES['通用密钥'] = 'secretKey'; // legacy exports before the rename
|
|
796
817
|
// Only export fields that belong to the entry's type. A record may carry
|
|
797
818
|
// stale fields from a past type change (e.g. an API Key with leftover
|
|
798
819
|
// username/password/url); those must not leak into readable exports.
|
|
799
820
|
var VISIBLE_FIELDS = {
|
|
800
|
-
account: ['title', 'username', 'password', 'url', 'notes'],
|
|
821
|
+
account: ['title', 'username', 'password', 'url', 'links', 'notes'],
|
|
801
822
|
apikey: ['title', 'provider', 'apiKey', 'endpoint', 'expiry', 'notes'],
|
|
802
823
|
secretKey: ['title', 'keyName', 'keyValue', 'notes'],
|
|
803
824
|
other: ['title', 'content', 'notes'],
|
|
@@ -829,12 +850,20 @@ window.__ModuleLoader__.load({
|
|
|
829
850
|
var d = new Date(Number(v));
|
|
830
851
|
return isNaN(d.getTime()) ? String(v) : d.toISOString();
|
|
831
852
|
}
|
|
853
|
+
// Render links as "Linked title(id)" so exports stay readable AND re-importable.
|
|
854
|
+
function formatLinks(links, arr) {
|
|
855
|
+
if (!Array.isArray(links) || !links.length) return '';
|
|
856
|
+
return links.map(function (id) {
|
|
857
|
+
var target = arr.filter(function (x) { return x.id === id; })[0];
|
|
858
|
+
return target && target.title ? target.title + '(' + id + ')' : String(id);
|
|
859
|
+
}).join('、');
|
|
860
|
+
}
|
|
832
861
|
// CSV shows the fields people actually read first; technical columns
|
|
833
862
|
// (ID / timestamps) go last. Import maps by header label, so order is safe.
|
|
834
863
|
var CSV_COLS = ['title', 'category', 'username', 'password', 'url', 'provider',
|
|
835
864
|
'apiKey', 'endpoint', 'expiry', 'content', 'keyName', 'keyValue',
|
|
836
865
|
'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'uploadKey', 'domains',
|
|
837
|
-
'notes', 'id', 'createdAt', 'updatedAt'];
|
|
866
|
+
'notes', 'links', 'id', 'createdAt', 'updatedAt'];
|
|
838
867
|
function buildCsv(arr) {
|
|
839
868
|
var lines = [CSV_COLS.map(function (c) { return csvEscape(FIELD_LABELS[c] || c); }).join(',')];
|
|
840
869
|
arr.forEach(function (e) {
|
|
@@ -845,6 +874,7 @@ window.__ModuleLoader__.load({
|
|
|
845
874
|
// do not belong to this type are left blank.
|
|
846
875
|
if (visible.indexOf(c) < 0 && c !== 'id' && c !== 'category' && c !== 'createdAt' && c !== 'updatedAt') return '';
|
|
847
876
|
var v = (c === 'createdAt' || c === 'updatedAt') ? csvDate(n[c]) : n[c];
|
|
877
|
+
if (c === 'links') v = formatLinks(n.links, arr);
|
|
848
878
|
if (c === 'category') v = CATEGORY_LABELS[v] || v;
|
|
849
879
|
return csvEscape(v);
|
|
850
880
|
}).join(','));
|
|
@@ -959,6 +989,7 @@ window.__ModuleLoader__.load({
|
|
|
959
989
|
fieldsFor(n.category).forEach(function (c) {
|
|
960
990
|
if (c === 'title') return;
|
|
961
991
|
var v = n[c];
|
|
992
|
+
if (c === 'links') v = formatLinks(n.links, arr);
|
|
962
993
|
if (v == null || v === '') return;
|
|
963
994
|
lines.push('| ' + (FIELD_LABELS[c] || c) + ' | ' + mdCell(v) + ' |');
|
|
964
995
|
});
|
|
@@ -1298,6 +1329,7 @@ window.__ModuleLoader__.load({
|
|
|
1298
1329
|
username: '', password: '', url: '',
|
|
1299
1330
|
provider: '', apiKey: '', endpoint: '', expiry: '',
|
|
1300
1331
|
content: '', keyName: '', keyValue: '',
|
|
1332
|
+
links: [],
|
|
1301
1333
|
appId: '', appSecret: '', token: '', encodingAesKey: '', serverUrl: '', uploadKey: '', domains: '',
|
|
1302
1334
|
notes: ''
|
|
1303
1335
|
};
|
|
@@ -1364,6 +1396,15 @@ window.__ModuleLoader__.load({
|
|
|
1364
1396
|
var cat = e.category || 'account';
|
|
1365
1397
|
var catMeta = CATEGORIES.filter(function (c) { return c.k === cat; })[0];
|
|
1366
1398
|
var catLabel = catMeta ? t(catMeta.label) : t('catAccount');
|
|
1399
|
+
var linkChips = Array.isArray(e.links) && e.links.length ? e.links.map(function (id) {
|
|
1400
|
+
var target = (props.entries || []).filter(function (x) { return x.id === id; })[0];
|
|
1401
|
+
if (!target) return null;
|
|
1402
|
+
var tc = CATEGORIES.filter(function (c) { return c.k === target.category; })[0];
|
|
1403
|
+
return h('button', {
|
|
1404
|
+
key: id, className: 'cv-link-chip', title: target.title,
|
|
1405
|
+
onClick: function () { props.onGo(id); }
|
|
1406
|
+
}, '🔗 ' + target.title + (tc ? ' · ' + t(tc.label) : ''));
|
|
1407
|
+
}).filter(Boolean) : [];
|
|
1367
1408
|
return h('div', { className: 'cv-card' },
|
|
1368
1409
|
h('div', { className: 'cv-card-head' },
|
|
1369
1410
|
h('span', { className: 'cv-badge cv-badge-' + cat }, catLabel),
|
|
@@ -1375,13 +1416,16 @@ window.__ModuleLoader__.load({
|
|
|
1375
1416
|
),
|
|
1376
1417
|
h('div', { className: 'cv-card-body' },
|
|
1377
1418
|
schemaOf(cat).slice(1).map(function (f) {
|
|
1419
|
+
if (f.key === 'links') return null;
|
|
1378
1420
|
if (!e[f.key]) return null;
|
|
1379
1421
|
return h(Field, {
|
|
1380
1422
|
key: f.key, t: t, label: f.label, value: e[f.key],
|
|
1381
1423
|
mono: !!f.mono, secret: isSecretField(f), multiline: isMultilineField(f), isUrl: !!f.isUrl,
|
|
1382
1424
|
revealed: !!props.revealed, onToggle: props.onToggle, onCopy: props.onCopy, onVisit: props.onVisit
|
|
1383
1425
|
});
|
|
1384
|
-
})
|
|
1426
|
+
}),
|
|
1427
|
+
linkChips.length ? h('div', { className: 'cv-links' },
|
|
1428
|
+
h('div', { className: 'cv-field-label' }, t('fLinks')), linkChips) : null
|
|
1385
1429
|
)
|
|
1386
1430
|
);
|
|
1387
1431
|
}
|
|
@@ -1395,7 +1439,7 @@ window.__ModuleLoader__.load({
|
|
|
1395
1439
|
|
|
1396
1440
|
// Only the essential fields show by default; the rest fold behind a
|
|
1397
1441
|
// "More fields" toggle so short forms stay short and long forms compact.
|
|
1398
|
-
var PRIMARY_KEYS = { title: 1, username: 1, password: 1, apiKey: 1, appId: 1, appSecret: 1, content: 1, keyName: 1, keyValue: 1 };
|
|
1442
|
+
var PRIMARY_KEYS = { title: 1, username: 1, password: 1, apiKey: 1, appId: 1, appSecret: 1, content: 1, keyName: 1, keyValue: 1, links: 1 };
|
|
1399
1443
|
var primary = fields.filter(function (f) { return PRIMARY_KEYS[f.key]; });
|
|
1400
1444
|
var secondary = fields.filter(function (f) { return !PRIMARY_KEYS[f.key]; });
|
|
1401
1445
|
var hasSecondary = secondary.some(function (f) { return !!d[f.key]; });
|
|
@@ -1410,11 +1454,32 @@ window.__ModuleLoader__.load({
|
|
|
1410
1454
|
}, extra || {});
|
|
1411
1455
|
}
|
|
1412
1456
|
// Multiline fields and long values get a full row; everything else pairs up.
|
|
1413
|
-
var WIDE_KEYS = { content: 1, notes: 1, endpoint: 1, serverUrl: 1, uploadKey: 1, domains: 1, encodingAesKey: 1 };
|
|
1457
|
+
var WIDE_KEYS = { content: 1, notes: 1, endpoint: 1, serverUrl: 1, uploadKey: 1, domains: 1, encodingAesKey: 1, links: 1 };
|
|
1414
1458
|
function isWide(f) { return f.type === 'textarea' || f.type === 'secretarea' || !!WIDE_KEYS[f.key]; }
|
|
1415
1459
|
function renderField(f) {
|
|
1416
1460
|
var control;
|
|
1417
|
-
if (f.type === '
|
|
1461
|
+
if (f.type === 'links') {
|
|
1462
|
+
var candidates = (props.entries || []).filter(function (x) {
|
|
1463
|
+
return x.id !== d.id && ['apikey', 'secretKey', 'other'].indexOf(x.category) >= 0;
|
|
1464
|
+
});
|
|
1465
|
+
var selected = Array.isArray(d.links) ? d.links : [];
|
|
1466
|
+
control = h('div', { className: 'cv-link-options' },
|
|
1467
|
+
candidates.length ? candidates.map(function (x) {
|
|
1468
|
+
var checked = selected.indexOf(x.id) >= 0;
|
|
1469
|
+
var cm = CATEGORIES.filter(function (c) { return c.k === x.category; })[0];
|
|
1470
|
+
return h('label', { key: x.id, className: 'cv-link-opt' },
|
|
1471
|
+
h('input', {
|
|
1472
|
+
type: 'checkbox', checked: checked,
|
|
1473
|
+
onChange: function () {
|
|
1474
|
+
var next = checked ? selected.filter(function (lid) { return lid !== x.id; }) : selected.concat([x.id]);
|
|
1475
|
+
onChange('links', next);
|
|
1476
|
+
}
|
|
1477
|
+
}),
|
|
1478
|
+
h('span', null, x.title + (cm ? ' · ' + t(cm.label) : ''))
|
|
1479
|
+
);
|
|
1480
|
+
}) : h('span', { className: 'cv-link-empty' }, t('linkNone'))
|
|
1481
|
+
);
|
|
1482
|
+
} else if (f.type === 'text' || f.type === 'date') {
|
|
1418
1483
|
control = h('input', baseInput(f, { type: f.type === 'date' ? 'date' : 'text' }));
|
|
1419
1484
|
} else if (f.type === 'textarea') {
|
|
1420
1485
|
control = h('textarea', baseInput(f, { className: 'cv-input cv-textarea' }));
|
|
@@ -2442,7 +2507,12 @@ window.__ModuleLoader__.load({
|
|
|
2442
2507
|
}
|
|
2443
2508
|
function delEntry(id) {
|
|
2444
2509
|
if (!window.confirm(t('confirmDelete'))) return;
|
|
2445
|
-
setEntries(function (prev) {
|
|
2510
|
+
setEntries(function (prev) {
|
|
2511
|
+
return prev.filter(function (x) { return x.id !== id; }).map(function (x) {
|
|
2512
|
+
if (!Array.isArray(x.links) || x.links.indexOf(id) < 0) return x;
|
|
2513
|
+
return Object.assign({}, x, { links: x.links.filter(function (lid) { return lid !== id; }) });
|
|
2514
|
+
});
|
|
2515
|
+
});
|
|
2446
2516
|
setToast(t('deleted'));
|
|
2447
2517
|
}
|
|
2448
2518
|
function doExport() {
|
|
@@ -2476,6 +2546,12 @@ window.__ModuleLoader__.load({
|
|
|
2476
2546
|
setGenTarget(null);
|
|
2477
2547
|
setToast(t('copied'));
|
|
2478
2548
|
}
|
|
2549
|
+
function goToEntry(id) {
|
|
2550
|
+
var target = entries.filter(function (x) { return x.id === id; })[0];
|
|
2551
|
+
if (!target) { setToast(t('linkMissing')); return; }
|
|
2552
|
+
setFilter('all');
|
|
2553
|
+
setQuery(target.title || '');
|
|
2554
|
+
}
|
|
2479
2555
|
function auditEditEntry(id) {
|
|
2480
2556
|
var e = entries.filter(function (x) { return x.id === id; })[0];
|
|
2481
2557
|
setAuditing(false);
|
|
@@ -2552,6 +2628,7 @@ window.__ModuleLoader__.load({
|
|
|
2552
2628
|
: list.map(function (e) {
|
|
2553
2629
|
return h(Card, {
|
|
2554
2630
|
key: e.id, entry: e, t: t, revealed: !!revealed[e.id],
|
|
2631
|
+
entries: entries, onGo: goToEntry,
|
|
2555
2632
|
onToggle: function () { toggleReveal(e.id); },
|
|
2556
2633
|
onEdit: function () { openEdit(e); },
|
|
2557
2634
|
onDelete: function () { delEntry(e.id); },
|
|
@@ -2564,6 +2641,7 @@ window.__ModuleLoader__.load({
|
|
|
2564
2641
|
),
|
|
2565
2642
|
editing ? h(EditorModal, {
|
|
2566
2643
|
t: t, draft: editing.draft, titleKey: editing.mode === 'new' ? 'editorNew' : 'editorEdit',
|
|
2644
|
+
entries: entries,
|
|
2567
2645
|
onChange: setDraftField, onSave: saveDraft, onCancel: function () { setEditing(null); },
|
|
2568
2646
|
onGenerate: function (field) { setGenTarget({ field: field }); }
|
|
2569
2647
|
}) : null,
|
package/index.js
CHANGED
|
@@ -46,7 +46,7 @@ const MAX_LIMIT = 200
|
|
|
46
46
|
const SUMMARY_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'expiry', 'updatedAt']
|
|
47
47
|
|
|
48
48
|
/** Current plugin version. Keep in sync with package.json when releasing. */
|
|
49
|
-
const CURRENT_VERSION = '1.5.
|
|
49
|
+
const CURRENT_VERSION = '1.5.2'
|
|
50
50
|
|
|
51
51
|
/** Where update checks read the latest published version from (GitHub Releases latest). */
|
|
52
52
|
const RELEASES_API = 'https://api.github.com/repos/mysterycode-liwen/dsh-credential-vault/releases/latest'
|
|
@@ -63,7 +63,7 @@ let snapshot = { entries: [], updatedAt: 0 }
|
|
|
63
63
|
* is dropped, so the Host can never hold a plaintext password / key / body.
|
|
64
64
|
*/
|
|
65
65
|
const META_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'keyName', 'url', 'endpoint', 'expiry',
|
|
66
|
-
'appId', 'serverUrl', 'domains', 'notes', 'createdAt', 'updatedAt']
|
|
66
|
+
'appId', 'serverUrl', 'domains', 'notes', 'links', 'createdAt', 'updatedAt']
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Force every incoming entry into a metadata-only shape. Applied defensively on
|
|
@@ -404,7 +404,7 @@ export function apply(ctx) {
|
|
|
404
404
|
name: 'tool:dsh-credential-vault',
|
|
405
405
|
order: 118,
|
|
406
406
|
text:
|
|
407
|
-
'凭据保险箱:用户把账号密码、API Key、微信公众号 /
|
|
407
|
+
'凭据保险箱:用户把账号密码、API Key、微信公众号 / 小程序开发信息、密钥、恢复码等保存在侧边栏「凭据保险箱」里。需要知道有哪些凭据时用 dsh_credential_vault_read 工具(按 query / category 过滤,category 可选 account / apikey / secretKey / other / wechatMp / wechatMini;数据多时先用 mode="summary" 看标题清单,再用 limit/offset 翻页)。出于安全,该工具只返回元数据——密码 / API Key / 密钥值 / AppSecret / Token / 上传密钥等一律显示为 ••••••••,明文只留在浏览器内、不会进入模型上下文,revealSecrets 参数已失效。不要向用户索要明文密钥;需要用到具体密钥时,请让用户自行在侧边栏面板中查看或复制。',
|
|
408
408
|
})
|
|
409
409
|
return () => {}
|
|
410
410
|
}, 'dsh-credential-vault-prompt')
|
package/package.json
CHANGED