dsh-plugin-explorer 0.2.1 → 0.2.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.
- package/client.js +75 -48
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -55,6 +55,8 @@ window.__ModuleLoader__.load({
|
|
|
55
55
|
networkHosts: '网络目标:{hosts}',
|
|
56
56
|
networkNone: '未发现网络目标',
|
|
57
57
|
hitsTitle: '命中规则({count})',
|
|
58
|
+
showAllHits: '展开其余 {count} 条',
|
|
59
|
+
showLess: '收起',
|
|
58
60
|
noHits: '未命中任何规则',
|
|
59
61
|
notesLine: '另有 {count} 条扫描提示',
|
|
60
62
|
confirmInstall: '确认安装',
|
|
@@ -107,6 +109,8 @@ window.__ModuleLoader__.load({
|
|
|
107
109
|
networkHosts: 'Network targets: {hosts}',
|
|
108
110
|
networkNone: 'No network targets found',
|
|
109
111
|
hitsTitle: 'Rule hits ({count})',
|
|
112
|
+
showAllHits: 'Show {count} more',
|
|
113
|
+
showLess: 'Show less',
|
|
110
114
|
noHits: 'No rules matched',
|
|
111
115
|
notesLine: '{count} additional scan notes',
|
|
112
116
|
confirmInstall: 'Install',
|
|
@@ -236,10 +240,16 @@ window.__ModuleLoader__.load({
|
|
|
236
240
|
padding: 16px; background: rgba(0, 0, 0, 0.45);
|
|
237
241
|
}
|
|
238
242
|
.pf-dialog {
|
|
239
|
-
width: min(
|
|
243
|
+
width: min(620px, 100%); max-height: min(76vh, 680px); overflow: hidden;
|
|
240
244
|
background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l1);
|
|
241
|
-
border-radius: 14px;
|
|
242
|
-
display: flex; flex-direction: column;
|
|
245
|
+
border-radius: 14px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.32);
|
|
246
|
+
display: flex; flex-direction: column;
|
|
247
|
+
}
|
|
248
|
+
.pf-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
|
|
249
|
+
.pf-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 18px 12px; display: flex; flex-direction: column; gap: 10px; }
|
|
250
|
+
.pf-dialog-foot {
|
|
251
|
+
flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 18px 14px;
|
|
252
|
+
border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1);
|
|
243
253
|
}
|
|
244
254
|
.pf-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
|
|
245
255
|
.pf-dialog-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
@@ -256,6 +266,8 @@ window.__ModuleLoader__.load({
|
|
|
256
266
|
.pf-verdict-block { color: light-dark(#cf222e, #f85149); }
|
|
257
267
|
.pf-scan-meta { font-size: 12px; color: var(--dsw-alias-label-secondary); display: flex; flex-wrap: wrap; gap: 4px 14px; }
|
|
258
268
|
.pf-hits { display: flex; flex-direction: column; gap: 6px; }
|
|
269
|
+
.pf-hits-block { display: flex; flex-direction: column; gap: 6px; }
|
|
270
|
+
.pf-hits-more { align-self: flex-start; margin-top: 2px; }
|
|
259
271
|
.pf-hits-title { font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); margin-top: 4px; }
|
|
260
272
|
.pf-hit {
|
|
261
273
|
font-size: 11px; line-height: 16px; padding: 8px 10px; border-radius: 8px;
|
|
@@ -271,7 +283,7 @@ window.__ModuleLoader__.load({
|
|
|
271
283
|
.pf-hit-hint { margin-top: 4px; color: var(--dsw-alias-label-secondary); }
|
|
272
284
|
.pf-recs { margin: 0; padding-left: 18px; font-size: 11px; line-height: 17px; color: var(--dsw-alias-label-secondary); }
|
|
273
285
|
.pf-disclaimer { font-size: 10px; line-height: 15px; color: var(--dsw-alias-label-secondary); }
|
|
274
|
-
.pf-dialog-actions { display: flex; justify-content: flex-end; gap: 8px;
|
|
286
|
+
.pf-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
275
287
|
.pf-button {
|
|
276
288
|
border: 1px solid var(--dsw-alias-border-l1); background: transparent; color: var(--dsw-alias-label-primary);
|
|
277
289
|
border-radius: 8px; padding: 7px 14px; font: inherit; font-size: 12px; cursor: pointer;
|
|
@@ -536,6 +548,7 @@ window.__ModuleLoader__.load({
|
|
|
536
548
|
|
|
537
549
|
function ScanDialog(props) {
|
|
538
550
|
const { scan, t, onCancel, onConfirm } = props
|
|
551
|
+
const [showAll, setShowAll] = useState(false)
|
|
539
552
|
if (scan === null || scan === undefined) return null
|
|
540
553
|
const { entry, version, status, result, error } = scan
|
|
541
554
|
const verdict = result?.verdict
|
|
@@ -546,6 +559,23 @@ window.__ModuleLoader__.load({
|
|
|
546
559
|
const hosts = Array.isArray(result?.network?.hosts) ? result.network.hosts : []
|
|
547
560
|
const hits = Array.isArray(result?.hits) ? result.hits : []
|
|
548
561
|
const recommendations = Array.isArray(result?.recommendations) ? result.recommendations : []
|
|
562
|
+
const severityRank = { high: 0, medium: 1, low: 2 }
|
|
563
|
+
const sortedHits = [...hits].sort((a, b) => (severityRank[a.severity] ?? 3) - (severityRank[b.severity] ?? 3))
|
|
564
|
+
// Low-severity rows are mostly noisy contextual matches, so they stay folded until asked for.
|
|
565
|
+
const importantHits = sortedHits.filter(hit => hit.severity !== 'low')
|
|
566
|
+
const visibleHits = showAll
|
|
567
|
+
? sortedHits
|
|
568
|
+
: importantHits.length > 0 ? importantHits.slice(0, 6) : sortedHits.slice(0, 3)
|
|
569
|
+
const hiddenHits = sortedHits.length - visibleHits.length
|
|
570
|
+
const confirmButton = status === 'ready'
|
|
571
|
+
? h('button', {
|
|
572
|
+
type: 'button', className: 'pf-button ' + (verdict === 'BLOCK' ? 'pf-button-danger' : 'pf-button-primary'),
|
|
573
|
+
onClick: () => onConfirm({ skipScan: false }),
|
|
574
|
+
}, confirmLabel)
|
|
575
|
+
: h('button', {
|
|
576
|
+
type: 'button', className: 'pf-button',
|
|
577
|
+
onClick: () => onConfirm({ skipScan: true }),
|
|
578
|
+
}, t('skipScan'))
|
|
549
579
|
return h('div', {
|
|
550
580
|
className: 'pf-overlay',
|
|
551
581
|
onMouseDown: event => { if (event.target === event.currentTarget) onCancel() },
|
|
@@ -558,52 +588,48 @@ window.__ModuleLoader__.load({
|
|
|
558
588
|
h('h3', { className: 'pf-dialog-title' }, t('scanTitle')),
|
|
559
589
|
h('div', { className: 'pf-dialog-sub' }, entry.name + (version ? '@' + version : ''))),
|
|
560
590
|
h('button', { type: 'button', className: 'pf-close', 'aria-label': t('cancel'), onClick: onCancel }, '×')),
|
|
561
|
-
|
|
562
|
-
? h('div', { className: 'pf-state', role: 'status' }, t('scanning'))
|
|
563
|
-
: status === 'failed'
|
|
564
|
-
? h('div', null,
|
|
565
|
-
h('div', { className: 'pf-verdict pf-verdict-block', style: { marginBottom: 6 } }, t('scanFailed')),
|
|
566
|
-
h('div', { className: 'pf-note', style: { marginBottom: 10 } }, t('scanFailedHint')),
|
|
567
|
-
h('div', { className: 'pf-note' }, error ?? ''))
|
|
568
|
-
: h('div', null,
|
|
569
|
-
h('div', { className: 'pf-verdict' },
|
|
570
|
-
h('span', { className: 'pf-verdict-badge ' + verdictClass }, verdictText),
|
|
571
|
-
h('span', { className: 'pf-scan-meta' },
|
|
572
|
-
h('span', null, t('summaryLine', summary)),
|
|
573
|
-
h('span', null, t('filesScanned', { count: result.filesScanned ?? 0 })),
|
|
574
|
-
result.cached === true ? h('span', null, t('scanCached')) : null)),
|
|
575
|
-
h('div', { className: 'pf-scan-meta', style: { marginTop: 8 } },
|
|
576
|
-
h('span', null, hosts.length === 0 ? t('networkNone') : t('networkHosts', { hosts: hosts.join(', ') }))),
|
|
577
|
-
hits.length === 0
|
|
578
|
-
? h('div', { className: 'pf-notes', style: { marginTop: 8 } }, t('noHits'))
|
|
579
|
-
: h('div', null,
|
|
580
|
-
h('div', { className: 'pf-hits-title' }, t('hitsTitle', { count: hits.length })),
|
|
581
|
-
h('div', { className: 'pf-hits' },
|
|
582
|
-
hits.slice(0, 40).map((hit, index) => h('div', {
|
|
583
|
-
key: index, className: 'pf-hit', 'data-sev': hit.severity,
|
|
584
|
-
},
|
|
585
|
-
h('div', { className: 'pf-hit-head' },
|
|
586
|
-
h('span', { className: 'pf-hit-rule' }, severityLabel(hit.severity, t) + ' · ' + hit.rule),
|
|
587
|
-
h('span', { className: 'pf-hit-file' }, hit.file + ':' + hit.line)),
|
|
588
|
-
h('div', { className: 'pf-hit-evidence' }, hit.evidence ?? ''),
|
|
589
|
-
hit.hint === undefined ? null : h('div', { className: 'pf-hit-hint' }, hit.hint))))),
|
|
590
|
-
(result.notes ?? 0) > 0 ? h('div', { className: 'pf-note', style: { marginTop: 6 } }, t('notesLine', { count: result.notes })) : null,
|
|
591
|
-
recommendations.length === 0 ? null : h('ul', { className: 'pf-recs', style: { marginTop: 8 } },
|
|
592
|
-
recommendations.slice(0, 4).map((text, index) => h('li', { key: index }, text))),
|
|
593
|
-
h('div', { className: 'pf-disclaimer', style: { marginTop: 10 } }, t('scanDisclaimer'))),
|
|
594
|
-
h('div', { className: 'pf-dialog-actions' },
|
|
595
|
-
h('button', { type: 'button', className: 'pf-button', onClick: onCancel }, t('cancel')),
|
|
591
|
+
h('div', { className: 'pf-dialog-body' },
|
|
596
592
|
status === 'scanning'
|
|
597
|
-
?
|
|
593
|
+
? h('div', { className: 'pf-state', role: 'status' }, t('scanning'))
|
|
598
594
|
: status === 'failed'
|
|
599
|
-
? h('
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
: h('
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
595
|
+
? h('div', null,
|
|
596
|
+
h('div', { className: 'pf-verdict pf-verdict-block', style: { marginBottom: 6 } }, t('scanFailed')),
|
|
597
|
+
h('div', { className: 'pf-note', style: { marginBottom: 10 } }, t('scanFailedHint')),
|
|
598
|
+
h('div', { className: 'pf-note' }, error ?? ''))
|
|
599
|
+
: h('div', null,
|
|
600
|
+
h('div', { className: 'pf-verdict' },
|
|
601
|
+
h('span', { className: 'pf-verdict-badge ' + verdictClass }, verdictText),
|
|
602
|
+
h('span', { className: 'pf-scan-meta' },
|
|
603
|
+
h('span', null, t('summaryLine', summary)),
|
|
604
|
+
h('span', null, t('filesScanned', { count: result.filesScanned ?? 0 })),
|
|
605
|
+
result.cached === true ? h('span', null, t('scanCached')) : null)),
|
|
606
|
+
h('div', { className: 'pf-scan-meta', style: { marginTop: 8 } },
|
|
607
|
+
h('span', null, hosts.length === 0 ? t('networkNone') : t('networkHosts', { hosts: hosts.join(', ') }))),
|
|
608
|
+
hits.length === 0
|
|
609
|
+
? h('div', { className: 'pf-notes', style: { marginTop: 8 } }, t('noHits'))
|
|
610
|
+
: h('div', { className: 'pf-hits-block' },
|
|
611
|
+
h('div', { className: 'pf-hits-title' }, t('hitsTitle', { count: sortedHits.length })),
|
|
612
|
+
h('div', { className: 'pf-hits' },
|
|
613
|
+
visibleHits.map((hit, index) => h('div', {
|
|
614
|
+
key: index, className: 'pf-hit', 'data-sev': hit.severity,
|
|
615
|
+
},
|
|
616
|
+
h('div', { className: 'pf-hit-head' },
|
|
617
|
+
h('span', { className: 'pf-hit-rule' }, severityLabel(hit.severity, t) + ' · ' + hit.rule),
|
|
618
|
+
h('span', { className: 'pf-hit-file' }, hit.file + ':' + hit.line)),
|
|
619
|
+
h('div', { className: 'pf-hit-evidence' }, hit.evidence ?? ''),
|
|
620
|
+
hit.hint === undefined ? null : h('div', { className: 'pf-hit-hint' }, hit.hint)))),
|
|
621
|
+
hiddenHits <= 0 ? null : h('button', {
|
|
622
|
+
type: 'button', className: 'pf-link pf-hits-more',
|
|
623
|
+
onClick: () => { setShowAll(value => !value) },
|
|
624
|
+
}, showAll ? t('showLess') : t('showAllHits', { count: hiddenHits }))),
|
|
625
|
+
(result.notes ?? 0) > 0 ? h('div', { className: 'pf-note', style: { marginTop: 6 } }, t('notesLine', { count: result.notes })) : null,
|
|
626
|
+
recommendations.length === 0 ? null : h('ul', { className: 'pf-recs', style: { marginTop: 8 } },
|
|
627
|
+
recommendations.slice(0, 4).map((text, index) => h('li', { key: index }, text))))),
|
|
628
|
+
h('div', { className: 'pf-dialog-foot' },
|
|
629
|
+
h('div', { className: 'pf-disclaimer' }, t('scanDisclaimer')),
|
|
630
|
+
h('div', { className: 'pf-dialog-actions' },
|
|
631
|
+
h('button', { type: 'button', className: 'pf-button', onClick: onCancel }, t('cancel')),
|
|
632
|
+
confirmButton))))
|
|
607
633
|
}
|
|
608
634
|
|
|
609
635
|
function FinderTab(props) {
|
|
@@ -771,6 +797,7 @@ window.__ModuleLoader__.load({
|
|
|
771
797
|
: null,
|
|
772
798
|
h('div', { className: 'pf-note' }, t('note')),
|
|
773
799
|
h(ScanDialog, {
|
|
800
|
+
key: scan === null ? 'closed' : scan.entry.name + '@' + scan.version,
|
|
774
801
|
scan, t,
|
|
775
802
|
onCancel: () => { setScan(null) },
|
|
776
803
|
onConfirm: confirmScan,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-explorer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Search the community plugin catalog, run a pre-install safety scan, filter by category and update installed bundles from the Plugins page.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|