@mysterycode-liwen/dsh-credential-vault 1.5.2 → 1.5.3

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.
Files changed (4) hide show
  1. package/README.md +6 -0
  2. package/client.js +106 -21
  3. package/index.js +1 -1
  4. 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.3 — 2026-11-28 — 关联凭据改为可搜索下拉框
130
+
131
+ - **关联凭据编辑器改为下拉多选框**:点击展开浮层,顶部可按名称实时搜索;提供「全部 / API Key / 密钥 / 其他」类型筛选 chips,快速定位目标凭据。
132
+ - **已选更直观**:已关联项以 chip 展示在触发框下方可逐个移除,并支持一键清空;点击外部自动收起浮层。
133
+ - 数据格式与 1.5.2 完全一致,旧数据/导出文件无需迁移。
134
+
129
135
  ### 1.5.2 — 2026-11-28 — 账号关联凭据与类型改名
130
136
 
131
137
  - **账号可关联其它凭据**:账号类型新增「关联凭据」字段,编辑时多选已有的 API Key / 密钥 / 其他凭据(不含账号自身);卡片上以可点击标签展示,点击直接跳转定位。
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.2';
18
+ var VERSION = '1.5.3';
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,7 +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
+ fLinks: 'Linked credentials', linkNone: 'No API Key / Key / Other credentials yet', linkMissing: 'Linked credential no longer exists', linkPlaceholder: 'Select credentials…', linkSearch: 'Search by name…', linkSelected: 'selected', linkNoMatch: 'No matching credentials', linkClear: 'Clear',
66
66
  fAppId: 'AppID', fAppIdPh: 'wx…',
67
67
  fAppSecret: 'AppSecret', fAppSecretPh: 'Application secret',
68
68
  fToken: 'Server Token', fTokenPh: 'Token from server config',
@@ -192,7 +192,7 @@ window.__ModuleLoader__.load({
192
192
  fExpiry: '到期日期(可选)',
193
193
  fContent: '内容 / 密钥', fContentPh: '恢复码、许可证、证书、PIN…',
194
194
  fNotes: '备注(可选)', fNotesPh: '其他信息…',
195
- fLinks: '关联凭据', linkNone: '还没有 API Key / 密钥 / 其他凭据', linkMissing: '关联的凭据已不存在',
195
+ fLinks: '关联凭据', linkNone: '还没有 API Key / 密钥 / 其他凭据', linkMissing: '关联的凭据已不存在', linkPlaceholder: '选择凭据…', linkSearch: '按名称搜索…', linkSelected: '项已选', linkNoMatch: '没有匹配的凭据', linkClear: '清空',
196
196
  fAppId: 'AppID', fAppIdPh: 'wx…',
197
197
  fAppSecret: 'AppSecret', fAppSecretPh: '应用密钥',
198
198
  fToken: '服务器 Token', fTokenPh: '服务器配置里的 Token',
@@ -431,9 +431,28 @@ window.__ModuleLoader__.load({
431
431
  '.cv-links{margin:10px 0 2px;padding-top:8px;border-top:1px dashed var(--cv-b1)}',
432
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
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)}',
434
+ '.cv-link-picker{position:relative}',
435
+ '.cv-link-picker-top{display:flex;gap:6px;align-items:center}',
436
+ '.cv-link-trigger{flex:1;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 12px;border-radius:9px;border:1px solid var(--cv-b1);background:var(--cv-l1);color:var(--cv-t1);font-size:13px;cursor:pointer;text-align:left}',
437
+ '.cv-link-trigger:hover{border-color:var(--cv-b2)}',
438
+ '.cv-link-trigger-on{border-color:var(--cv-brand)}',
439
+ '.cv-link-caret{color:var(--cv-t2);font-size:11px}',
440
+ '.cv-link-clear{border:none;background:var(--cv-l2);color:var(--cv-t2);border-radius:7px;width:30px;height:30px;cursor:pointer;font-size:16px;line-height:1}',
441
+ '.cv-link-selected{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}',
442
+ '.cv-link-sel-chip{display:inline-flex;align-items:center;gap:3px;padding:4px 6px 4px 9px;border-radius:999px;background:var(--cv-l2);border:1px solid var(--cv-b1);color:var(--cv-brand);font-size:11.5px;max-width:100%}',
443
+ '.cv-link-sel-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}',
444
+ '.cv-link-sel-x{border:none;background:transparent;color:var(--cv-t2);cursor:pointer;font-size:14px;line-height:1;padding:0 2px}',
445
+ '.cv-link-sel-x:hover{color:var(--cv-err)}',
446
+ '.cv-link-popover{position:absolute;z-index:30;left:0;right:0;top:calc(100% + 6px);padding:9px;border:1px solid var(--cv-b1);border-radius:10px;background:var(--cv-bg);box-shadow:0 8px 24px rgba(0,0,0,.16)}',
447
+ '.cv-link-search{width:100%;padding:8px 10px;font-size:12.5px}',
448
+ '.cv-link-typechips{display:flex;gap:5px;flex-wrap:wrap;margin:8px 0}',
449
+ '.cv-link-typechip{padding:4px 10px;border-radius:999px;border:1px solid var(--cv-b1);background:transparent;color:var(--cv-t2);font-size:11.5px;cursor:pointer}',
450
+ '.cv-link-typechip:hover{background:var(--cv-l2)}',
451
+ '.cv-link-typechip-on{background:var(--cv-brand);border-color:var(--cv-brand);color:var(--cv-bg)}',
452
+ '.cv-link-options{max-height:170px;overflow:auto;border:1px solid var(--cv-b1);border-radius:8px;padding:6px 9px;background:var(--cv-l1)}',
453
+ '.cv-link-opt{display:flex;align-items:center;gap:7px;padding:5px 2px;font-size:12.5px;cursor:pointer}',
454
+ '.cv-link-opt:hover{background:var(--cv-l2)}',
455
+ '.cv-link-empty{font-size:12px;color:var(--cv-t2);padding:8px 2px}',
437
456
  '.cv-card-title{font-weight:600;font-size:14.5px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
438
457
  '.cv-card-actions{display:flex;gap:4px}',
439
458
  '.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}',
@@ -1444,6 +1463,17 @@ window.__ModuleLoader__.load({
1444
1463
  var secondary = fields.filter(function (f) { return !PRIMARY_KEYS[f.key]; });
1445
1464
  var hasSecondary = secondary.some(function (f) { return !!d[f.key]; });
1446
1465
  var moreState = useState(hasSecondary), showMore = moreState[0], setShowMore = moreState[1];
1466
+ // Link picker: dropdown with search + type filter (account "linked credentials").
1467
+ var lkOpenState = useState(false), linksOpen = lkOpenState[0], setLinksOpen = lkOpenState[1];
1468
+ var lkQueryState = useState(''), linkQuery = lkQueryState[0], setLinkQuery = lkQueryState[1];
1469
+ var lkTypeState = useState('all'), linkType = lkTypeState[0], setLinkType = lkTypeState[1];
1470
+ var lkRef = useRef(null);
1471
+ useEffect(function () {
1472
+ if (!linksOpen) return;
1473
+ function onDoc(ev) { if (lkRef.current && !lkRef.current.contains(ev.target)) setLinksOpen(false); }
1474
+ document.addEventListener('mousedown', onDoc);
1475
+ return function () { document.removeEventListener('mousedown', onDoc); };
1476
+ }, [linksOpen]);
1447
1477
 
1448
1478
  function baseInput(f, extra) {
1449
1479
  return Object.assign({
@@ -1463,21 +1493,76 @@ window.__ModuleLoader__.load({
1463
1493
  return x.id !== d.id && ['apikey', 'secretKey', 'other'].indexOf(x.category) >= 0;
1464
1494
  });
1465
1495
  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'))
1496
+ function toggleLink(id) {
1497
+ var next = selected.indexOf(id) >= 0
1498
+ ? selected.filter(function (lid) { return lid !== id; })
1499
+ : selected.concat([id]);
1500
+ onChange('links', next);
1501
+ }
1502
+ var typeOpts = [
1503
+ { k: 'all', label: 'filterAll' },
1504
+ { k: 'apikey', label: 'filterApikey' },
1505
+ { k: 'secretKey', label: 'filterSecretKey' },
1506
+ { k: 'other', label: 'filterOther' }
1507
+ ];
1508
+ var shown = candidates.filter(function (x) {
1509
+ if (linkType !== 'all' && x.category !== linkType) return false;
1510
+ var q = linkQuery.trim().toLowerCase();
1511
+ return !q || String(x.title || '').toLowerCase().indexOf(q) >= 0;
1512
+ });
1513
+ control = h('div', { className: 'cv-link-picker', ref: lkRef },
1514
+ h('div', { className: 'cv-link-picker-top' },
1515
+ h('button', {
1516
+ type: 'button', className: 'cv-link-trigger' + (linksOpen ? ' cv-link-trigger-on' : ''),
1517
+ onClick: function () { setLinksOpen(!linksOpen); }
1518
+ },
1519
+ h('span', null, selected.length ? (selected.length + ' ' + t('linkSelected')) : t('linkPlaceholder')),
1520
+ h('span', { className: 'cv-link-caret' }, linksOpen ? '▴' : '▾')
1521
+ ),
1522
+ selected.length ? h('button', {
1523
+ type: 'button', className: 'cv-link-clear', title: t('linkClear'),
1524
+ onClick: function () { onChange('links', []); }
1525
+ }, '×') : null
1526
+ ),
1527
+ selected.length ? h('div', { className: 'cv-link-selected' },
1528
+ selected.map(function (id) {
1529
+ var tgt = candidates.filter(function (x) { return x.id === id; })[0];
1530
+ var label = tgt ? tgt.title : t('linkMissing');
1531
+ return h('span', { key: id, className: 'cv-link-sel-chip', title: label },
1532
+ h('span', { className: 'cv-link-sel-text' }, '🔗 ' + label),
1533
+ h('button', {
1534
+ type: 'button', className: 'cv-link-sel-x', title: t('linkClear'),
1535
+ onClick: function () { toggleLink(id); }
1536
+ }, '×')
1537
+ );
1538
+ })
1539
+ ) : null,
1540
+ linksOpen ? h('div', { className: 'cv-link-popover' },
1541
+ h('input', {
1542
+ className: 'cv-input cv-link-search', type: 'text',
1543
+ placeholder: t('linkSearch'), value: linkQuery,
1544
+ onChange: function (ev) { setLinkQuery(ev.target.value); }
1545
+ }),
1546
+ h('div', { className: 'cv-link-typechips' },
1547
+ typeOpts.map(function (o) {
1548
+ return h('button', {
1549
+ type: 'button', key: o.k,
1550
+ className: 'cv-link-typechip' + (linkType === o.k ? ' cv-link-typechip-on' : ''),
1551
+ onClick: function () { setLinkType(o.k); }
1552
+ }, t(o.label));
1553
+ })
1554
+ ),
1555
+ h('div', { className: 'cv-link-options' },
1556
+ shown.length ? shown.map(function (x) {
1557
+ var checked = selected.indexOf(x.id) >= 0;
1558
+ var cm = CATEGORIES.filter(function (c) { return c.k === x.category; })[0];
1559
+ return h('label', { key: x.id, className: 'cv-link-opt' },
1560
+ h('input', { type: 'checkbox', checked: checked, onChange: function () { toggleLink(x.id); } }),
1561
+ h('span', null, x.title + (cm ? ' · ' + t(cm.label) : ''))
1562
+ );
1563
+ }) : h('span', { className: 'cv-link-empty' }, t('linkNoMatch'))
1564
+ )
1565
+ ) : null
1481
1566
  );
1482
1567
  } else if (f.type === 'text' || f.type === 'date') {
1483
1568
  control = h('input', baseInput(f, { type: f.type === 'date' ? 'date' : 'text' }));
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.2'
49
+ const CURRENT_VERSION = '1.5.3'
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'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysterycode-liwen/dsh-credential-vault",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "DeepSeek Harness 侧边栏凭据保险箱:本地保存账号密码、API Key 与恢复码,支持访问密码、密保重置、闲置自动锁定,并提供默认脱敏的 Agent 读取工具。",