dsh-mesh-access 1.5.4 → 1.5.6

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/CHANGELOG.md CHANGED
@@ -215,3 +215,13 @@
215
215
  - 新增「远程卡顿?临时停用 billion-context」卡片:一键写入/移除 profile 的
216
216
  cordis.patch.yml 停用补丁(带标记,恢复时精确删除),并结束现存守护进程。
217
217
  - 适用场景:组网/远程连接卡顿时减负;重启 dsh web 后彻底不加载,随时可恢复。
218
+
219
+ ## 1.5.5 — billion-context 卡片改为纯指引
220
+
221
+ - 移除插件内直接停用/恢复 billion-context 的按钮(避免替用户改 profile 配置)。
222
+ - 改为提示卡:说明卡顿原因与守护数量,指引用户去插件管理/商店自行关闭
223
+ (附 dsh plugin --profile web remove billion-context 命令)。
224
+
225
+ ## 1.5.6 — README 加徽章
226
+
227
+ - npm/GitHub 页面顶部加六个徽章(版本 / 周下载 / License / Release / 平台 / DSH 插件)。
package/README.en.md CHANGED
@@ -9,6 +9,14 @@ inside the server process.
9
9
 
10
10
  [English](#what-it-does) | [中文](README.md)
11
11
 
12
+ [![npm](https://img.shields.io/npm/v/dsh-mesh-access?label=npm&logo=npm)](https://www.npmjs.com/package/dsh-mesh-access)
13
+ [![weekly downloads](https://img.shields.io/npm/dw/dsh-mesh-access)](https://www.npmjs.com/package/dsh-mesh-access)
14
+ [![License](https://img.shields.io/npm/l/dsh-mesh-access)](LICENSE)
15
+ [![GitHub Release](https://img.shields.io/github/v/release/SilverKurali/dsh-mesh-access?label=Release&logo=github)](https://github.com/SilverKurali/dsh-mesh-access/releases)
16
+ [![platform](https://img.shields.io/badge/platform-Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-888)](#)
17
+ [![DSH plugin](https://img.shields.io/badge/DSH-plugin-blueviolet)](https://www.npmjs.com/package/dsh-mesh-access)
18
+
19
+
12
20
  ![The “组网访问” (mesh access) panel in the sidebar](assets/screenshot-1.png)
13
21
 
14
22
  ## What it does
package/README.md CHANGED
@@ -7,6 +7,13 @@
7
7
 
8
8
  [中文](#它做什么) | [English](README.en.md)
9
9
 
10
+ [![npm 版本](https://img.shields.io/npm/v/dsh-mesh-access?label=npm&logo=npm)](https://www.npmjs.com/package/dsh-mesh-access)
11
+ [![周下载量](https://img.shields.io/npm/dw/dsh-mesh-access?label=%E5%91%A8%E4%B8%8B%E8%BD%BD)](https://www.npmjs.com/package/dsh-mesh-access)
12
+ [![License](https://img.shields.io/npm/l/dsh-mesh-access)](LICENSE)
13
+ [![GitHub Release](https://img.shields.io/github/v/release/SilverKurali/dsh-mesh-access?label=Release&logo=github)](https://github.com/SilverKurali/dsh-mesh-access/releases)
14
+ [![平台](https://img.shields.io/badge/platform-Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-888)](#)
15
+ [![DSH 插件](https://img.shields.io/badge/DSH-%E6%8F%92%E4%BB%B6-blueviolet)](https://www.npmjs.com/package/dsh-mesh-access)
16
+
10
17
  ![侧边栏里的「组网访问」面板](assets/screenshot-1.png)
11
18
 
12
19
  ## 它做什么
package/lib/client.js CHANGED
@@ -69,7 +69,6 @@ window.__ModuleLoader__.load({
69
69
  tunnel: () => fetchJson('/api/dsh-mesh-access/tunnel', {}, 8000),
70
70
  auth: () => fetchJson('/api/dsh-mesh-access/auth', {}, 8000),
71
71
  perf: () => fetchJson('/api/dsh-mesh-access/perf', {}, 6000),
72
- perfPost: (body) => fetchJson('/api/dsh-mesh-access/perf', { method: 'POST', body: JSON.stringify(body) }, 20000),
73
72
  authPost: (body) => fetchJson('/api/dsh-mesh-access/auth', { method: 'POST', body: JSON.stringify(body) }, 20000),
74
73
  tunnelAction: (action) =>
75
74
  fetchJson('/api/dsh-mesh-access/tunnel', {
@@ -160,15 +159,6 @@ window.__ModuleLoader__.load({
160
159
  .finally(() => setTunnelBusy(false))
161
160
  }
162
161
 
163
- const runPerf = async (action) => {
164
- setPerfBusy(true)
165
- try {
166
- const r = await api.perfPost({ action })
167
- if (!r.ok) { window.alert(r.error || '操作失败'); return }
168
- window.alert(r.note || '完成')
169
- refresh()
170
- } catch (e) { window.alert('操作失败:' + (e && e.message)) } finally { setPerfBusy(false) }
171
- }
172
162
  const runConfig = () => {
173
163
  const payload = Object.assign({ action: 'config' }, form)
174
164
  setTunnelBusy(true)
@@ -546,16 +536,16 @@ window.__ModuleLoader__.load({
546
536
  })(),
547
537
  ),
548
538
  h(
549
- Card, { title: '远程卡顿?临时停用 billion-context(可选)' },
539
+ Card, { title: '远程卡顿?可临时关闭 billion-context(提示)' },
550
540
  h('div', { style: S.hint },
551
- '组网/远程连接特别卡时,可临时停用 billion-context 插件(它会为每个会话开本地守护进程,远程场景下是纯开销)。停用后上下文压缩等会话功能不可用,远程更流畅。'),
552
- perf ? h('div', { style: S.row },
553
- h('span', { style: S.hint },
554
- perf.bcDisabled ? '当前:已停用(重启 dsh web 后彻底不加载)' : ('当前:运行中' + (perf.bcDaemons ? '(守护 ' + perf.bcDaemons + ' 个)' : ''))),
555
- perf.bcDisabled
556
- ? h('button', { style: S.btn, disabled: perfBusy, onClick: () => runPerf('enable-bc') }, '恢复')
557
- : h('button', { style: S.btnPrimary, disabled: perfBusy, onClick: () => { if (window.confirm('停用 billion-context?上下文压缩等会话功能将不可用,重启 dsh web 后彻底生效。')) runPerf('disable-bc') } }, '临时停用'),
558
- ) : h('div', { style: S.hint }, '状态读取中…'),
541
+ '组网/远程连接特别卡时,多半是 billion-context 插件的开销(它为每个会话开本地守护进程' +
542
+ (perf && perf.bcDaemons ? ',当前守护 ' + perf.bcDaemons + ' 个' : '') +
543
+ ')。想关闭请到 DSH 的插件管理/插件商店里自行停用 billion-context:'),
544
+ h('div', { style: S.row },
545
+ h('code', { style: { ...S.hint, background: 'rgba(127,127,127,.15)', padding: '2px 6px', borderRadius: 4 } },
546
+ 'dsh plugin --profile web remove billion-context'),
547
+ ),
548
+ h('div', { style: S.hint }, '关闭后上下文压缩等会话功能不可用;重启 dsh web 生效。想用时再装回来即可。'),
559
549
  ),
560
550
  h(
561
551
  Card, { title: '第一次用星空组网?' },
package/lib/index.js CHANGED
@@ -738,40 +738,12 @@ transport.useEncryption = true
738
738
  }
739
739
 
740
740
  /* —— billion-context 临时停用(组网/远程卡顿时的减负开关)—— */
741
- const BC_MARKER = '# dsh-mesh-access managed (perf toggle)'
742
- const profileRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
743
- const cordisPatch = () => path.join(profileRoot, 'cordis.patch.yml')
744
- const bcDisabled = () => {
745
- try { return fs.readFileSync(cordisPatch(), 'utf8').includes(BC_MARKER) } catch { return false }
746
- }
747
741
  const bcDaemonPids = () => {
748
742
  try {
749
743
  const out = execSync("pgrep -f 'billion-context/dist/index.js start' || true", { encoding: 'utf8' })
750
744
  return out.trim() ? out.trim().split('\n') : []
751
745
  } catch { return [] }
752
746
  }
753
- const bcDisable = () => {
754
- const f = cordisPatch()
755
- let text = ''
756
- try { text = fs.readFileSync(f, 'utf8') } catch { text = '' }
757
- if (!text.includes(BC_MARKER)) {
758
- text = text.replace(/\s+$/, '\n') + `\n${BC_MARKER}\n- id: billion-context\n disabled: true\n`
759
- fs.writeFileSync(f, text)
760
- }
761
- for (const pid of bcDaemonPids()) { try { process.kill(Number(pid), 'SIGTERM') } catch {} }
762
- return { ok: true, disabled: true, note: '已写入停用补丁并结束 billion-context 守护;重启 dsh web 后彻底不加载' }
763
- }
764
- const bcEnable = () => {
765
- const f = cordisPatch()
766
- try {
767
- let text = fs.readFileSync(f, 'utf8')
768
- const re = new RegExp('\\n?' + BC_MARKER.replace(/[()]/g, '\\$&') + '\\n- id: billion-context\\n\\s+disabled: true\\n?', 'g')
769
- text = text.replace(re, '\n').replace(/\s+$/, '\n')
770
- fs.writeFileSync(f, text)
771
- } catch {}
772
- return { ok: true, disabled: false, note: '已移除停用补丁;重启 dsh web 后恢复加载' }
773
- }
774
-
775
747
  ctx.effect(() => {
776
748
  const routes = [
777
749
  {
@@ -801,17 +773,9 @@ transport.useEncryption = true
801
773
  path: '/api/dsh-mesh-access/perf',
802
774
  handler: async (req, res) => {
803
775
  if (req.method === 'GET') {
804
- return json(res, 200, { ok: true, bcDisabled: bcDisabled(), bcDaemons: bcDaemonPids().length })
805
- }
806
- if (req.method === 'POST') {
807
- let body = {}
808
- try { body = JSON.parse((await readBody(req)) || '{}') } catch { return json(res, 400, { ok: false, error: 'body 不是合法 JSON' }) }
809
- const action = String(body.action ?? '')
810
- if (action === 'disable-bc') return json(res, 200, bcDisable())
811
- if (action === 'enable-bc') return json(res, 200, bcEnable())
812
- return json(res, 400, { ok: false, error: "action 只能是 'disable-bc' 或 'enable-bc'" })
776
+ return json(res, 200, { ok: true, bcDaemons: bcDaemonPids().length })
813
777
  }
814
- return json(res, 405, { ok: false, error: 'GET/POST only' })
778
+ return json(res, 405, { ok: false, error: 'GET only' })
815
779
  },
816
780
  },
817
781
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mesh-access",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "Control your DSH from your phone: opens a port on the mesh/VPN interface from inside the running server process, so a phone browser gets the same instance and the same session list — no SSH, no second dsh. Also reachable from another PC, a GUI NAS, or a TV box.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",