@objectivex666/dsh-settings-search 1.4.2 → 1.4.4
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 +2 -0
- package/lib/client.js +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
|
|
31
31
|
const NS = 'settings-search-v5'
|
|
32
32
|
/** Single source of truth is package.json — scripts/check.mjs asserts this matches. */
|
|
33
|
-
const PKG_VERSION = '1.4.
|
|
33
|
+
const PKG_VERSION = '1.4.4'
|
|
34
34
|
const NPM_NAME = '@objectivex666/dsh-settings-search'
|
|
35
35
|
const zh = {
|
|
36
36
|
title: '设置',
|
|
@@ -52,6 +52,7 @@ window.__ModuleLoader__.load({
|
|
|
52
52
|
updErr: '检查失败(网络或注册表不可达),请稍后重试。',
|
|
53
53
|
updCopy: '复制命令',
|
|
54
54
|
updCopied: '已复制 ✓',
|
|
55
|
+
updCopyFail: '复制失败,请长按上方命令手动复制。',
|
|
55
56
|
}
|
|
56
57
|
const en = {
|
|
57
58
|
title: 'Settings',
|
|
@@ -73,6 +74,7 @@ window.__ModuleLoader__.load({
|
|
|
73
74
|
updErr: 'Check failed (network or registry unreachable). Try again later.',
|
|
74
75
|
updCopy: 'Copy command',
|
|
75
76
|
updCopied: 'Copied ✓',
|
|
77
|
+
updCopyFail: 'Copy failed — please long-press the command above.',
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
/** Inner-row slots that represent specific options inside one page. */
|
|
@@ -513,16 +515,18 @@ window.__ModuleLoader__.load({
|
|
|
513
515
|
const [state, setState] = React.useState('idle') // idle | loading | newest | outdated | error
|
|
514
516
|
const [latest, setLatest] = React.useState('')
|
|
515
517
|
const [copied, setCopied] = React.useState(false)
|
|
518
|
+
const [copyFailed, setCopyFailed] = React.useState(false)
|
|
516
519
|
|
|
517
520
|
React.useEffect(() => {
|
|
518
521
|
if (!copied) return
|
|
519
|
-
const off = setTimeout(() => setCopied(false), 1600)
|
|
522
|
+
const off = setTimeout(() => { setCopied(false); setCopyFailed(false) }, 1600)
|
|
520
523
|
return () => clearTimeout(off)
|
|
521
524
|
}, [copied])
|
|
522
525
|
|
|
523
526
|
const check = async () => {
|
|
524
527
|
setState('loading')
|
|
525
528
|
setCopied(false)
|
|
529
|
+
setCopyFailed(false)
|
|
526
530
|
try {
|
|
527
531
|
const res = await fetch(`https://registry.npmjs.org/${NPM_NAME}/latest?t=${Date.now()}`)
|
|
528
532
|
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
|
@@ -537,8 +541,8 @@ window.__ModuleLoader__.load({
|
|
|
537
541
|
}
|
|
538
542
|
|
|
539
543
|
const copyCmd = async () => {
|
|
540
|
-
const cmd = `dsh plugin update ${NPM_NAME}`
|
|
541
|
-
try { await navigator.clipboard.writeText(cmd); setCopied(true) } catch {
|
|
544
|
+
const cmd = `dsh plugin --profile web update ${NPM_NAME}`
|
|
545
|
+
try { await navigator.clipboard.writeText(cmd); setCopied(true); setCopyFailed(false) } catch { setCopyFailed(true) }
|
|
542
546
|
}
|
|
543
547
|
|
|
544
548
|
const statusNode = {
|
|
@@ -548,10 +552,11 @@ window.__ModuleLoader__.load({
|
|
|
548
552
|
error: React.createElement('span', { className: 'sss-upd-val' }, t('updErr')),
|
|
549
553
|
outdated: latest === '' ? null : React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } }, [
|
|
550
554
|
React.createElement('p', { className: 'sss-upd-note' }, t('updFound').replace('{ver}', `v${latest}`)),
|
|
551
|
-
React.createElement('code', { className: 'sss-cmd' }, `dsh plugin update ${NPM_NAME}`),
|
|
555
|
+
React.createElement('code', { className: 'sss-cmd' }, `dsh plugin --profile web update ${NPM_NAME}`),
|
|
552
556
|
React.createElement('div', null,
|
|
553
557
|
React.createElement('button', { className: 'sss-btn', type: 'button', onClick: () => { void copyCmd() } },
|
|
554
|
-
copied ? t('updCopied') : t('updCopy'))
|
|
558
|
+
copied ? t('updCopied') : t('updCopy')),
|
|
559
|
+
copyFailed ? React.createElement('p', { className: 'sss-upd-note', style: { color: 'var(--dsw-alias-label-danger)' } }, t('updCopyFail')) : null),
|
|
555
560
|
]),
|
|
556
561
|
}
|
|
557
562
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectivex666/dsh-settings-search",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "DSH settings panel search plugin – instantly filter setting sections and general items with navigation guidance. Installable via `dsh plugin add`.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|