most-box 0.2.4 → 0.2.6

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 (128) hide show
  1. package/electron/main.js +58 -4
  2. package/electron/updateChecker.js +6 -2
  3. package/electron/updateChecker.test.js +24 -0
  4. package/out/admin/index.html +0 -0
  5. package/out/app/index.html +0 -0
  6. package/out/assets/FilePreviewOverlay-DqH7uKb7.js +1 -0
  7. package/out/assets/LanguageToggle-BoBNesNU.js +1 -0
  8. package/out/assets/{MarketingHeader-Q2cpkqAM.js → MarketingHeader-Derv67Vs.js} +1 -1
  9. package/out/assets/MarketingLayout-fc2mymJm.js +1 -0
  10. package/out/assets/MarketingThemeToggle-BLuQ_uE-.js +1 -0
  11. package/out/assets/{MilkdownEditor-Bv2VA3bu.js → MilkdownEditor-f2vRIY21.js} +1 -1
  12. package/out/assets/OpenSidebarButton-BKX4B_yG.js +1 -0
  13. package/out/assets/SidebarAccount-D6wj_ijc.js +1 -0
  14. package/out/assets/SidebarHomeLink-ByOHwlH8.js +1 -0
  15. package/out/assets/arrow-right-BCi9KXDX.js +1 -0
  16. package/out/assets/circle-alert-Dyc-4wje.js +1 -0
  17. package/out/assets/cloud-DfaFxhLj.js +1 -0
  18. package/out/assets/copy-D8HSH5Ki.js +1 -0
  19. package/out/assets/download-Q6jKMPIG.js +1 -0
  20. package/out/assets/{downloadValidation-xzpa5rap.js → downloadValidation-B-w8D_0W.js} +1 -1
  21. package/out/assets/external-link-GQcZwDTT.js +1 -0
  22. package/out/assets/file-text-CVl5SZPJ.js +1 -0
  23. package/out/assets/folder-BtIdk-YN.js +1 -0
  24. package/out/assets/hard-drive-Cew_LD0N.js +1 -0
  25. package/out/assets/i18n--maTEG0d.js +1 -0
  26. package/out/assets/index-B2-kpfu5.css +1 -0
  27. package/out/assets/index-Cg4kEvx8.js +31 -0
  28. package/out/assets/index.lazy-BAq__8ON.js +2 -0
  29. package/out/assets/index.lazy-BPh8D_H9.js +1 -0
  30. package/out/assets/index.lazy-Bn4kDToA.js +1 -0
  31. package/out/assets/index.lazy-BqHgW5fE.js +1 -0
  32. package/out/assets/index.lazy-CLYRM_kh.js +1 -0
  33. package/out/assets/index.lazy-CMSCQucz.js +1 -0
  34. package/out/assets/index.lazy-Cut4XkPH.js +1 -0
  35. package/out/assets/index.lazy-DKOSJyaQ.js +2 -0
  36. package/out/assets/index.lazy-DjPbRI_L.js +1 -0
  37. package/out/assets/index.lazy-DujygWms.js +1 -0
  38. package/out/assets/index.lazy-DxAGUwlf.js +3 -0
  39. package/out/assets/index.lazy-WXDn5r_l.js +1 -0
  40. package/out/assets/index.lazy-ghLI7p1x.js +1 -0
  41. package/out/assets/key-round-D1zfZzvP.js +1 -0
  42. package/out/assets/loader-BSclU8WE.js +1 -0
  43. package/out/assets/lock-C9VP0ezG.js +1 -0
  44. package/out/assets/message-square-Dg3YjjmO.js +1 -0
  45. package/out/assets/mp-FQvFEcYM.js +1 -0
  46. package/out/assets/music-BeCPak70.js +1 -0
  47. package/out/assets/notebook-pen-DO1CJiqn.js +1 -0
  48. package/out/assets/play-CnhsLC5C.js +1 -0
  49. package/out/assets/plus-BpjwXzbO.js +1 -0
  50. package/out/assets/save-BVeMjaW1.js +1 -0
  51. package/out/assets/search-CsAnnJyH.js +1 -0
  52. package/out/assets/send-C1J-eGNs.js +1 -0
  53. package/out/assets/shield-check-CZYDVJoh.js +1 -0
  54. package/out/assets/trash-2-C_LtCiNh.js +1 -0
  55. package/out/assets/triangle-alert-DOwc-41Y.js +1 -0
  56. package/out/assets/ui-PnUvY9zL.js +4 -0
  57. package/out/assets/upload-DgxxldtV.js +1 -0
  58. package/out/assets/{useChannelMessages-DS1ntAKN.js → useChannelMessages-CZHmH5n-.js} +1 -1
  59. package/out/assets/useGameRoom-B8Ds_PKe.js +1 -0
  60. package/out/assets/userProfile-CRGZ8PUF.js +1 -0
  61. package/out/assets/wallet-DBTWBi6K.js +1 -0
  62. package/out/assets/wifi-pP6SJLcu.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 +1 -1
  75. package/server/src/utils/api.js +149 -9
  76. package/out/assets/AppShell-gILTcRs-.js +0 -1
  77. package/out/assets/FilePreviewOverlay-CM-fcIaD.js +0 -1
  78. package/out/assets/LanguageToggle-B99eQcTE.js +0 -1
  79. package/out/assets/MarketingLayout-X3Nj2JvA.js +0 -1
  80. package/out/assets/MarketingThemeToggle-z4jr4-vt.js +0 -1
  81. package/out/assets/OpenSidebarButton-CaQJk5LD.js +0 -1
  82. package/out/assets/SidebarAccount-CpNVqNva.js +0 -1
  83. package/out/assets/arrow-right-mNO53HQi.js +0 -1
  84. package/out/assets/circle-alert-CofRTRHr.js +0 -1
  85. package/out/assets/cloud-DAGFCFIp.js +0 -1
  86. package/out/assets/copy-5aEv78Eq.js +0 -1
  87. package/out/assets/download-Bhqn6hL1.js +0 -1
  88. package/out/assets/external-link-CNR21yFA.js +0 -1
  89. package/out/assets/file-text-CFfvvCnM.js +0 -1
  90. package/out/assets/folder-BGJCjyba.js +0 -1
  91. package/out/assets/hard-drive-4vHpA5kz.js +0 -1
  92. package/out/assets/index-CgErXULe.css +0 -1
  93. package/out/assets/index-DN0kD5zr.js +0 -31
  94. package/out/assets/index.lazy-0DsJzEoI.js +0 -1
  95. package/out/assets/index.lazy-CJBRtbWA.js +0 -1
  96. package/out/assets/index.lazy-CPV-dZxo.js +0 -1
  97. package/out/assets/index.lazy-CQavt0-9.js +0 -2
  98. package/out/assets/index.lazy-CUq9lbK_.js +0 -1
  99. package/out/assets/index.lazy-CxpNXlwa.js +0 -1
  100. package/out/assets/index.lazy-DOgKxDuF.js +0 -1
  101. package/out/assets/index.lazy-Dzf-q-Vf.js +0 -1
  102. package/out/assets/index.lazy-GtegOPkJ.js +0 -2
  103. package/out/assets/index.lazy-H7NATHUs.js +0 -1
  104. package/out/assets/index.lazy-b_N8nrYw.js +0 -1
  105. package/out/assets/index.lazy-erexqght.js +0 -3
  106. package/out/assets/index.lazy-s3nUpCQ1.js +0 -1
  107. package/out/assets/key-round-BpSdpOHi.js +0 -1
  108. package/out/assets/loader-ByMmV2_4.js +0 -1
  109. package/out/assets/lock-C0pdaery.js +0 -1
  110. package/out/assets/message-square-Eu86zZup.js +0 -1
  111. package/out/assets/mp-DjXDNjls.js +0 -1
  112. package/out/assets/music-Btrhub6z.js +0 -1
  113. package/out/assets/notebook-pen-CfdFgaDE.js +0 -1
  114. package/out/assets/play-D5r9Yvbq.js +0 -1
  115. package/out/assets/plus-Mlh7r_bm.js +0 -1
  116. package/out/assets/refresh-cw--JB8k6mH.js +0 -1
  117. package/out/assets/save-DN4eprSt.js +0 -1
  118. package/out/assets/search-CbzMyENy.js +0 -1
  119. package/out/assets/send-D8p6f8OD.js +0 -1
  120. package/out/assets/shield-check-c0labdRH.js +0 -1
  121. package/out/assets/trash-2-zdhWec_U.js +0 -1
  122. package/out/assets/triangle-alert-D-qigSSn.js +0 -1
  123. package/out/assets/upload-BD23c5Pz.js +0 -1
  124. package/out/assets/useGameRoom-BSPkCY3n.js +0 -1
  125. package/out/assets/userProfile-BmzBA_Bk.js +0 -1
  126. package/out/assets/userStore-q0BBZsIV.js +0 -4
  127. package/out/assets/wallet-DmZMdK9A.js +0 -1
  128. package/out/assets/wifi-CVqaPDcv.js +0 -1
@@ -3,7 +3,9 @@ import { buildAuthHeaders, normalizeAuthPath } from './auth.js'
3
3
 
4
4
  const STORAGE_KEY = 'mostbox_backend_url'
5
5
  const INVITE_STORAGE_KEY = 'mostbox_backend_invite'
6
+ const REMOTE_NODES_KEY = 'mostbox_remote_nodes'
6
7
  const LOCALHOST_BACKEND_URL = 'http://localhost:1976'
8
+ const MAX_REMOTE_NODES = 8
7
9
 
8
10
  function isLocalFrontendOrigin() {
9
11
  if (typeof window === 'undefined') return false
@@ -30,16 +32,22 @@ function getConfiguredBackendUrl() {
30
32
  return localStorage.getItem(STORAGE_KEY) || ''
31
33
  }
32
34
 
33
- function getRemoteBackendUrl() {
34
- const configured = getConfiguredBackendUrl()
35
- if (!configured) return ''
35
+ function isRemoteBackendUrl(url) {
36
+ const configured = normalizeBackendUrl(url)
37
+ if (!configured) return false
38
+
36
39
  try {
37
40
  const { hostname } = new URL(configured)
38
- return ['localhost', '127.0.0.1', '::1'].includes(hostname)
39
- ? ''
40
- : configured
41
+ const normalized = hostname.toLowerCase()
42
+ return !(
43
+ normalized === 'localhost' ||
44
+ normalized === '::1' ||
45
+ normalized === '[::1]' ||
46
+ normalized === '127.0.0.1' ||
47
+ normalized.startsWith('127.')
48
+ )
41
49
  } catch {
42
- return configured
50
+ return true
43
51
  }
44
52
  }
45
53
 
@@ -48,6 +56,114 @@ function getBackendInvite() {
48
56
  return localStorage.getItem(INVITE_STORAGE_KEY) || ''
49
57
  }
50
58
 
59
+ function normalizeRemoteNode(input, fallback = {}) {
60
+ if (!input || typeof input !== 'object') return null
61
+
62
+ const url = normalizeBackendUrl(input.url)
63
+ if (!isRemoteBackendUrl(url)) return null
64
+
65
+ return {
66
+ url,
67
+ invite: typeof input.invite === 'string' ? input.invite.trim() : '',
68
+ active: input.active === true || fallback.active === true,
69
+ updatedAt: Number(input.updatedAt || fallback.updatedAt || Date.now()),
70
+ }
71
+ }
72
+
73
+ function uniqueRemoteNodes(nodes) {
74
+ const byUrl = new Map()
75
+ let activeUrl = ''
76
+
77
+ for (const node of nodes) {
78
+ const normalized = normalizeRemoteNode(node)
79
+ if (!normalized) continue
80
+
81
+ if (normalized.active && !activeUrl) {
82
+ activeUrl = normalized.url
83
+ } else if (normalized.active && activeUrl !== normalized.url) {
84
+ normalized.active = false
85
+ }
86
+
87
+ const existing = byUrl.get(normalized.url)
88
+ if (!existing || normalized.updatedAt >= existing.updatedAt) {
89
+ byUrl.set(normalized.url, {
90
+ ...existing,
91
+ ...normalized,
92
+ active: normalized.active || existing?.active === true,
93
+ })
94
+ }
95
+ }
96
+
97
+ return [...byUrl.values()]
98
+ .map(node => ({
99
+ ...node,
100
+ active: node.url === activeUrl || (!activeUrl && node.active === true),
101
+ }))
102
+ .sort((a, b) => {
103
+ if (a.active !== b.active) return a.active ? -1 : 1
104
+ return b.updatedAt - a.updatedAt
105
+ })
106
+ .slice(0, MAX_REMOTE_NODES)
107
+ }
108
+
109
+ function getRemoteNodes() {
110
+ if (typeof window === 'undefined') return []
111
+
112
+ const parsed = parseJsonText(localStorage.getItem(REMOTE_NODES_KEY))
113
+ const nodes = Array.isArray(parsed) ? parsed : []
114
+
115
+ const configured = getConfiguredBackendUrl()
116
+ if (isRemoteBackendUrl(configured)) {
117
+ nodes.push({
118
+ url: configured,
119
+ invite: getBackendInvite(),
120
+ active: true,
121
+ updatedAt: Date.now(),
122
+ })
123
+ }
124
+
125
+ return uniqueRemoteNodes(nodes)
126
+ }
127
+
128
+ function setRemoteNodes(nodes) {
129
+ if (typeof window === 'undefined') return
130
+
131
+ localStorage.setItem(
132
+ REMOTE_NODES_KEY,
133
+ JSON.stringify(uniqueRemoteNodes(nodes))
134
+ )
135
+ }
136
+
137
+ function getActiveRemoteNode() {
138
+ return getRemoteNodes().find(node => node.active) || null
139
+ }
140
+
141
+ function saveRemoteNode(url, invite = getBackendInvite(), active = true) {
142
+ const cleaned = normalizeBackendUrl(url)
143
+ if (!isRemoteBackendUrl(cleaned)) return
144
+
145
+ const nodes = getRemoteNodes().map(node => ({
146
+ ...node,
147
+ active: active ? false : node.active,
148
+ }))
149
+ nodes.unshift({
150
+ url: cleaned,
151
+ invite: (invite || '').trim(),
152
+ active,
153
+ updatedAt: Date.now(),
154
+ })
155
+ setRemoteNodes(nodes)
156
+ }
157
+
158
+ function clearActiveRemoteNode() {
159
+ setRemoteNodes(
160
+ getRemoteNodes().map(node => ({
161
+ ...node,
162
+ active: false,
163
+ }))
164
+ )
165
+ }
166
+
51
167
  function normalizeBackendUrl(url) {
52
168
  return (url || '').trim().replace(/\/+$/, '')
53
169
  }
@@ -88,6 +204,15 @@ function normalizePath(path) {
88
204
  return path.startsWith('/') ? path : `/${path}`
89
205
  }
90
206
 
207
+ function parseJsonText(text) {
208
+ if (!text) return null
209
+ try {
210
+ return JSON.parse(text)
211
+ } catch {
212
+ return null
213
+ }
214
+ }
215
+
91
216
  function getBackendAuthPath(url) {
92
217
  const requestPath = normalizeAuthPath(url)
93
218
  const backendUrl = getBackendUrl()
@@ -208,6 +333,9 @@ export function setBackendUrl(url) {
208
333
  const cleaned = normalizeBackendUrl(url)
209
334
  if (cleaned) {
210
335
  localStorage.setItem(STORAGE_KEY, cleaned)
336
+ if (isRemoteBackendUrl(cleaned)) {
337
+ saveRemoteNode(cleaned)
338
+ }
211
339
  } else {
212
340
  localStorage.removeItem(STORAGE_KEY)
213
341
  }
@@ -227,11 +355,15 @@ export function setBackendInvite(invite) {
227
355
  export function configureBackend({ url, invite }) {
228
356
  setBackendUrl(url)
229
357
  setBackendInvite(invite)
358
+ saveRemoteNode(url, invite)
230
359
  }
231
360
 
232
361
  export function clearBackendConnection() {
233
362
  setBackendUrl('')
234
363
  setBackendInvite('')
364
+ if (typeof window !== 'undefined') {
365
+ clearActiveRemoteNode()
366
+ }
235
367
  }
236
368
 
237
369
  export function getBackendUrlExport() {
@@ -246,8 +378,16 @@ export function getSameOriginBackendUrlExport() {
246
378
  return getSameOriginBackendUrl()
247
379
  }
248
380
 
249
- export function getRemoteBackendUrlExport() {
250
- return getRemoteBackendUrl()
381
+ export function getRemoteUrlExport() {
382
+ return getActiveRemoteNode()?.url || ''
383
+ }
384
+
385
+ export function getRemoteInviteExport() {
386
+ return getActiveRemoteNode()?.invite || ''
387
+ }
388
+
389
+ export function getRemoteNodesExport() {
390
+ return getRemoteNodes()
251
391
  }
252
392
 
253
393
  export function getBackendInviteExport() {
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{g as r}from"./userStore-q0BBZsIV.js";import{n as i,t as a}from"./LanguageToggle-B99eQcTE.js";import{I as o}from"./index-DN0kD5zr.js";var s=r(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),c=t(e(),1);function l(e,t){return typeof t==`boolean`?t:typeof window<`u`&&`matchMedia`in window?window.matchMedia(e).matches:!1}function u(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){let[r,i]=(0,c.useState)(n?t:l(e));return(0,c.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 d(e=!1,t={}){let[n,r]=(0,c.useState)(e),i=(0,c.useCallback)(()=>{r(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),a=(0,c.useCallback)(()=>{r(e=>e&&(t.onClose?.(),!1))},[t.onClose]);return[n,{open:i,close:a,toggle:(0,c.useCallback)(()=>{n?a():i()},[a,i,n]),set:r}]}var f=n(),p=(0,c.createContext)(null);function m(){let e=(0,c.useContext)(p);if(!e)throw Error(`useAppShell must be used within AppShell`);return e}function h({sidebar:e,className:t=``,headerTitle:n,headerRight:r,sidebarToggleReplacement:l,defaultHide:m=!1,children:h}){let[g,_]=d(!1),[v,y]=(0,c.useState)(m),b=(0,c.useRef)(m),x=u(`(max-width: 768px)`),{t:S}=o(),C=(0,c.useCallback)((e={})=>{_.close(),e.collapse&&y(!0)},[_]);(0,c.useEffect)(()=>{m!==b.current&&(m?C({collapse:!0}):y(!1),b.current=m)},[m,C]);let w=()=>{x?_.toggle():y(!v)},T=()=>{x?_.open():y(!1)},E=x?g:!v;return(0,f.jsx)(p.Provider,{value:{closeSidebar:C,openSidebar:T,isSidebarVisible:E},children:(0,f.jsxs)(`div`,{className:[`app-layout`,t].filter(Boolean).join(` `),children:[(0,f.jsx)(`div`,{className:`sidebar-overlay ${g?`visible`:``}`,onClick:()=>C()}),(0,f.jsx)(`div`,{className:`sidebar ${g?`open`:``} ${v?`collapsed`:``}`,children:e({closeSidebar:C,openSidebar:T})}),(0,f.jsxs)(`div`,{className:`main-content`,children:[(0,f.jsxs)(`header`,{className:`app-header`,children:[(0,f.jsxs)(`div`,{className:`header-left`,children:[l??(0,f.jsx)(`button`,{onClick:w,className:`btn btn-icon sidebar-toggle-btn`,"aria-label":S(x?`appShell.openMenu`:v?`appShell.expandSidebar`:`appShell.collapseSidebar`),children:(0,f.jsx)(s,{size:16})}),n]}),(0,f.jsxs)(`div`,{className:`header-right`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(a,{className:`btn btn-icon app-language-toggle`}),r]})]}),h]})]})})}export{m as n,d as r,h as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{g as r}from"./userStore-q0BBZsIV.js";import{t as i}from"./file-text-CFfvvCnM.js";import{t as a}from"./loader-ByMmV2_4.js";import{t as o}from"./music-Btrhub6z.js";import{I as s,b as c,k as l}from"./index-DN0kD5zr.js";var u=r(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),d=r(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),f=r(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]);function p(e){let t=String(e||``).split(`.`).pop()?.toLowerCase()||``,n=[`jpg`,`jpeg`,`png`,`gif`,`webp`,`svg`,`bmp`,`ico`,`tiff`,`heic`,`heif`],r=[`mp4`,`webm`,`mov`,`avi`,`mkv`,`flv`,`wmv`,`m4v`,`mpeg`,`3gp`],i=[`mp3`,`wav`,`ogg`,`flac`,`aac`,`m4a`,`wma`,`opus`],a=`txt.md.js.ts.jsx.tsx.css.scss.less.json.xml.html.htm.yaml.yml.toml.ini.cfg.conf.log.sh.bash.py.rb.go.rs.java.c.cpp.h.hpp.cs.php.sql.graphql.env.gitignore.dockerfile.readme`.split(`.`);return n.includes(t)?`image`:r.includes(t)?`video`:i.includes(t)?`audio`:a.includes(t)?`text`:`file`}var m=t(e(),1),h=n();function g(e){return e===`image`||e===`video`||e===`audio`}function _({item:e,isBackendReady:t,getFileDownloadUrl:n,onClose:r}){let{t:u}=s(),[d,f]=(0,m.useState)(``),[p,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(``),[b,x]=(0,m.useState)(``);return(0,m.useEffect)(()=>{if(e.subtype!==`text`)return;let r=!1;if(f(``),x(``),!t){f(u(`preview.loadFailed`));return}return _(!0),(async()=>{try{let t=await fetch(n(e.cid),{headers:{...await c(`GET`,`/api/files/${e.cid}/download`),Range:`bytes=0-9999`}});if(!t.ok)throw Error(u(`preview.loadFailed`));let i=await t.text();r||f(i||u(`preview.emptyFile`))}catch{r||f(u(`preview.loadFailed`))}finally{r||_(!1)}})(),()=>{r=!0}},[n,t,e.cid,e.subtype]),(0,m.useEffect)(()=>{if(!g(e.subtype)){y(``);return}if(y(``),x(``),!t){x(u(`preview.loadFailed`));return}let r=``,i=!1;return(async()=>{try{let t=await fetch(n(e.cid),{headers:await c(`GET`,`/api/files/${e.cid}/download`)});if(!t.ok)throw Error(u(`preview.loadFailed`));let a=URL.createObjectURL(await t.blob());r=a,i||y(a)}catch{i||x(u(`preview.loadFailed`))}})(),()=>{i=!0,r&&URL.revokeObjectURL(r)}},[n,t,e.cid,e.subtype]),(0,h.jsxs)(`div`,{className:`preview-overlay`,onClick:r,children:[(0,h.jsx)(`button`,{type:`button`,className:`preview-close`,onClick:r,"aria-label":u(`preview.close`),children:(0,h.jsx)(l,{size:20})}),(0,h.jsxs)(`div`,{onClick:e=>e.stopPropagation(),children:[e.subtype===`image`&&(0,h.jsx)(`div`,{className:`preview-media-wrapper`,children:v?(0,h.jsx)(`img`,{src:v,alt:e.fileName,translate:`no`}):b?(0,h.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,h.jsx)(i,{size:48,className:`preview-file-icon`}),(0,h.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,h.jsx)(`p`,{className:`preview-unsupported-hint`,children:b})]}):(0,h.jsx)(`div`,{className:`preview-loading`,children:(0,h.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`video`&&(0,h.jsx)(`div`,{className:`preview-media-wrapper`,children:v?(0,h.jsx)(`video`,{src:v,controls:!0}):b?(0,h.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,h.jsx)(i,{size:48,className:`preview-file-icon`}),(0,h.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,h.jsx)(`p`,{className:`preview-unsupported-hint`,children:b})]}):(0,h.jsx)(`div`,{className:`preview-loading`,children:(0,h.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`audio`&&(0,h.jsxs)(`div`,{className:`preview-audio`,children:[(0,h.jsx)(`div`,{className:`preview-audio-icon`,children:(0,h.jsx)(o,{size:36,color:`var(--accent)`})}),(0,h.jsx)(`p`,{className:`preview-audio-filename`,translate:`no`,children:e.fileName}),v?(0,h.jsx)(`audio`,{className:`preview-audio-player`,src:v,controls:!0}):(0,h.jsx)(`div`,{className:`preview-text-loading`,children:b?(0,h.jsx)(`p`,{children:b}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(a,{size:24,className:`preview-text-spinner`}),(0,h.jsx)(`p`,{children:u(`preview.audioLoading`)})]})})]}),e.subtype===`file`&&(0,h.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,h.jsx)(i,{size:48,className:`preview-file-icon`}),(0,h.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,h.jsx)(`p`,{className:`preview-unsupported-hint`,children:u(`preview.unsupported`)})]}),e.subtype===`text`&&(0,h.jsxs)(`div`,{className:`preview-text-container`,children:[(0,h.jsx)(`div`,{className:`preview-text-header`,children:(0,h.jsx)(`span`,{translate:`no`,children:e.fileName})}),p?(0,h.jsxs)(`div`,{className:`preview-text-loading`,children:[(0,h.jsx)(a,{size:24,className:`preview-text-spinner`}),(0,h.jsx)(`p`,{children:u(`preview.textLoading`)}),(0,h.jsx)(`p`,{className:`preview-text-loading-hint`,children:u(`preview.firstSyncHint`)})]}):(0,h.jsx)(`pre`,{className:`preview-text`,translate:`no`,children:d||u(`preview.emptyFile`)})]})]})]})}export{u as a,d as i,p as n,f as r,_ as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{g as t}from"./userStore-q0BBZsIV.js";import{t as n}from"./refresh-cw--JB8k6mH.js";import{I as r,L as i,R as a,c as o,p as s}from"./index-DN0kD5zr.js";var c=t(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),l=t(`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`}]]),u=t(`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`}]]),d=t(`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`}]]),f=e();function p(){let{t:e}=r(),{state:t,installAndRestart:i}=s(),a=t.status===`installing`;return t.status!==`downloaded`&&!a?null:(0,f.jsxs)(`button`,{type:`button`,className:`btn btn-primary desktop-update-button`,disabled:a,title:e(`desktopUpdate.readyTitle`,{version:t.version||t.filename}),onClick:()=>{i()},children:[(0,f.jsx)(n,{size:16}),e(a?`desktopUpdate.installing`:`desktopUpdate.install`)]})}function m({className:e=``}){let{locale:t,localeName:n,setLocale:s,t:u}=r(),d=u(`common.locale.choose`),p=`${d} (${u(`common.locale.current`)}: ${n})`;return(0,f.jsx)(o,{ariaLabel:d,placement:`bottom-end`,items:i.map(e=>({key:e,label:a[e],icon:e===t?(0,f.jsx)(c,{size:16}):(0,f.jsx)(`span`,{"aria-hidden":`true`}),onSelect:()=>{e!==t&&s(e)}})),renderTrigger:t=>(0,f.jsx)(`button`,{...t,className:[`language-toggle`,e].filter(Boolean).join(` `),"aria-label":d,title:p,children:(0,f.jsx)(l,{size:16})})})}export{c as a,u as i,p as n,d as r,m as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{b as t,t as n}from"./userStore-q0BBZsIV.js";import{n as r,t as i}from"./LanguageToggle-B99eQcTE.js";import{t as a}from"./download-Bhqn6hL1.js";import{I as o,f as s,i as c}from"./index-DN0kD5zr.js";import{t as l}from"./MarketingThemeToggle-z4jr4-vt.js";import{t as u}from"./LogoIcon-B2fFe0l1.js";var d=e();function f(){let e=n(e=>e.identity),f=n(e=>e.openLoginModal),{t:p}=o(),m=s(),h=e?.displayName||e?.username||p(`nav.openWeb`);return(0,d.jsx)(`nav`,{className:`mkt-nav`,children:(0,d.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,d.jsxs)(t,{to:`/`,className:`mkt-nav-logo`,children:[(0,d.jsx)(u,{}),`MOST PEOPLE`]}),(0,d.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,d.jsx)(l,{}),(0,d.jsx)(i,{className:`mkt-theme-toggle`}),(0,d.jsx)(r,{}),!m&&(0,d.jsxs)(t,{to:`/download/`,className:`btn btn-primary mkt-nav-preview`,children:[(0,d.jsx)(a,{size:16}),p(`nav.downloadClient`)]}),e?(0,d.jsx)(t,{to:`/profile/`,className:`mkt-nav-avatar-trigger`,"aria-label":p(`nav.profile`),title:h,children:(0,d.jsx)(`img`,{className:`mkt-nav-avatar`,src:c(e.address,e.avatar),alt:``,"aria-hidden":`true`})}):(0,d.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:f,children:p(`nav.getStarted`)})]})]})})}var p={name:`most-box`,version:`0.2.4`,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/**`],protocols:[{name:`MostBox Link`,schemes:[`most`]}],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`]},{target:`zip`,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`}}},m=[{to:`/`,labelKey:`footer.about`},{to:`/ping/`,labelKey:`footer.network`},{href:`https://github.com/most-people/most`,labelKey:null,label:`GitHub`,external:!0}],h=p.version;function g(){let{t:e}=o();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:m.map(n=>`external`in n?(0,d.jsx)(`a`,{href:n.href,target:`_blank`,rel:`noopener noreferrer`,children:n.label},n.href):(0,d.jsx)(t,{to:n.to,children:e(n.labelKey)},n.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`,h]})]})})})}function _({children:e,header:t}){return(0,d.jsxs)(`div`,{className:`mkt-layout`,children:[t??(0,d.jsx)(f,{}),(0,d.jsx)(`main`,{className:`mkt-layout-main`,children:e}),(0,d.jsx)(g,{})]})}export{_ 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,r as i}from"./LanguageToggle-B99eQcTE.js";import{I as a}from"./index-DN0kD5zr.js";var o=t(e(),1),s=n();function c(){let[e,t]=(0,o.useState)(!1),{t:n}=a();return(0,o.useEffect)(()=>{let e=localStorage.getItem(`theme`),n=window.matchMedia(`(prefers-color-scheme: dark)`).matches;(e===`dark`||!e&&n)&&t(!0)},[]),(0,o.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`),localStorage.setItem(`theme`,e?`dark`:`light`)},[e]),(0,s.jsx)(`button`,{type:`button`,className:`mkt-theme-toggle`,onClick:()=>t(!e),"aria-label":n(`common.theme.toggle`),title:n(`common.theme.toggle`),children:e?(0,s.jsx)(i,{size:16}):(0,s.jsx)(r,{size:16})})}export{c as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{g as t}from"./userStore-q0BBZsIV.js";import{n}from"./AppShell-gILTcRs-.js";import{I as r}from"./index-DN0kD5zr.js";var i=t(`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:t=``,variant:o=`primary`}){let{isSidebarVisible:s,openSidebar:c}=n(),{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 ${t}`.trim(),onClick:c,children:[(0,a.jsx)(i,{size:16}),d]})}export{o as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{b as r,t as i}from"./userStore-q0BBZsIV.js";import{I as a,i as o,u as s}from"./index-DN0kD5zr.js";var c=t(e(),1),l=n();function u({className:e=``}){let t=i(e=>e.identity),n=i(e=>e.openLoginModal),u=i(e=>e.logoutUser),[d,f]=(0,c.useState)(!1),{t:p}=a();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)(r,{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:o(t.address,t.avatar),alt:``,"aria-hidden":`true`})}):(0,l.jsx)(`img`,{className:`user-avatar-img`,src:o(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{g as e}from"./userStore-q0BBZsIV.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{g as e}from"./userStore-q0BBZsIV.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{g as e}from"./userStore-q0BBZsIV.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{g as e}from"./userStore-q0BBZsIV.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{g as e}from"./userStore-q0BBZsIV.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};
@@ -1 +0,0 @@
1
- import{g as e}from"./userStore-q0BBZsIV.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
@@ -1 +0,0 @@
1
- import{g as e}from"./userStore-q0BBZsIV.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
@@ -1 +0,0 @@
1
- import{g as e}from"./userStore-q0BBZsIV.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),n=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t as n,n as t};
@@ -1 +0,0 @@
1
- import{g as e}from"./userStore-q0BBZsIV.js";var t=e(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]);export{t};