dsh-pocket 1.4.6 → 1.4.7

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/client/client.js CHANGED
@@ -1459,12 +1459,7 @@ function PocketSettingsTab({ rpcCall }) {
1459
1459
  )
1460
1460
  )
1461
1461
  ),
1462
- // 桌面端提示:更新/重启由 DSH Desktop 管理,本插件这两项功能已关闭(扫码同屏等照常)
1463
- isDesktop ? (0, import_react2.createElement)(
1464
- "div",
1465
- { style: { ...styles.block, padding: "8px 0 0" } },
1466
- (0, import_react2.createElement)("div", { style: styles.muted }, "\u{1F4BB} DSH Desktop \u73AF\u5883\uFF1A\u66F4\u65B0\u4E0E\u91CD\u542F\u7531\u684C\u9762\u7248\u7BA1\u7406\uFF0C\u6B64\u5904\u5DF2\u505C\u7528 | Running inside DSH Desktop: updates & restart are managed by the desktop app")
1467
- ) : null,
1462
+ // 桌面端不显示更新/重启横幅(更新由 DSH Desktop 管理),也不需要额外提示
1468
1463
  // 重启后提示(进程在后台运行,停止方法)——左侧蓝色色条(桌面端不会触发本插件的自重启)
1469
1464
  !isDesktop && restartNotice ? (0, import_react2.createElement)(
1470
1465
  "div",
package/client/index.jsx CHANGED
@@ -188,10 +188,7 @@ function PocketSettingsTab({ rpcCall }) {
188
188
  ),
189
189
  ),
190
190
 
191
- // 桌面端提示:更新/重启由 DSH Desktop 管理,本插件这两项功能已关闭(扫码同屏等照常)
192
- isDesktop ? h('div', { style: { ...styles.block, padding: '8px 0 0' } },
193
- h('div', { style: styles.muted }, '💻 DSH Desktop 环境:更新与重启由桌面版管理,此处已停用 | Running inside DSH Desktop: updates & restart are managed by the desktop app'),
194
- ) : null,
191
+ // 桌面端不显示更新/重启横幅(更新由 DSH Desktop 管理),也不需要额外提示
195
192
 
196
193
  // 重启后提示(进程在后台运行,停止方法)——左侧蓝色色条(桌面端不会触发本插件的自重启)
197
194
  !isDesktop && restartNotice ? h('div', { style: { ...styles.block, borderLeft: '4px solid var(--dsw-alias-brand-primary,#4f6ef7)', borderRadius: 8, background: 'var(--dsw-alias-bg-layer-2,#f3f4f6)', padding: '10px 12px' } },
package/lib/service.mjs CHANGED
@@ -114,15 +114,28 @@ export function createPocketService({
114
114
 
115
115
  return {
116
116
  dshPort,
117
- /** 启动局域网代理(幂等)。 */
117
+ /** 启动局域网代理(幂等)。端口被占(EADDRINUSE,如桌面版与普通环境同时运行)时自动尝试下一个端口。 */
118
118
  async startProxy() {
119
119
  if (proxy) return proxy;
120
- proxy = await createProxy({
121
- port,
122
- host: '0.0.0.0',
123
- upstream: { host: '127.0.0.1', port: dshPort },
124
- ...(injectHtml ? { injectHtml } : {}),
125
- });
120
+ let lastErr = null;
121
+ for (let p = port; p < port + 10; p++) {
122
+ try {
123
+ proxy = await createProxy({
124
+ port: p,
125
+ host: '0.0.0.0',
126
+ upstream: { host: '127.0.0.1', port: dshPort },
127
+ ...(injectHtml ? { injectHtml } : {}),
128
+ });
129
+ if (p !== port) {
130
+ console.log(`dsh-pocket: port ${port} busy, proxy on ${p} | 端口 ${port} 被占用,代理改用 ${p}`);
131
+ }
132
+ break;
133
+ } catch (err) {
134
+ if (err?.code !== 'EADDRINUSE') throw err; // 非端口冲突直接失败
135
+ lastErr = err;
136
+ }
137
+ }
138
+ if (!proxy) throw lastErr ?? new Error('proxy start failed | 代理启动失败');
126
139
  return proxy;
127
140
  },
128
141
 
package/package.json CHANGED
@@ -76,5 +76,5 @@
76
76
  "access": "public",
77
77
  "registry": "https://registry.npmjs.org/"
78
78
  },
79
- "version": "1.4.6"
79
+ "version": "1.4.7"
80
80
  }