dsh-mobile-plugin 0.5.107 → 0.5.108

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/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * 插件入口(**稳定外壳**)。
3
3
  *
4
+ * 2026-11-24:查新版改为与装包同源(优先问 npm,市场兜底),修 106 卡住不放。
5
+ *
4
6
  * 这个文件是整条自更新链路的锚点,所以它必须尽量不变。真正的实现在**代**里:随包发布的
5
7
  * 那份是 `lib/impl.js`,市场装新版之后 profile 里那份是新一代(新 realpath)。
6
8
  * 外壳负责挑一代、装上去,并在更新到位后换过去,见 `lib/shell/runtime.js`。
@@ -78,7 +80,13 @@ export function apply(ctx) {
78
80
  updateState.checking = true
79
81
  try {
80
82
  await deviceOta.reconcileOfficial()
81
- updateState.result = await updater.checkUpdate(base())
83
+ // 与真正装包同源:先问盘上那一代的 npm 查询模块;只有那一代没有查询模块(老版本 /
84
+ // 无头源码部署)才退回市场。市场没同步到新版就让自动更新停摆、而 App 走 npm 看得到
85
+ // 新版 —— 这正是 0.5.106 卡住不放的原因,两处判据必须走同一个源。
86
+ const fromNpm = await updater.checkFromGeneration({
87
+ packageManager: hostService('profileContext')?.packageManager ?? null,
88
+ })
89
+ updateState.result = fromNpm ?? await updater.checkUpdate(base())
82
90
  updateState.lastError = null
83
91
  } catch (error) {
84
92
  updateState.result = null
@@ -1,3 +1,4 @@
1
+ /** 2026-11-24:判新版改为与装包同源(优先问 npm,市场兜底),修 106 卡住不放。 */
1
2
  /** 更新账本保留安装恢复结果,外壳(含启动时加载的常驻模块)变化提示重新载入外壳。 */
2
3
  /**
3
4
  * 更新编排:查与装都归实现自己,装完就地换代(不重启 DSH)。
@@ -183,6 +184,57 @@ export async function checkUpdate(base, name = PACKAGE_NAME, { force = false } =
183
184
  }
184
185
  }
185
186
 
187
+ /**
188
+ * 外壳的进程启动时就把插件树定死了:盘上那一代换过之后,这里再 require 会拿到旧模块。
189
+ * 所以「判有没有新版」也跟装包一样,从盘上那一代**动态**取查询模块(带时间戳绕开缓存)。
190
+ */
191
+ async function generationModule(dir, rel) {
192
+ const file = path.join(dir, 'lib', rel)
193
+ if (!fs.existsSync(file)) return null
194
+ try {
195
+ return await import(`${pathToFileURL(file).href}?v=${Date.now()}`)
196
+ } catch {
197
+ return null
198
+ }
199
+ }
200
+
201
+ /**
202
+ * 用盘上那一代自己的查询模块问 npm 注册表——与真正装包同一个源。
203
+ *
204
+ * 装包走 `update-install.cjs`(问 npm 注册表),而自动更新以前拿去判「有没有新版」的
205
+ * `check()` 问的是 DSH 市场:市场没装 / 太老 / 还没同步到新版本时,那一头说「没新版」,
206
+ * 自动更新就地停摆,可 App 和手动更新走 npm 却看得到新版。两处判据必须同源。
207
+ *
208
+ * 盘上那一代没有查询模块(老版本 / 无头源码部署)就拿到 null,调用方退回市场,不让
209
+ * 自动更新整个坏掉。拿不到注册表地址也照查——查询模块自己会退回官方源。
210
+ */
211
+ export async function checkFromGeneration({ packageManager = null } = {}) {
212
+ const dir = installedPackageDirSafe()
213
+ if (!dir) return null
214
+ const reg = await generationModule(dir, 'update-registry.cjs')
215
+ const inst = await generationModule(dir, 'update-install.cjs')
216
+ const checkForUpdate = reg?.checkForUpdate ?? reg?.default?.checkForUpdate
217
+ const profileRegistry = inst?.profileRegistry ?? inst?.default?.profileRegistry
218
+ const declaredSource = inst?.declaredSource ?? inst?.default?.declaredSource
219
+ if (typeof checkForUpdate !== 'function' || typeof profileRegistry !== 'function') return null
220
+ try {
221
+ const base = await profileRegistry({ profileNodeModules: profileNodeModules(), packageManager })
222
+ const source = typeof declaredSource === 'function'
223
+ ? declaredSource(path.dirname(profileNodeModules()))
224
+ : null
225
+ const update = await checkForUpdate({ installedVersion: installedVersion(), source, base: base ?? undefined })
226
+ return {
227
+ installedVersion: typeof update.installedVersion === 'string' ? update.installedVersion : null,
228
+ latestVersion: typeof update.latestVersion === 'string' ? update.latestVersion : null,
229
+ updateAvailable: update.updateAvailable === true,
230
+ source: typeof update.source === 'string' ? update.source : null,
231
+ channelSwitch: false,
232
+ }
233
+ } catch {
234
+ return null
235
+ }
236
+ }
237
+
186
238
  /**
187
239
  * 这条链能不能自动更新。
188
240
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mobile-plugin",
3
- "version": "0.5.107",
3
+ "version": "0.5.108",
4
4
  "description": "Mobile API (/api/mobile/v1) and relay client for the DSH mobile app — desktop profile build (dsh 0.2.x, peers resolved by the host)",
5
5
  "license": "MIT",
6
6
  "icon": "./icon.png",
@@ -117,24 +117,23 @@
117
117
  "yaml": "2.9.1"
118
118
  },
119
119
  "dshMobileReleaseNotes": {
120
- "version": "0.5.107",
120
+ "version": "0.5.108",
121
121
  "kinds": [
122
- "feature",
123
- "other",
124
- "fix"
122
+ "fix",
123
+ "feature"
125
124
  ],
126
125
  "notes": {
127
- "zh-Hans": "- 配对二维码现在会带一条公用中转地址做兜底,扫不出服务商线路的 iPhone 也能连上;自己配的中转仍然优先。\n- ZeroNews 首次接入自动带上邀请归属,新注册账号不用手动点邀请链接就能归到代理商名下。\n- 配置页的更新卡片清空了:手动「立即更新」按钮撤掉,更新交给自动更新。",
128
- "zh-Hant": "- 配對二維碼現在會帶一條公用中轉位址做兜底,掃不出服務商線路的 iPhone 也能連上;自己配的中轉仍然優先。\n- ZeroNews 首次接入自動帶上邀請歸屬,新註冊帳號不用手動點邀請連結就能歸到代理商名下。\n- 設定頁的更新卡片清空了:手動「立即更新」按鈕撤掉,更新交給自動更新。",
129
- "en": "- The pairing QR code now includes a built-in public relay address as a fallback, so iPhones that cannot scan provider lines can still connect; your own relay stays the primary choice.\n- ZeroNews now attributes new sign-ups to the reseller automatically on first setup, with no invite link to click.\n- The panel update card has been cleared out: the manual \"Update now\" button is gone and updates run automatically.",
130
- "ja": "- ペアリング用QRコードに内蔵の公共中継アドレスが予備として入るようになり、事業者回線を読み取れないiPhoneでも接続できます。自分で設定した中継は引き続き優先されます。\n- ZeroNewsは初回接続時に招待元を自動で引き継ぎ、新規登録アカウントは招待リンクを開かずに代理店に紐づきます。\n- パネルの更新カードが空になりました。手動の「今すぐ更新」ボタンは撤去され、更新は自動で行われます。",
131
- "ko": "- 페어링 QR 코드에 내장 공용 릴레이 주소가 대비책으로 포함되어, 통신사 회선을 스캔하지 못하는 iPhone도 연결할 수 있습니다. 직접 설정한 릴레이는 계속 우선합니다.\n- ZeroNews 첫 연결 시 초대 귀속이 자동으로 적용되어, 신규 가입 계정이 초대 링크 없이 대리점에 배정됩니다.\n- 패널 업데이트 카드가 비워졌습니다. 수동 \"지금 업데이트\" 버튼은 제거되고 업데이트는 자동으로 처리됩니다.",
132
- "de": "- Der Pairing-QR-Code enthält jetzt eine integrierte öffentliche Relay-Adresse als Fallback, sodass iPhones, die Provider-Leitungen nicht scannen können, trotzdem verbinden können. Dein eigenes Relay bleibt primär.\n- ZeroNews ordnet neue Registrierungen bei der ersten Einrichtung automatisch dem Reseller zu – ein Einladungslink muss nicht angeklickt werden.\n- Die Update-Karte im Panel wurde geleert: Der manuelle „Jetzt aktualisieren\"-Button ist entfernt, Updates laufen automatisch.",
133
- "es": "- El código QR de emparejamiento ahora incluye una dirección de relay pública integrada como respaldo, para que los iPhone que no pueden escanear las líneas del proveedor también puedan conectarse. Tu propio relay sigue siendo prioritario.\n- ZeroNews ahora atribuye automáticamente los registros nuevos al revendedor en la primera configuración, sin necesidad de hacer clic en un enlace de invitación.\n- La tarjeta de actualización del panel se ha vaciado: se eliminó el botón manual «Actualizar ahora» y las actualizaciones se hacen automáticamente.",
134
- "fr": "- Le code QR d'appariement contient désormais une adresse de relais publique intégrée en secours, afin que les iPhone qui ne peuvent pas scanner les lignes du fournisseur puissent tout de même se connecter. Votre propre relais reste prioritaire.\n- ZeroNews attribue désormais automatiquement les nouvelles inscriptions au revendeur dès la première configuration, sans clic sur un lien d'invitation.\n- La carte de mise à jour du panneau a été vidée : le bouton manuel « Mettre à jour maintenant » a été supprimé et les mises à jour se font automatiquement.",
135
- "pt": "- O código QR de pareamento agora inclui um endereço de relay público integrado como reserva, para que iPhones que não conseguem ler as linhas do provedor também consigam se conectar. Seu próprio relay continua tendo prioridade.\n- O ZeroNews agora atribui automaticamente novos cadastros ao revendedor na primeira configuração, sem precisar clicar em um link de convite.\n- O cartão de atualização do painel foi esvaziado: o botão manual \"Atualizar agora\" foi removido e as atualizações acontecem automaticamente.",
136
- "ru": "- QR-код сопряжения теперь содержит встроенный публичный адрес реле в качестве резерва, поэтому iPhone, которые не считывают линии провайдера, тоже могут подключиться. Ваш собственный реле остаётся приоритетным.\n- ZeroNews теперь автоматически привязывает новые регистрации к реселлеру при первом подключении — нажимать ссылку-приглашение не нужно.\n- Карточка обновления в панели очищена: кнопка «Обновить сейчас» убрана, обновления выполняются автоматически.",
137
- "tr": "- Eşleştirme QR kodu artık yedek olarak yerleşik bir ortak röle adresi içeriyor; sağlayıcı hatlarını okuyamayan iPhone'lar da bağlanabiliyor. Kendi röleniz öncelikli olmaya devam ediyor.\n- ZeroNews, ilk kurulumda yeni kayıtları otomatik olarak bayiye atıyor; davet bağlantısına tıklamanız gerekmiyor.\n- Paneldeki güncelleme kartı boşaltıldı: \"Şimdi güncelle\" düğmesi kaldırıldı, güncellemeler otomatik yapılıyor."
126
+ "zh-Hans": "- 修复插件卡在旧版不自动更新的问题:电脑判断有没有新版现在和真正安装走同一个来源,不会再出现「手机上有提示、电脑上却一直不动」。\n- App 现在每隔半小时检查一次插件新版,一直开着也能收到更新提示,不用再切到后台再回来。\n- 插件更新完成后会自动清掉页面上残留的「更新 / 稍后再说」;设备多的时候,更新页可以一次把所有设备一起更新。",
127
+ "zh-Hant": "- 修復外掛卡在舊版不自動更新的問題:電腦判斷有沒有新版現在和真正安裝走同一個來源,不會再出現「手機上有提示、電腦上卻一直不動」。\n- App 現在每隔半小時檢查一次外掛新版,一直開著也能收到更新提示,不用再切到背景再回來。\n- 外掛更新完成後會自動清掉頁面上殘留的「更新 / 稍後再說」;裝置多的時候,更新頁可以一次把所有裝置一起更新。",
128
+ "en": "- Fixed a bug where the plugin could get stuck on an old version and never auto-update: the computer now checks for new versions from the same source it installs from, so the phone can show an update while the computer stays put no longer happens.\n- The app now checks for plugin updates every 30 minutes, so you'll get the notification even if you leave it open — no need to send it to the background and come back.\n- After an update finishes, the leftover \"Update / Later\" buttons are cleared automatically; with many devices, the update page can update them all at once.",
129
+ "ja": "- プラグインが古いバージョンで固まって自動更新されない問題を修正しました。新しいバージョンがあるかの確認を、実際のインストールと同じ情報源から行うようになり、「スマホには通知が出るのにパソコンが動かない」という状態が起きなくなりました。\n- アプリが30分ごとにプラグインの更新を確認するようになり、開いたままでも通知が届きます。バックグラウンドにして戻る必要はありません。\n- 更新完了後にページに残る「更新 / 後で」ボタンが自動で消えます。デバイスが多い場合、更新ページですべてをまとめて更新できます。",
130
+ "ko": "- 플러그인이 오래된 버전에 멈춰 자동 업데이트되지 않던 문제를 수정했습니다. 새 버전이 있는지 확인할 때 실제 설치와 같은 출처를 사용하므로, \"휴대전화에는 알림이 뜨는데 컴퓨터는 그대로인\" 상황이 더 이상 발생하지 않습니다.\n- 앱이 30분마다 플러그인 업데이트를 확인하므로 계속 열어 두어도 알림을 받을 수 있습니다. 백그라운드로 보냈다가 돌아올 필요가 없습니다.\n- 업데이트가 끝나면 화면에 남아 있던 \"업데이트 / 나중에\" 버튼이 자동으로 사라집니다. 기기가 많으면 업데이트 페이지에서 모두 한 번에 업데이트할 수 있습니다.",
131
+ "de": "- Behoben: Das Plugin blieb manchmal auf einer alten Version hängen und aktualisierte sich nicht automatisch. Der Computer prüft jetzt auf dieselbe Weise auf neue Versionen, wie er auch installiert — „das Handy zeigt eine Update-Meldung, der Computer bleibt stehen“ passiert nicht mehr.\n- Die App prüft jetzt alle 30 Minuten auf Plugin-Updates, sodass du auch bei dauerhaft geöffneter App eine Benachrichtigung bekommst — ohne in den Hintergrund und zurück zu wechseln.\n- Nach Abschluss eines Updates verschwinden die übrig gebliebenen Buttons „Aktualisieren / Später“ automatisch; bei vielen Geräten kann die Update-Seite alle auf einmal aktualisieren.",
132
+ "es": "- Corregido: el plugin podía quedarse atascado en una versión antigua y no actualizarse solo. Ahora el ordenador comprueba si hay versiones nuevas desde la misma fuente que usa para instalar, así que ya no ocurre que «el móvil muestra un aviso pero el ordenador no se mueve».\n- La app ahora comprueba las actualizaciones del plugin cada 30 minutos, así que recibirás el aviso aunque la dejes abierta, sin necesidad de pasar a segundo plano y volver.\n- Al terminar una actualización, los botones sobrantes de «Actualizar / Más tarde» desaparecen automáticamente; con muchos dispositivos, la página de actualizaciones puede actualizarlos todos a la vez.",
133
+ "fr": "- Corrigé : le plugin pouvait rester bloqué sur une ancienne version et ne pas se mettre à jour automatiquement. L'ordinateur vérifie désormais l'existence de nouvelles versions depuis la même source que celle utilisée pour l'installation : le cas « le téléphone affiche une notification mais l'ordinateur ne bouge pas » ne se produit plus.\n- L'application vérifie maintenant les mises à jour du plugin toutes les 30 minutes : vous recevrez la notification même si elle reste ouverte, sans passer en arrière-plan et revenir.\n- Une fois la mise à jour terminée, les boutons restants « Mettre à jour / Plus tard » disparaissent automatiquement ; avec de nombreux appareils, la page de mise à jour peut tous les mettre à jour en une seule fois.",
134
+ "pt": "- Corrigido: o plugin podia ficar preso numa versão antiga e não atualizar sozinho. Agora o computador verifica se há versões novas na mesma fonte usada para instalar, então não acontece mais de «o celular mostrar um aviso e o computador ficar parado».\n- O app agora verifica atualizações do plugin a cada 30 minutos, então você recebe o aviso mesmo deixando-o aberto, sem precisar ir para o segundo plano e voltar.\n- Após a conclusão da atualização, os botões restantes de «Atualizar / Depois» desaparecem automaticamente; com muitos dispositivos, a página de atualizações pode atualizar todos de uma vez.",
135
+ "ru": "- Исправлено: плагин мог застрять на старой версии и не обновляться автоматически. Теперь компьютер проверяет наличие новых версий из того же источника, из которого выполняет установку, поэтому ситуация «телефон показывает уведомление, а компьютер не реагирует» больше не возникает.\n- Теперь приложение проверяет обновления плагина каждые 30 минут, поэтому уведомление придёт даже если оно всё время открыто — не нужно сворачивать его и возвращаться.\n- После завершения обновления оставшиеся кнопки «Обновить / Позже» исчезают автоматически; при большом количестве устройств страница обновлений может обновить их все сразу.",
136
+ "tr": "- Düzeltildi: eklenti eski bir sürüme takılıp kendiliğinden güncellenmeyebiliyordu. Artık bilgisayar yeni sürüm olup olmadığını, kurulumu yaptığı kaynaktan kontrol ediyor; böylece \"telefonda bildirim çıkıyor ama bilgisayar kıpırdamıyor\" durumu artık oluşmuyor.\n- Uygulama artık eklenti güncellemelerini 30 dakikada bir kontrol ediyor; açık bıraksanız da bildirim gelir, arka plana alıp geri dönmeniz gerekmez.\n- Bir güncelleme tamamlandığında geride kalan \"Güncelle / Daha sonra\" düğmeleri otomatik kaybolur; cihaz sayısı fazlaysa güncelleme sayfası tümünü aynı anda güncelleyebilir."
138
137
  }
139
138
  }
140
139
  }