most-box 0.2.1 → 0.2.3

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 (168) hide show
  1. package/README.md +66 -6
  2. package/electron/deepLink.js +29 -0
  3. package/electron/main.js +87 -20
  4. package/out/admin/index.html +0 -0
  5. package/out/app/index.html +0 -0
  6. package/out/assets/AppShell-B1U4lDqV.js +1 -0
  7. package/out/assets/FilePreviewOverlay-Cme4vUhr.js +1 -0
  8. package/out/assets/LanguageToggle-CBpXWdO9.js +1 -0
  9. package/out/assets/MarketingHeader-CkcBATx2.js +1 -0
  10. package/out/assets/MarketingLayout-mQV6ciYc.js +1 -0
  11. package/out/assets/{MarketingThemeToggle-qlwCZU1o.js → MarketingThemeToggle-DHVvLtms.js} +1 -1
  12. package/out/assets/{MilkdownEditor-_TGlDyA_.js → MilkdownEditor-WdGJyEa8.js} +1 -1
  13. package/out/assets/OpenSidebarButton-CtsDYSq0.js +1 -0
  14. package/out/assets/SidebarAccount-4NFTcAF7.js +1 -0
  15. package/out/assets/arrow-right-RldN7Rwi.js +1 -0
  16. package/out/assets/circle-alert-BQoSDxUe.js +1 -0
  17. package/out/assets/cloud-DHoTMeZY.js +1 -0
  18. package/out/assets/copy-BtJHJnqH.js +1 -0
  19. package/out/assets/download-Bg-OdoxM.js +1 -0
  20. package/out/assets/downloadValidation-DS9_BV-n.js +1 -0
  21. package/out/assets/external-link-m8ZIQe4p.js +1 -0
  22. package/out/assets/file-text-DG1orIkZ.js +1 -0
  23. package/out/assets/game-s6irY8hS.js +1 -0
  24. package/out/assets/hard-drive-BB-sllXA.js +1 -0
  25. package/out/assets/index-3OD3Chi9.css +1 -0
  26. package/out/assets/index-BJ7E8LJN.js +31 -0
  27. package/out/assets/index-BSOvFG3o.css +1 -0
  28. package/out/assets/index-C0xqKeu-.css +1 -0
  29. package/out/assets/index.lazy-B5hOQuoO.js +2 -0
  30. package/out/assets/index.lazy-B9ligvAg.js +1 -0
  31. package/out/assets/index.lazy-BZ7nMBcY.js +3 -0
  32. package/out/assets/index.lazy-C-2BI6Ew.js +1 -0
  33. package/out/assets/index.lazy-C3z-lGsL.js +1 -0
  34. package/out/assets/index.lazy-Cda9sU_h.js +1 -0
  35. package/out/assets/index.lazy-D5ybxeOu.js +1 -0
  36. package/out/assets/index.lazy-DMZi3gid.js +1 -0
  37. package/out/assets/index.lazy-DSjaivix.js +1 -0
  38. package/out/assets/index.lazy-Dvgt53xN.js +1 -0
  39. package/out/assets/index.lazy-Dvo4Ncqe.js +2 -0
  40. package/out/assets/index.lazy-DwKnzBXo.js +1 -0
  41. package/out/assets/index.lazy-GQILyi6o.js +1 -0
  42. package/out/assets/key-round-DIQ3Xt5F.js +1 -0
  43. package/out/assets/lock-tf1t2yuy.js +1 -0
  44. package/out/assets/message-square-DaQH7q-P.js +1 -0
  45. package/out/assets/mp-DYPYks13.js +1 -0
  46. package/out/assets/music-DaFvU2DL.js +1 -0
  47. package/out/assets/notebook-pen-CqEFOHKx.js +1 -0
  48. package/out/assets/play-B7q6F75-.js +1 -0
  49. package/out/assets/plus-H2i2mspM.js +1 -0
  50. package/out/assets/refresh-cw-roxAhABl.js +1 -0
  51. package/out/assets/save-DR0O9ReR.js +1 -0
  52. package/out/assets/search-ncblG-zw.js +1 -0
  53. package/out/assets/send-m1XCcuPn.js +1 -0
  54. package/out/assets/shield-check-BwcvTU4U.js +1 -0
  55. package/out/assets/trash-2-CNpsqYc1.js +1 -0
  56. package/out/assets/triangle-alert-DP9EP7IM.js +1 -0
  57. package/out/assets/upload-V--8p13l.js +1 -0
  58. package/out/assets/useChannelMessages-qJTlBnzX.js +3 -0
  59. package/out/assets/useGameRoom-C9hu7Cez.js +1 -0
  60. package/out/assets/useNavigate-DWlBD_-b.js +1 -0
  61. package/out/assets/userStore-C4vdYsQp.js +4 -0
  62. package/out/assets/wallet-CozFU6yK.js +1 -0
  63. package/out/assets/wifi-DIR3g_8A.js +1 -0
  64. package/out/chat/index.html +0 -0
  65. package/out/chat/join/index.html +0 -0
  66. package/out/download/index.html +2 -2
  67. package/out/game/gandengyan/index.html +0 -0
  68. package/out/game/index.html +0 -0
  69. package/out/game/zhajinhua/index.html +0 -0
  70. package/out/index.html +2 -2
  71. package/out/note/index.html +0 -0
  72. package/out/ping/index.html +2 -2
  73. package/out/profile/index.html +0 -0
  74. package/out/web3/index.html +0 -0
  75. package/package.json +9 -1
  76. package/server/index.js +36 -7
  77. package/server/src/core/channelIdentity.js +6 -0
  78. package/server/src/core/gameRoom.js +15 -5
  79. package/server/src/core/mostLink.js +8 -7
  80. package/server/src/core/zhajinhua.js +6 -0
  81. package/server/src/games/gandengyan.js +10 -0
  82. package/server/src/http/access.js +63 -12
  83. package/server/src/http/app.js +34 -838
  84. package/server/src/http/nodeStatus.js +101 -9
  85. package/server/src/http/routePolicy.js +2 -0
  86. package/server/src/http/routes/channelRoutes.js +163 -0
  87. package/server/src/http/routes/fileRoutes.js +345 -0
  88. package/server/src/http/routes/nodeRoutes.js +323 -0
  89. package/server/src/http/routes/seedRoutes.js +58 -0
  90. package/server/src/index.js +197 -16
  91. package/server/src/node/config.js +2 -6
  92. package/server/src/utils/api.js +27 -1
  93. package/server/src/utils/avatar.js +30 -15
  94. package/server/src/utils/downloadMessages.js +0 -2
  95. package/out/assets/AppShell-OiOEqXPr.js +0 -1
  96. package/out/assets/ChatUi-Cif5LRF3.js +0 -1
  97. package/out/assets/CopyButton-Dm7krgbq.js +0 -1
  98. package/out/assets/LanguageToggle-B4ZNuBCV.js +0 -1
  99. package/out/assets/MarketingHeader-yIZuQP7m.js +0 -1
  100. package/out/assets/MarketingLayout-DVH0Nx7S.js +0 -1
  101. package/out/assets/MoveModal-BVr4Q7-b.js +0 -1
  102. package/out/assets/Nav-5xeettNJ.js +0 -1
  103. package/out/assets/NoteSidebar-DpniUKmy.js +0 -1
  104. package/out/assets/OpenSidebarButton-BfgG2HIT.js +0 -1
  105. package/out/assets/PemBlock-CxwIepth.js +0 -1
  106. package/out/assets/SidebarAccount-Zg5DZblE.js +0 -1
  107. package/out/assets/arrow-right-CL9YSDVS.js +0 -1
  108. package/out/assets/channelApi-DNdJfsJ-.js +0 -1
  109. package/out/assets/chevron-down-CnLh_-aO.js +0 -1
  110. package/out/assets/circle-alert-oiiRDvhx.js +0 -1
  111. package/out/assets/cloud-BEe2N89j.js +0 -1
  112. package/out/assets/code-9LB8QqxL.js +0 -1
  113. package/out/assets/copy-giX4rmFJ.js +0 -1
  114. package/out/assets/download-D0oMEYQZ.js +0 -1
  115. package/out/assets/downloadValidation-Bk1VsBBo.js +0 -1
  116. package/out/assets/external-link-Cm2WCUxv.js +0 -1
  117. package/out/assets/filePreview-BZ50vZZf.js +0 -1
  118. package/out/assets/game-Bvz4dspe.js +0 -1
  119. package/out/assets/hard-drive-B3CQbcp2.js +0 -1
  120. package/out/assets/index-8eWJAjpY.css +0 -1
  121. package/out/assets/index-BZc4blbW.css +0 -1
  122. package/out/assets/index-BkZvz4WA.css +0 -1
  123. package/out/assets/index-WCK14Vja.js +0 -34
  124. package/out/assets/index.lazy-5Q6GuMNT.js +0 -1
  125. package/out/assets/index.lazy-5jq6EFXa.js +0 -3
  126. package/out/assets/index.lazy-7n1Q-NrA.js +0 -3
  127. package/out/assets/index.lazy-BFnOyQFj.js +0 -1
  128. package/out/assets/index.lazy-B_oPp6qK.js +0 -1
  129. package/out/assets/index.lazy-BvY50KVz.js +0 -1
  130. package/out/assets/index.lazy-C0Kn_amZ.js +0 -1
  131. package/out/assets/index.lazy-C3cek3Gn.js +0 -1
  132. package/out/assets/index.lazy-CLpPkdy1.js +0 -1
  133. package/out/assets/index.lazy-Cpr1kApf.js +0 -2
  134. package/out/assets/index.lazy-CuwLZiUK.js +0 -1
  135. package/out/assets/index.lazy-DDc3Ylgf.js +0 -2
  136. package/out/assets/index.lazy-Dg3aqOss.js +0 -1
  137. package/out/assets/key-round-CzuljhND.js +0 -1
  138. package/out/assets/lock-D2NhNoJW.js +0 -1
  139. package/out/assets/message-square-DwBq_Go5.js +0 -1
  140. package/out/assets/mp-Bln2MB9G.js +0 -1
  141. package/out/assets/music-CB73K5Gz.js +0 -1
  142. package/out/assets/notebook-pen-Up7r5zoI.js +0 -1
  143. package/out/assets/play-OszVgROb.js +0 -1
  144. package/out/assets/plus-BbxQG_Ai.js +0 -1
  145. package/out/assets/save-CiqyiifY.js +0 -1
  146. package/out/assets/search-gqAPOsgS.js +0 -1
  147. package/out/assets/send-vwCWsZGP.js +0 -1
  148. package/out/assets/shield-check-CxWxsNLc.js +0 -1
  149. package/out/assets/trash-2-DNGr8IgF.js +0 -1
  150. package/out/assets/triangle-alert-B_1BlX1b.js +0 -1
  151. package/out/assets/upload-Dxl7GUzb.js +0 -1
  152. package/out/assets/useChannelMessages-7bYKXU_R.js +0 -3
  153. package/out/assets/useGameRoom-DqA1mkfk.js +0 -1
  154. package/out/assets/wallet-DlkawdPJ.js +0 -1
  155. package/out/assets/wifi-sBOKcPFM.js +0 -1
  156. package/out/demo/index.html +0 -0
  157. /package/out/avatars/default/{ocean.svg → dolphin.svg} +0 -0
  158. /package/out/avatars/default/{violet.svg → owl.svg} +0 -0
  159. /package/out/avatars/default/{mint.svg → panda.svg} +0 -0
  160. /package/out/avatars/default/{dusk.svg → snow-mountain.svg} +0 -0
  161. /package/out/avatars/default/{ember.svg → tiger.svg} +0 -0
  162. /package/out/avatars/default/{sage.svg → turtle.svg} +0 -0
  163. /package/public/avatars/default/{ocean.svg → dolphin.svg} +0 -0
  164. /package/public/avatars/default/{violet.svg → owl.svg} +0 -0
  165. /package/public/avatars/default/{mint.svg → panda.svg} +0 -0
  166. /package/public/avatars/default/{dusk.svg → snow-mountain.svg} +0 -0
  167. /package/public/avatars/default/{ember.svg → tiger.svg} +0 -0
  168. /package/public/avatars/default/{sage.svg → turtle.svg} +0 -0
@@ -32,6 +32,7 @@ import {
32
32
  createChannelWriterId,
33
33
  buildChannelKey,
34
34
  normalizeChannelKey,
35
+ isSpecialChannel,
35
36
  uniqueStrings,
36
37
  } from './core/channelIdentity.js'
37
38
  import { getPathBaseName, getDisplayPathFolder } from './core/displayPath.js'
@@ -166,7 +167,7 @@ export class MostBoxEngine extends EventEmitter {
166
167
  #userSyncCores = new Map()
167
168
  #userSyncCoreOffsets = new Map()
168
169
  #userSyncDiscoveries = new Map()
169
- #userSyncMetadata = { sessions: {}, clocks: {} }
170
+ #userSyncMetadata = { sessions: {}, clocks: {}, profiles: {} }
170
171
 
171
172
  #chatSwarm = null
172
173
 
@@ -1883,6 +1884,58 @@ export class MostBoxEngine extends EventEmitter {
1883
1884
  }
1884
1885
  }
1885
1886
 
1887
+ getUserProfile(ownerAddressInput) {
1888
+ this.#ensureInitialized()
1889
+ const ownerAddress = normalizeOwnerAddress(ownerAddressInput)
1890
+ if (!ownerAddress) {
1891
+ throw new ValidationError('valid owner address is required')
1892
+ }
1893
+ const profile = this.#userSyncMetadata.profiles?.[ownerAddress]
1894
+ return profile ? { ...profile } : null
1895
+ }
1896
+
1897
+ saveUserProfile(ownerAddressInput, profileInput = {}) {
1898
+ this.#ensureInitialized()
1899
+ const ownerAddress = normalizeOwnerAddress(ownerAddressInput)
1900
+ if (!ownerAddress) {
1901
+ throw new ValidationError('valid owner address is required')
1902
+ }
1903
+ const existing = this.getUserProfile(ownerAddress)
1904
+ const profile = this.#normalizeUserProfileRecord(
1905
+ ownerAddress,
1906
+ profileInput,
1907
+ getNextSyncTimestamp(existing?.syncUpdatedAt)
1908
+ )
1909
+ if (!profile) {
1910
+ throw new ValidationError('valid profile is required')
1911
+ }
1912
+ if (existing && profile.syncUpdatedAt <= existing.syncUpdatedAt) {
1913
+ return { ...existing }
1914
+ }
1915
+
1916
+ this.#userSyncMetadata.profiles = this.#userSyncMetadata.profiles || {}
1917
+ this.#userSyncMetadata.profiles[ownerAddress] = profile
1918
+ this.#setUserSyncClock(ownerAddress, 'profile', profile.syncUpdatedAt)
1919
+ this.#appendUserSyncOpSoon(ownerAddress, 'profile:upsert', { profile })
1920
+
1921
+ const changedChannels = this.#applyUserProfileToJoinedChannels(
1922
+ ownerAddress,
1923
+ profile
1924
+ )
1925
+ if (changedChannels) {
1926
+ this.#saveChannelsMetadata()
1927
+ this.emit('user:metadata:updated', {
1928
+ ownerAddress,
1929
+ scope: 'channels',
1930
+ })
1931
+ }
1932
+ this.emit('user:metadata:updated', {
1933
+ ownerAddress,
1934
+ scope: 'profile',
1935
+ })
1936
+ return { ...profile }
1937
+ }
1938
+
1886
1939
  async cacheFile(cid, options = {}) {
1887
1940
  this.#ensureInitialized()
1888
1941
  const ownerAddress = normalizeOwnerAddress(options.ownerAddress)
@@ -2404,14 +2457,13 @@ export class MostBoxEngine extends EventEmitter {
2404
2457
  }
2405
2458
 
2406
2459
  /**
2407
- * 列出所有频道
2460
+ * 列出频道;默认排除带点号的系统频道。
2408
2461
  * @returns {Array<{ channelId: string, channelKey: string, name: string, createdAt: string, lastMessageAt: string, type: string, peerCount: number, remark: string, pinned: boolean }>}
2409
2462
  */
2410
2463
  listChannels(options = {}) {
2411
2464
  this.#ensureInitialized()
2412
2465
  const ownerAddress = normalizeOwnerAddress(options.ownerAddress)
2413
2466
  const type = String(options.type || '').trim()
2414
- const excludeType = String(options.excludeType || '').trim()
2415
2467
 
2416
2468
  return this.#channels
2417
2469
  .filter(c => {
@@ -2420,8 +2472,7 @@ export class MostBoxEngine extends EventEmitter {
2420
2472
  })
2421
2473
  .filter(c => {
2422
2474
  if (type) return c.type === type
2423
- if (excludeType) return c.type !== excludeType
2424
- return true
2475
+ return !isSpecialChannel(c)
2425
2476
  })
2426
2477
  .map(c => this.#formatChannelForResponse(c, ownerAddress))
2427
2478
  }
@@ -2531,7 +2582,9 @@ export class MostBoxEngine extends EventEmitter {
2531
2582
  this.#upsertChannelMember(channel, {
2532
2583
  ownerAddress: options.ownerAddress,
2533
2584
  displayName: authorName,
2534
- avatar: options.avatar,
2585
+ ...(Object.prototype.hasOwnProperty.call(options, 'avatar')
2586
+ ? { avatar: options.avatar }
2587
+ : {}),
2535
2588
  })
2536
2589
  ) {
2537
2590
  this.#saveChannelsMetadata()
@@ -2992,9 +3045,16 @@ export class MostBoxEngine extends EventEmitter {
2992
3045
  existing.displayName = displayName
2993
3046
  changed = true
2994
3047
  }
2995
- if (avatar && existing.avatar !== avatar) {
2996
- existing.avatar = avatar
2997
- changed = true
3048
+ if (Object.prototype.hasOwnProperty.call(options, 'avatar')) {
3049
+ const currentAvatar = normalizeChannelAvatar(existing.avatar)
3050
+ if (currentAvatar !== avatar) {
3051
+ if (avatar) {
3052
+ existing.avatar = avatar
3053
+ } else {
3054
+ delete existing.avatar
3055
+ }
3056
+ changed = true
3057
+ }
2998
3058
  }
2999
3059
  if (!existing.joinedAt) {
3000
3060
  existing.joinedAt = new Date().toISOString()
@@ -3072,10 +3132,23 @@ export class MostBoxEngine extends EventEmitter {
3072
3132
  item => normalizeOwnerAddress(item?.address) === authorAddress
3073
3133
  )
3074
3134
  : null
3075
- const avatar = normalizeChannelAvatar(member?.avatar)
3076
- const baseMessage = avatar && message?.avatar !== avatar
3077
- ? { ...message, avatar }
3078
- : message
3135
+ let baseMessage = message
3136
+ if (member) {
3137
+ const displayName = normalizeChannelDisplayName(
3138
+ member.displayName,
3139
+ authorAddress
3140
+ )
3141
+ const avatar = normalizeChannelAvatar(member.avatar)
3142
+ if (displayName && baseMessage?.authorName !== displayName) {
3143
+ baseMessage = { ...baseMessage, authorName: displayName }
3144
+ }
3145
+ if (avatar && baseMessage?.avatar !== avatar) {
3146
+ baseMessage = { ...baseMessage, avatar }
3147
+ } else if (!avatar && baseMessage?.avatar) {
3148
+ baseMessage = { ...baseMessage }
3149
+ delete baseMessage.avatar
3150
+ }
3151
+ }
3079
3152
  const attachment = baseMessage?.attachment
3080
3153
  if (!attachment?.cid || !attachment.fileName) {
3081
3154
  return baseMessage
@@ -3362,8 +3435,10 @@ export class MostBoxEngine extends EventEmitter {
3362
3435
  .filter(channel => this.#channelHasMember(channel, ownerAddress))
3363
3436
  .map(channel => this.#formatChannelForSync(channel, ownerAddress))
3364
3437
  .filter(Boolean)
3438
+ const profile = this.#formatUserProfileForSync(ownerAddress)
3365
3439
  return this.#appendUserSyncOp(ownerAddress, 'snapshot', {
3366
3440
  reason,
3441
+ profile,
3367
3442
  files,
3368
3443
  trashFiles,
3369
3444
  channels,
@@ -3382,8 +3457,16 @@ export class MostBoxEngine extends EventEmitter {
3382
3457
  async #applyUserSyncOp(session, op) {
3383
3458
  let changedFiles = false
3384
3459
  let changedChannels = false
3460
+ let changedProfile = false
3385
3461
  if (op.kind === 'snapshot') {
3386
3462
  const payload = op.payload || {}
3463
+ const profileResult = this.#applyUserSyncProfileRecord(
3464
+ session.ownerAddress,
3465
+ payload.profile,
3466
+ getSyncTimestamp(payload.profile?.syncUpdatedAt, op.timestamp)
3467
+ )
3468
+ changedProfile = profileResult.changedProfile || changedProfile
3469
+ changedChannels = profileResult.changedChannels || changedChannels
3387
3470
  for (const file of Array.isArray(payload.files) ? payload.files : []) {
3388
3471
  changedFiles =
3389
3472
  this.#applyUserSyncFileRecord(
@@ -3442,8 +3525,22 @@ export class MostBoxEngine extends EventEmitter {
3442
3525
  op.payload?.channelKey,
3443
3526
  getSyncTimestamp(op.payload?.syncUpdatedAt, op.timestamp)
3444
3527
  )
3528
+ } else if (op.kind === 'profile:upsert') {
3529
+ const profileResult = this.#applyUserSyncProfileRecord(
3530
+ session.ownerAddress,
3531
+ op.payload?.profile,
3532
+ getSyncTimestamp(op.payload?.profile?.syncUpdatedAt, op.timestamp)
3533
+ )
3534
+ changedProfile = profileResult.changedProfile
3535
+ changedChannels = changedChannels || profileResult.changedChannels
3445
3536
  }
3446
3537
 
3538
+ if (changedProfile) {
3539
+ this.emit('user:metadata:updated', {
3540
+ ownerAddress: session.ownerAddress,
3541
+ scope: 'profile',
3542
+ })
3543
+ }
3447
3544
  if (changedFiles) {
3448
3545
  this.#savePublishedMetadata()
3449
3546
  this.#saveTrashMetadata()
@@ -3462,7 +3559,10 @@ export class MostBoxEngine extends EventEmitter {
3462
3559
  if (changedFiles || changedChannels) {
3463
3560
  this.#touchUserSyncSession(session)
3464
3561
  }
3465
- return changedFiles || changedChannels
3562
+ if (changedProfile) {
3563
+ this.#touchUserSyncSession(session)
3564
+ }
3565
+ return changedFiles || changedChannels || changedProfile
3466
3566
  }
3467
3567
 
3468
3568
  async #mergeUserSyncWriterCoreKeys(session, writerCoreKeys = []) {
@@ -3557,6 +3657,70 @@ export class MostBoxEngine extends EventEmitter {
3557
3657
  }
3558
3658
  }
3559
3659
 
3660
+ #formatUserProfileForSync(ownerAddress) {
3661
+ const owner = normalizeOwnerAddress(ownerAddress)
3662
+ if (!owner) return null
3663
+ const profile = this.#userSyncMetadata.profiles?.[owner]
3664
+ return profile ? { ...profile } : null
3665
+ }
3666
+
3667
+ #normalizeUserProfileRecord(ownerAddress, record, timestamp = Date.now()) {
3668
+ const owner = normalizeOwnerAddress(ownerAddress)
3669
+ if (!owner || !record || typeof record !== 'object') return null
3670
+ const displayName = normalizeChannelDisplayName(record.displayName, owner)
3671
+ const avatar = normalizeChannelAvatar(record.avatar)
3672
+ const syncUpdatedAt = getSyncTimestamp(record.syncUpdatedAt, timestamp)
3673
+ return {
3674
+ displayName,
3675
+ avatar,
3676
+ syncUpdatedAt,
3677
+ }
3678
+ }
3679
+
3680
+ #applyUserSyncProfileRecord(ownerAddress, record, timestamp) {
3681
+ const owner = normalizeOwnerAddress(ownerAddress)
3682
+ const profile = this.#normalizeUserProfileRecord(owner, record, timestamp)
3683
+ if (!profile) {
3684
+ return { changedProfile: false, changedChannels: false }
3685
+ }
3686
+ if (!this.#shouldApplyUserSyncEntity(owner, 'profile', profile.syncUpdatedAt)) {
3687
+ return { changedProfile: false, changedChannels: false }
3688
+ }
3689
+
3690
+ const existing = this.#userSyncMetadata.profiles?.[owner]
3691
+ this.#userSyncMetadata.profiles = this.#userSyncMetadata.profiles || {}
3692
+ this.#userSyncMetadata.profiles[owner] = profile
3693
+ this.#setUserSyncClock(owner, 'profile', profile.syncUpdatedAt)
3694
+ const changedChannels = this.#applyUserProfileToJoinedChannels(
3695
+ owner,
3696
+ profile
3697
+ )
3698
+ return {
3699
+ changedProfile:
3700
+ !existing ||
3701
+ existing.displayName !== profile.displayName ||
3702
+ existing.avatar !== profile.avatar ||
3703
+ Number(existing.syncUpdatedAt) !== profile.syncUpdatedAt,
3704
+ changedChannels,
3705
+ }
3706
+ }
3707
+
3708
+ #applyUserProfileToJoinedChannels(ownerAddress, profile) {
3709
+ const owner = normalizeOwnerAddress(ownerAddress)
3710
+ if (!owner || !profile) return false
3711
+ let changed = false
3712
+ for (const channel of this.#channels) {
3713
+ if (!this.#channelHasMember(channel, owner)) continue
3714
+ changed =
3715
+ this.#upsertChannelMember(channel, {
3716
+ ownerAddress: owner,
3717
+ displayName: profile.displayName,
3718
+ avatar: profile.avatar,
3719
+ }) || changed
3720
+ }
3721
+ return changed
3722
+ }
3723
+
3560
3724
  #appendUserSyncChannelUpsertSoon(channel, ownerAddress) {
3561
3725
  const owner = normalizeOwnerAddress(ownerAddress)
3562
3726
  const record = this.#formatChannelForSync(channel, owner)
@@ -3896,6 +4060,12 @@ export class MostBoxEngine extends EventEmitter {
3896
4060
  if (channelKey) {
3897
4061
  this.#setUserSyncClock(ownerAddress, `channel:${channelKey}`, timestamp)
3898
4062
  }
4063
+ } else if (op.kind === 'profile:upsert') {
4064
+ const timestamp = getSyncTimestamp(
4065
+ op.payload?.profile?.syncUpdatedAt,
4066
+ op.timestamp
4067
+ )
4068
+ this.#setUserSyncClock(ownerAddress, 'profile', timestamp)
3899
4069
  }
3900
4070
  }
3901
4071
 
@@ -4636,7 +4806,18 @@ export class MostBoxEngine extends EventEmitter {
4636
4806
  }
4637
4807
  }
4638
4808
 
4639
- return { sessions, clocks }
4809
+ const profiles = {}
4810
+ for (const [owner, profile] of Object.entries(parsed.profiles || {})) {
4811
+ const ownerAddress = normalizeOwnerAddress(owner)
4812
+ const normalized = this.#normalizeUserProfileRecord(
4813
+ ownerAddress,
4814
+ profile,
4815
+ profile?.syncUpdatedAt
4816
+ )
4817
+ if (normalized) profiles[ownerAddress] = normalized
4818
+ }
4819
+
4820
+ return { sessions, clocks, profiles }
4640
4821
  }
4641
4822
  } catch (err) {
4642
4823
  console.warn(
@@ -4644,7 +4825,7 @@ export class MostBoxEngine extends EventEmitter {
4644
4825
  err.message
4645
4826
  )
4646
4827
  }
4647
- return { sessions: {}, clocks: {} }
4828
+ return { sessions: {}, clocks: {}, profiles: {} }
4648
4829
  }
4649
4830
 
4650
4831
  #saveUserSyncMetadata() {
@@ -51,17 +51,13 @@ export function normalizeNodeConfig(raw = {}) {
51
51
  rawNode.remoteInvites ?? raw.remoteInvites ?? defaults.remoteInvites
52
52
  )
53
53
  const host = normalizeHost(rawNode.host ?? raw.host, defaults.host)
54
- const port = normalizePositiveInteger(
55
- rawNode.port ?? raw.port,
56
- defaults.port
57
- )
58
54
  return {
59
55
  dataPath:
60
56
  typeof raw.dataPath === 'string'
61
57
  ? raw.dataPath.trim()
62
58
  : defaults.dataPath,
63
59
  host,
64
- port,
60
+ port: DEFAULT_NODE_PORT,
65
61
  capacityBytes,
66
62
  maxFileSizeBytes,
67
63
  remoteInvites,
@@ -116,7 +112,7 @@ export function createNodeConfigStore(configDir = getDefaultConfigDir()) {
116
112
  node: {
117
113
  ...(raw.node && typeof raw.node === 'object' ? raw.node : {}),
118
114
  host: patch.host === undefined ? current.host : patch.host,
119
- port: patch.port === undefined ? current.port : patch.port,
115
+ port: DEFAULT_NODE_PORT,
120
116
  capacityBytes:
121
117
  patch.capacityBytes === undefined
122
118
  ? current.capacityBytes
@@ -15,6 +15,11 @@ function getDefaultBackendUrl() {
15
15
  return isLocalFrontendOrigin() ? LOCALHOST_BACKEND_URL : ''
16
16
  }
17
17
 
18
+ function getSameOriginBackendUrl() {
19
+ if (typeof window === 'undefined') return ''
20
+ return window.location.origin || ''
21
+ }
22
+
18
23
  function getBackendUrl() {
19
24
  if (typeof window === 'undefined') return ''
20
25
  return localStorage.getItem(STORAGE_KEY) || getDefaultBackendUrl()
@@ -233,6 +238,14 @@ export function getBackendUrlExport() {
233
238
  return getBackendUrl()
234
239
  }
235
240
 
241
+ export function getConfiguredBackendUrlExport() {
242
+ return getConfiguredBackendUrl()
243
+ }
244
+
245
+ export function getSameOriginBackendUrlExport() {
246
+ return getSameOriginBackendUrl()
247
+ }
248
+
236
249
  export function getRemoteBackendUrlExport() {
237
250
  return getRemoteBackendUrl()
238
251
  }
@@ -311,7 +324,7 @@ export async function getAuthenticatedWebSocketUrl(path = '/ws') {
311
324
  }
312
325
 
313
326
  export async function checkBackendConnection() {
314
- const url = getBackendUrl()
327
+ const url = getBackendUrl() || getSameOriginBackendUrl()
315
328
  const invite = shouldAttachBackendInvite(url) ? getBackendInvite() : ''
316
329
  return checkBackendConnectionTarget({ url, invite })
317
330
  }
@@ -334,6 +347,19 @@ async function probeHttp(cleanedUrl, invite, identity) {
334
347
  signal: AbortSignal.timeout(3000),
335
348
  })
336
349
  if (!res.ok) return { ok: false, reason: 'http' }
350
+ const data = await res
351
+ .clone()
352
+ .json()
353
+ .catch(() => null)
354
+ if (
355
+ !data ||
356
+ typeof data.remoteAccess !== 'boolean' ||
357
+ typeof data.inviteRequired !== 'boolean' ||
358
+ typeof data.adminAvailable !== 'boolean' ||
359
+ typeof data.listenHost !== 'string'
360
+ ) {
361
+ return { ok: false, reason: 'http' }
362
+ }
337
363
  return { ok: true }
338
364
  } catch {
339
365
  return { ok: false, reason: 'http' }
@@ -1,19 +1,32 @@
1
1
  import { createAvatar } from '@dicebear/core'
2
2
  import { botttsNeutral } from '@dicebear/collection'
3
3
 
4
- export const DEFAULT_AVATAR_PREFIX = 'most-avatar:'
5
-
6
4
  export const defaultAvatarIds = [
7
- 'mint',
8
- 'violet',
9
- 'ocean',
10
- 'ember',
11
- 'sage',
12
- 'dusk',
5
+ 'panda',
6
+ 'owl',
7
+ 'dolphin',
8
+ 'tiger',
9
+ 'turtle',
10
+ 'snow-mountain',
13
11
  ]
14
12
 
13
+ const legacyDefaultAvatarIdAliases = {
14
+ mint: 'panda',
15
+ violet: 'owl',
16
+ ocean: 'dolphin',
17
+ ember: 'tiger',
18
+ sage: 'turtle',
19
+ dusk: 'snow-mountain',
20
+ }
21
+
22
+ function normalizeDefaultAvatarId(id) {
23
+ const value = typeof id === 'string' ? id.trim() : ''
24
+ if (defaultAvatarIds.includes(value)) return value
25
+ return legacyDefaultAvatarIdAliases[value] || ''
26
+ }
27
+
15
28
  export function getDefaultAvatarValue(id) {
16
- return `${DEFAULT_AVATAR_PREFIX}${id}`
29
+ return getDefaultAvatarPath(normalizeDefaultAvatarId(id) || id)
17
30
  }
18
31
 
19
32
  export function getDefaultAvatarPath(id) {
@@ -22,15 +35,20 @@ export function getDefaultAvatarPath(id) {
22
35
 
23
36
  function getDefaultAvatarId(avatar) {
24
37
  if (typeof avatar !== 'string') return ''
25
- if (!avatar.startsWith(DEFAULT_AVATAR_PREFIX)) return ''
26
- const id = avatar.slice(DEFAULT_AVATAR_PREFIX.length)
27
- return defaultAvatarIds.includes(id) ? id : ''
38
+ const value = avatar.trim()
39
+ const match = /^\/avatars\/default\/([^/]+)\.svg$/.exec(value)
40
+ return normalizeDefaultAvatarId(match?.[1] || '')
28
41
  }
29
42
 
30
43
  export function isDefaultAvatarValue(avatar) {
31
44
  return Boolean(getDefaultAvatarId(avatar))
32
45
  }
33
46
 
47
+ export function normalizeDefaultAvatarValue(avatar) {
48
+ const id = getDefaultAvatarId(avatar)
49
+ return id ? getDefaultAvatarPath(id) : ''
50
+ }
51
+
34
52
  function createAddressAvatar(address) {
35
53
  return createAvatar(botttsNeutral, {
36
54
  seed: 'most.box@' + address,
@@ -44,9 +62,6 @@ export function generateAvatar(address, avatar) {
44
62
  if (defaultAvatarId) {
45
63
  return getDefaultAvatarPath(defaultAvatarId)
46
64
  }
47
- if (typeof avatar === 'string' && avatar.startsWith(DEFAULT_AVATAR_PREFIX)) {
48
- return address ? createAddressAvatar(address) : '/avatar.png'
49
- }
50
65
  if (avatar) return avatar
51
66
  if (!address) return '/avatar.png'
52
67
  return createAddressAvatar(address)
@@ -31,8 +31,6 @@ const LINK_VALIDATION_MESSAGES = {
31
31
  'CID 格式不符合 MostBox 要求,请确认分享链接完整。',
32
32
  [MOST_LINK_ERROR_CODES.CID_DIGEST_LENGTH]:
33
33
  'CID 格式不符合 MostBox 要求,请确认分享链接完整。',
34
- [MOST_LINK_ERROR_CODES.FILENAME_REQUIRED]:
35
- '链接缺少 filename 参数,请复制完整分享链接后再检测。',
36
34
  }
37
35
 
38
36
  export function getDownloadCheckErrorMessageFromPayload(
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{t as r}from"./LanguageToggle-B4ZNuBCV.js";import{J as i,Z as a}from"./index-WCK14Vja.js";var o=i(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=t(e(),1);function c(e,t){return typeof t==`boolean`?t:typeof window<`u`&&`matchMedia`in window?window.matchMedia(e).matches:!1}function l(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){let[r,i]=(0,s.useState)(n?t:c(e));return(0,s.useEffect)(()=>{try{if(`matchMedia`in window){let t=window.matchMedia(e);i(t.matches);let n=e=>i(e.matches);return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}}}catch{return}},[e]),r||!1}function u(e=!1,t={}){let[n,r]=(0,s.useState)(e),i=(0,s.useCallback)(()=>{r(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),a=(0,s.useCallback)(()=>{r(e=>e&&(t.onClose?.(),!1))},[t.onClose]);return[n,{open:i,close:a,toggle:(0,s.useCallback)(()=>{n?a():i()},[a,i,n]),set:r}]}var d=n(),f=(0,s.createContext)(null);function p(){let e=(0,s.useContext)(f);if(!e)throw Error(`useAppShell must be used within AppShell`);return e}function m({sidebar:e,className:t=``,headerTitle:n,headerRight:i,sidebarToggleReplacement:c,defaultHide:p=!1,children:m}){let[h,g]=u(!1),[_,v]=(0,s.useState)(p),y=(0,s.useRef)(p),b=l(`(max-width: 768px)`),{t:x}=a(),S=(0,s.useCallback)((e={})=>{g.close(),e.collapse&&v(!0)},[g]);(0,s.useEffect)(()=>{p!==y.current&&(p?S({collapse:!0}):v(!1),y.current=p)},[p,S]);let C=()=>{b?g.toggle():v(!_)},w=()=>{b?g.open():v(!1)},T=b?h:!_;return(0,d.jsx)(f.Provider,{value:{closeSidebar:S,openSidebar:w,isSidebarVisible:T},children:(0,d.jsxs)(`div`,{className:[`app-layout`,t].filter(Boolean).join(` `),children:[(0,d.jsx)(`div`,{className:`sidebar-overlay ${h?`visible`:``}`,onClick:()=>S()}),(0,d.jsx)(`div`,{className:`sidebar ${h?`open`:``} ${_?`collapsed`:``}`,children:e({closeSidebar:S,openSidebar:w})}),(0,d.jsxs)(`div`,{className:`main-content`,children:[(0,d.jsxs)(`header`,{className:`app-header`,children:[(0,d.jsxs)(`div`,{className:`header-left`,children:[c??(0,d.jsx)(`button`,{onClick:C,className:`btn btn-icon sidebar-toggle-btn`,"aria-label":x(b?`appShell.openMenu`:_?`appShell.expandSidebar`:`appShell.collapseSidebar`),children:(0,d.jsx)(o,{size:16})}),n]}),(0,d.jsxs)(`div`,{className:`header-right`,children:[(0,d.jsx)(r,{className:`btn btn-icon app-language-toggle`}),i]})]}),m]})]})})}export{p as n,u as r,m as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{t}from"./arrow-right-CL9YSDVS.js";import{t as n}from"./circle-alert-oiiRDvhx.js";import{t as r}from"./download-D0oMEYQZ.js";import{n as i,t as a}from"./plus-BbxQG_Ai.js";import{n as o,t as s}from"./trash-2-DNGr8IgF.js";import{a as c,i as l,n as u,r as d}from"./filePreview-BZ50vZZf.js";import{t as f}from"./message-square-DwBq_Go5.js";import{t as p}from"./music-CB73K5Gz.js";import{G as m,J as h,Z as g,c as _}from"./index-WCK14Vja.js";var v=h(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),y=h(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),b=e();function x(e){return!e||e<=0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function S(e){let t=String(e||``).split(`/`);return t[t.length-1]||e}function C(e){return e===`image`?(0,b.jsx)(l,{size:20}):e===`video`?(0,b.jsx)(c,{size:20}):e===`audio`?(0,b.jsx)(p,{size:20}):(0,b.jsx)(o,{size:20})}function w({attachment:e,status:t=`idle`,pending:i=!1,onOpen:a}){let{t:o}=g(),s=t===`checking`,c=[`ui-file-action`,`chat-attachment-action`,t===`error`?`error`:``,t===`available`?`available`:``].filter(Boolean).join(` `),l=x(e.size)||o(`chat.mostboxFile`);return(0,b.jsxs)(`button`,{type:`button`,className:`ui-file-card chat-attachment-card`,onClick:()=>a?.(e),disabled:i||s,title:e.link,translate:`no`,children:[(0,b.jsx)(`span`,{className:`ui-file-icon chat-attachment-icon ${e.kind}`,children:s?(0,b.jsx)(d,{size:20,className:`ui-spinner chat-attachment-spinner`}):C(e.kind)}),(0,b.jsxs)(`span`,{className:`ui-file-info chat-attachment-info`,children:[(0,b.jsx)(`span`,{className:`ui-file-name chat-attachment-name`,translate:`no`,children:S(e.fileName)}),(0,b.jsx)(`span`,{className:`ui-file-meta chat-attachment-meta`,translate:`yes`,children:i?o(`chat.sending`):l})]}),(0,b.jsx)(`span`,{className:c,translate:`yes`,children:s?o(`chat.checking`):t===`available`?(0,b.jsx)(m,{size:16}):t===`error`?(0,b.jsx)(n,{size:17}):(0,b.jsx)(r,{size:16})})]})}var T=[{key:`image`,labelKey:`chat.attachment.image`,accept:`image/*`,icon:l},{key:`video`,labelKey:`chat.attachment.video`,accept:`video/*`,icon:c},{key:`file`,labelKey:`chat.attachment.file`,accept:``,icon:o}],E=T.map(e=>e.accept).join(`,`);function D({children:e}){return(0,b.jsx)(`div`,{className:`message-bubble`,translate:`no`,children:e})}function O({children:e}){return(0,b.jsx)(`div`,{className:`message-bubble has-attachment`,children:e})}function k({variant:e,pending:t=!1,avatarSrc:n,author:r,time:i,children:a}){return(0,b.jsxs)(`div`,{className:[`chat-message`,e,t?`pending`:``].filter(Boolean).join(` `),children:[(0,b.jsx)(`img`,{className:`msg-avatar`,src:n,alt:`avatar`}),(0,b.jsxs)(`div`,{className:`msg-content`,children:[(0,b.jsx)(`span`,{className:`message-author`,translate:`no`,children:r}),a,(0,b.jsx)(`span`,{className:`message-time`,children:i})]})]})}function A({active:e=!1,pinned:t=!1,unread:n=!1,title:r,onSelect:a,onTogglePin:o,onRename:c,onLeave:l}){let{t:d}=g(),p=!!(o||c||l);return(0,b.jsxs)(`div`,{className:[`sidebar-nav-btn`,e?`active`:``,t?`pinned`:``,n?`unread`:``].filter(Boolean).join(` `),onClick:a,role:`button`,tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&e.key===`Enter`&&a?.()},children:[(0,b.jsxs)(`span`,{className:`chat-channel-icon-wrap`,children:[(0,b.jsx)(f,{size:16}),n&&(0,b.jsx)(`span`,{className:`chat-channel-unread-dot`,title:d(`chat.unread`),"aria-hidden":`true`})]}),(0,b.jsx)(`span`,{className:`chat-channel-title`,children:(0,b.jsx)(`span`,{className:`chat-channel-title-text`,translate:`no`,children:r})}),p&&(0,b.jsx)(_,{ariaLabel:d(`chat.channelActions`),className:`channel-actions-anchor`,placement:`bottom-end`,items:[{key:`pin`,label:d(t?`chat.unpin`:`chat.pin`),icon:t?(0,b.jsx)(y,{size:16}):(0,b.jsx)(v,{size:16}),onSelect:()=>o?.()},{key:`rename`,label:d(`chat.rename`),icon:(0,b.jsx)(u,{size:16}),onSelect:()=>c?.()},{key:`delete`,label:d(`chat.delete`),icon:(0,b.jsx)(s,{size:16}),onSelect:()=>l?.()}],renderTrigger:e=>(0,b.jsx)(`button`,{...e,className:`leave-channel-btn channel-actions-trigger`,title:d(`common.moreActions`),"aria-label":d(`common.moreActions`),children:(0,b.jsx)(i,{size:16})})})]})}function j({members:e,isLoading:t=!1}){let{t:n}=g();return t&&e.length===0?(0,b.jsx)(`div`,{className:`ui-empty-inline channel-members-empty`,children:n(`chat.loadingMembers`)}):e.length===0?(0,b.jsx)(`div`,{className:`ui-empty-inline channel-members-empty`,children:n(`chat.noMembers`)}):(0,b.jsx)(`div`,{className:`channel-members-grid`,children:e.map(e=>(0,b.jsxs)(`div`,{className:`channel-member`,children:[(0,b.jsx)(`img`,{className:`channel-member-avatar`,src:e.avatarSrc,alt:`avatar`}),(0,b.jsx)(`span`,{className:`channel-member-name`,translate:`no`,children:e.name})]},e.id))})}function M({message:e,placeholder:n,disabled:r=!1,isPublishingAttachment:i=!1,attachmentButtonTitle:o,attachmentInputRef:s,onMessageChange:c,onSend:l,onSelectAttachmentFiles:u}){let{t:f}=g(),p=r||i,m=r||!e.trim(),h=o||f(`chat.attachment.add`);function v(e,t){t?.(e.currentTarget.files),e.currentTarget.value=``}function y(t){t.key===`Enter`&&e.trim()&&l()}function x(e){if(p)return;let t=s?.current;t&&(t.accept=e,t.click())}return(0,b.jsxs)(`div`,{className:`chat-input-area`,children:[(0,b.jsx)(`input`,{ref:s,type:`file`,accept:E,className:`chat-file-input`,onChange:e=>v(e,u)}),(0,b.jsx)(_,{ariaLabel:f(`chat.attachmentType`),placement:`top-start`,disabled:p,items:T.map(e=>{let t=e.icon;return{key:e.key,label:f(e.labelKey),icon:(0,b.jsx)(t,{size:16}),onSelect:()=>x(e.accept)}}),renderTrigger:e=>(0,b.jsx)(`button`,{...e,className:`btn btn-circle chat-tool-btn`,"aria-label":h,children:i?(0,b.jsx)(d,{size:18,className:`ui-spinner chat-attachment-spinner`}):(0,b.jsx)(a,{size:18})})}),(0,b.jsx)(`input`,{type:`text`,className:`input input-pill`,placeholder:n,value:e,disabled:r,onChange:e=>c(e.target.value),onKeyDown:y}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-circle btn-primary send-btn`,onClick:l,disabled:m,title:f(`chat.sendMessage`),children:(0,b.jsx)(t,{size:18})})]})}export{k as a,S as c,M as i,O as n,D as o,A as r,w as s,j as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{i as r}from"./LanguageToggle-B4ZNuBCV.js";import{t as i}from"./copy-giX4rmFJ.js";import{Z as a}from"./index-WCK14Vja.js";var o=t(e(),1),s=n();function c({text:e,label:t,copiedLabel:n,className:c=`btn btn-icon`,iconSize:l=14}){let{t:u}=a(),[d,f]=(0,o.useState)(!1),p=n||u(`common.copied`),m=t||u(`common.copy`);async function h(){try{await navigator.clipboard.writeText(e),f(!0),setTimeout(()=>f(!1),1500)}catch{}}return(0,s.jsxs)(`button`,{type:`button`,className:c,onClick:h,title:d?p:m,children:[d?(0,s.jsx)(r,{size:l}):(0,s.jsx)(i,{size:l}),t?d?p:t:null]})}export{c as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{$ as t,J as n,Q as r,Z as i,c as a}from"./index-WCK14Vja.js";var o=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),s=n(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),c=n(`moon`,[[`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`,key:`kfwtm`}]]),l=n(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),u=e();function d({className:e=``}){let{locale:n,localeName:c,setLocale:l,t:d}=i(),f=d(`common.locale.choose`),p=`${f} (${d(`common.locale.current`)}: ${c})`;return(0,u.jsx)(a,{ariaLabel:f,placement:`bottom-end`,items:r.map(e=>({key:e,label:t[e],icon:e===n?(0,u.jsx)(o,{size:16}):(0,u.jsx)(`span`,{"aria-hidden":`true`}),onSelect:()=>{e!==n&&l(e)}})),renderTrigger:t=>(0,u.jsx)(`button`,{...t,className:[`language-toggle`,e].filter(Boolean).join(` `),"aria-label":f,title:p,children:(0,u.jsx)(s,{size:16})})})}export{o as i,l as n,c as r,d as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{t}from"./LanguageToggle-B4ZNuBCV.js";import{nt as n,q as r}from"./index-WCK14Vja.js";import{t as i}from"./MarketingThemeToggle-qlwCZU1o.js";var a=e();function o(){return(0,a.jsx)(`nav`,{className:`mkt-nav`,children:(0,a.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,a.jsxs)(n,{to:`/`,className:`mkt-nav-logo`,children:[(0,a.jsx)(r,{size:18}),(0,a.jsx)(`span`,{children:`MOST PEOPLE`})]}),(0,a.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,a.jsx)(i,{}),(0,a.jsx)(t,{className:`mkt-theme-toggle`})]})]})})}export{o as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import"./index-WCK14Vja.js";import{n as t,t as n}from"./Nav-5xeettNJ.js";var r=e();function i({children:e,header:i}){return(0,r.jsxs)(`div`,{className:`mkt-layout`,children:[i??(0,r.jsx)(n,{}),(0,r.jsx)(`main`,{className:`mkt-layout-main`,children:e}),(0,r.jsx)(t,{})]})}export{i as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{n as r}from"./upload-Dxl7GUzb.js";import{n as i}from"./trash-2-DNGr8IgF.js";import{a,i as o,t as s}from"./filePreview-BZ50vZZf.js";import{t as c}from"./music-CB73K5Gz.js";import{J as l,U as u,Z as d,f}from"./index-WCK14Vja.js";var p=l(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),m=n();function h(e){let t=e.lastIndexOf(`/`);return t===-1?{folder:``,name:e}:{folder:e.substring(0,t),name:e.substring(t+1)}}function g({file:e,isSelected:t,onSelect:n,onPreview:r}){let l=s(e.fileName),u=(0,m.jsx)(i,{size:24,color:`#fff`});return l===`image`?u=(0,m.jsx)(o,{size:24,color:`#fff`}):l===`video`?u=(0,m.jsx)(a,{size:24,color:`#fff`}):l===`audio`&&(u=(0,m.jsx)(c,{size:24,color:`#fff`})),(0,m.jsxs)(`div`,{"data-id":e.cid,onClick:()=>n(e.cid),onDoubleClick:()=>r(e),className:`card ${t?`selected`:``}`,children:[(0,m.jsx)(`div`,{className:`card-icon ${e.starred?`starred`:`file`}`,children:u}),(0,m.jsx)(`p`,{className:`card-name`,translate:`no`,children:h(e.fileName).name})]})}function _({folder:e,onClick:t}){return(0,m.jsxs)(`div`,{onClick:t,className:`card`,children:[(0,m.jsx)(`div`,{className:`card-icon folder`,children:(0,m.jsx)(r,{size:28,color:`#fff`})}),(0,m.jsx)(`p`,{className:`card-name`,translate:`no`,children:e.name})]})}var v=t(e(),1);function y(e,t){return e?[{path:``,name:t},...e.split(`/`).filter(Boolean).map((e,t,n)=>({path:n.slice(0,t+1).join(`/`),name:e}))]:[]}function b({items:e,allFolders:t,currentPath:n,onMove:i,onClose:a}){let[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(n),{t:p}=d(),h=y(o,p(`move.root`));function g(){i(o||c.trim())}let _=t.filter(e=>{if(o===``)return!e.path.includes(`/`);let t=o+`/`;return e.path.startsWith(t)?!e.path.substring(t.length).includes(`/`):!1});return(0,m.jsx)(f,{onClose:a,children:(0,m.jsxs)(`div`,{className:`move-modal`,onClick:e=>e.stopPropagation(),children:[(0,m.jsxs)(`div`,{className:`modal-header`,children:[(0,m.jsx)(`h3`,{children:p(`move.title`)}),(0,m.jsx)(`button`,{type:`button`,onClick:a,className:`btn btn-icon`,children:(0,m.jsx)(u,{size:18})})]}),(0,m.jsx)(`p`,{className:`move-modal-desc`,children:p(`move.selectedCount`,{count:e.length})}),(0,m.jsx)(`div`,{className:`move-new-folder`,children:(0,m.jsx)(`input`,{type:`text`,className:`input`,value:c,onChange:e=>l(e.target.value),placeholder:p(`move.pathPlaceholder`),translate:`no`})}),(0,m.jsx)(`p`,{className:`move-modal-hint`,children:p(`move.pathExample`)}),(0,m.jsx)(`div`,{className:`move-breadcrumb`,children:h.map((e,t)=>(0,m.jsxs)(v.Fragment,{children:[t>0&&(0,m.jsx)(`span`,{className:`breadcrumb-separator`,children:`/`}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>{s(e.path),l(e.path)},className:`move-breadcrumb-btn ${o===e.path&&!c?`active`:``}`,children:(0,m.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.name})})]},e.path))}),(0,m.jsxs)(`div`,{className:`move-folder-list`,children:[_.length===0&&(0,m.jsx)(`p`,{className:`move-modal-empty`,children:p(`move.noSubfolders`)}),_.map(e=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:`move-folder-item ${o===e.path&&!c?`selected`:``}`,children:[(0,m.jsx)(r,{size:16}),(0,m.jsx)(`span`,{translate:`no`,children:e.name})]},e.path))]}),(0,m.jsxs)(`div`,{className:`modal-actions`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:a,className:`btn btn-secondary`,children:p(`common.cancel`)}),(0,m.jsx)(`button`,{type:`button`,onClick:g,className:`btn btn-primary`,children:p(`move.action`)})]})]})})}export{p as a,h as i,g as n,_ as r,b as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{t}from"./LanguageToggle-B4ZNuBCV.js";import{t as n}from"./download-D0oMEYQZ.js";import{Z as r,a as i,m as a,nt as o,p as s}from"./index-WCK14Vja.js";import{t as c}from"./MarketingThemeToggle-qlwCZU1o.js";import{t as l}from"./LogoIcon-B2fFe0l1.js";var u={name:`most-box`,version:`0.2.1`,description:`MostBox - P2P file sharing application`,type:`module`,main:`electron/main.js`,bin:{"most-box":`server/cli.js`},files:[`out`,`public`,`electron`,`server/src`,`server/index.js`,`server/cli.js`],scripts:{start:`vite`,server:`node --watch server/index.js`,dev:`vite`,build:`vite build && node scripts/prepare-start-static.mjs`,preview:`vite preview`,serve:`npm run build && node server/index.js`,test:`node --test server/tests/**/*.test.js`,"test:unit":`node --test server/tests/unit/*.test.js`,"test:frontend":`node --test src/tests/*.test.js`,"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`,typecheck:`tsc -p tsconfig.typecheck.json`,"typecheck:strict-router":`tsc -p tsconfig.strict-router.json`,"check:static-output":`node scripts/check-static-output.mjs`,format:`npx prettier --write .`,lint:`npx eslint .`,"r2:cors":`node scripts/configure-r2-cors.mjs`,"electron:dev":`concurrently "npm run build" "wait-on out/index.html && electron ."`,"electron:rebuild":`electron-rebuild -f -w sodium-native`,"electron:build":`npm run build && npm run electron:rebuild && electron-builder`,"electron:build:win":`npm run build && npm run electron:rebuild && electron-builder --win`,"electron:build:win:x64":`npm run electron:build:win -- --x64`,"electron:build:win:arm64":`npm run electron:build:win -- --arm64`,"electron:build:mac":`npm run build && npm run electron:rebuild && electron-builder --mac`,"electron:build:linux":`npm run build && npm run electron:rebuild && electron-builder --linux`},keywords:[`p2p`,`file-sharing`,`hyperswarm`,`hyperdrive`],license:`MIT`,dependencies:{"@dicebear/collection":`^9.4.2`,"@dicebear/core":`^9.4.2`,"@hono/node-server":`^2.0.4`,"@tanstack/react-router":`^1.170.15`,"@tanstack/react-start":`^1.168.25`,b4a:`^1.8.1`,busboy:`^1.6.0`,corestore:`^7.10.0`,dayjs:`^1.11.21`,ethers:`^6.16.0`,eventemitter3:`^5.0.4`,hono:`^4.12.23`,hypercore:`^11.33.1`,hyperdrive:`^13.3.2`,hyperswarm:`^4.17.0`,"ipfs-unixfs-importer":`^17.0.1`,multiformats:`^14.0.0`,tweetnacl:`^1.0.3`,ws:`^8.21.0`},devDependencies:{"@electron/rebuild":`^4.0.4`,"@eslint/js":`^10.0.1`,"@iconify/react":`^6.0.2`,"@mantine/hooks":`^9.3.0`,"@milkdown/crepe":`^7.21.2`,"@milkdown/utils":`^7.21.2`,"@types/react":`^19.2.16`,"@vitejs/plugin-react":`^6.0.2`,concurrently:`^10.0.3`,electron:`^42.3.3`,"electron-builder":`^26.8.1`,esbuild:`^0.28.0`,eslint:`^10.4.1`,globals:`^17.6.0`,ky:`^2.0.2`,"lucide-react":`^1.17.0`,prettier:`^3.8.3`,"qrcode.react":`^4.2.0`,react:`^19.2.7`,"react-dom":`^19.2.7`,typescript:`6.0.3`,"typescript-eslint":`^8.60.1`,vite:`^8.0.16`,"wait-on":`^9.0.10`,zustand:`^5.0.14`},overrides:{"brace-expansion":`5.0.6`,postcss:`8.5.15`,ws:`$ws`},build:{appId:`com.mostbox.app`,productName:`MostBox`,publish:[{provider:`github`,releaseType:`release`}],directories:{output:`dist`},afterPack:`electron/afterPack.cjs`,files:[`out/**/*`,`electron/**/*`,`server/src/**/*`,`server/index.js`,`server/cli.js`,`package.json`,`!**/*.map`,`!electron/**/*.test.js`,`!server/tests/**/*`],asarUnpack:[`**/*.node`,`**/sodium-native/**`],win:{target:[`nsis`],artifactName:"${productName}-${version}-win-${arch}-setup.${ext}",icon:`public/logo.ico`},nsis:{oneClick:!1,allowToChangeInstallationDirectory:!0,createDesktopShortcut:!0,createStartMenuShortcut:!0,shortcutName:`MostBox`},mac:{artifactName:"${productName}-${version}-mac-${arch}.${ext}",target:[{target:`dmg`,arch:[`x64`,`arm64`]}],icon:`public/logo-512.png`,category:`public.app-category.utilities`},dmg:{contents:[{x:130,y:220},{x:410,y:220,type:`link`,path:`/Applications`}]},linux:{artifactName:"${productName}-${version}-linux-${arch}.${ext}",target:[{target:`AppImage`,arch:[`x64`,`arm64`]}],icon:`public/logo-512.png`,category:`Utility`}}},d=e(),f=[{to:`/`,labelKey:`footer.about`},{to:`/ping/`,labelKey:`footer.network`},{href:`https://github.com/most-people/most`,labelKey:null,label:`GitHub`,external:!0}],p=u.version;function m(){let{t:e}=r();return(0,d.jsx)(`footer`,{className:`mkt-footer`,children:(0,d.jsx)(`div`,{className:`mkt-container`,children:(0,d.jsxs)(`div`,{className:`mkt-footer-inner`,children:[(0,d.jsx)(`div`,{className:`mkt-footer-links`,children:f.map(t=>`external`in t?(0,d.jsx)(`a`,{href:t.href,target:`_blank`,rel:`noopener noreferrer`,children:t.label},t.href):(0,d.jsx)(o,{to:t.to,children:e(t.labelKey)},t.to))}),(0,d.jsxs)(`span`,{className:`mkt-footer-copy`,children:[`© `,new Date().getFullYear(),` MOST PEOPLE · MIT License`]}),(0,d.jsxs)(`span`,{className:`mkt-footer-build`,translate:`no`,children:[`v`,p]})]})})})}function h(){let e=a(e=>e.identity),u=a(e=>e.openLoginModal),{t:f}=r(),p=s(),m=e?.displayName||e?.username||f(`nav.openWeb`);return(0,d.jsx)(`nav`,{className:`mkt-nav`,children:(0,d.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,d.jsxs)(o,{to:`/`,className:`mkt-nav-logo`,children:[(0,d.jsx)(l,{}),`MOST PEOPLE`]}),(0,d.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,d.jsx)(c,{}),(0,d.jsx)(t,{className:`mkt-theme-toggle`}),!p&&(0,d.jsxs)(o,{to:`/download/`,className:`btn btn-primary mkt-nav-preview`,children:[(0,d.jsx)(n,{size:16}),f(`nav.downloadClient`)]}),e?(0,d.jsx)(o,{to:`/profile/`,className:`mkt-nav-avatar-trigger`,"aria-label":f(`nav.profile`),title:m,children:(0,d.jsx)(`img`,{className:`mkt-nav-avatar`,src:i(e.address,e.avatar),alt:``,"aria-hidden":`true`})}):(0,d.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:u,children:f(`nav.getStarted`)})]})]})})}export{m as n,h as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{t as r}from"./chevron-down-CnLh_-aO.js";import{n as i,r as a,t as o}from"./upload-Dxl7GUzb.js";import{n as s,t as c}from"./triangle-alert-B_1BlX1b.js";import{t as l}from"./cloud-BEe2N89j.js";import{t as u}from"./download-D0oMEYQZ.js";import{n as d}from"./plus-BbxQG_Ai.js";import{B as f,U as p,V as m,Z as h,f as g,m as _,q as v}from"./index-WCK14Vja.js";import{t as y}from"./SidebarAccount-Zg5DZblE.js";var b=t(e(),1),x=n();function S({sync:e}){let{t}=h(),n=(0,b.useRef)(null),[r,i]=(0,b.useState)(!1),a=_(e=>e.wallet),f=e.action!==null;(0,b.useEffect)(()=>{if(!r)return;function e(e){n.current?.contains(e.target)||i(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);async function p(e){i(!1),await e()}return(0,x.jsxs)(`div`,{className:`note-more`,ref:n,children:[(0,x.jsx)(`button`,{className:`btn btn-icon note-more-trigger`,onClick:()=>i(e=>!e),title:t(`common.moreActions`),"aria-label":t(`common.moreActions`),children:(0,x.jsx)(d,{size:16})}),r&&(0,x.jsxs)(`div`,{className:`note-more-menu`,children:[(0,x.jsxs)(`div`,{className:`ui-notice note-sync-status ${e.hasConflict?`warning conflict`:``}`,children:[(0,x.jsx)(`span`,{className:`ui-icon-tile note-sync-status-icon ${e.hasConflict?`warning`:``}`,children:e.hasConflict?(0,x.jsx)(c,{size:16}):e.status===`synced`?(0,x.jsx)(s,{size:16}):(0,x.jsx)(l,{size:16})}),(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`strong`,{children:t(`note.sync.title`)}),(0,x.jsx)(`small`,{children:e.statusLabel})]})]}),(0,x.jsxs)(`button`,{className:`note-more-item`,onClick:()=>p(e.exportLocalBackup),disabled:!a||f,children:[(0,x.jsx)(o,{size:16}),t(`note.sync.exportLocal`)]}),(0,x.jsxs)(`button`,{className:`note-more-item`,onClick:()=>p(e.importLocalBackup),disabled:!a||f,children:[(0,x.jsx)(u,{size:16}),t(`note.sync.importLocal`)]})]})]})}function C(e){return e.type===`directory`?m(e.path?`${e.path}/${e.name}`:e.name):f(e)}function w({target:e,directories:t,onMove:n,onClose:o}){let{t:s}=h(),c=m(e.path||``),l=C(e),u=t.filter(t=>e.type===`directory`?t.path!==l&&!t.path.startsWith(`${l}/`):!0),[d,f]=(0,b.useState)(c),[_,v]=(0,b.useState)(``),[y,S]=(0,b.useState)(new Set),w=m(_),T=_.trim()?w:d,E=m(T)===c,D=new Map;for(let e of u){let t=D.get(e.parentPath)||[];t.push(e),D.set(e.parentPath,t)}let O=u.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split(`/`).filter(Boolean);return t.every((e,n)=>y.has(t.slice(0,n+1).join(`/`)))}),k=[{label:s(`note.root`),path:``},...d.split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:n.slice(0,t+1).join(`/`)}))];function A(e){f(m(e)),v(``)}function j(e){A(e),D.has(e)&&S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function M(){E||n(T)}return(0,x.jsx)(g,{onClose:o,children:(0,x.jsxs)(`div`,{className:`note-move-modal`,onClick:e=>e.stopPropagation(),children:[(0,x.jsxs)(`div`,{className:`modal-header`,children:[(0,x.jsx)(`h3`,{children:s(`note.move.title`)}),(0,x.jsx)(`button`,{className:`btn btn-icon`,onClick:o,children:(0,x.jsx)(p,{size:18})})]}),(0,x.jsxs)(`div`,{className:`note-move-target`,children:[(0,x.jsx)(`span`,{children:s(`note.move.moving`)}),(0,x.jsx)(`strong`,{translate:`no`,children:e.name})]}),(0,x.jsx)(`div`,{className:`note-move-path`,children:k.map((e,t)=>(0,x.jsxs)(b.Fragment,{children:[t>0&&(0,x.jsx)(`span`,{children:`/`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>A(e.path),children:(0,x.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))}),(0,x.jsxs)(`div`,{className:`note-move-folder-list`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`note-move-folder-item ${d===``?`selected`:``}`,onClick:()=>A(``),children:[(0,x.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,x.jsx)(i,{className:`note-move-folder-icon`,size:16}),(0,x.jsx)(`span`,{children:s(`note.root`)})]}),u.length===0?(0,x.jsx)(`p`,{className:`note-move-empty`,children:s(`note.move.noFolders`)}):O.map(e=>{let t=D.has(e.path),n=y.has(e.path);return(0,x.jsxs)(`button`,{type:`button`,className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${d===e.path?`selected`:``}`,onClick:()=>j(e.path),children:[t?n?(0,x.jsx)(r,{className:`note-move-expander`,size:14}):(0,x.jsx)(a,{className:`note-move-expander`,size:14}):(0,x.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,x.jsx)(i,{className:`note-move-folder-icon`,size:16}),(0,x.jsx)(`span`,{translate:`no`,children:e.name}),e.parentPath&&(0,x.jsx)(`small`,{translate:`no`,children:e.parentPath})]},e.path)})]}),(0,x.jsx)(`input`,{className:`input input-compact`,value:_,onChange:e=>v(e.target.value),placeholder:s(`note.move.pathPlaceholder`),translate:`no`}),(0,x.jsxs)(`div`,{className:`note-move-destination`,children:[(0,x.jsx)(`span`,{children:s(`note.move.destinationLabel`)}),(0,x.jsx)(`span`,{translate:T?`no`:`yes`,children:T||s(`note.root`)})]}),(0,x.jsxs)(`div`,{className:`modal-actions`,children:[(0,x.jsx)(`button`,{className:`btn btn-secondary`,onClick:o,children:s(`common.cancel`)}),(0,x.jsx)(`button`,{className:`btn btn-primary`,onClick:M,disabled:E,children:s(`note.action.move`)})]})]})})}function T({children:e}){return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`sidebar-header sidebar-header-link`,onClick:()=>{window.location.href=`/`},children:[(0,x.jsx)(v,{size:18}),(0,x.jsx)(`h1`,{children:`MOST PEOPLE`})]}),e,(0,x.jsx)(y,{})]})}export{w as n,S as r,T as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{n as t}from"./AppShell-OiOEqXPr.js";import{J as n,Z as r}from"./index-WCK14Vja.js";var i=n(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),a=e();function o({label:e,className:n=``,variant:o=`primary`}){let{isSidebarVisible:s,openSidebar:c}=t(),{t:l}=r(),u=o===`primary`?`btn-primary`:``,d=e||l(`appShell.openSidebar`);return s?null:(0,a.jsxs)(`button`,{type:`button`,className:`btn ${u} sidebar-open-hint ${n}`.trim(),onClick:c,children:[(0,a.jsx)(i,{size:16}),d]})}export{o as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{t}from"./download-D0oMEYQZ.js";import{J as n,Z as r}from"./index-WCK14Vja.js";import{t as i}from"./CopyButton-Dm7krgbq.js";var a=n(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),o=e();function s({icon:e,message:t,className:n=`empty-state glass`}){return(0,o.jsxs)(`div`,{className:n,children:[(0,o.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,o.jsx)(`p`,{children:t})]})}function c({title:e,icon:t,children:n,accent:r=!1}){return(0,o.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,o.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,o.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,o.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,o.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function l({label:e,pem:n,filename:a}){let{t:s}=r();function c(){let e=new Blob([n],{type:`text/plain`}),t=URL.createObjectURL(e),r=document.createElement(`a`);r.href=t,r.download=a,r.click(),URL.revokeObjectURL(t)}return(0,o.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,o.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,o.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,o.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,o.jsx)(i,{text:n,label:s(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,o.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:c,title:s(`common.download`),children:[(0,o.jsx)(t,{size:14}),s(`common.download`)]})]})]}),(0,o.jsx)(`textarea`,{className:`textarea mono`,value:n,readOnly:!0,rows:6,translate:`no`})]})}export{a as i,c as n,s as r,l as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{Z as r,a as i,m as a,nt as o,u as s}from"./index-WCK14Vja.js";var c=t(e(),1),l=n();function u({className:e=``}){let t=a(e=>e.identity),n=a(e=>e.openLoginModal),u=a(e=>e.logoutUser),[d,f]=(0,c.useState)(!1),{t:p}=r();return(0,l.jsxs)(`div`,{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,l.jsxs)(`div`,{className:`user-info`,children:[t?(0,l.jsx)(o,{to:`/profile/`,className:`user-avatar-link`,"aria-label":p(`nav.profile`),title:p(`nav.profile`),children:(0,l.jsx)(`img`,{className:`user-avatar-img`,src:i(t.address,t.avatar),alt:``,"aria-hidden":`true`})}):(0,l.jsx)(`img`,{className:`user-avatar-img`,src:i(void 0,void 0),alt:``,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`user-name`,title:t?.address,children:(0,l.jsx)(`span`,{translate:t?.displayName?`no`:`yes`,children:t?.displayName||p(`account.notSignedIn`)})})]}),t?(0,l.jsx)(`button`,{type:`button`,className:`btn btn-secondary logout-btn`,onClick:()=>f(!0),children:p(`account.logout`)}):(0,l.jsx)(`button`,{className:`btn btn-primary login-btn`,onClick:n,children:p(`account.signIn`)}),d&&(0,l.jsx)(s,{title:p(`account.logoutTitle`),message:p(`account.logoutConfirm`),confirmText:p(`account.logout`),danger:!0,onConfirm:()=>{u(),f(!1)},onClose:()=>f(!1)})]})}export{u as t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
@@ -1 +0,0 @@
1
- import{C as e,_ as t}from"./index-WCK14Vja.js";var n={getChannels(e={}){let n=new URLSearchParams;e.type&&n.set(`type`,e.type),e.excludeType&&n.set(`excludeType`,e.excludeType);let r=n.toString();return t.get(r?`/api/channels?${r}`:`/api/channels`).json()},createChannel(e,n=`personal`,r={}){return t.post(`/api/channels`,{json:{name:e,type:n,...r}}).json()},leaveChannel(e){return t.delete(`/api/channels`,{json:{channelKey:e}}).json()},getChannelMessages(e,n=100,r=0){return t.get(`/api/channels/${encodeURIComponent(e)}/messages?limit=${n}&offset=${r}`).json()},sendChannelMessage({channelName:e,content:n,author:r,authorName:i,avatar:a,attachment:o}){return t.post(`/api/channels/${encodeURIComponent(e)}/messages`,{json:o?{content:n,author:r,authorName:i,avatar:a,attachment:o}:{content:n,author:r,authorName:i,avatar:a}}).json()},getChannelMembers(e){return t.get(`/api/channels/${encodeURIComponent(e)}/members`).json()},getChannelPeers(e){return t.get(`/api/channels/${encodeURIComponent(e)}/peers`).json()},setChannelRemark(e,n){return t.put(`/api/channels/${encodeURIComponent(e)}/remark`,{json:{remark:n}}).json()},setChannelPinned(e,n){return t.put(`/api/channels/${encodeURIComponent(e)}/pin`,{json:{pinned:n}}).json()},getFileDownloadUrl(t){return e(`/api/files/${t}/download`)}};export{n as t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-WCK14Vja.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};