@mysterycode-liwen/dsh-credential-vault 1.4.3 → 1.5.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/README.md +13 -0
- package/client.js +138 -26
- package/cordis.patch.yml +3 -3
- package/icon.svg +6 -6
- package/index.js +412 -411
- package/locale/en.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,6 +126,19 @@ Host 侧工具在 Harness 启动时注册。重启 Harness,或在插件管理
|
|
|
126
126
|
|
|
127
127
|
## 更新日志 / Changelog
|
|
128
128
|
|
|
129
|
+
### 1.5.1 — 2026-11-28 — 新增「通用密钥」类型
|
|
130
|
+
|
|
131
|
+
- **新增凭据类型「通用密钥」**(`secretKey`):标题 + 密钥名称 + 密钥值 + 备注,适合保存零散的 token / secret / 口令,密钥值默认脱敏。
|
|
132
|
+
- **安全链路同步**:密钥值纳入 Host 脱敏、浏览器镜像掩码、安全审计与加密导出范围;工具 `category` 过滤新增 `secretKey`。
|
|
133
|
+
- **导入导出同步**:新增「密钥名称 / 密钥值」中文字段与 Card 展示,JSON / CSV / Markdown 三格式往返无损。
|
|
134
|
+
|
|
135
|
+
### 1.5.0 — 2026-11-26 — 微信开发凭据类型与表单改版
|
|
136
|
+
|
|
137
|
+
- **新增两种凭据类型**:微信公众号(`wechatMp`)与微信小程序(`wechatMini`),字段包含 AppID、AppSecret、Token / EncodingAESKey、服务器地址、上传密钥、服务器域名等;密钥类字段默认脱敏。
|
|
138
|
+
- **类型排序**:「其他」始终排在类型列表最后。
|
|
139
|
+
- **表单改版**:编辑表单改为每个字段独占一行的单列布局,次要字段折叠到「更多字段」,弹窗与输入框自适应窄容器。
|
|
140
|
+
- **安全字段同步扩展**:新增的微信密钥字段纳入 Host 脱敏与加密导出范围,测试覆盖新类型的导入 / 导出 / 脱敏往返。
|
|
141
|
+
|
|
129
142
|
### 1.4.3 — 2026-11-23 — 安全加固
|
|
130
143
|
|
|
131
144
|
- **明文不再落盘**:移除 Host 端 `vault.json` 镜像与相关迁移逻辑,内存快照重启即清空。
|
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.
|
|
18
|
+
var VERSION = '1.5.1';
|
|
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
|
|
@@ -40,6 +40,7 @@ window.__ModuleLoader__.load({
|
|
|
40
40
|
sort: 'Sort', sortRecent: 'Recently updated', sortTitle: 'Name (A–Z)', sortCategory: 'Type',
|
|
41
41
|
search: 'Search name, account, URL or notes…',
|
|
42
42
|
filterAll: 'All', filterAccount: 'Accounts', filterApikey: 'API keys', filterOther: 'Other',
|
|
43
|
+
filterWechatMp: 'Official Accounts', filterWechatMini: 'Mini Programs', filterSecretKey: 'Secret keys',
|
|
43
44
|
localNotice: 'Stored locally in this browser (localStorage) on this device. Not synced or encrypted — avoid shared / public browsers.',
|
|
44
45
|
show: 'Show', hide: 'Hide', copy: 'Copy', visit: 'Visit', copied: 'Copied to clipboard', copyFail: 'Copy failed — select the text manually',
|
|
45
46
|
visitFail: 'Could not open the browser. Check the URL and try again.',
|
|
@@ -49,7 +50,9 @@ window.__ModuleLoader__.load({
|
|
|
49
50
|
emptyFiltered: 'No matches',
|
|
50
51
|
editorNew: 'New credential', editorEdit: 'Edit credential',
|
|
51
52
|
fTitle: 'Name', fTitlePh: 'e.g. GitHub, Google', fTitlePhApikey: 'e.g. OpenAI, AWS, GitHub PAT', fTitlePhOther: 'e.g. Recovery codes, Wi-Fi, License',
|
|
52
|
-
|
|
53
|
+
fTitlePhWechatMp: 'e.g. My Official Account', fTitlePhWechatMini: 'e.g. My Mini Program',
|
|
54
|
+
fTitlePhSecretKey: 'e.g. GitHub PAT, service token',
|
|
55
|
+
fCategory: 'Type', formDetails: 'Credentials', moreFields: 'More fields', lessFields: 'Fewer fields',
|
|
53
56
|
fAccount: 'Account / username', fAccountPh: 'user@example.com',
|
|
54
57
|
fPassword: 'Password', fPasswordPh: 'Enter password',
|
|
55
58
|
fUrl: 'Login URL (optional)', fUrlPh: 'https://…',
|
|
@@ -59,10 +62,23 @@ window.__ModuleLoader__.load({
|
|
|
59
62
|
fExpiry: 'Expires on (optional)',
|
|
60
63
|
fContent: 'Content / secret', fContentPh: 'Recovery codes, license key, certificate, PIN…',
|
|
61
64
|
fNotes: 'Notes (optional)', fNotesPh: 'Any extra info…',
|
|
65
|
+
fAppId: 'AppID', fAppIdPh: 'wx…',
|
|
66
|
+
fAppSecret: 'AppSecret', fAppSecretPh: 'Application secret',
|
|
67
|
+
fToken: 'Server Token', fTokenPh: 'Token from server config',
|
|
68
|
+
fAesKey: 'EncodingAESKey', fAesKeyPh: '43-char message encryption key',
|
|
69
|
+
fServerUrl: 'Server URL', fServerUrlPh: 'https://… (callback URL)',
|
|
70
|
+
fUploadKey: 'Code upload key', fUploadKeyPh: 'Private key used to upload mini program code',
|
|
71
|
+
fDomains: 'Server domains', fDomainsPh: 'request / socket / upload / download domains',
|
|
72
|
+
fKeyName: 'Key name', fKeyNamePh: 'e.g. access token, webhook secret',
|
|
73
|
+
fKeyValue: 'Secret value', fKeyValuePh: 'Paste the token / secret / password',
|
|
62
74
|
catAccount: 'Account', catApikey: 'API key', catOther: 'Other',
|
|
75
|
+
catWechatMp: 'WeChat Official Account', catWechatMini: 'WeChat Mini Program', catSecretKey: 'Secret key',
|
|
63
76
|
hintAccount: 'For website / app logins — username and password.',
|
|
64
77
|
hintApikey: 'For platform-issued API keys, tokens and endpoints.',
|
|
65
78
|
hintOther: 'For recovery codes, licenses, certificates or any free text.',
|
|
79
|
+
hintWechatMp: 'For WeChat Official Account developer credentials and server config.',
|
|
80
|
+
hintWechatMini: 'For WeChat Mini Program developer credentials and upload key.',
|
|
81
|
+
hintSecretKey: 'For miscellaneous name + value secrets — tokens, secrets, passwords.',
|
|
66
82
|
save: 'Save', cancel: 'Cancel', required: 'Please enter a name',
|
|
67
83
|
confirmDelete: 'Delete this credential? This cannot be undone.',
|
|
68
84
|
saved: 'Saved', deleted: 'Deleted', revealAll: 'Reveal all', hideAll: 'Hide all',
|
|
@@ -153,6 +169,7 @@ window.__ModuleLoader__.load({
|
|
|
153
169
|
sort: '排序', sortRecent: '最近更新', sortTitle: '名称(A–Z)', sortCategory: '类型',
|
|
154
170
|
search: '搜索名称、账号、网址或备注…',
|
|
155
171
|
filterAll: '全部', filterAccount: '账号密码', filterApikey: 'API Key', filterOther: '其他',
|
|
172
|
+
filterWechatMp: '微信公众号', filterWechatMini: '微信小程序', filterSecretKey: '通用密钥',
|
|
156
173
|
localNotice: '数据仅保存在本机浏览器的 localStorage 中,不跨设备同步、不加密,请避免在公用/共享浏览器使用。',
|
|
157
174
|
show: '显示', hide: '隐藏', copy: '复制', visit: '访问', copied: '已复制到剪贴板', copyFail: '复制失败,请手动选择文本',
|
|
158
175
|
visitFail: '无法打开浏览器,请检查网址后重试。',
|
|
@@ -162,7 +179,9 @@ window.__ModuleLoader__.load({
|
|
|
162
179
|
emptyFiltered: '没有匹配项',
|
|
163
180
|
editorNew: '新增凭据', editorEdit: '编辑凭据',
|
|
164
181
|
fTitle: '名称', fTitlePh: '例如:GitHub、Google', fTitlePhApikey: '例如:OpenAI、AWS、GitHub PAT', fTitlePhOther: '例如:恢复码、Wi-Fi、许可证',
|
|
165
|
-
|
|
182
|
+
fTitlePhWechatMp: '例如:我的公众号', fTitlePhWechatMini: '例如:我的小程序',
|
|
183
|
+
fTitlePhSecretKey: '例如:GitHub PAT、服务令牌',
|
|
184
|
+
fCategory: '类型', formDetails: '凭据信息', moreFields: '更多字段', lessFields: '收起字段',
|
|
166
185
|
fAccount: '账号 / 用户名', fAccountPh: 'user@example.com',
|
|
167
186
|
fPassword: '密码', fPasswordPh: '输入密码',
|
|
168
187
|
fUrl: '登录网址(可选)', fUrlPh: 'https://…',
|
|
@@ -172,10 +191,23 @@ window.__ModuleLoader__.load({
|
|
|
172
191
|
fExpiry: '到期日期(可选)',
|
|
173
192
|
fContent: '内容 / 密钥', fContentPh: '恢复码、许可证、证书、PIN…',
|
|
174
193
|
fNotes: '备注(可选)', fNotesPh: '其他信息…',
|
|
194
|
+
fAppId: 'AppID', fAppIdPh: 'wx…',
|
|
195
|
+
fAppSecret: 'AppSecret', fAppSecretPh: '应用密钥',
|
|
196
|
+
fToken: '服务器 Token', fTokenPh: '服务器配置里的 Token',
|
|
197
|
+
fAesKey: 'EncodingAESKey', fAesKeyPh: '43 位消息加解密密钥',
|
|
198
|
+
fServerUrl: '服务器地址', fServerUrlPh: 'https://…(回调地址)',
|
|
199
|
+
fUploadKey: '代码上传密钥', fUploadKeyPh: '上传小程序代码用的私钥',
|
|
200
|
+
fDomains: '服务器域名', fDomainsPh: 'request / socket / upload / download 合法域名',
|
|
201
|
+
fKeyName: '密钥名称', fKeyNamePh: '例如:访问令牌、Webhook 密钥',
|
|
202
|
+
fKeyValue: '密钥值', fKeyValuePh: '粘贴令牌 / 密钥 / 口令',
|
|
175
203
|
catAccount: '账号密码', catApikey: 'API Key', catOther: '其他',
|
|
204
|
+
catWechatMp: '微信公众号', catWechatMini: '微信小程序', catSecretKey: '通用密钥',
|
|
176
205
|
hintAccount: '用于保存网站 / 应用的登录账号与密码。',
|
|
177
206
|
hintApikey: '用于保存平台签发的 API Key、令牌与接口地址。',
|
|
178
207
|
hintOther: '用于保存恢复码、许可证、证书等任意文本。',
|
|
208
|
+
hintWechatMp: '用于保存公众号开发者凭证与服务器配置。',
|
|
209
|
+
hintWechatMini: '用于保存小程序开发者凭证与代码上传密钥。',
|
|
210
|
+
hintSecretKey: '用于保存零散的名称 + 值型密钥:令牌、密钥、口令等。',
|
|
179
211
|
save: '保存', cancel: '取消', required: '请输入名称',
|
|
180
212
|
confirmDelete: '确定删除这条凭据?此操作不可撤销。',
|
|
181
213
|
saved: '已保存', deleted: '已删除', revealAll: '全部显示', hideAll: '全部隐藏',
|
|
@@ -281,21 +313,52 @@ window.__ModuleLoader__.load({
|
|
|
281
313
|
{ key: 'expiry', label: 'fExpiry', type: 'date' },
|
|
282
314
|
{ key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
|
|
283
315
|
],
|
|
316
|
+
secretKey: [
|
|
317
|
+
{ key: 'title', label: 'fTitle', ph: 'fTitlePhSecretKey', type: 'text', required: true },
|
|
318
|
+
{ key: 'keyName', label: 'fKeyName', ph: 'fKeyNamePh', type: 'text', mono: true },
|
|
319
|
+
{ key: 'keyValue', label: 'fKeyValue', ph: 'fKeyValuePh', type: 'secret', mono: true },
|
|
320
|
+
{ key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
|
|
321
|
+
],
|
|
284
322
|
other: [
|
|
285
323
|
{ key: 'title', label: 'fTitle', ph: 'fTitlePhOther', type: 'text', required: true },
|
|
286
324
|
{ key: 'content', label: 'fContent', ph: 'fContentPh', type: 'secretarea', mono: true },
|
|
287
325
|
{ key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
|
|
326
|
+
],
|
|
327
|
+
wechatMp: [
|
|
328
|
+
{ key: 'title', label: 'fTitle', ph: 'fTitlePhWechatMp', type: 'text', required: true },
|
|
329
|
+
{ key: 'appId', label: 'fAppId', ph: 'fAppIdPh', type: 'text', mono: true },
|
|
330
|
+
{ key: 'appSecret', label: 'fAppSecret', ph: 'fAppSecretPh', type: 'secret', mono: true },
|
|
331
|
+
{ key: 'token', label: 'fToken', ph: 'fTokenPh', type: 'secret', mono: true },
|
|
332
|
+
{ key: 'encodingAesKey', label: 'fAesKey', ph: 'fAesKeyPh', type: 'secret', mono: true },
|
|
333
|
+
{ key: 'serverUrl', label: 'fServerUrl', ph: 'fServerUrlPh', type: 'text', isUrl: true },
|
|
334
|
+
{ key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
|
|
335
|
+
],
|
|
336
|
+
wechatMini: [
|
|
337
|
+
{ key: 'title', label: 'fTitle', ph: 'fTitlePhWechatMini', type: 'text', required: true },
|
|
338
|
+
{ key: 'appId', label: 'fAppId', ph: 'fAppIdPh', type: 'text', mono: true },
|
|
339
|
+
{ key: 'appSecret', label: 'fAppSecret', ph: 'fAppSecretPh', type: 'secret', mono: true },
|
|
340
|
+
{ key: 'uploadKey', label: 'fUploadKey', ph: 'fUploadKeyPh', type: 'secretarea', mono: true },
|
|
341
|
+
{ key: 'domains', label: 'fDomains', ph: 'fDomainsPh', type: 'textarea' },
|
|
342
|
+
{ key: 'notes', label: 'fNotes', ph: 'fNotesPh', type: 'textarea' }
|
|
288
343
|
]
|
|
289
344
|
};
|
|
345
|
+
// "other" is always the LAST option — both in the type dropdown and in
|
|
346
|
+
// the filter chips. Keep it that way when adding new categories.
|
|
290
347
|
var CATEGORIES = [
|
|
291
348
|
{ k: 'account', label: 'catAccount', hint: 'hintAccount' },
|
|
292
349
|
{ k: 'apikey', label: 'catApikey', hint: 'hintApikey' },
|
|
350
|
+
{ k: 'wechatMp', label: 'catWechatMp', hint: 'hintWechatMp' },
|
|
351
|
+
{ k: 'wechatMini', label: 'catWechatMini', hint: 'hintWechatMini' },
|
|
352
|
+
{ k: 'secretKey', label: 'catSecretKey', hint: 'hintSecretKey' },
|
|
293
353
|
{ k: 'other', label: 'catOther', hint: 'hintOther' }
|
|
294
354
|
];
|
|
295
355
|
var FILTERS = [
|
|
296
356
|
{ k: 'all', label: 'filterAll' },
|
|
297
357
|
{ k: 'account', label: 'filterAccount' },
|
|
298
358
|
{ k: 'apikey', label: 'filterApikey' },
|
|
359
|
+
{ k: 'wechatMp', label: 'filterWechatMp' },
|
|
360
|
+
{ k: 'wechatMini', label: 'filterWechatMini' },
|
|
361
|
+
{ k: 'secretKey', label: 'filterSecretKey' },
|
|
299
362
|
{ k: 'other', label: 'filterOther' }
|
|
300
363
|
];
|
|
301
364
|
function schemaOf(cat) { return SCHEMAS[cat] || SCHEMAS.account; }
|
|
@@ -305,7 +368,7 @@ window.__ModuleLoader__.load({
|
|
|
305
368
|
var CSS = [
|
|
306
369
|
'.cv-root{--cv-bg:var(--dsw-alias-bg-base,#fff);--cv-l1:var(--dsw-alias-bg-layer-1,#f6f7f9);--cv-l2:var(--dsw-alias-bg-layer-2,#eceef3);--cv-b1:var(--dsw-alias-border-l1,#e2e5eb);--cv-b2:var(--dsw-alias-border-l2,#c9cfd9);--cv-brand:var(--dsw-alias-brand-primary,#2563eb);--cv-t1:var(--dsw-alias-label-primary,#1d2129);--cv-t2:var(--dsw-alias-label-secondary,#6b7280);--cv-err:var(--dsw-alias-state-error-primary,#dc2626);--cv-ok:var(--dsw-alias-state-success-primary,#16a34a);color:var(--cv-t1);background:var(--cv-bg);font-family:inherit;font-size:14px;min-height:100%;box-sizing:border-box;position:relative}',
|
|
307
370
|
'.cv-root *{box-sizing:border-box}',
|
|
308
|
-
'.cv-wrap{max-width:
|
|
371
|
+
'.cv-wrap{max-width:90%;margin:0 auto;padding:28px 26px 60px}',
|
|
309
372
|
'.cv-head{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}',
|
|
310
373
|
'.cv-head-left{display:flex;align-items:center;gap:14px}',
|
|
311
374
|
'.cv-head-icon{width:52px;height:52px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:var(--cv-l1);border:1px solid var(--cv-b1)}',
|
|
@@ -359,6 +422,9 @@ window.__ModuleLoader__.load({
|
|
|
359
422
|
'.cv-badge-apikey{background:var(--cv-brand);color:var(--cv-bg)}',
|
|
360
423
|
'.cv-badge-account{color:var(--cv-brand)}',
|
|
361
424
|
'.cv-badge-other{background:var(--cv-l2);color:var(--cv-t2)}',
|
|
425
|
+
'.cv-badge-wechatMp{background:#07c160;color:#fff}',
|
|
426
|
+
'.cv-badge-wechatMini{background:#10aec2;color:#fff}',
|
|
427
|
+
'.cv-badge-secretKey{background:#8b5cf6;color:#fff}',
|
|
362
428
|
'.cv-card-title{font-weight:600;font-size:14.5px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
363
429
|
'.cv-card-actions{display:flex;gap:4px}',
|
|
364
430
|
'.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}',
|
|
@@ -376,9 +442,9 @@ window.__ModuleLoader__.load({
|
|
|
376
442
|
'.cv-empty h3{margin:0 0 6px;color:var(--cv-t1);font-size:16px}',
|
|
377
443
|
'.cv-empty p{margin:0;font-size:13px}',
|
|
378
444
|
'.cv-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.2);display:flex;align-items:flex-start;justify-content:center;z-index:9999;padding:20px}',
|
|
379
|
-
'.cv-modal{position:sticky;top:50vh;transform:translateY(-50%);width:
|
|
380
|
-
'.cv-modal.cv-modal-editor{
|
|
381
|
-
'.cv-settings .cv-modal{max-width:100%;min-width:0}',
|
|
445
|
+
'.cv-modal{position:sticky;top:50vh;transform:translateY(-50%);width:min(500px,92%);max-width:100%;min-width:0;max-height:90vh;overflow:auto;background:var(--cv-bg);border:1px solid var(--cv-b1);border-radius:16px;box-shadow:0 20px 60px rgba(0,0,0,.28);outline:none}',
|
|
446
|
+
'.cv-modal.cv-modal-editor{width:min(560px,96%);min-width:0}',
|
|
447
|
+
'.cv-settings .cv-modal{width:min(100%,800px);max-width:100%;min-width:0}',
|
|
382
448
|
// Sidebar panel only: modals are positioned relative to the panel itself
|
|
383
449
|
// (flex-centered inside .cv-root) — the settings-page sticky float is untouched.
|
|
384
450
|
'.cv-panelroot>.cv-modal-backdrop{align-items:center}',
|
|
@@ -387,11 +453,20 @@ window.__ModuleLoader__.load({
|
|
|
387
453
|
'.cv-modal-head h2{margin:0;font-size:17px;font-weight:650}',
|
|
388
454
|
'.cv-modal-hint{margin:5px 22px 0;padding:8px 11px;border-radius:8px;background:var(--cv-l1);border:1px solid var(--cv-b1);color:var(--cv-t2);font-size:12px;line-height:1.5}',
|
|
389
455
|
'.cv-modal-body{padding:14px 22px 6px;display:flex;flex-direction:column;gap:12px}',
|
|
390
|
-
|
|
391
|
-
'.cv-form-
|
|
392
|
-
'.cv-
|
|
456
|
+
// Editor form: one field per row for a clean, roomy layout.
|
|
457
|
+
'.cv-form-body{display:grid;grid-template-columns:1fr;gap:16px;padding:20px 24px 12px}',
|
|
458
|
+
'.cv-form-body .cv-row-full{grid-column:1 / -1}',
|
|
459
|
+
'.cv-form-body .cv-form-row{gap:8px}',
|
|
460
|
+
'.cv-form-row{display:flex;flex-direction:column;gap:6px;min-width:0;max-width:100%}',
|
|
461
|
+
'.cv-form-label{font-size:12px;color:var(--cv-t2);font-weight:600;letter-spacing:.02em}',
|
|
462
|
+
'.cv-form-label .cv-req{color:var(--cv-err);margin-left:2px}',
|
|
463
|
+
'.cv-form-sep{grid-column:1 / -1;display:flex;align-items:center;gap:10px;margin:4px 0 0;color:var(--cv-t2);font-size:11px;font-weight:650;letter-spacing:.08em;text-transform:uppercase}',
|
|
464
|
+
'.cv-form-sep:after{content:"";flex:1;height:1px;background:var(--cv-b1)}',
|
|
465
|
+
'.cv-more-btn{grid-column:1 / -1;align-self:start;display:inline-flex;align-items:center;gap:5px;padding:6px 10px;border:1px dashed var(--cv-b2);border-radius:8px;background:transparent;color:var(--cv-t2);font-size:12px;font-family:inherit;cursor:pointer}',
|
|
466
|
+
'.cv-more-btn:hover{border-color:var(--cv-brand);color:var(--cv-brand)}',
|
|
467
|
+
'.cv-input{width:100%;max-width:100%;min-width:0;padding:9px 11px;border-radius:9px;border:1px solid var(--cv-b1);background:var(--cv-l1);color:var(--cv-t1);font-size:13px;outline:none;font-family:inherit;box-sizing:border-box}',
|
|
393
468
|
'.cv-input:focus{border-color:var(--cv-brand)}',
|
|
394
|
-
'.cv-textarea{min-height:64px;resize:vertical}',
|
|
469
|
+
'.cv-textarea{min-height:64px;max-width:100%;resize:vertical;overflow-wrap:anywhere}',
|
|
395
470
|
'.cv-secret-input{display:flex;gap:6px;align-items:stretch}',
|
|
396
471
|
'.cv-secret-input .cv-input{flex:1;min-width:0}',
|
|
397
472
|
'.cv-secret-toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;padding:0 13px;border:1px solid var(--cv-b1);border-radius:9px;background:var(--cv-l1);color:var(--cv-t2);font-size:13px;font-family:inherit;cursor:pointer;white-space:nowrap}',
|
|
@@ -412,7 +487,7 @@ window.__ModuleLoader__.load({
|
|
|
412
487
|
'.cv-link{background:none;border:none;padding:0;color:var(--cv-brand);font-size:12.5px;cursor:pointer;text-decoration:underline;font-family:inherit}',
|
|
413
488
|
'.cv-link:hover{opacity:.8}',
|
|
414
489
|
'.cv-lock-foot{margin-top:16px;color:var(--cv-t2);font-size:11px;line-height:1.5}',
|
|
415
|
-
'.cv-settings{max-width:
|
|
490
|
+
'.cv-settings{max-width:90%;margin:0 auto;padding:28px 26px 60px;position:relative}',
|
|
416
491
|
'.cv-settings-head{margin-bottom:8px}',
|
|
417
492
|
'.cv-settings-head h2{margin:0;font-size:18px;font-weight:650}',
|
|
418
493
|
'.cv-settings-head p{margin:5px 0 0;color:var(--cv-t2);font-size:13px;line-height:1.5}',
|
|
@@ -487,6 +562,7 @@ window.__ModuleLoader__.load({
|
|
|
487
562
|
if (n.secret != null && n.password == null && n.apiKey == null && n.content == null) {
|
|
488
563
|
if (n.category === 'apikey') n.apiKey = n.secret;
|
|
489
564
|
else if (n.category === 'other') n.content = n.secret;
|
|
565
|
+
else if (n.category === 'secretKey') n.keyValue = n.secret;
|
|
490
566
|
else n.password = n.secret;
|
|
491
567
|
}
|
|
492
568
|
if (n.category === 'apikey') {
|
|
@@ -519,8 +595,9 @@ window.__ModuleLoader__.load({
|
|
|
519
595
|
// Fire-and-forget: the browser stays usable even if the Host route is down.
|
|
520
596
|
// Large vaults: DEBOUNCE so a burst of edits results in one POST, not dozens
|
|
521
597
|
// of multi-megabyte payloads. A trailing timer always flushes the latest data.
|
|
522
|
-
var MIRROR_FIELDS = ['id', 'title', 'category', 'username', 'provider', '
|
|
523
|
-
|
|
598
|
+
var MIRROR_FIELDS = ['id', 'title', 'category', 'username', 'provider', 'keyName', 'url', 'endpoint', 'expiry',
|
|
599
|
+
'appId', 'serverUrl', 'domains', 'notes', 'createdAt', 'updatedAt'];
|
|
600
|
+
var MIRROR_SECRETS = ['password', 'apiKey', 'content', 'appSecret', 'token', 'encodingAesKey', 'uploadKey', 'keyValue'];
|
|
524
601
|
function toEnvelope(entry) {
|
|
525
602
|
var out = {};
|
|
526
603
|
MIRROR_FIELDS.forEach(function (k) {
|
|
@@ -623,6 +700,7 @@ window.__ModuleLoader__.load({
|
|
|
623
700
|
var cat = e.category || 'account';
|
|
624
701
|
if (cat === 'apikey') return String(e.apiKey || '');
|
|
625
702
|
if (cat === 'other') return String(e.content || '');
|
|
703
|
+
if (cat === 'secretKey') return String(e.keyValue || '');
|
|
626
704
|
return String(e.password || '');
|
|
627
705
|
}
|
|
628
706
|
function runAudit(entries) {
|
|
@@ -695,7 +773,9 @@ window.__ModuleLoader__.load({
|
|
|
695
773
|
function pad(n) { return n < 10 ? '0' + n : '' + n; }
|
|
696
774
|
return d.getFullYear() + pad(d.getMonth() + 1) + pad(d.getDate()) + '-' + pad(d.getHours()) + pad(d.getMinutes());
|
|
697
775
|
}
|
|
698
|
-
var EXPORT_COLS = ['id', 'title', 'category', 'username', 'password', 'url', 'provider', 'apiKey', 'endpoint', 'expiry', 'content', '
|
|
776
|
+
var EXPORT_COLS = ['id', 'title', 'category', 'username', 'password', 'url', 'provider', 'apiKey', 'endpoint', 'expiry', 'content', 'keyName', 'keyValue',
|
|
777
|
+
'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'uploadKey', 'domains',
|
|
778
|
+
'notes', 'createdAt', 'updatedAt'];
|
|
699
779
|
|
|
700
780
|
// ---- Human-readable labels ------------------------------------------------
|
|
701
781
|
// CSV/Markdown use Chinese labels for people; every label maps back to its
|
|
@@ -703,11 +783,14 @@ window.__ModuleLoader__.load({
|
|
|
703
783
|
var FIELD_LABELS = {
|
|
704
784
|
id: 'ID', title: '标题', category: '类型', username: '用户名', password: '密码',
|
|
705
785
|
url: '网址', provider: '服务商', apiKey: 'API Key', endpoint: '接口地址',
|
|
706
|
-
expiry: '有效期', content: '内容',
|
|
786
|
+
expiry: '有效期', content: '内容', keyName: '密钥名称', keyValue: '密钥值',
|
|
787
|
+
appId: 'AppID', appSecret: 'AppSecret', token: '服务器Token', encodingAesKey: 'EncodingAESKey',
|
|
788
|
+
serverUrl: '服务器地址', uploadKey: '代码上传密钥', domains: '服务器域名',
|
|
789
|
+
notes: '备注', createdAt: '创建时间', updatedAt: '更新时间'
|
|
707
790
|
};
|
|
708
791
|
var LABEL_FIELDS = {};
|
|
709
792
|
Object.keys(FIELD_LABELS).forEach(function (k) { LABEL_FIELDS[FIELD_LABELS[k]] = k; });
|
|
710
|
-
var CATEGORY_LABELS = { account: '账号', apikey: 'API Key', other: '其他' };
|
|
793
|
+
var CATEGORY_LABELS = { account: '账号', apikey: 'API Key', secretKey: '通用密钥', other: '其他', wechatMp: '微信公众号', wechatMini: '微信小程序' };
|
|
711
794
|
var LABEL_CATEGORIES = {};
|
|
712
795
|
Object.keys(CATEGORY_LABELS).forEach(function (k) { LABEL_CATEGORIES[CATEGORY_LABELS[k]] = k; });
|
|
713
796
|
// Only export fields that belong to the entry's type. A record may carry
|
|
@@ -716,7 +799,10 @@ window.__ModuleLoader__.load({
|
|
|
716
799
|
var VISIBLE_FIELDS = {
|
|
717
800
|
account: ['title', 'username', 'password', 'url', 'notes'],
|
|
718
801
|
apikey: ['title', 'provider', 'apiKey', 'endpoint', 'expiry', 'notes'],
|
|
719
|
-
|
|
802
|
+
secretKey: ['title', 'keyName', 'keyValue', 'notes'],
|
|
803
|
+
other: ['title', 'content', 'notes'],
|
|
804
|
+
wechatMp: ['title', 'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'notes'],
|
|
805
|
+
wechatMini: ['title', 'appId', 'appSecret', 'uploadKey', 'domains', 'notes']
|
|
720
806
|
};
|
|
721
807
|
function fieldsFor(cat) { return VISIBLE_FIELDS[cat] || VISIBLE_FIELDS.account; }
|
|
722
808
|
// Strip fields that do not belong to the entry's type. Applied inside
|
|
@@ -746,7 +832,9 @@ window.__ModuleLoader__.load({
|
|
|
746
832
|
// CSV shows the fields people actually read first; technical columns
|
|
747
833
|
// (ID / timestamps) go last. Import maps by header label, so order is safe.
|
|
748
834
|
var CSV_COLS = ['title', 'category', 'username', 'password', 'url', 'provider',
|
|
749
|
-
'apiKey', 'endpoint', 'expiry', 'content', '
|
|
835
|
+
'apiKey', 'endpoint', 'expiry', 'content', 'keyName', 'keyValue',
|
|
836
|
+
'appId', 'appSecret', 'token', 'encodingAesKey', 'serverUrl', 'uploadKey', 'domains',
|
|
837
|
+
'notes', 'id', 'createdAt', 'updatedAt'];
|
|
750
838
|
function buildCsv(arr) {
|
|
751
839
|
var lines = [CSV_COLS.map(function (c) { return csvEscape(FIELD_LABELS[c] || c); }).join(',')];
|
|
752
840
|
arr.forEach(function (e) {
|
|
@@ -1209,7 +1297,9 @@ window.__ModuleLoader__.load({
|
|
|
1209
1297
|
id: '', title: '', category: cat || 'account',
|
|
1210
1298
|
username: '', password: '', url: '',
|
|
1211
1299
|
provider: '', apiKey: '', endpoint: '', expiry: '',
|
|
1212
|
-
content: '',
|
|
1300
|
+
content: '', keyName: '', keyValue: '',
|
|
1301
|
+
appId: '', appSecret: '', token: '', encodingAesKey: '', serverUrl: '', uploadKey: '', domains: '',
|
|
1302
|
+
notes: ''
|
|
1213
1303
|
};
|
|
1214
1304
|
}
|
|
1215
1305
|
|
|
@@ -1272,7 +1362,8 @@ window.__ModuleLoader__.load({
|
|
|
1272
1362
|
function Card(props) {
|
|
1273
1363
|
var e = props.entry, t = props.t;
|
|
1274
1364
|
var cat = e.category || 'account';
|
|
1275
|
-
var
|
|
1365
|
+
var catMeta = CATEGORIES.filter(function (c) { return c.k === cat; })[0];
|
|
1366
|
+
var catLabel = catMeta ? t(catMeta.label) : t('catAccount');
|
|
1276
1367
|
return h('div', { className: 'cv-card' },
|
|
1277
1368
|
h('div', { className: 'cv-card-head' },
|
|
1278
1369
|
h('span', { className: 'cv-badge cv-badge-' + cat }, catLabel),
|
|
@@ -1302,6 +1393,14 @@ window.__ModuleLoader__.load({
|
|
|
1302
1393
|
var meta = CATEGORIES.filter(function (c) { return c.k === cat; })[0] || CATEGORIES[0];
|
|
1303
1394
|
var fields = schemaOf(cat);
|
|
1304
1395
|
|
|
1396
|
+
// Only the essential fields show by default; the rest fold behind a
|
|
1397
|
+
// "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 };
|
|
1399
|
+
var primary = fields.filter(function (f) { return PRIMARY_KEYS[f.key]; });
|
|
1400
|
+
var secondary = fields.filter(function (f) { return !PRIMARY_KEYS[f.key]; });
|
|
1401
|
+
var hasSecondary = secondary.some(function (f) { return !!d[f.key]; });
|
|
1402
|
+
var moreState = useState(hasSecondary), showMore = moreState[0], setShowMore = moreState[1];
|
|
1403
|
+
|
|
1305
1404
|
function baseInput(f, extra) {
|
|
1306
1405
|
return Object.assign({
|
|
1307
1406
|
className: 'cv-input', value: d[f.key] || '',
|
|
@@ -1310,6 +1409,9 @@ window.__ModuleLoader__.load({
|
|
|
1310
1409
|
onChange: function (ev) { onChange(f.key, ev.target.value); }
|
|
1311
1410
|
}, extra || {});
|
|
1312
1411
|
}
|
|
1412
|
+
// 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 };
|
|
1414
|
+
function isWide(f) { return f.type === 'textarea' || f.type === 'secretarea' || !!WIDE_KEYS[f.key]; }
|
|
1313
1415
|
function renderField(f) {
|
|
1314
1416
|
var control;
|
|
1315
1417
|
if (f.type === 'text' || f.type === 'date') {
|
|
@@ -1332,8 +1434,8 @@ window.__ModuleLoader__.load({
|
|
|
1332
1434
|
h('button', { type: 'button', className: 'cv-secret-toggle', onClick: function () { setShowSecret(!showSecret); } }, showSecret ? t('hide') : t('show'))
|
|
1333
1435
|
);
|
|
1334
1436
|
}
|
|
1335
|
-
return h('label', { key: f.key, className: 'cv-form-row' },
|
|
1336
|
-
h('span', { className: 'cv-form-label' }, t(f.label)),
|
|
1437
|
+
return h('label', { key: f.key, className: 'cv-form-row' + (isWide(f) ? ' cv-row-full' : '') },
|
|
1438
|
+
h('span', { className: 'cv-form-label' }, t(f.label), f.required ? h('span', { className: 'cv-req' }, '*') : null),
|
|
1337
1439
|
control
|
|
1338
1440
|
);
|
|
1339
1441
|
}
|
|
@@ -1345,14 +1447,24 @@ window.__ModuleLoader__.load({
|
|
|
1345
1447
|
},
|
|
1346
1448
|
h('div', { className: 'cv-modal-head' }, h('h2', null, t(props.titleKey) + ' · ' + t(meta.label))),
|
|
1347
1449
|
h('div', { className: 'cv-modal-hint' }, t(meta.hint)),
|
|
1348
|
-
h('div', { className: 'cv-
|
|
1349
|
-
h('label', { className: 'cv-form-row' },
|
|
1450
|
+
h('div', { className: 'cv-form-body' },
|
|
1451
|
+
h('label', { className: 'cv-form-row cv-row-full' },
|
|
1350
1452
|
h('span', { className: 'cv-form-label' }, t('fCategory')),
|
|
1351
1453
|
h('select', { className: 'cv-input', value: cat, onChange: function (ev) { onChange('category', ev.target.value); } },
|
|
1352
1454
|
CATEGORIES.map(function (c) { return h('option', { key: c.k, value: c.k }, t(c.label)); })
|
|
1353
1455
|
)
|
|
1354
1456
|
),
|
|
1355
|
-
|
|
1457
|
+
h('div', { className: 'cv-form-sep' }, t('formDetails')),
|
|
1458
|
+
primary.map(renderField),
|
|
1459
|
+
secondary.length ? (showMore ? secondary.map(renderField) : null) : null,
|
|
1460
|
+
secondary.length && !showMore ? h('button', {
|
|
1461
|
+
type: 'button', className: 'cv-more-btn',
|
|
1462
|
+
onClick: function () { setShowMore(true); }
|
|
1463
|
+
}, '▾ ' + t('moreFields') + ' (' + secondary.length + ')') : null,
|
|
1464
|
+
secondary.length && showMore ? h('button', {
|
|
1465
|
+
type: 'button', className: 'cv-more-btn',
|
|
1466
|
+
onClick: function () { setShowMore(false); }
|
|
1467
|
+
}, '▴ ' + t('lessFields')) : null
|
|
1356
1468
|
),
|
|
1357
1469
|
h('div', { className: 'cv-modal-foot' },
|
|
1358
1470
|
h('button', { className: 'cv-btn', onClick: props.onCancel }, t('cancel')),
|
package/cordis.patch.yml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
- insert:
|
|
2
|
-
- id: dsh-credential-vault
|
|
3
|
-
name: '@mysterycode-liwen/dsh-credential-vault'
|
|
1
|
+
- insert:
|
|
2
|
+
- id: dsh-credential-vault
|
|
3
|
+
name: '@mysterycode-liwen/dsh-credential-vault'
|
package/icon.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
-
<rect width="64" height="64" rx="14" fill="#2563eb"/>
|
|
3
|
-
<path d="M32 14 L46 19.5 V31 C46 40.5 39.8 46.8 32 50 C24.2 46.8 18 40.5 18 31 V19.5 Z" fill="#ffffff" opacity="0.96"/>
|
|
4
|
-
<circle cx="32" cy="29.5" r="4.3" fill="#2563eb"/>
|
|
5
|
-
<rect x="29.8" y="32.5" width="4.4" height="8.5" rx="2.2" fill="#2563eb"/>
|
|
6
|
-
</svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
+
<rect width="64" height="64" rx="14" fill="#2563eb"/>
|
|
3
|
+
<path d="M32 14 L46 19.5 V31 C46 40.5 39.8 46.8 32 50 C24.2 46.8 18 40.5 18 31 V19.5 Z" fill="#ffffff" opacity="0.96"/>
|
|
4
|
+
<circle cx="32" cy="29.5" r="4.3" fill="#2563eb"/>
|
|
5
|
+
<rect x="29.8" y="32.5" width="4.4" height="8.5" rx="2.2" fill="#2563eb"/>
|
|
6
|
+
</svg>
|