dsh-aupdate 0.8.1 → 0.8.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 -20
  2. package/client.js +138 -147
  3. package/index.js +0 -16
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -136,7 +136,8 @@ mtime 为准:那是磁盘事实。会话目录整个读不到时返回「不
136
136
  插件页里的这一行有摘要和整页两种视图。**没有保存按钮**:每个改动就地落盘(攒 350ms
137
137
  合成一次请求,请求串行,不并发写同一个设置文件),落盘后立刻按新节奏重排,不用重启。
138
138
  数字框每敲一个字符都会变一次,但不会一个字符发一个请求。
139
- 同一份界面还挂在**设置 → 插件更新**里,是独立的一页,不用先去插件页翻这张卡。
139
+ 这份界面挂在**插件页那一行**和**插件配置页**里;0.8.3 起不再单独占「设置 → 插件更新」一页,
140
+ 额外入口是插件页顶栏「版本管理」里的「设置」按钮。升级后第一次打开会弹一张一次性提示卡告诉你入口搬到哪了。
140
141
  读写走 `/api/dsh-aupdate/{state,run,rollback,logs}`。
141
142
 
142
143
  版面按 `dsh-cost-meter` 的设置页组织:一栏一栏的分区卡片、小号分区标题、浅一档的说明
@@ -225,14 +226,6 @@ stargazers)与「分享」(复制项目地址到剪贴板,任何环境都
225
226
  「注册表」面板列出三档预设,每行能单独测(`/-/ping` 和根地址同时发,谁先答应用谁,整次 5 秒
226
227
  封顶),也能直接切过去;自定义源可以填完先测再切。
227
228
 
228
- ## 显示位置
229
-
230
- 设置页有一组开关,决定这个插件挂在哪些地方:**设置 → 插件更新**、**插件页里的那一行**、
231
- **插件配置页**、**插件页「版本管理」标签**。关掉的那一处干脆不注册槽位,而不是挂上去再渲染成
232
- 空条目。
233
-
234
- 「挂不挂」是在插件加载时决定的,而那时读不到后端设置,所以选择会在 localStorage 里存一份镜像
235
- 供加载时同步读取;改完开关后插件会**就地重载**一次,新的一组槽位立刻生效,不用重启 DSH。
236
229
 
237
230
  ## 安装源与兼容性预检
238
231
 
@@ -464,8 +457,10 @@ The row in the plugins page shows a summary and a full page. There is **no Save
464
457
  every change is persisted as you make it — coalesced into one request over 350 ms, sent
465
458
  serially so two requests never write the same settings file at once — and re-schedules
466
459
  immediately without a restart. A number field fires per keystroke; that does not become
467
- one request per character. The same UI is also its own page under
468
- **Settings → Plugin updates**, so it is not buried in the plugins page.
460
+ one request per character. The same UI lives in **the plugins-page row** and in **the plugin config page**. Since 0.8.3 it is
461
+ no longer its own page under **Settings → Plugin updates**; the extra entry is the **Settings**
462
+ button inside the plugins-page Versions tab. The first time you open the app after upgrading, a
463
+ one-shot notice says where it went.
469
464
 
470
465
  The layout follows the `dsh-cost-meter` settings page: stacked section cards, small section
471
466
  headings, one-step-muted secondary text and two button tiers. "Last run" is no longer a run
@@ -529,15 +524,6 @@ The **Registries** panel lists the three presets, each with its own Test button
529
524
  root URL are fired together and whichever answers first wins, inside a 5 s budget) and a switch; a
530
525
  custom URL can be tested before it is used.
531
526
 
532
- ## Where it shows
533
-
534
- A group of switches decides which surfaces this plugin occupies: **Settings → Plugin updates**,
535
- **the row in the plugins page**, **the plugin config page**, and **the plugins page Versions tab**.
536
- A disabled surface is not registered at all, rather than registered and rendered empty.
537
-
538
- Whether a slot is registered is decided at plugin load time, when the backend settings are not
539
- readable, so the choice is mirrored into localStorage for that synchronous read; changing a switch
540
- reloads the plugin in place, so the new set of slots takes effect without restarting DSH.
541
527
 
542
528
  ## Registry and compatibility pre-check
543
529
 
package/client.js CHANGED
@@ -182,12 +182,9 @@ window.__ModuleLoader__.load({
182
182
  versionsCopyFail: '复制失败',
183
183
  versionsDiagnostics: '复制诊断',
184
184
  versionsCustomSource: '自定义源',
185
- displayGroup: '显示位置',
186
- displayHint: '关掉哪一处就不再挂那一处;改动会让插件就地重载一次生效,不用重启 DSH',
187
- showSettings: '设置 → 插件更新',
188
- showRow: '插件页里的这一行',
189
- showBundle: '插件配置页',
190
- showTab: '插件页「版本管理」标签',
185
+ movedTitle: '设置页搬到插件页了',
186
+ movedBadge: '已搬家',
187
+ movedBody: '「设置 → 插件更新」不再单独占一页:设置就在插件页那张卡里;也可以在插件页顶栏「版本管理」里点「设置」。',
191
188
  maxPerCycle: '一轮最多装几个',
192
189
  maxPerCycleHint: '0 表示不限。装包会一直占着 pnpm 锁,限一个数就把单次占用封顶,剩下的下一轮接着装',
193
190
  sessionIdle: '会话静默(分钟)',
@@ -389,12 +386,9 @@ window.__ModuleLoader__.load({
389
386
  versionsCopyFail: 'Could not copy',
390
387
  versionsDiagnostics: 'Copy diagnostics',
391
388
  versionsCustomSource: 'Custom registry',
392
- displayGroup: 'Where it shows',
393
- displayHint: 'Turning one off stops registering that surface; the plugin reloads itself in place, no DSH restart',
394
- showSettings: 'Settings → Plugin updates',
395
- showRow: 'The row in the plugins page',
396
- showBundle: 'Plugin config page',
397
- showTab: 'Plugins page "Versions" tab',
389
+ movedTitle: 'Settings moved into the plugins page',
390
+ movedBadge: 'Moved',
391
+ movedBody: '"Settings → Plugin updates" is no longer a page of its own: the same controls live in the plugins-page card, and under Versions → Settings.',
398
392
  maxPerCycle: 'Installs per cycle',
399
393
  maxPerCycleHint: '0 means no limit. pnpm holds a lock for the whole install, so a cap bounds how long the profile stays busy; the rest wait for the next cycle',
400
394
  sessionIdle: 'Session quiet window (minutes)',
@@ -769,41 +763,6 @@ window.__ModuleLoader__.load({
769
763
  @media (prefers-reduced-motion:reduce){.dsh-au-toast{animation:none}}
770
764
  `
771
765
 
772
- /* ── 显示位置 ─────────────────────────────────────────────────────────
773
- *
774
- * 四个挂载点各自可以被关掉。麻烦在于「挂不挂」是在 apply() 里决定的,
775
- * 而 apply() 是同步的、拿不到后端的设置——设置要等 /state 回来。
776
- *
777
- * 所以把选择在 localStorage 里存一份镜像:设置页每次拿到 /state 就刷一次,
778
- * apply() 同步读它。改完显示开关后后端会让插件就地重载一次,apply() 重新跑,
779
- * 读到的就是新值——不需要重启 DSH。
780
- *
781
- * 读不到(第一次装、换浏览器)时全部按「显示」,和改造前一致。
782
- */
783
- const DISPLAY_KEY = 'dsh-aupdate:display'
784
- const DISPLAY_FIELDS = ['showSettingsSection', 'showPluginsRow', 'showPluginsBundle', 'showVersionsTab']
785
-
786
- function readDisplay() {
787
- const value = { showSettingsSection: true, showPluginsRow: true, showPluginsBundle: true, showVersionsTab: true }
788
- try {
789
- const raw = window.localStorage.getItem(DISPLAY_KEY)
790
- if (raw === null) return value
791
- const parsed = JSON.parse(raw)
792
- for (const key of DISPLAY_FIELDS) {
793
- if (typeof parsed?.[key] === 'boolean') value[key] = parsed[key]
794
- }
795
- } catch {}
796
- return value
797
- }
798
-
799
- function writeDisplay(settings) {
800
- try {
801
- const value = {}
802
- for (const key of DISPLAY_FIELDS) value[key] = settings?.[key] !== false
803
- window.localStorage.setItem(DISPLAY_KEY, JSON.stringify(value))
804
- } catch {}
805
- }
806
-
807
766
  /** 只注入一次:id 存在就跳过,重复挂载/热更新都不会叠出第二份样式表。 */
808
767
  function installStyles() {
809
768
  try {
@@ -1145,8 +1104,6 @@ window.__ModuleLoader__.load({
1145
1104
  applyLang(next?.settings?.lang)
1146
1105
  setState(next)
1147
1106
  setDraft(next.settings)
1148
- // 把显示选择镜像到 localStorage:apply() 下次重载时同步读它。
1149
- writeDisplay(next.settings)
1150
1107
  setPhase('ready')
1151
1108
  } catch {
1152
1109
  setPhase('error')
@@ -1458,16 +1415,6 @@ window.__ModuleLoader__.load({
1458
1415
  h('span', null, T.registry + ': ' + (state?.registry === '' || !state?.registry ? T.regPnpm : state.registry)),
1459
1416
  ),
1460
1417
  ),
1461
- // 显示位置:四个挂载点各自可以关掉。设置本身存在后端,客户端只是把它镜像
1462
- // 到 localStorage,供 apply() 在注册槽位时同步判断(见 readDisplay 的注释)。
1463
- h('div', { className: S.card },
1464
- h('h3', { className: S.h }, T.displayGroup),
1465
- h('p', { className: S.note }, T.displayHint),
1466
- h(SwitchRow, { label: T.showSettings, value: draft.showSettingsSection !== false, onChange: (v) => patch('showSettingsSection', v) }),
1467
- h(SwitchRow, { label: T.showRow, value: draft.showPluginsRow !== false, onChange: (v) => patch('showPluginsRow', v) }),
1468
- h(SwitchRow, { label: T.showBundle, value: draft.showPluginsBundle !== false, onChange: (v) => patch('showPluginsBundle', v) }),
1469
- h(SwitchRow, { label: T.showTab, value: draft.showVersionsTab !== false, onChange: (v) => patch('showVersionsTab', v) }),
1470
- ),
1471
1418
  h('div', { className: S.card },
1472
1419
  h('h3', { className: S.h }, T.keepTitle),
1473
1420
  h('p', { className: S.note }, T.keepHint),
@@ -1785,14 +1732,20 @@ window.__ModuleLoader__.load({
1785
1732
  .join('|')
1786
1733
  }
1787
1734
 
1788
- function showUpdateToast(updates, applied) {
1789
- if (toastOpen) return
1735
+ /* ── 右下角通知卡 ─────────────────────────────────────────────────────
1736
+ *
1737
+ * 一张卡两种用途:更新提醒,和「设置页搬家」这类一次性告知。结构照
1738
+ * dsh-cost-meter 的峰/谷提醒:圆点徽标 → 标题行(带 ×)→ 一句正文 →
1739
+ * 可选清单 → 主按钮。
1740
+ *
1741
+ * 同一时刻只挂一张:两张叠在右下角会互相挡住,而这两种通知都不紧急。
1742
+ */
1743
+ function showNotice(options) {
1790
1744
  const doc = typeof document === 'undefined' ? null : document
1791
- if (doc === null || doc.body === null) return
1792
- const rows = (Array.isArray(updates) ? updates : []).map((item) => describeUpdate(item)).filter((row) => row !== null)
1793
- if (rows.length === 0) return
1745
+ if (doc === null || doc.body === null) return false
1746
+ if (toastOpen) return false
1794
1747
  toastOpen = true
1795
- // 提醒可能在设置页之外弹出来,样式表没装就先补上(幂等)。
1748
+ // 提醒可能在任何页面弹出来,样式表没装就先补上(幂等)。
1796
1749
  installStyles()
1797
1750
  const box = doc.createElement('div')
1798
1751
  box.setAttribute('data-dsh-aupdate', 'toast')
@@ -1800,58 +1753,59 @@ window.__ModuleLoader__.load({
1800
1753
  box.setAttribute('role', 'status')
1801
1754
  box.setAttribute('aria-live', 'polite')
1802
1755
 
1803
- // 结构与 cost-meter 的「峰/谷切换提醒」一致:圆点徽标 → 标题行(含 ×)
1804
- // → 一句正文 → 清单 → 右对齐按钮。徽标是那张卡最好认的一处,这里复用它。
1805
- const badge = doc.createElement('div')
1806
- badge.className = 'dsh-au-toast-badge'
1807
- badge.textContent = applied > 0 ? T.toastBadge : T.toastBadgeFound
1808
- box.appendChild(badge)
1756
+ if (options.badge) {
1757
+ const badge = doc.createElement('div')
1758
+ badge.className = 'dsh-au-toast-badge'
1759
+ badge.textContent = options.badge
1760
+ box.appendChild(badge)
1761
+ }
1809
1762
 
1810
1763
  const head = doc.createElement('div')
1811
1764
  head.className = 'dsh-au-toast-head'
1812
1765
  const title = doc.createElement('div')
1813
1766
  title.className = 'dsh-au-toast-title'
1814
- // 真的装完了才说「已更新」;只查到、没动手时说「可更新」,别把「发现」说成「装了」。
1815
- title.textContent = (applied > 0 ? T.toastTitle : T.toastTitleFound).replace('{n}', String(rows.length))
1767
+ title.textContent = options.title
1816
1768
  const xBtn = doc.createElement('button')
1817
1769
  xBtn.type = 'button'
1818
1770
  xBtn.className = 'dsh-au-toast-x'
1819
1771
  xBtn.textContent = '×'
1820
- xBtn.setAttribute('aria-label', T.toastDismiss)
1772
+ xBtn.setAttribute('aria-label', options.dismissLabel)
1821
1773
  head.appendChild(title)
1822
1774
  head.appendChild(xBtn)
1823
1775
  box.appendChild(head)
1824
1776
 
1825
- const body = doc.createElement('div')
1826
- body.className = 'dsh-au-toast-body'
1827
- body.textContent = applied > 0 ? T.toastBody : T.toastBodyFound
1828
- box.appendChild(body)
1829
-
1830
- const list = doc.createElement('div')
1831
- list.className = 'dsh-au-toast-list'
1832
- // 超过 12 条就在框内滚动:提醒不该占掉半屏。
1833
- for (const row of rows.slice(0, 12)) {
1834
- const line = doc.createElement('div')
1835
- line.className = 'dsh-au-toast-item'
1836
- const nameEl = doc.createElement('span')
1837
- nameEl.className = 'dsh-au-toast-name'
1838
- nameEl.textContent = row.name
1839
- // 包名可能很长(@scope/name),压缩它而不是压缩版本。
1840
- line.appendChild(nameEl)
1841
- if (row.versions !== '') {
1842
- const verEl = doc.createElement('span')
1843
- verEl.className = 'dsh-au-toast-ver'
1844
- verEl.textContent = row.versions
1845
- line.appendChild(verEl)
1846
- }
1847
- list.appendChild(line)
1777
+ if (options.body) {
1778
+ const body = doc.createElement('div')
1779
+ body.className = 'dsh-au-toast-body'
1780
+ body.textContent = options.body
1781
+ box.appendChild(body)
1848
1782
  }
1849
- box.appendChild(list)
1850
1783
 
1851
- if (rows.length > 12) {
1784
+ const rows = Array.isArray(options.rows) ? options.rows : []
1785
+ if (rows.length > 0) {
1786
+ const list = doc.createElement('div')
1787
+ list.className = 'dsh-au-toast-list'
1788
+ for (const row of rows) {
1789
+ const line = doc.createElement('div')
1790
+ line.className = 'dsh-au-toast-item'
1791
+ const nameEl = doc.createElement('span')
1792
+ nameEl.className = 'dsh-au-toast-name'
1793
+ nameEl.textContent = row.name
1794
+ line.appendChild(nameEl)
1795
+ if (row.versions !== '') {
1796
+ const verEl = doc.createElement('span')
1797
+ verEl.className = 'dsh-au-toast-ver'
1798
+ verEl.textContent = row.versions
1799
+ line.appendChild(verEl)
1800
+ }
1801
+ list.appendChild(line)
1802
+ }
1803
+ box.appendChild(list)
1804
+ }
1805
+ if (options.more) {
1852
1806
  const more = doc.createElement('div')
1853
1807
  more.className = 'dsh-au-toast-more'
1854
- more.textContent = T.toastMore.replace('{n}', String(rows.length - 12))
1808
+ more.textContent = options.more
1855
1809
  box.appendChild(more)
1856
1810
  }
1857
1811
 
@@ -1860,7 +1814,7 @@ window.__ModuleLoader__.load({
1860
1814
  const close = doc.createElement('button')
1861
1815
  close.type = 'button'
1862
1816
  close.className = 'dsh-au-btn dsh-au-primary'
1863
- close.textContent = T.toastDismiss
1817
+ close.textContent = options.dismissLabel
1864
1818
  foot.appendChild(close)
1865
1819
  box.appendChild(foot)
1866
1820
 
@@ -1883,8 +1837,49 @@ window.__ModuleLoader__.load({
1883
1837
  xBtn.addEventListener('click', dismiss)
1884
1838
  try { doc.addEventListener('keydown', onKey, true) } catch {}
1885
1839
  doc.body.appendChild(box)
1886
- // 不点也不会一直挂着:15 秒后自己消失,省得挡住下面的界面。
1887
- setTimeout(dismiss, 15000)
1840
+ // 不点也不会一直挂着:默认 15 秒,搬家的提示留长一点。
1841
+ setTimeout(dismiss, options.ms ?? 15000)
1842
+ return true
1843
+ }
1844
+
1845
+ /** 更新提醒:把这一轮发现的版本做成一张通知卡。 */
1846
+ function showUpdateToast(updates, applied) {
1847
+ const rows = (Array.isArray(updates) ? updates : []).map((item) => describeUpdate(item)).filter((row) => row !== null)
1848
+ if (rows.length === 0) return false
1849
+ return showNotice({
1850
+ badge: applied > 0 ? T.toastBadge : T.toastBadgeFound,
1851
+ // 真的装完了才说「已更新」;只查到、没动手时说「可更新」。
1852
+ title: (applied > 0 ? T.toastTitle : T.toastTitleFound).replace('{n}', String(rows.length)),
1853
+ body: applied > 0 ? T.toastBody : T.toastBodyFound,
1854
+ rows: rows.slice(0, 12),
1855
+ more: rows.length > 12 ? T.toastMore.replace('{n}', String(rows.length - 12)) : '',
1856
+ dismissLabel: T.toastDismiss,
1857
+ ms: 15000,
1858
+ })
1859
+ }
1860
+
1861
+ /* 0.8.3 起「设置 → 插件更新」不再单独占一页:入口搬到插件页那张卡、插件配置页
1862
+ * 和版本管理页的「设置」。这里提示一次就够,记在 localStorage 里,不然每开一次
1863
+ * 页面都会弹。 */
1864
+ const MOVED_KEY = 'dsh-aupdate:settings-moved'
1865
+
1866
+ function movedNoticePending() {
1867
+ try { return window.localStorage.getItem(MOVED_KEY) !== '1' } catch { return false }
1868
+ }
1869
+
1870
+ function markMovedNotice() {
1871
+ try { window.localStorage.setItem(MOVED_KEY, '1') } catch {}
1872
+ }
1873
+
1874
+ function showMovedNotice() {
1875
+ return showNotice({
1876
+ badge: T.movedBadge,
1877
+ title: T.movedTitle,
1878
+ body: T.movedBody,
1879
+ rows: [],
1880
+ dismissLabel: T.toastDismiss,
1881
+ ms: 22000,
1882
+ })
1888
1883
  }
1889
1884
 
1890
1885
  function startUpdateNotifier() {
@@ -1895,13 +1890,20 @@ window.__ModuleLoader__.load({
1895
1890
  try {
1896
1891
  const state = await getState(LANG)
1897
1892
  if (state?.settings?.notify !== false) {
1898
- const updates = Array.isArray(state?.lastRun?.updates) ? state.lastRun.updates : []
1899
- if (updates.length > 0) {
1900
- // 签名算的是「包名+版本变化」,旧格式也能算出来,不会重复弹。
1901
- const sig = updateSignature(updates)
1902
- if (sig !== notifiedMark()) {
1903
- markNotified(sig)
1904
- showUpdateToast(updates, appliedCount(state?.lastRun))
1893
+ // 搬家提示排在前面:它只说一次,而更新提醒下一轮还会再来。
1894
+ if (movedNoticePending() && !toastOpen) {
1895
+ markMovedNotice()
1896
+ showMovedNotice()
1897
+ } else {
1898
+ const updates = Array.isArray(state?.lastRun?.updates) ? state.lastRun.updates : []
1899
+ if (updates.length > 0) {
1900
+ // 签名算的是「包名+版本变化」,旧格式也能算出来,不会重复弹。
1901
+ const sig = updateSignature(updates)
1902
+ // 已经挂着一张卡时不标记:留到下一轮再弹,别把提醒吞掉。
1903
+ if (sig !== notifiedMark() && !toastOpen) {
1904
+ markNotified(sig)
1905
+ showUpdateToast(updates, appliedCount(state?.lastRun))
1906
+ }
1905
1907
  }
1906
1908
  }
1907
1909
  }
@@ -1953,7 +1955,6 @@ window.__ModuleLoader__.load({
1953
1955
  try {
1954
1956
  const next = await getState(LANG)
1955
1957
  setState(next)
1956
- writeDisplay(next?.settings)
1957
1958
  } catch {}
1958
1959
  }, [])
1959
1960
 
@@ -2295,48 +2296,38 @@ window.__ModuleLoader__.load({
2295
2296
  installStyles()
2296
2297
  // 提醒跟着插件一起上、一起卸:ctx.effect 收的是清理函数。
2297
2298
  if (typeof ctx.effect === 'function') ctx.effect(startUpdateNotifier, 'dsh-aupdate: update notices')
2298
- // 「显示位置」:关掉的那一处干脆不注册槽位,而不是挂上去再渲染成空——
2299
- // 后者会在标签栏/设置导航里留下一个点进去什么都没有的空条目。
2300
- const display = readDisplay()
2301
-
2302
2299
  // key 的格式是「包名#条目id」:本插件在 cordis.patch.yml 里的条目 id 就是包名本身,
2303
2300
  // 和 dsh-ops 的 dsh-ops#dsh-ops 一样。写成 #auto-update 之类是挂不上的。
2304
- if (display.showPluginsRow) {
2305
- ctx.slots.inject('plugins.row.config', () => ctx.slots.register({
2306
- name: 'plugins.row.config',
2307
- key: NS + '#' + NS,
2308
- }, (props) => (props && props.view === 'summary' ? h(AutoUpdateSummary) : h(AutoUpdateCard))))
2309
- }
2301
+ ctx.slots.inject('plugins.row.config', () => ctx.slots.register({
2302
+ name: 'plugins.row.config',
2303
+ key: NS + '#' + NS,
2304
+ }, (props) => (props && props.view === 'summary' ? h(AutoUpdateSummary) : h(AutoUpdateCard))))
2310
2305
 
2311
2306
  // bundle 级配置页用包名做 key,和 free-search 的写法一致。
2312
- if (display.showPluginsBundle) {
2313
- ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
2314
- name: 'plugins.bundle.config',
2315
- key: NS,
2316
- }, (props) => (props && props.view === 'summary' ? h(AutoUpdateSummary) : h(AutoUpdateCard))))
2317
- }
2307
+ ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
2308
+ name: 'plugins.bundle.config',
2309
+ key: NS,
2310
+ }, (props) => (props && props.view === 'summary' ? h(AutoUpdateSummary) : h(AutoUpdateCard))))
2318
2311
 
2319
- // 设置 → 插件更新:挂成独立的一页,写法照抄 dsh-our-free-model-balance-zxp
2320
- // 的「渠道余额」。原来只有插件页里那张卡,想改策略得先去插件页翻它。
2321
- if (display.showSettingsSection) {
2322
- ctx.slots.inject('settings.section', () => ctx.slots.register({
2323
- name: 'settings.section',
2324
- id: NS,
2325
- order: 36,
2326
- label: () => T.pageLabel,
2327
- }, () => h(AutoUpdateCard)))
2328
- }
2329
-
2330
- // 插件页标签栏多一个「版本管理」:和设置页分工——设置页管「什么时候自动升」,
2312
+ // 插件页标签栏多一个「版本管理」:和插件页那张卡分工——那张管「什么时候自动升」,
2331
2313
  // 这一页管「现在就要某一版」。order 2 排在「已安装/发现」(0) 和市场(1) 之后。
2332
- if (display.showVersionsTab) {
2333
- ctx.slots.inject('plugins.tab', () => ctx.slots.register({
2334
- name: 'plugins.tab',
2335
- id: NS,
2336
- order: 2,
2337
- label: () => T.versionsTab,
2338
- }, () => h(VersionsTab)))
2339
- }
2314
+ ctx.slots.inject('plugins.tab', () => ctx.slots.register({
2315
+ name: 'plugins.tab',
2316
+ id: NS,
2317
+ order: 2,
2318
+ label: () => T.versionsTab,
2319
+ }, () => h(VersionsTab)))
2320
+
2321
+ // 注意:这里**故意不再注册** 'settings.section'。
2322
+ // 「设置 → 插件更新」原本是独立的一页,现在设置已经在插件页那张卡、
2323
+ // 插件配置页和版本管理页的「设置」里了,多一个入口只是多一处要维护的地方。
2324
+ // 想把它挂回来,取消下面这段注释即可(order 36 是原来的位置)。
2325
+ // ctx.slots.inject('settings.section', () => ctx.slots.register({
2326
+ // name: 'settings.section',
2327
+ // id: NS,
2328
+ // order: 36,
2329
+ // label: () => T.pageLabel,
2330
+ // }, () => h(AutoUpdateCard)))
2340
2331
  },
2341
2332
  }
2342
2333
  },
package/index.js CHANGED
@@ -541,8 +541,6 @@ const OVERRIDEABLE = [
541
541
  'allowMajor', 'allowPrerelease',
542
542
  // 安装源与兼容性预检(0.8.0 借自 dsh-plugin-upgrader)。
543
543
  'registryMode', 'registryUrl', 'compatCheck',
544
- // 显示位置(设置页 / 插件行 / 插件配置页 / 版本管理标签)。
545
- 'showSettingsSection', 'showPluginsRow', 'showPluginsBundle', 'showVersionsTab',
546
544
  // 调度:四种节奏 + 失败抑制时长。这些键不写进 Config schema,
547
545
  // 只活在覆盖层里——Config 的字段类型是宿主校验的,加错一个类型
548
546
  // 会在加载期直接抛错,而覆盖层是我们自己的文件,改坏了只影响这一项。
@@ -742,12 +740,6 @@ function settingsOf(config) {
742
740
  // 兼容性预检:装之前先看目标版本声明的 DSH 范围。默认开——宿主闸门是在
743
741
  // bundle 已经卸下之后才拒绝的,等它拒绝就已经晚了。
744
742
  compatCheck: booleanSetting(config, 'compatCheck', true),
745
- // 显示位置:四个界面各自能被关掉。关掉由客户端在注册槽位时跳过,
746
- // 所以改完要重新加载一次插件(POST /state 会自己安排一次就地重载)。
747
- showSettingsSection: booleanSetting(config, 'showSettingsSection', true),
748
- showPluginsRow: booleanSetting(config, 'showPluginsRow', true),
749
- showPluginsBundle: booleanSetting(config, 'showPluginsBundle', true),
750
- showVersionsTab: booleanSetting(config, 'showVersionsTab', true),
751
743
  intervalMinutes: numberSetting(config, 'intervalMinutes', 1440, 10, 10080),
752
744
  firstDelayMinutes: numberSetting(config, 'firstDelayMinutes', 5, 0, 1440),
753
745
  exclude: stringList(config?.exclude),
@@ -2766,20 +2758,12 @@ function registerRoutes(scope, ctxRef) {
2766
2758
  sendJson(res, 400, { error: 'bad json' })
2767
2759
  return
2768
2760
  }
2769
- const before = settingsOf(ctxRef.config)
2770
2761
  const result = writeOverrides(body)
2771
2762
  if (!result.ok) {
2772
2763
  sendJson(res, 500, { error: result.error })
2773
2764
  return
2774
2765
  }
2775
2766
  writeLog('settingsChanged', [Object.keys(body)])
2776
- // 显示位置是「注册哪些槽位」决定的,改完必须重新加载一次插件才生效。
2777
- // 这里不重启应用,只让本插件就地重载(和装完包之后做的是同一件事)。
2778
- const displayChanged = ['showSettingsSection', 'showPluginsRow', 'showPluginsBundle', 'showVersionsTab']
2779
- .some((key) => before[key] !== settingsOf(ctxRef.config)[key])
2780
- if (displayChanged && settingsOf(ctxRef.config).hotReload) {
2781
- setTimeout(() => { void hotApply(ctxRef.ctx, []).catch(() => {}) }, 1200).unref?.()
2782
- }
2783
2767
  // 改完立刻按新设置重排,否则要等下一次触发才换节奏。
2784
2768
  try {
2785
2769
  if (typeof ctxRef.reschedule === 'function') ctxRef.reschedule()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aupdate",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "description": "定时检查 DSH 插件更新,串行安装后就地生效,不重启;支持多种调度节奏、失败抑制、按包回滚,并在动手前留快照、忙时自动让开;不更新/只更新哪些插件改成勾选,发现更新在右下角提醒,日志最新在最上面,并在「设置 → 插件更新」里有独立一页。",
6
6
  "license": "MIT",