dsh-mesh-access 1.5.3 → 1.5.5

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
@@ -209,3 +209,15 @@
209
209
  - start 成功后把端口记进侧车(meshPort);手动 stop 会清除记录。
210
210
  - dsh web 启动时若侧车有记录,自动把组网口开回来(轮询等待上游端口与组网网卡就绪,
211
211
  最多 5 分钟;期间用户手动开过就不再干预)。解决升级/重启后手机突然 502 的问题。
212
+
213
+ ## 1.5.4 — 面板可临时停用 billion-context
214
+
215
+ - 新增「远程卡顿?临时停用 billion-context」卡片:一键写入/移除 profile 的
216
+ cordis.patch.yml 停用补丁(带标记,恢复时精确删除),并结束现存守护进程。
217
+ - 适用场景:组网/远程连接卡顿时减负;重启 dsh web 后彻底不加载,随时可恢复。
218
+
219
+ ## 1.5.5 — billion-context 卡片改为纯指引
220
+
221
+ - 移除插件内直接停用/恢复 billion-context 的按钮(避免替用户改 profile 配置)。
222
+ - 改为提示卡:说明卡顿原因与守护数量,指引用户去插件管理/商店自行关闭
223
+ (附 dsh plugin --profile web remove billion-context 命令)。
package/lib/client.js CHANGED
@@ -68,6 +68,7 @@ window.__ModuleLoader__.load({
68
68
  status: () => fetchJson('/api/dsh-mesh-access/status', {}, 6000),
69
69
  tunnel: () => fetchJson('/api/dsh-mesh-access/tunnel', {}, 8000),
70
70
  auth: () => fetchJson('/api/dsh-mesh-access/auth', {}, 8000),
71
+ perf: () => fetchJson('/api/dsh-mesh-access/perf', {}, 6000),
71
72
  authPost: (body) => fetchJson('/api/dsh-mesh-access/auth', { method: 'POST', body: JSON.stringify(body) }, 20000),
72
73
  tunnelAction: (action) =>
73
74
  fetchJson('/api/dsh-mesh-access/tunnel', {
@@ -103,6 +104,8 @@ window.__ModuleLoader__.load({
103
104
  const [authBusy, setAuthBusy] = react.useState(false)
104
105
  const [authErr, setAuthErr] = react.useState(null)
105
106
  const [authForm, setAuthForm] = react.useState({ username: '', password: '' })
107
+ const [perf, setPerf] = react.useState(null)
108
+ const [perfBusy, setPerfBusy] = react.useState(false)
106
109
  const [tab, setTab] = react.useState('guide')
107
110
  const [authMsg, setAuthMsg] = react.useState('')
108
111
  const [busy, setBusy] = react.useState(false)
@@ -129,6 +132,10 @@ window.__ModuleLoader__.load({
129
132
  .auth()
130
133
  .then((a) => setAuth(a))
131
134
  .catch(() => {})
135
+ api
136
+ .perf()
137
+ .then((pf) => setPerf(pf))
138
+ .catch(() => {})
132
139
  }, [])
133
140
 
134
141
  react.useEffect(() => {
@@ -529,6 +536,18 @@ window.__ModuleLoader__.load({
529
536
  })(),
530
537
  ),
531
538
  h(
539
+ Card, { title: '远程卡顿?可临时关闭 billion-context(提示)' },
540
+ 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 生效。想用时再装回来即可。'),
549
+ ),
550
+ h(
532
551
  Card, { title: '第一次用星空组网?' },
533
552
  h('div', { style: S.hint }, '三步走,不用记 IP,也不用改任何配置。'),
534
553
  h('div', { style: S.row },
package/lib/index.js CHANGED
@@ -17,9 +17,11 @@
17
17
  */
18
18
  import os from 'node:os'
19
19
  import fs from 'node:fs'
20
+ import path from 'node:path'
21
+ import { fileURLToPath } from 'node:url'
22
+ import { execSync } from 'node:child_process'
20
23
  import http from 'node:http'
21
24
  import net from 'node:net'
22
- import path from 'node:path'
23
25
  import { randomBytes, scryptSync, timingSafeEqual } from 'node:crypto'
24
26
  import { spawn } from 'node:child_process'
25
27
 
@@ -735,6 +737,13 @@ transport.useEncryption = true
735
737
  }
736
738
  }
737
739
 
740
+ /* —— billion-context 临时停用(组网/远程卡顿时的减负开关)—— */
741
+ const bcDaemonPids = () => {
742
+ try {
743
+ const out = execSync("pgrep -f 'billion-context/dist/index.js start' || true", { encoding: 'utf8' })
744
+ return out.trim() ? out.trim().split('\n') : []
745
+ } catch { return [] }
746
+ }
738
747
  ctx.effect(() => {
739
748
  const routes = [
740
749
  {
@@ -759,6 +768,16 @@ transport.useEncryption = true
759
768
  return json(res, 400, { ok: false, error: "action 只能是 'start' 或 'stop'" })
760
769
  },
761
770
  },
771
+ {
772
+ kind: 'exact',
773
+ path: '/api/dsh-mesh-access/perf',
774
+ handler: async (req, res) => {
775
+ if (req.method === 'GET') {
776
+ return json(res, 200, { ok: true, bcDaemons: bcDaemonPids().length })
777
+ }
778
+ return json(res, 405, { ok: false, error: 'GET only' })
779
+ },
780
+ },
762
781
  {
763
782
  kind: 'exact',
764
783
  path: '/api/dsh-mesh-access/auth',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mesh-access",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
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",