dsh-pocket 2.2.0 → 2.3.0
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.en.md +1 -0
- package/README.md +1 -0
- package/lib/index.js +4 -2
- package/lib/settings.mjs +20 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -132,6 +132,7 @@ Note: in named-tunnel mode the public PIN is **not auto-rotated** (the address i
|
|
|
132
132
|
| `ERR_PNPM_ADDING_TO_ROOT` | pnpm 9 workspace-root restriction: append `-w` (`--workspace-root`) to install/update commands |
|
|
133
133
|
| Nothing changed after install/update | **You must restart `dsh web`**; the running process still loads the old code |
|
|
134
134
|
| `listen EADDRINUSE ... :3081` | A stale dsh-pocket process holds the port: macOS/Linux `lsof -ti :3081 \| xargs kill -9`; Windows `netstat -ano \| findstr :3081` (find the LISTENING PID) → `taskkill /PID <PID> /F`, then retry |
|
|
135
|
+
| Want a different port (issue #70) | Plugin mode: write `"proxyPort": 3082` into `$DSH_HOME/dsh-pocket/settings.json` and restart `dsh web`. CLI mode: `dsh-pocket --port 3082`. If the port is taken you'll get `EADDRINUSE` — kill the old process or pick another one |
|
|
135
136
|
| Version stuck below 1.x | `^0.x` ranges never jump to 1.x: update with `--latest` (`dsh plugin --profile web update dsh-pocket --latest -w`) |
|
|
136
137
|
| Public `error 1033` | See "Public tunnel troubleshooting" below — usually a local proxy/VPN (Clash etc. TUN mode) killing the tunnel |
|
|
137
138
|
| After "Restart dsh web", the page says the process is running in the background | The new process from in-page self-restart is a detached background process (not attached to your terminal) — that's the standard way to apply updates in-page; stop it: macOS/Linux `lsof -ti :3080 \| xargs kill -9`; Windows `netstat -ano \| findstr :3080` → `taskkill /PID <PID> /F` (logs under `$DSH_HOME` as `dsh-pocket-restart-*.log`) |
|
package/README.md
CHANGED
|
@@ -132,6 +132,7 @@ npx @deepseek-ai/dsh web
|
|
|
132
132
|
| `ERR_PNPM_ADDING_TO_ROOT` | pnpm 9 对 workspace 根的限制:安装/更新命令**末尾加 `-w`**(`--workspace-root`) |
|
|
133
133
|
| 装完/更新了但界面没变化 | **必须重启 `dsh web`** 才生效;运行中的进程仍加载旧代码 |
|
|
134
134
|
| `listen EADDRINUSE ... :3081` | 旧 dsh-pocket 进程还占着端口:macOS/Linux `lsof -ti :3081 \| xargs kill -9`;Windows `netstat -ano \| findstr :3081`(找 LISTENING 的 PID)→ `taskkill /PID <PID> /F`,后重试 |
|
|
135
|
+
| 想换端口(issue #70) | 插件模式:在 `$DSH_HOME/dsh-pocket/settings.json` 写 `"proxyPort": 3082` 后重启 `dsh web`。CLI 模式:`dsh-pocket --port 3082`。端口被占会报 `EADDRINUSE`,杀掉旧进程或换一个端口 |
|
|
135
136
|
| 版本停在 0.x 升不上去 | `^0.x` 范围不允许升到 1.x:更新用 `--latest`(`dsh plugin --profile web update dsh-pocket --latest -w`) |
|
|
136
137
|
| 公网 `error 1033` | 见下方「公网隧道常见问题」——多半是本机代理/VPN(Clash 等 TUN 模式)掐断了隧道 |
|
|
137
138
|
| 点「重启 dsh web」后页面提示进程在后台运行 | 自重启的新进程是 detached 后台进程(不挂终端),是页内更新的标准做法;停止它:macOS/Linux `lsof -ti :3080 \| xargs kill -9`;Windows `netstat -ano \| findstr :3080` → `taskkill /PID <PID> /F`(日志在 `$DSH_HOME` 下 `dsh-pocket-restart-*.log`) |
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { createPocketService } from './service.mjs';
|
|
|
21
21
|
import { installPocketRpc } from './web-rpc.js';
|
|
22
22
|
import { restartHost } from './restart.js';
|
|
23
23
|
import { advancedNoticeScript, DEFAULT_INJECT, classifyHost } from './proxy.mjs';
|
|
24
|
-
import { lanEnabled, setLanEnabled, lanAuthEnabled, setLanAuthEnabled, lanIpOverride, setLanIpOverride, pinCustom, setPinCustom, tunnelMode, setTunnelMode, tunnelToken, setTunnelToken, tunnelHostname, setTunnelHostname, resetSettings } from './settings.mjs';
|
|
24
|
+
import { lanEnabled, setLanEnabled, lanAuthEnabled, setLanAuthEnabled, lanIpOverride, setLanIpOverride, pinCustom, setPinCustom, tunnelMode, setTunnelMode, tunnelToken, setTunnelToken, tunnelHostname, setTunnelHostname, resetSettings, proxyPort } from './settings.mjs';
|
|
25
25
|
|
|
26
26
|
const name = 'dsh-pocket';
|
|
27
27
|
const inject = ['connection', 'webServer'];
|
|
@@ -246,7 +246,9 @@ export function apply(ctx, config = {}, internals = {}) {
|
|
|
246
246
|
|
|
247
247
|
const service = internals.service ?? createPocketService({
|
|
248
248
|
dshPort,
|
|
249
|
-
|
|
249
|
+
// 端口(issue #70):插件模式优先级 settings.proxyPort > cordis patch config.port > 3081。
|
|
250
|
+
// 3081 被占时 createPocketService 内部 EADDRINUSE 抛错,按 DSH 插件启动失败处理(用户改端口重启即可)。
|
|
251
|
+
port: internals.port ?? config.port ?? (proxyPort() || 3081),
|
|
250
252
|
home: internals.home,
|
|
251
253
|
internals,
|
|
252
254
|
getLanIpOverride: () => lanIpOverride(),
|
package/lib/settings.mjs
CHANGED
|
@@ -192,3 +192,23 @@ export function setTunnelHostname(value) {
|
|
|
192
192
|
writeSettings(s);
|
|
193
193
|
return v;
|
|
194
194
|
}
|
|
195
|
+
|
|
196
|
+
// ---------- 代理端口(issue #70) ----------
|
|
197
|
+
// 局域网代理的监听端口(默认 3081)。插件模式下唯一改法就是写 settings.json 的
|
|
198
|
+
// proxyPort 字段(CLI 模式可用 dsh-pocket --port)。允许范围 1-65535;
|
|
199
|
+
// 端口已被占用时 dsh web 启动会直接抛 EADDRINUSE(保持原行为),不必在 setter 校验。
|
|
200
|
+
/** 当前代理端口(0 = 用默认 3081)。 */
|
|
201
|
+
export function proxyPort() {
|
|
202
|
+
const v = Number(readSettings().proxyPort);
|
|
203
|
+
return Number.isInteger(v) && v >= 1 && v <= 65535 ? v : 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** 设置代理端口(持久化)。空/0/非法值清除,回退默认 3081。 */
|
|
207
|
+
export function setProxyPort(value) {
|
|
208
|
+
const n = Number(value);
|
|
209
|
+
const s = readSettings();
|
|
210
|
+
if (Number.isInteger(n) && n >= 1 && n <= 65535) s.proxyPort = n;
|
|
211
|
+
else delete s.proxyPort;
|
|
212
|
+
writeSettings(s);
|
|
213
|
+
return proxyPort();
|
|
214
|
+
}
|
package/package.json
CHANGED