most-box 0.2.9 → 0.3.1

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.
Files changed (140) hide show
  1. package/README.md +41 -21
  2. package/electron/main.js +18 -1
  3. package/electron/preload.cjs +8 -0
  4. package/out/admin/index.html +0 -0
  5. package/out/app/index.html +0 -0
  6. package/out/assets/AccountMenu-NjOgag0d.js +1 -0
  7. package/out/assets/FilePreviewOverlay-CZp6F1s_.js +1 -0
  8. package/out/assets/MarketingHeader-7B-OT2XX.js +1 -0
  9. package/out/assets/MarketingLayout-CyiSCygk.js +1 -0
  10. package/out/assets/{MilkdownEditor-CT6SHYKG.js → MilkdownEditor-WedhCoFH.js} +1 -1
  11. package/out/assets/OpenSidebarButton-BoSmO8CY.js +1 -0
  12. package/out/assets/SidebarHomeLink-CkhGDvZ8.js +1 -0
  13. package/out/assets/arrow-right-DUxAoZqb.js +1 -0
  14. package/out/assets/{ui-BpDGD3IR.js → avatar-BZwHW4ll.js} +2 -2
  15. package/out/assets/circle-alert-DSZ0bG_3.js +1 -0
  16. package/out/assets/copy-CK7HMulu.js +1 -0
  17. package/out/assets/download-Q1uCiwif.js +1 -0
  18. package/out/assets/downloadValidation-Ch966YTl.js +1 -0
  19. package/out/assets/external-link-DGzNJOqQ.js +1 -0
  20. package/out/assets/file-text-C3v0L_lQ.js +1 -0
  21. package/out/assets/folder-CwtLO09O.js +1 -0
  22. package/out/assets/hard-drive-B2V5USzR.js +1 -0
  23. package/out/assets/i18n-DZaOYCSO.js +1 -0
  24. package/out/assets/index-BRhsWNj1.css +1 -0
  25. package/out/assets/index-CBkHUp3F.css +1 -0
  26. package/out/assets/index-CYVRmppz.css +1 -0
  27. package/out/assets/index-DluhgSHX.js +31 -0
  28. package/out/assets/index.lazy-B5TYRvFJ.js +1 -0
  29. package/out/assets/index.lazy-BeDctVci.js +1 -0
  30. package/out/assets/index.lazy-BjmAkVtV.js +1 -0
  31. package/out/assets/index.lazy-CHJbzlK6.js +1 -0
  32. package/out/assets/index.lazy-CITrkWMQ.js +1 -0
  33. package/out/assets/index.lazy-CTGE5fUt.js +2 -0
  34. package/out/assets/index.lazy-CUxcXUMy.js +2 -0
  35. package/out/assets/index.lazy-D84xQtPb.js +3 -0
  36. package/out/assets/index.lazy-DRqAgqpV.js +1 -0
  37. package/out/assets/index.lazy-DSAmY1q_.js +1 -0
  38. package/out/assets/index.lazy-DvbVQRSL.js +1 -0
  39. package/out/assets/index.lazy-gAJi-rJV.js +1 -0
  40. package/out/assets/index.lazy-rzyMd-Gz.js +1 -0
  41. package/out/assets/key-round-Dn5tud-4.js +1 -0
  42. package/out/assets/loader-CLoDCtNy.js +1 -0
  43. package/out/assets/lock-BEWKuIqK.js +1 -0
  44. package/out/assets/message-square-C8ZiYztG.js +1 -0
  45. package/out/assets/mp-CGBtY36n.js +1 -0
  46. package/out/assets/music-BsTA8b_M.js +1 -0
  47. package/out/assets/notebook-pen-DgWzxf2y.js +1 -0
  48. package/out/assets/play-CVkbAJJU.js +1 -0
  49. package/out/assets/plus-D1kCYb8G.js +1 -0
  50. package/out/assets/save-X5c7jlCg.js +1 -0
  51. package/out/assets/search-DAV9vDOq.js +1 -0
  52. package/out/assets/send-C5JjYo-A.js +1 -0
  53. package/out/assets/shield-check-DuD6OLde.js +1 -0
  54. package/out/assets/smartphone-gVFruyjO.js +1 -0
  55. package/out/assets/trash-2-CE-3Dc63.js +1 -0
  56. package/out/assets/triangle-alert-DnOxsFpB.js +1 -0
  57. package/out/assets/upload-CsnBv3pd.js +1 -0
  58. package/out/assets/useChannelMessages-Bs_RWgO4.js +4 -0
  59. package/out/assets/useGameRoom-BxDxm3rp.js +1 -0
  60. package/out/assets/userProfile-UphvP_bG.js +1 -0
  61. package/out/assets/wallet-VDaoXwjI.js +1 -0
  62. package/out/assets/wifi-DfWbmlGE.js +1 -0
  63. package/out/chat/index.html +0 -0
  64. package/out/chat/join/index.html +0 -0
  65. package/out/download/index.html +2 -2
  66. package/out/game/gandengyan/index.html +0 -0
  67. package/out/game/index.html +0 -0
  68. package/out/game/zhajinhua/index.html +0 -0
  69. package/out/index.html +2 -2
  70. package/out/note/index.html +0 -0
  71. package/out/ping/index.html +2 -2
  72. package/out/profile/index.html +0 -0
  73. package/out/web3/index.html +0 -0
  74. package/package.json +2 -5
  75. package/server/index.js +59 -2
  76. package/server/src/http/app.js +9 -1
  77. package/server/src/http/nodeStatus.js +6 -0
  78. package/server/src/http/routePolicy.js +1 -0
  79. package/server/src/http/routes/channelRoutes.js +12 -0
  80. package/server/src/http/routes/noteVaultRoutes.js +85 -0
  81. package/server/src/index.js +476 -3
  82. package/server/src/utils/noteVault.js +327 -0
  83. package/electron/preload.js +0 -6
  84. package/out/assets/FilePreviewOverlay-BYZIAMJ-.js +0 -1
  85. package/out/assets/LanguageToggle-CSQtRZ3A.js +0 -1
  86. package/out/assets/MarketingHeader-ceWdRCpe.js +0 -1
  87. package/out/assets/MarketingLayout-Bun1d2wL.js +0 -1
  88. package/out/assets/MarketingThemeToggle-CIKP8x9W.js +0 -1
  89. package/out/assets/OpenSidebarButton-CLSCB7CG.js +0 -1
  90. package/out/assets/SidebarAccount-CNh0kvtB.js +0 -1
  91. package/out/assets/SidebarHomeLink-DXv0c9Ob.js +0 -1
  92. package/out/assets/arrow-right-BU9c_SL4.js +0 -1
  93. package/out/assets/circle-alert-iuHzciph.js +0 -1
  94. package/out/assets/copy-DEzFUzeX.js +0 -1
  95. package/out/assets/download-jEPn2njL.js +0 -1
  96. package/out/assets/downloadValidation-Bzl7cci9.js +0 -1
  97. package/out/assets/external-link-BFaoZeK0.js +0 -1
  98. package/out/assets/file-text-DPA1riJ_.js +0 -1
  99. package/out/assets/folder-Cfgc70_F.js +0 -1
  100. package/out/assets/hard-drive-Dar_AZEq.js +0 -1
  101. package/out/assets/i18n-NjvOSuV6.js +0 -1
  102. package/out/assets/index-3OD3Chi9.css +0 -1
  103. package/out/assets/index-BHZhApbo.css +0 -1
  104. package/out/assets/index-BI8oNSVC.js +0 -31
  105. package/out/assets/index-BSOvFG3o.css +0 -1
  106. package/out/assets/index.lazy-7omTRykl.js +0 -2
  107. package/out/assets/index.lazy-BOMHingE.js +0 -3
  108. package/out/assets/index.lazy-BSY5_gby.js +0 -1
  109. package/out/assets/index.lazy-C4ipXKZ7.js +0 -1
  110. package/out/assets/index.lazy-CPZbEnJZ.js +0 -1
  111. package/out/assets/index.lazy-Ch4Y17pJ.js +0 -1
  112. package/out/assets/index.lazy-CvBIIYbm.js +0 -1
  113. package/out/assets/index.lazy-Cz-OZwYL.js +0 -1
  114. package/out/assets/index.lazy-D4zNn3D6.js +0 -2
  115. package/out/assets/index.lazy-DRY3xoQp.js +0 -1
  116. package/out/assets/index.lazy-_mEd0Q_u.js +0 -1
  117. package/out/assets/index.lazy-bAp_Hgck.js +0 -1
  118. package/out/assets/index.lazy-ur0joIFl.js +0 -1
  119. package/out/assets/key-round-DNcpSuMw.js +0 -1
  120. package/out/assets/loader-BXQtdens.js +0 -1
  121. package/out/assets/lock-CLIE8cct.js +0 -1
  122. package/out/assets/message-square-Dp09WY1I.js +0 -1
  123. package/out/assets/mp-B6kdA94c.js +0 -1
  124. package/out/assets/music-B19Tg557.js +0 -1
  125. package/out/assets/notebook-pen-C8TlK5sB.js +0 -1
  126. package/out/assets/play-B-BjsTZz.js +0 -1
  127. package/out/assets/plus-4hygj-1Z.js +0 -1
  128. package/out/assets/save-BjrbPwhJ.js +0 -1
  129. package/out/assets/search-DSkiWdvX.js +0 -1
  130. package/out/assets/send-BL4d5iOt.js +0 -1
  131. package/out/assets/shield-check-DzDuWO8r.js +0 -1
  132. package/out/assets/smartphone-tRRFFO0a.js +0 -1
  133. package/out/assets/trash-2-V12tJ8lI.js +0 -1
  134. package/out/assets/triangle-alert-DGWc8ZHu.js +0 -1
  135. package/out/assets/upload-CoCptKya.js +0 -1
  136. package/out/assets/useChannelMessages-BeKF0gwo.js +0 -3
  137. package/out/assets/useGameRoom-cs9YpYt7.js +0 -1
  138. package/out/assets/userProfile-qcc60tHK.js +0 -1
  139. package/out/assets/wallet-T7ONZ3Kg.js +0 -1
  140. package/out/assets/wifi-Bgo8eHY0.js +0 -1
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><html lang="zh-CN" data-scroll-behavior="smooth"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="stylesheet" href="/assets/index-BHZhApbo.css" data-precedence="default"/><title>MostBox - 网络连通性</title><meta name="theme-color" content="#5e6ad2"/><meta name="description" content="测试到全球主流网站的网络连通性和延迟"/><link rel="modulepreload" href="/assets/index-BI8oNSVC.js"/><link rel="modulepreload" href="/assets/jsx-runtime-Bt-cYkS5.js"/><link rel="modulepreload" href="/assets/ui-BpDGD3IR.js"/><link rel="modulepreload" href="/assets/useNavigate-DWlBD_-b.js"/><link rel="modulepreload" href="/assets/i18n-NjvOSuV6.js"/><link rel="icon" href="/logo.svg" type="image/svg+xml"/><script>
1
+ <!DOCTYPE html><html lang="zh-CN" data-scroll-behavior="smooth"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="stylesheet" href="/assets/index-CBkHUp3F.css" data-precedence="default"/><title>MostBox - 网络连通性</title><meta name="theme-color" content="#5e6ad2"/><meta name="description" content="测试到全球主流网站的网络连通性和延迟"/><link rel="modulepreload" href="/assets/index-DluhgSHX.js"/><link rel="modulepreload" href="/assets/jsx-runtime-Bt-cYkS5.js"/><link rel="modulepreload" href="/assets/avatar-BZwHW4ll.js"/><link rel="modulepreload" href="/assets/useNavigate-DWlBD_-b.js"/><link rel="modulepreload" href="/assets/i18n-DZaOYCSO.js"/><link rel="icon" href="/logo.svg" type="image/svg+xml"/><script>
2
2
  (function() {
3
3
  var theme = localStorage.getItem('theme');
4
4
  if (theme === 'dark' || (!theme && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
@@ -17,4 +17,4 @@
17
17
  window.onunhandledrejection = function(event) {
18
18
  console.error('[Unhandled Promise Rejection]', event.reason);
19
19
  };
20
- </script><!--$--><div class="mkt-layout"><nav class="mkt-nav"><div class="mkt-nav-inner"><a href="/" class="mkt-nav-logo"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="8" height="8" rx="2" fill="var(--accent)" opacity="0.4"></rect><rect x="14" y="2" width="8" height="8" rx="2" fill="var(--accent)" opacity="0.7"></rect><rect x="2" y="14" width="8" height="8" rx="2" fill="var(--accent)" opacity="0.7"></rect><rect x="14" y="14" width="8" height="8" rx="2" fill="var(--accent)"></rect></svg>MOST PEOPLE</a><div class="mkt-nav-cta"><button type="button" class="mkt-theme-toggle" aria-label="切换主题" title="切换主题"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"></path></svg></button><span class="ui-action-menu-anchor"><button type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="_R_55r6_" class="language-toggle mkt-theme-toggle" aria-label="选择语言" title="选择语言 (当前语言: 简体中文)"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-languages" aria-hidden="true"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg></button></span><a href="/download/" class="btn btn-primary mkt-nav-preview"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载客户端</a><button type="button" class="btn btn-secondary">开始使用</button></div></div></nav><main class="mkt-layout-main"><div class="ping-page"><div class="ping-header"><div class="ping-title-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wifi ping-title-icon" aria-hidden="true"><path d="M12 20h.01"></path><path d="M2 8.82a15 15 0 0 1 20 0"></path><path d="M5 12.859a10 10 0 0 1 14 0"></path><path d="M8.5 16.429a5 5 0 0 1 7 0"></path></svg><div><h1 class="ping-title">网络连通性</h1><p class="ping-subtitle">通过向对应网站发送请求进行测试,延迟值仅供参考。</p></div></div><button class="btn btn-icon" aria-label="重新测试全部" title="重新测试全部"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-grid"><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-search" aria-hidden="true"><path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://google.com" target="_blank" rel="noreferrer" class="ping-card-name">Google</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Google" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud" aria-hidden="true"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://cloudflare.com" target="_blank" rel="noreferrer" class="ping-card-name">Cloudflare</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Cloudflare" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play" aria-hidden="true"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://youtube.com" target="_blank" rel="noreferrer" class="ping-card-name">YouTube</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 YouTube" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-terminal" aria-hidden="true"><path d="M12 19h8"></path><path d="m4 17 6-6-6-6"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://github.com" target="_blank" rel="noreferrer" class="ping-card-name">GitHub</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 GitHub" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bot" aria-hidden="true"><path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://chatgpt.com" target="_blank" rel="noreferrer" class="ping-card-name">ChatGPT</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 ChatGPT" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-at-sign" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://x.com" target="_blank" rel="noreferrer" class="ping-card-name">X</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 X" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-camera" aria-hidden="true"><path d="M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"></path><circle cx="12" cy="13" r="3"></circle></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://instagram.com" target="_blank" rel="noreferrer" class="ping-card-name">Instagram</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Instagram" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square" aria-hidden="true"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://reddit.com" target="_blank" rel="noreferrer" class="ping-card-name">Reddit</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Reddit" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open" aria-hidden="true"><path d="M12 7v14"></path><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://wikipedia.org" target="_blank" rel="noreferrer" class="ping-card-name">Wikipedia</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Wikipedia" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-smartphone" aria-hidden="true"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://apple.com" target="_blank" rel="noreferrer" class="ping-card-name">Apple</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Apple" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send" aria-hidden="true"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"></path><path d="m21.854 2.147-10.94 10.939"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://telegram.org" target="_blank" rel="noreferrer" class="ping-card-name">Telegram</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Telegram" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-messages-square" aria-hidden="true"><path d="M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path><path d="M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://discord.com" target="_blank" rel="noreferrer" class="ping-card-name">Discord</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Discord" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-music" aria-hidden="true"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://tiktok.com" target="_blank" rel="noreferrer" class="ping-card-name">TikTok</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 TikTok" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-package" aria-hidden="true"><path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"></path><path d="M12 22V12"></path><polyline points="3.29 7 12 12 20.71 7"></polyline><path d="m7.5 4.27 9 5.15"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://npmjs.com" target="_blank" rel="noreferrer" class="ping-card-name">npm</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 npm" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-triangle" aria-hidden="true"><path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://vercel.com" target="_blank" rel="noreferrer" class="ping-card-name">Vercel</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Vercel" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div></div></div></main><footer class="mkt-footer"><div class="mkt-container"><div class="mkt-footer-inner"><div class="mkt-footer-links"><a href="/">关于</a><a class="active" href="/ping/" data-status="active" aria-current="page">网络</a><a href="https://github.com/most-people/most" target="_blank" rel="noopener noreferrer">GitHub</a></div><span class="mkt-footer-copy">© <!-- -->2026<!-- --> MOST PEOPLE · MIT License</span><span class="mkt-footer-build" translate="no">v<!-- -->0.2.9</span></div></div></footer></div><script>(function(a,f){let l;try{l=JSON.parse(sessionStorage.getItem(a)||"{}")}catch{return}const n=l?.[f||history.state?.__TSR_key];let c=!1;for(const t in n){const e=n[t],o=e?.scrollX,s=e?.scrollY;if(Number.isFinite(o)&&Number.isFinite(s)){if(t==="window")scrollTo(o,s),c=!0;else if(t)try{const r=document.querySelector(t);r&&(r.scrollLeft=o,r.scrollTop=s)}catch{}}}if(c)return;const i=location.hash.slice(1);if(i){const t=history.state?.__hashScrollIntoViewOptions??!0;if(t){const e=document.getElementById(i);e&&e.scrollIntoView(t)}return}scrollTo(0,0)})("tsr-scroll-restoration-v1_3");document.currentScript.remove()</script><!--/$--><script class="$tsr" id="$tsr-stream-barrier">(self.$R=self.$R||{})["tsr"]=[];self.$_TSR={h(){this.hydrated=!0,this.c()},e(){this.streamEnded=!0,this.c()},c(){this.hydrated&&this.streamEnded&&(delete self.$_TSR,delete self.$R.tsr)},p(e){this.initialized?e():this.buffer.push(e)},buffer:[]};$_TSR.router=($R=>$R[0]={manifest:$R[1]={routes:$R[2]={__root__:$R[3]={preloads:$R[4]=["/assets/index-BI8oNSVC.js","/assets/jsx-runtime-Bt-cYkS5.js","/assets/ui-BpDGD3IR.js","/assets/useNavigate-DWlBD_-b.js","/assets/i18n-NjvOSuV6.js"],scripts:$R[5]=[$R[6]={attrs:$R[7]={type:"module",async:!0,src:"/assets/index-BI8oNSVC.js"}}],css:$R[8]=["/assets/index-BHZhApbo.css"]}}},matches:$R[9]=[$R[10]={i:"__root__",u:1782275850814,s:"success",ssr:!0},$R[11]={i:"pingping",u:1782275850819,s:"success",ssr:!0}],lastMatchId:"pingping"})($R["tsr"]);$_TSR.e();document.currentScript.remove()</script><script type="module" async="" src="/assets/index-BI8oNSVC.js"></script></body></html>
20
+ </script><!--$--><div class="mkt-layout"><nav class="mkt-nav"><div class="mkt-nav-inner"><a href="/" class="mkt-nav-logo"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="8" height="8" rx="2" fill="var(--accent)" opacity="0.4"></rect><rect x="14" y="2" width="8" height="8" rx="2" fill="var(--accent)" opacity="0.7"></rect><rect x="2" y="14" width="8" height="8" rx="2" fill="var(--accent)" opacity="0.7"></rect><rect x="14" y="14" width="8" height="8" rx="2" fill="var(--accent)"></rect></svg>MOST PEOPLE</a><div class="mkt-nav-cta"><button type="button" class="header-tool-btn" title="切换主题" aria-label="切换主题" aria-pressed="false"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-moon" aria-hidden="true"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"></path></svg></button><span class="ui-action-menu-anchor language-toggle"><button type="button" aria-haspopup="menu" aria-expanded="false" aria-controls="_R_55r6_" class="header-tool-btn" title="选择语言" aria-label="选择语言"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-languages" aria-hidden="true"><path d="m5 8 6 6"></path><path d="m4 14 6-6 2-3"></path><path d="M2 5h12"></path><path d="M7 2h1"></path><path d="m22 22-5-10-5 10"></path><path d="M14 18h6"></path></svg></button></span><a href="/download/" class="btn btn-primary mkt-nav-preview"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg>下载客户端</a><a title="个人资料" aria-label="个人资料" href="/profile/" class="account-profile-link"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg></a></div></div></nav><main class="mkt-layout-main"><div class="ping-page"><div class="ping-header"><div class="ping-title-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wifi ping-title-icon" aria-hidden="true"><path d="M12 20h.01"></path><path d="M2 8.82a15 15 0 0 1 20 0"></path><path d="M5 12.859a10 10 0 0 1 14 0"></path><path d="M8.5 16.429a5 5 0 0 1 7 0"></path></svg><div><h1 class="ping-title">网络连通性</h1><p class="ping-subtitle">通过向对应网站发送请求进行测试,延迟值仅供参考。</p></div></div><button class="btn btn-icon" aria-label="重新测试全部" title="重新测试全部"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-grid"><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-search" aria-hidden="true"><path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://google.com" target="_blank" rel="noreferrer" class="ping-card-name">Google</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Google" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud" aria-hidden="true"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://cloudflare.com" target="_blank" rel="noreferrer" class="ping-card-name">Cloudflare</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Cloudflare" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play" aria-hidden="true"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://youtube.com" target="_blank" rel="noreferrer" class="ping-card-name">YouTube</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 YouTube" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-terminal" aria-hidden="true"><path d="M12 19h8"></path><path d="m4 17 6-6-6-6"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://github.com" target="_blank" rel="noreferrer" class="ping-card-name">GitHub</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 GitHub" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bot" aria-hidden="true"><path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://chatgpt.com" target="_blank" rel="noreferrer" class="ping-card-name">ChatGPT</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 ChatGPT" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-at-sign" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://x.com" target="_blank" rel="noreferrer" class="ping-card-name">X</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 X" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-camera" aria-hidden="true"><path d="M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"></path><circle cx="12" cy="13" r="3"></circle></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://instagram.com" target="_blank" rel="noreferrer" class="ping-card-name">Instagram</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Instagram" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square" aria-hidden="true"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://reddit.com" target="_blank" rel="noreferrer" class="ping-card-name">Reddit</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Reddit" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open" aria-hidden="true"><path d="M12 7v14"></path><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://wikipedia.org" target="_blank" rel="noreferrer" class="ping-card-name">Wikipedia</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Wikipedia" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-smartphone" aria-hidden="true"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://apple.com" target="_blank" rel="noreferrer" class="ping-card-name">Apple</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Apple" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send" aria-hidden="true"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"></path><path d="m21.854 2.147-10.94 10.939"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://telegram.org" target="_blank" rel="noreferrer" class="ping-card-name">Telegram</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Telegram" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-messages-square" aria-hidden="true"><path d="M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path><path d="M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://discord.com" target="_blank" rel="noreferrer" class="ping-card-name">Discord</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Discord" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-music" aria-hidden="true"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://tiktok.com" target="_blank" rel="noreferrer" class="ping-card-name">TikTok</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 TikTok" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-package" aria-hidden="true"><path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"></path><path d="M12 22V12"></path><polyline points="3.29 7 12 12 20.71 7"></polyline><path d="m7.5 4.27 9 5.15"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://npmjs.com" target="_blank" rel="noreferrer" class="ping-card-name">npm</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 npm" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div><div class="ping-card pending"><div class="ping-card-top"><span class="ping-card-icon"><span class="brand-icon-wrap"><span class="brand-icon-fallback "><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-triangle" aria-hidden="true"><path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path></svg></span><span class="brand-icon-real "><span></span></span></span></span><a href="https://vercel.com" target="_blank" rel="noreferrer" class="ping-card-name">Vercel</a><button class="ping-card-refresh" disabled="" aria-label="重新测试 Vercel" title="重新测试"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw ping-spin" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg></button></div><div class="ping-card-bottom"><span class="ping-pulse-dot"></span><span class="ping-latency is-muted">--</span></div></div></div></div></main><footer class="mkt-footer"><div class="mkt-container"><div class="mkt-footer-inner"><div class="mkt-footer-links"><a href="/">关于</a><a class="active" href="/ping/" data-status="active" aria-current="page">网络</a><a href="https://github.com/most-people/most" target="_blank" rel="noopener noreferrer">GitHub</a></div><span class="mkt-footer-copy">© <!-- -->2026<!-- --> MOST PEOPLE · MIT License</span><span class="mkt-footer-build" translate="no">v<!-- -->0.3.1</span></div></div></footer></div><script>(function(a,f){let l;try{l=JSON.parse(sessionStorage.getItem(a)||"{}")}catch{return}const n=l?.[f||history.state?.__TSR_key];let c=!1;for(const t in n){const e=n[t],o=e?.scrollX,s=e?.scrollY;if(Number.isFinite(o)&&Number.isFinite(s)){if(t==="window")scrollTo(o,s),c=!0;else if(t)try{const r=document.querySelector(t);r&&(r.scrollLeft=o,r.scrollTop=s)}catch{}}}if(c)return;const i=location.hash.slice(1);if(i){const t=history.state?.__hashScrollIntoViewOptions??!0;if(t){const e=document.getElementById(i);e&&e.scrollIntoView(t)}return}scrollTo(0,0)})("tsr-scroll-restoration-v1_3");document.currentScript.remove()</script><!--/$--><script class="$tsr" id="$tsr-stream-barrier">(self.$R=self.$R||{})["tsr"]=[];self.$_TSR={h(){this.hydrated=!0,this.c()},e(){this.streamEnded=!0,this.c()},c(){this.hydrated&&this.streamEnded&&(delete self.$_TSR,delete self.$R.tsr)},p(e){this.initialized?e():this.buffer.push(e)},buffer:[]};$_TSR.router=($R=>$R[0]={manifest:$R[1]={routes:$R[2]={__root__:$R[3]={preloads:$R[4]=["/assets/index-DluhgSHX.js","/assets/jsx-runtime-Bt-cYkS5.js","/assets/avatar-BZwHW4ll.js","/assets/useNavigate-DWlBD_-b.js","/assets/i18n-DZaOYCSO.js"],scripts:$R[5]=[$R[6]={attrs:$R[7]={type:"module",async:!0,src:"/assets/index-DluhgSHX.js"}}],css:$R[8]=["/assets/index-CBkHUp3F.css"]}}},matches:$R[9]=[$R[10]={i:"__root__",u:1782383355731,s:"success",ssr:!0},$R[11]={i:"pingping",u:1782383355735,s:"success",ssr:!0}],lastMatchId:"pingping"})($R["tsr"]);$_TSR.e();document.currentScript.remove()</script><script type="module" async="" src="/assets/index-DluhgSHX.js"></script></body></html>
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "most-box",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "MostBox - P2P file sharing application",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",
@@ -18,7 +18,7 @@
18
18
  "scripts": {
19
19
  "start": "vite",
20
20
  "server": "node --watch server/index.js",
21
- "dev": "vite",
21
+ "desktop": "npm run electron:dev",
22
22
  "build": "vite build && node scripts/prepare-start-static.mjs",
23
23
  "preview": "vite preview",
24
24
  "serve": "npm run build && node server/index.js",
@@ -27,9 +27,6 @@
27
27
  "test:desktop": "node --test electron/*.test.js",
28
28
  "test:frontend": "node --test src/tests/*.test.js",
29
29
  "test:protocol": "node --test --test-name-pattern \"extracts CID and filename|matches golden CID samples|publishes a file from Buffer|lists published files|pulls through local seed nodes\" server/tests/unit/cid.test.js server/tests/integration/cid.test.js server/tests/integration/engine.test.js",
30
- "android": "npm --prefix mobile/android start",
31
- "android:build": "npm --prefix mobile/android run apk",
32
- "android:test": "npm --prefix mobile/android test",
33
30
  "typecheck": "tsc -p tsconfig.typecheck.json",
34
31
  "typecheck:strict-router": "tsc -p tsconfig.strict-router.json",
35
32
  "check:static-output": "node scripts/check-static-output.mjs",
package/server/index.js CHANGED
@@ -137,6 +137,9 @@ function bindEngineEvents({
137
137
  engine.on('channel:peer:offline', data =>
138
138
  wsBroadcast('channel:peer:offline', data)
139
139
  )
140
+ engine.on('channel:presence', data =>
141
+ wsSendToChannel(data.channelKey, 'channel:presence', data)
142
+ )
140
143
  engine.on('channel:joined', data => wsBroadcast('channel:joined', data))
141
144
  engine.on('channel:left', data => wsBroadcast('channel:left', data))
142
145
  engine.on('user:metadata:updated', data => {
@@ -157,23 +160,33 @@ function bindEngineEvents({
157
160
  }
158
161
 
159
162
  function createWebSocketServer({
163
+ engine,
160
164
  serverInstance,
161
165
  validateWebSocketRequest,
166
+ getWebSocketUserAddress,
162
167
  subscribeToChannel,
163
168
  unsubscribeFromChannel,
164
169
  cleanupWsSubscriptions,
165
170
  }) {
166
171
  const wss = new WebSocketServer({ noServer: true })
172
+ let wsConnectionCounter = 0
167
173
 
168
- wss.on('connection', ws => {
174
+ wss.on('connection', (ws, req) => {
175
+ ws.userAddress = getWebSocketUserAddress(req)
176
+ ws.presenceSourceId = `ws:${++wsConnectionCounter}`
169
177
  ws.on('error', () => {})
170
178
  ws.on('close', () => {
171
179
  cleanupWsSubscriptions(ws)
180
+ try {
181
+ engine.clearChannelPresenceSource(ws.presenceSourceId, {
182
+ broadcast: true,
183
+ })
184
+ } catch {}
172
185
  })
173
186
  ws.on('message', raw => {
174
187
  try {
175
188
  const msg = JSON.parse(raw)
176
- const { event, data } = msg
189
+ const { event, data = {} } = msg
177
190
 
178
191
  switch (event) {
179
192
  case 'register':
@@ -189,6 +202,48 @@ function createWebSocketServer({
189
202
  unsubscribeFromChannel(ws, data.channel)
190
203
  }
191
204
  break
205
+ case 'channel:presence:join':
206
+ if (data.channel && ws.userAddress) {
207
+ engine.joinChannelPresence(data.channel, {
208
+ ownerAddress: ws.userAddress,
209
+ sourceId: ws.presenceSourceId,
210
+ sessionId: data.sessionId,
211
+ displayName: data.displayName,
212
+ avatar: data.avatar,
213
+ profileUpdatedAt: data.profileUpdatedAt,
214
+ })
215
+ }
216
+ break
217
+ case 'channel:presence:heartbeat':
218
+ if (data.channel && ws.userAddress) {
219
+ engine.heartbeatChannelPresence(data.channel, {
220
+ ownerAddress: ws.userAddress,
221
+ sourceId: ws.presenceSourceId,
222
+ sessionId: data.sessionId,
223
+ })
224
+ }
225
+ break
226
+ case 'channel:presence:profile':
227
+ if (data.channel && ws.userAddress) {
228
+ engine.updateChannelPresenceProfile(data.channel, {
229
+ ownerAddress: ws.userAddress,
230
+ sourceId: ws.presenceSourceId,
231
+ sessionId: data.sessionId,
232
+ displayName: data.displayName,
233
+ avatar: data.avatar,
234
+ profileUpdatedAt: data.profileUpdatedAt,
235
+ })
236
+ }
237
+ break
238
+ case 'channel:presence:leave':
239
+ if (data.channel && ws.userAddress) {
240
+ engine.leaveChannelPresence(data.channel, {
241
+ ownerAddress: ws.userAddress,
242
+ sourceId: ws.presenceSourceId,
243
+ sessionId: data.sessionId,
244
+ })
245
+ }
246
+ break
192
247
  }
193
248
  } catch (err) {
194
249
  console.error('[WS Message Error]', err.message)
@@ -295,8 +350,10 @@ export async function main() {
295
350
  )
296
351
 
297
352
  wssRef.current = createWebSocketServer({
353
+ engine,
298
354
  serverInstance: serverInstanceRef.current,
299
355
  validateWebSocketRequest: appRuntime.validateWebSocketRequest,
356
+ getWebSocketUserAddress: appRuntime.getWebSocketUserAddress,
300
357
  subscribeToChannel: appRuntime.subscribeToChannel,
301
358
  unsubscribeFromChannel: appRuntime.unsubscribeFromChannel,
302
359
  cleanupWsSubscriptions: appRuntime.cleanupWsSubscriptions,
@@ -31,6 +31,7 @@ import { registerStaticRoutes } from './staticFiles.js'
31
31
  import { registerChannelRoutes } from './routes/channelRoutes.js'
32
32
  import { registerFileRoutes } from './routes/fileRoutes.js'
33
33
  import { registerNodeRoutes } from './routes/nodeRoutes.js'
34
+ import { registerNoteVaultRoutes } from './routes/noteVaultRoutes.js'
34
35
  import { registerSeedRoutes } from './routes/seedRoutes.js'
35
36
 
36
37
  export { UPLOAD_TMP_DIR } from './uploads.js'
@@ -225,6 +226,11 @@ export function createApp(engine, options = {}) {
225
226
  return false
226
227
  }
227
228
 
229
+ return Boolean(getWebSocketUserAddress(req))
230
+ }
231
+
232
+ function getWebSocketUserAddress(req) {
233
+ const url = new URL(req.url, `http://localhost:${appPort}`)
228
234
  const address = url.searchParams.get('address') || ''
229
235
  const timestamp = url.searchParams.get('timestamp') || ''
230
236
  const signature = url.searchParams.get('signature') || ''
@@ -233,7 +239,7 @@ export function createApp(engine, options = {}) {
233
239
  'GET',
234
240
  '/ws'
235
241
  )
236
- return auth.ok
242
+ return auth.ok ? auth.address : ''
237
243
  }
238
244
 
239
245
  // 将广播函数挂载到 engine 上供外部测试使用
@@ -297,6 +303,7 @@ export function createApp(engine, options = {}) {
297
303
  registerSeedRoutes(app, { engine, appendNodeLog, broadcastNodeStatus })
298
304
  registerFileRoutes(app, { engine, configStore, wsBroadcast })
299
305
  registerChannelRoutes(app, { engine })
306
+ registerNoteVaultRoutes(app, { configStore, isRemoteRequest })
300
307
 
301
308
  registerStaticRoutes(app)
302
309
 
@@ -310,5 +317,6 @@ export function createApp(engine, options = {}) {
310
317
  unsubscribeFromChannel,
311
318
  cleanupWsSubscriptions,
312
319
  validateWebSocketRequest,
320
+ getWebSocketUserAddress,
313
321
  }
314
322
  }
@@ -266,6 +266,12 @@ export function buildOpenApiSpec(appPort) {
266
266
  responses: { 200: { description: 'Channel peers' } },
267
267
  },
268
268
  },
269
+ '/api/channels/{name}/presence': {
270
+ get: {
271
+ summary: 'List active user presence for a channel',
272
+ responses: { 200: { description: 'Channel presence' } },
273
+ },
274
+ },
269
275
  '/api/channels/{name}/remark': {
270
276
  put: {
271
277
  summary: 'Set an authenticated user channel remark',
@@ -28,6 +28,7 @@ export function requiresUserAuth(path) {
28
28
  path === '/api/trash' ||
29
29
  path === '/api/move' ||
30
30
  path === '/api/folder/rename' ||
31
+ path.startsWith('/api/note-vault') ||
31
32
  path.startsWith('/api/files/') ||
32
33
  path.startsWith('/api/trash/') ||
33
34
  path.startsWith('/api/channels')
@@ -123,6 +123,18 @@ export function registerChannelRoutes(app, { engine }) {
123
123
  }
124
124
  })
125
125
 
126
+ app.get('/api/channels/:name/presence', c => {
127
+ try {
128
+ return c.json(
129
+ engine.getChannelPresence(c.req.param('name'), {
130
+ ownerAddress: c.get('userAddress'),
131
+ })
132
+ )
133
+ } catch (err) {
134
+ return badRequestOrAppError(c, err)
135
+ }
136
+ })
137
+
126
138
  app.put('/api/channels/:name/remark', async c => {
127
139
  const name = c.req.param('name')
128
140
  const body = await c.req.json()
@@ -0,0 +1,85 @@
1
+ import { errorJson } from '../errors.js'
2
+ import { PermissionError } from '../../utils/errors.js'
3
+ import {
4
+ configureNoteVault,
5
+ getConfiguredNoteVaultPath,
6
+ getNoteVaultStatus,
7
+ listMarkdownFiles,
8
+ readMarkdownFile,
9
+ writeMarkdownFile,
10
+ } from '../../utils/noteVault.js'
11
+
12
+ function assertNoteVaultAccess(c, isRemoteRequest) {
13
+ if (process.env.ELECTRON_APP !== 'true') {
14
+ throw new PermissionError('Note vault is only available in Electron')
15
+ }
16
+ if (isRemoteRequest(c)) {
17
+ throw new PermissionError('Note vault is only available locally')
18
+ }
19
+ }
20
+
21
+ function getBodyPath(body) {
22
+ return String(body.path || body.vaultPath || '').trim()
23
+ }
24
+
25
+ export function registerNoteVaultRoutes(app, { configStore, isRemoteRequest }) {
26
+ app.get('/api/note-vault/status', async c => {
27
+ try {
28
+ assertNoteVaultAccess(c, isRemoteRequest)
29
+ return c.json(await getNoteVaultStatus(configStore.configDir))
30
+ } catch (err) {
31
+ return errorJson(c, err)
32
+ }
33
+ })
34
+
35
+ app.post('/api/note-vault/config', async c => {
36
+ try {
37
+ assertNoteVaultAccess(c, isRemoteRequest)
38
+ const body = await c.req.json()
39
+ const status = await configureNoteVault(
40
+ configStore.configDir,
41
+ getBodyPath(body)
42
+ )
43
+ return c.json({ success: true, ...status })
44
+ } catch (err) {
45
+ return errorJson(c, err)
46
+ }
47
+ })
48
+
49
+ app.get('/api/note-vault/files', async c => {
50
+ try {
51
+ assertNoteVaultAccess(c, isRemoteRequest)
52
+ const vaultPath = await getConfiguredNoteVaultPath(configStore.configDir)
53
+ return c.json({ files: await listMarkdownFiles(vaultPath) })
54
+ } catch (err) {
55
+ return errorJson(c, err)
56
+ }
57
+ })
58
+
59
+ app.get('/api/note-vault/file', async c => {
60
+ try {
61
+ assertNoteVaultAccess(c, isRemoteRequest)
62
+ const vaultPath = await getConfiguredNoteVaultPath(configStore.configDir)
63
+ const file = await readMarkdownFile(vaultPath, c.req.query('path'))
64
+ return c.json(file)
65
+ } catch (err) {
66
+ return errorJson(c, err)
67
+ }
68
+ })
69
+
70
+ app.put('/api/note-vault/file', async c => {
71
+ try {
72
+ assertNoteVaultAccess(c, isRemoteRequest)
73
+ const body = await c.req.json()
74
+ const vaultPath = await getConfiguredNoteVaultPath(configStore.configDir)
75
+ const file = await writeMarkdownFile(
76
+ vaultPath,
77
+ String(body.path || ''),
78
+ String(body.content || '')
79
+ )
80
+ return c.json({ success: true, file })
81
+ } catch (err) {
82
+ return errorJson(c, err)
83
+ }
84
+ })
85
+ }