most-box 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/electron/main.js +58 -4
- package/electron/updateChecker.js +10 -27
- package/electron/updateChecker.test.js +67 -0
- package/out/admin/index.html +0 -0
- package/out/app/index.html +0 -0
- package/out/assets/FilePreviewOverlay-CW8lKJCw.js +1 -0
- package/out/assets/LanguageToggle-Cfh33R2h.js +1 -0
- package/out/assets/{MarketingHeader-B3vYocUz.js → MarketingHeader-BKBngzf5.js} +1 -1
- package/out/assets/MarketingLayout-C3xrXmfU.js +1 -0
- package/out/assets/MarketingThemeToggle-Cl7PhFgv.js +1 -0
- package/out/assets/{MilkdownEditor-CRA9oxMp.js → MilkdownEditor-B5SKAyjg.js} +1 -1
- package/out/assets/OpenSidebarButton-Bdx86oG8.js +1 -0
- package/out/assets/SidebarAccount-c8jirEMF.js +1 -0
- package/out/assets/SidebarHomeLink-LzYXrJRr.js +1 -0
- package/out/assets/arrow-right-BC_GWahx.js +1 -0
- package/out/assets/circle-alert-Dkgyw_GE.js +1 -0
- package/out/assets/copy-KIwotKoP.js +1 -0
- package/out/assets/download-DPA-3LpR.js +1 -0
- package/out/assets/{downloadValidation-eInMiVSX.js → downloadValidation-CH8BeY7_.js} +1 -1
- package/out/assets/external-link-BmR2rZ80.js +1 -0
- package/out/assets/file-text-BJQfDW9r.js +1 -0
- package/out/assets/folder-Gb80aQnO.js +1 -0
- package/out/assets/hard-drive-P2dGA7FX.js +1 -0
- package/out/assets/i18n-Cqyi6NZb.js +1 -0
- package/out/assets/index-CSBg7dZN.css +1 -0
- package/out/assets/index-CiHRnvMj.js +31 -0
- package/out/assets/index.lazy-B7u3Ztoe.js +1 -0
- package/out/assets/index.lazy-BdOfbfjo.js +2 -0
- package/out/assets/index.lazy-Bh4jDrUl.js +1 -0
- package/out/assets/index.lazy-Bo6McUf1.js +1 -0
- package/out/assets/index.lazy-BxUje7fk.js +1 -0
- package/out/assets/index.lazy-CIqPn0cy.js +1 -0
- package/out/assets/index.lazy-CfuoMz6P.js +1 -0
- package/out/assets/index.lazy-DAKkwnV2.js +1 -0
- package/out/assets/index.lazy-DRaxm9OS.js +1 -0
- package/out/assets/index.lazy-DkrwcEBu.js +2 -0
- package/out/assets/index.lazy-K6IB-5kb.js +3 -0
- package/out/assets/index.lazy-Uu9DCtrI.js +1 -0
- package/out/assets/index.lazy-mXESMo49.js +1 -0
- package/out/assets/key-round-DvpIlAJY.js +1 -0
- package/out/assets/loader-8eVY8_SD.js +1 -0
- package/out/assets/lock-Cvtl60UJ.js +1 -0
- package/out/assets/message-square-JK7ABH3O.js +1 -0
- package/out/assets/mp-CMvgV1-c.js +1 -0
- package/out/assets/music-YRSH1Jq6.js +1 -0
- package/out/assets/notebook-pen-BjGx0coX.js +1 -0
- package/out/assets/play-Ds19moWN.js +1 -0
- package/out/assets/plus-CvGkRhJV.js +1 -0
- package/out/assets/save-BcI68ZgS.js +1 -0
- package/out/assets/search-BIa4RSPA.js +1 -0
- package/out/assets/send-_ups0_3f.js +1 -0
- package/out/assets/shield-check-Dzw5rdPe.js +1 -0
- package/out/assets/smartphone-DSQ5L_sr.js +1 -0
- package/out/assets/trash-2-BIrBn6Ce.js +1 -0
- package/out/assets/triangle-alert-CgWIEl4u.js +1 -0
- package/out/assets/ui-u9yJHkb-.js +4 -0
- package/out/assets/upload-1jmNeGjH.js +1 -0
- package/out/assets/{useChannelMessages-D_306Ymv.js → useChannelMessages-DNxfCew-.js} +1 -1
- package/out/assets/useGameRoom-Du07VEgb.js +1 -0
- package/out/assets/userProfile-CL1Ev2GK.js +1 -0
- package/out/assets/wallet-BvM_X5nW.js +1 -0
- package/out/assets/wifi-66t1dsgC.js +1 -0
- package/out/chat/index.html +0 -0
- package/out/chat/join/index.html +0 -0
- package/out/download/index.html +2 -2
- package/out/game/gandengyan/index.html +0 -0
- package/out/game/index.html +0 -0
- package/out/game/zhajinhua/index.html +0 -0
- package/out/index.html +2 -2
- package/out/note/index.html +0 -0
- package/out/ping/index.html +2 -2
- package/out/profile/index.html +0 -0
- package/out/web3/index.html +0 -0
- package/package.json +5 -1
- package/server/src/core/channelIdentity.js +3 -5
- package/server/src/core/gameRoom.js +18 -43
- package/server/src/core/ownerMetadata.js +3 -4
- package/server/src/core/releaseManifest.js +108 -0
- package/server/src/core/shared.js +50 -0
- package/server/src/core/zhajinhua.js +12 -33
- package/server/src/games/gandengyan.js +7 -14
- package/server/src/http/nodeStatus.js +0 -6
- package/server/src/http/routes/channelRoutes.js +1 -13
- package/server/src/http/routes/nodeRoutes.js +1 -1
- package/server/src/index.js +44 -14
- package/server/src/utils/api.js +47 -0
- package/server/src/utils/auth.js +2 -5
- package/server/src/utils/dateTime.js +1 -3
- package/out/assets/AppShell-oF8wPXde.js +0 -1
- package/out/assets/FilePreviewOverlay-DTBZt89J.js +0 -1
- package/out/assets/LanguageToggle-HAJ3D6Ne.js +0 -1
- package/out/assets/MarketingLayout-CapVVXTP.js +0 -1
- package/out/assets/MarketingThemeToggle-B47H68ro.js +0 -1
- package/out/assets/OpenSidebarButton-D3JRO-Hh.js +0 -1
- package/out/assets/SidebarAccount-8_hQAYXx.js +0 -1
- package/out/assets/arrow-right-mNO53HQi.js +0 -1
- package/out/assets/circle-alert-CofRTRHr.js +0 -1
- package/out/assets/cloud-DAGFCFIp.js +0 -1
- package/out/assets/copy-5aEv78Eq.js +0 -1
- package/out/assets/download-Bhqn6hL1.js +0 -1
- package/out/assets/external-link-CNR21yFA.js +0 -1
- package/out/assets/file-text-CFfvvCnM.js +0 -1
- package/out/assets/folder-BGJCjyba.js +0 -1
- package/out/assets/hard-drive-4vHpA5kz.js +0 -1
- package/out/assets/index--p9MKNEl.js +0 -31
- package/out/assets/index-DEu4udaa.css +0 -1
- package/out/assets/index.lazy-2K3f5PZe.js +0 -1
- package/out/assets/index.lazy-B-2etVwK.js +0 -1
- package/out/assets/index.lazy-B4WTQF5E.js +0 -1
- package/out/assets/index.lazy-BFfsQrRe.js +0 -1
- package/out/assets/index.lazy-C5udBnrO.js +0 -1
- package/out/assets/index.lazy-C84HrZpm.js +0 -1
- package/out/assets/index.lazy-CBC2N5p_.js +0 -3
- package/out/assets/index.lazy-CzANViGX.js +0 -1
- package/out/assets/index.lazy-D3cw7yyA.js +0 -2
- package/out/assets/index.lazy-DVVZzbCN.js +0 -1
- package/out/assets/index.lazy-DxZgywoV.js +0 -1
- package/out/assets/index.lazy-RBLN4SE9.js +0 -1
- package/out/assets/index.lazy-s4E2z9AY.js +0 -2
- package/out/assets/key-round-BpSdpOHi.js +0 -1
- package/out/assets/loader-ByMmV2_4.js +0 -1
- package/out/assets/lock-C0pdaery.js +0 -1
- package/out/assets/message-square-Eu86zZup.js +0 -1
- package/out/assets/mp-CJWipckT.js +0 -1
- package/out/assets/music-Btrhub6z.js +0 -1
- package/out/assets/notebook-pen-CfdFgaDE.js +0 -1
- package/out/assets/play-D5r9Yvbq.js +0 -1
- package/out/assets/plus-Mlh7r_bm.js +0 -1
- package/out/assets/refresh-cw--JB8k6mH.js +0 -1
- package/out/assets/save-DN4eprSt.js +0 -1
- package/out/assets/search-CbzMyENy.js +0 -1
- package/out/assets/send-D8p6f8OD.js +0 -1
- package/out/assets/shield-check-c0labdRH.js +0 -1
- package/out/assets/trash-2-zdhWec_U.js +0 -1
- package/out/assets/triangle-alert-CO_5uXy2.js +0 -1
- package/out/assets/upload-BD23c5Pz.js +0 -1
- package/out/assets/useGameRoom-CURx56m6.js +0 -1
- package/out/assets/userProfile-oeBvU6ch.js +0 -1
- package/out/assets/userStore-q0BBZsIV.js +0 -4
- package/out/assets/wallet-DmZMdK9A.js +0 -1
- package/out/assets/wifi-CVqaPDcv.js +0 -1
package/README.md
CHANGED
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
|
|
31
31
|
前往 [Most.Box 下载页](https://Most.Box/download) 下载客户端,支持 Windows、macOS 和 Linux。桌面端内置本地 MostBox 节点,提供完整 P2P 文件分享、下载校验和持续做种能力,无需单独安装 Node.js。
|
|
32
32
|
|
|
33
|
+
### 移动端 App 计划
|
|
34
|
+
|
|
35
|
+
移动端优先按 Android 前台完整种子 MVP 推进,参考 Keet/Pear 的“P2P 核心端 + 平台 UI 壳”分层:手机端先验证自己能发布、下载、校验并在前台继续做种,再扩展后台能力、iOS 和商店分发。详细范围见 [docs/mobile-android-plan.md](docs/mobile-android-plan.md)。
|
|
36
|
+
|
|
37
|
+
Android 工程入口在 `mobile/android/`。本地开发可运行 `npm run android` 启动 Expo Dev Client 并打开 Android 真机/模拟器;首次安装开发版或原生依赖变更后运行 `npm run android:build`。
|
|
38
|
+
|
|
33
39
|
### 方式二:npm 包
|
|
34
40
|
|
|
35
41
|
适合开发、自托管或临时启动本机节点。请先安装 Node.js >= 22.12,然后运行:
|
package/electron/main.js
CHANGED
|
@@ -434,11 +434,65 @@ function quitForUpdate() {
|
|
|
434
434
|
app.quit()
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
function getPowerShellPath() {
|
|
438
|
+
if (process.env.SystemRoot) {
|
|
439
|
+
const candidate = path.join(
|
|
440
|
+
process.env.SystemRoot,
|
|
441
|
+
'System32',
|
|
442
|
+
'WindowsPowerShell',
|
|
443
|
+
'v1.0',
|
|
444
|
+
'powershell.exe'
|
|
445
|
+
)
|
|
446
|
+
if (fs.existsSync(candidate)) return candidate
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return 'powershell.exe'
|
|
450
|
+
}
|
|
451
|
+
|
|
437
452
|
function installWindowsUpdate(updatePath) {
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
453
|
+
const scriptPath = path.join(
|
|
454
|
+
app.getPath('userData'),
|
|
455
|
+
'updates',
|
|
456
|
+
'install-windows.ps1'
|
|
457
|
+
)
|
|
458
|
+
const exePath = app.getPath('exe')
|
|
459
|
+
const script = `param(
|
|
460
|
+
[Parameter(Mandatory=$true)][string]$UpdatePath,
|
|
461
|
+
[Parameter(Mandatory=$true)][int]$AppPid,
|
|
462
|
+
[Parameter(Mandatory=$true)][string]$ExePath
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
$ErrorActionPreference = "Stop"
|
|
466
|
+
try {
|
|
467
|
+
Wait-Process -Id $AppPid -ErrorAction SilentlyContinue
|
|
468
|
+
} catch {}
|
|
469
|
+
|
|
470
|
+
$installer = Start-Process -FilePath $UpdatePath -ArgumentList "/S" -Wait -PassThru
|
|
471
|
+
if (($null -eq $installer.ExitCode -or $installer.ExitCode -eq 0) -and (Test-Path -LiteralPath $ExePath)) {
|
|
472
|
+
Start-Process -FilePath $ExePath
|
|
473
|
+
}
|
|
474
|
+
`
|
|
475
|
+
|
|
476
|
+
fs.mkdirSync(path.dirname(scriptPath), { recursive: true })
|
|
477
|
+
fs.writeFileSync(scriptPath, script, 'utf8')
|
|
478
|
+
const child = spawn(
|
|
479
|
+
getPowerShellPath(),
|
|
480
|
+
[
|
|
481
|
+
'-NoProfile',
|
|
482
|
+
'-ExecutionPolicy',
|
|
483
|
+
'Bypass',
|
|
484
|
+
'-File',
|
|
485
|
+
scriptPath,
|
|
486
|
+
updatePath,
|
|
487
|
+
String(process.pid),
|
|
488
|
+
exePath,
|
|
489
|
+
],
|
|
490
|
+
{
|
|
491
|
+
detached: true,
|
|
492
|
+
stdio: 'ignore',
|
|
493
|
+
windowsHide: true,
|
|
494
|
+
}
|
|
495
|
+
)
|
|
442
496
|
child.unref()
|
|
443
497
|
quitForUpdate()
|
|
444
498
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findCompatibleUpdateAsset,
|
|
3
|
+
isReleaseManifest,
|
|
4
|
+
resolveReleaseAssetDownload,
|
|
5
|
+
} from '../server/src/core/releaseManifest.js'
|
|
6
|
+
|
|
1
7
|
export const DEFAULT_RELEASE_MANIFEST_URL =
|
|
2
8
|
'https://download.most.box/releases/latest.json'
|
|
3
9
|
|
|
@@ -43,31 +49,8 @@ export function isNewerVersion(candidateVersion, currentVersion) {
|
|
|
43
49
|
return false
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
function isRecord(value) {
|
|
47
|
-
return typeof value === 'object' && value !== null
|
|
48
|
-
}
|
|
49
|
-
|
|
50
52
|
export function findUpdateAsset(manifest, platform, arch) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const compatibleAssets = manifest.assets.filter(
|
|
54
|
-
asset =>
|
|
55
|
-
isRecord(asset) &&
|
|
56
|
-
asset.platform === platform &&
|
|
57
|
-
asset.arch === arch &&
|
|
58
|
-
(asset.kind === 'updater' || asset.kind === 'installer') &&
|
|
59
|
-
typeof asset.cid === 'string' &&
|
|
60
|
-
(typeof asset.githubUrl === 'string' ||
|
|
61
|
-
typeof asset.r2Url === 'string' ||
|
|
62
|
-
typeof asset.githubUrl === 'undefined') &&
|
|
63
|
-
(typeof asset.r2Url === 'string' || typeof asset.r2Url === 'undefined')
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
compatibleAssets.find(asset => asset.kind === 'updater') ||
|
|
68
|
-
compatibleAssets.find(asset => asset.kind === 'installer') ||
|
|
69
|
-
null
|
|
70
|
-
)
|
|
53
|
+
return findCompatibleUpdateAsset(manifest, platform, arch)
|
|
71
54
|
}
|
|
72
55
|
|
|
73
56
|
export function formatBytes(size) {
|
|
@@ -83,8 +66,7 @@ export function getAvailableUpdate(manifest, options = {}) {
|
|
|
83
66
|
const arch = options.arch
|
|
84
67
|
|
|
85
68
|
if (
|
|
86
|
-
!
|
|
87
|
-
typeof manifest.version !== 'string' ||
|
|
69
|
+
!isReleaseManifest(manifest) ||
|
|
88
70
|
!isNewerVersion(manifest.version, currentVersion)
|
|
89
71
|
) {
|
|
90
72
|
return null
|
|
@@ -93,7 +75,8 @@ export function getAvailableUpdate(manifest, options = {}) {
|
|
|
93
75
|
const asset = findUpdateAsset(manifest, platform, arch)
|
|
94
76
|
if (!asset) return null
|
|
95
77
|
|
|
96
|
-
const downloadUrl = asset
|
|
78
|
+
const { url: downloadUrl } = resolveReleaseAssetDownload(asset, 'r2')
|
|
79
|
+
if (!downloadUrl) return null
|
|
97
80
|
|
|
98
81
|
return {
|
|
99
82
|
version: manifest.version,
|
|
@@ -44,6 +44,7 @@ const manifest = {
|
|
|
44
44
|
arch: 'arm64',
|
|
45
45
|
kind: 'updater',
|
|
46
46
|
filename: 'MostBox-0.1.3-win-arm64-setup.exe',
|
|
47
|
+
size: 108003328,
|
|
47
48
|
cid: 'bafkreidsxk7x7eekhalvskbqtqnucird2p4eq3riz6ijmrswzm4miwq74m',
|
|
48
49
|
githubUrl:
|
|
49
50
|
'https://github.com/most-people/most/releases/download/v0.1.3/MostBox-0.1.3-win-arm64-setup.exe',
|
|
@@ -53,6 +54,7 @@ const manifest = {
|
|
|
53
54
|
arch: 'arm64',
|
|
54
55
|
kind: 'updater',
|
|
55
56
|
filename: 'MostBox-0.1.3-mac-arm64.zip',
|
|
57
|
+
size: 134217728,
|
|
56
58
|
cid: 'bafkreicjs6qwdk7xuclzrkch7gx4vy3zc7y5dxrg4i764py54nk5kekbsm',
|
|
57
59
|
githubUrl:
|
|
58
60
|
'https://github.com/most-people/most/releases/download/v0.1.3/MostBox-0.1.3-mac-arm64.zip',
|
|
@@ -155,6 +157,71 @@ describe('desktop update checker', () => {
|
|
|
155
157
|
assert.equal(update?.downloadUrl, manifest.assets[2].githubUrl)
|
|
156
158
|
})
|
|
157
159
|
|
|
160
|
+
it('prefers a compatible updater asset before installer fallback', () => {
|
|
161
|
+
const updaterOnlyOnGitHub = {
|
|
162
|
+
version: '0.1.4',
|
|
163
|
+
publishedAt: '2026-06-02T00:00:00.000Z',
|
|
164
|
+
assets: [
|
|
165
|
+
{
|
|
166
|
+
platform: 'windows',
|
|
167
|
+
arch: 'x64',
|
|
168
|
+
kind: 'installer',
|
|
169
|
+
filename: 'MostBox-0.1.4-win-x64-setup.exe',
|
|
170
|
+
size: 113246208,
|
|
171
|
+
cid: 'bafkreibax3b55elk3vr76ejckvn32ucdogkiq5kkwu5vuxgmccf2hdhbiq',
|
|
172
|
+
r2Url:
|
|
173
|
+
'https://download.most.box/releases/v0.1.4/MostBox-0.1.4-win-x64-setup.exe',
|
|
174
|
+
githubUrl:
|
|
175
|
+
'https://github.com/most-people/most/releases/download/v0.1.4/MostBox-0.1.4-win-x64-setup.exe',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
platform: 'windows',
|
|
179
|
+
arch: 'x64',
|
|
180
|
+
kind: 'updater',
|
|
181
|
+
filename: 'MostBox-0.1.4-win-x64-setup.exe',
|
|
182
|
+
size: 113246208,
|
|
183
|
+
cid: 'bafkreih7l2lwv34xse23634mj5g6d63ovfjhyo5hb2h4lng2hhsxp6wh6q',
|
|
184
|
+
githubUrl:
|
|
185
|
+
'https://github.com/most-people/most/releases/download/v0.1.4/MostBox-0.1.4-win-x64-setup.exe',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const update = getAvailableUpdate(updaterOnlyOnGitHub, {
|
|
191
|
+
currentVersion: '0.1.3',
|
|
192
|
+
platform: 'windows',
|
|
193
|
+
arch: 'x64',
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
assert.equal(update?.asset.kind, 'updater')
|
|
197
|
+
assert.equal(update?.cid, updaterOnlyOnGitHub.assets[1].cid)
|
|
198
|
+
assert.equal(update?.downloadUrl, updaterOnlyOnGitHub.assets[1].githubUrl)
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
it('ignores updater assets without an HTTP fallback URL', () => {
|
|
202
|
+
const update = getAvailableUpdate(
|
|
203
|
+
{
|
|
204
|
+
version: '0.1.4',
|
|
205
|
+
assets: [
|
|
206
|
+
{
|
|
207
|
+
platform: 'windows',
|
|
208
|
+
arch: 'x64',
|
|
209
|
+
kind: 'updater',
|
|
210
|
+
filename: 'MostBox-0.1.4-win-x64-setup.exe',
|
|
211
|
+
cid: 'bafybeibkowplg3qw4jnfzrrmh5yljvtg4eas3h5d2u4xjptfbxozxwi4cq',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
currentVersion: '0.1.3',
|
|
217
|
+
platform: 'windows',
|
|
218
|
+
arch: 'x64',
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
assert.equal(update, null)
|
|
223
|
+
})
|
|
224
|
+
|
|
158
225
|
it('formats installer sizes for update prompts', () => {
|
|
159
226
|
assert.equal(formatBytes(112197632), '107 MB')
|
|
160
227
|
assert.equal(formatBytes(2.5 * 1024 * 1024), '2.5 MB')
|
package/out/admin/index.html
CHANGED
|
Binary file
|
package/out/app/index.html
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,w as i}from"./ui-u9yJHkb-.js";import{a}from"./i18n-Cqyi6NZb.js";import{t as o}from"./file-text-BJQfDW9r.js";import{t as s}from"./loader-8eVY8_SD.js";import{t as c}from"./music-YRSH1Jq6.js";import{m as l}from"./index-CiHRnvMj.js";var u=i(`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=i(`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=i(`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:i}){let{t:u}=a(),[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 l(`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 l(`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:i,children:[(0,h.jsx)(`button`,{type:`button`,className:`preview-close`,onClick:i,"aria-label":u(`preview.close`),children:(0,h.jsx)(r,{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)(o,{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)(o,{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)(c,{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)(s,{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)(o,{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)(s,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{s as t,t as n,w as r}from"./ui-u9yJHkb-.js";import{a as i,c as a,o}from"./i18n-Cqyi6NZb.js";var s=r(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),c=r(`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`}]]),l=r(`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`}]]),u=r(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),d=r(`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}=i(),{state:n,installAndRestart:r}=t(),a=n.status===`checking`,o=n.status===`downloading`,s=n.status===`downloaded`,c=n.status===`installing`,l=a||o||c;if(!a&&!o&&!s&&!c)return null;let d=e(`desktopUpdate.install`);a?d=e(`desktopUpdate.checking`):o?d=n.progress>0?e(`desktopUpdate.downloadingProgress`,{progress:n.progress}):e(`desktopUpdate.downloading`):c&&(d=e(`desktopUpdate.installing`));let p=a||o?e(`desktopUpdate.downloadingTitle`):e(`desktopUpdate.readyTitle`,{version:n.version||n.filename});return(0,f.jsxs)(`button`,{type:`button`,className:`btn ${s||c?`btn-primary`:`btn-secondary`} desktop-update-button`,disabled:!s||c,title:p,"aria-live":l?`polite`:void 0,onClick:()=>{s&&r()},children:[(0,f.jsx)(u,{size:16,className:l?`spin`:void 0}),d]})}function m({className:e=``}){let{locale:t,localeName:r,setLocale:l,t:u}=i(),d=u(`common.locale.choose`),p=`${d} (${u(`common.locale.current`)}: ${r})`;return(0,f.jsx)(n,{ariaLabel:d,placement:`bottom-end`,items:o.map(e=>({key:e,label:a[e],icon:e===t?(0,f.jsx)(s,{size:16}):(0,f.jsx)(`span`,{"aria-hidden":`true`}),onSelect:()=>{e!==t&&l(e)}})),renderTrigger:t=>(0,f.jsx)(`button`,{...t,className:[`language-toggle`,e].filter(Boolean).join(` `),"aria-label":d,title:p,children:(0,f.jsx)(c,{size:16})})})}export{l as a,u as i,p as n,s as o,d as r,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{n as t,t as n}from"./LanguageToggle-
|
|
1
|
+
import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{n as t,t as n}from"./LanguageToggle-Cfh33R2h.js";import{I as r,j as i}from"./index-CiHRnvMj.js";import{t as a}from"./MarketingThemeToggle-Cl7PhFgv.js";var o=e();function s(){return(0,o.jsx)(`nav`,{className:`mkt-nav`,children:(0,o.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,o.jsxs)(`button`,{type:`button`,className:`mkt-nav-logo`,onClick:i(),children:[(0,o.jsx)(r,{size:18}),(0,o.jsx)(`span`,{children:`MOST PEOPLE`})]}),(0,o.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,o.jsx)(a,{}),(0,o.jsx)(n,{className:`mkt-theme-toggle`}),(0,o.jsx)(t,{})]})]})})}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{O as t,c as n,o as r}from"./ui-u9yJHkb-.js";import{a as i}from"./i18n-Cqyi6NZb.js";import{n as a,t as o}from"./LanguageToggle-Cfh33R2h.js";import{t as s}from"./download-DPA-3LpR.js";import{i as c}from"./index-CiHRnvMj.js";import{t as l}from"./MarketingThemeToggle-Cl7PhFgv.js";import{t as u}from"./LogoIcon-B2fFe0l1.js";var d={name:`most-box`,version:`0.2.7`,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:desktop":`node --test electron/*.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`,android:`npm --prefix mobile/android start`,"android:build":`npm --prefix mobile/android run apk`,"android:test":`npm --prefix mobile/android test`,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`}}},f=e(),p=[{to:`/`,labelKey:`footer.about`},{to:`/ping/`,labelKey:`footer.network`},{href:`https://github.com/most-people/most`,labelKey:null,label:`GitHub`,external:!0}],m=d.version;function h(){let{t:e}=i();return(0,f.jsx)(`footer`,{className:`mkt-footer`,children:(0,f.jsx)(`div`,{className:`mkt-container`,children:(0,f.jsxs)(`div`,{className:`mkt-footer-inner`,children:[(0,f.jsx)(`div`,{className:`mkt-footer-links`,children:p.map(n=>`external`in n?(0,f.jsx)(`a`,{href:n.href,target:`_blank`,rel:`noopener noreferrer`,children:n.label},n.href):(0,f.jsx)(t,{to:n.to,children:e(n.labelKey)},n.to))}),(0,f.jsxs)(`span`,{className:`mkt-footer-copy`,children:[`© `,new Date().getFullYear(),` MOST PEOPLE · MIT License`]}),(0,f.jsxs)(`span`,{className:`mkt-footer-build`,translate:`no`,children:[`v`,m]})]})})})}function g({children:e,header:t}){return(0,f.jsxs)(`div`,{className:`mkt-layout`,children:[t??(0,f.jsx)(_,{}),(0,f.jsx)(`main`,{className:`mkt-layout-main`,children:e}),(0,f.jsx)(h,{})]})}function _(){let e=n(e=>e.identity),d=n(e=>e.openLoginModal),{t:p}=i(),m=r(),h=e?.displayName||e?.username||p(`nav.openWeb`);return(0,f.jsx)(`nav`,{className:`mkt-nav`,children:(0,f.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,f.jsxs)(t,{to:`/`,className:`mkt-nav-logo`,children:[(0,f.jsx)(u,{}),`MOST PEOPLE`]}),(0,f.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,f.jsx)(l,{}),(0,f.jsx)(o,{className:`mkt-theme-toggle`}),(0,f.jsx)(a,{}),!m&&(0,f.jsxs)(t,{to:`/download/`,className:`btn btn-primary mkt-nav-preview`,children:[(0,f.jsx)(s,{size:16}),p(`nav.downloadClient`)]}),e?(0,f.jsx)(t,{to:`/profile/`,className:`mkt-nav-avatar-trigger`,"aria-label":p(`nav.profile`),title:h,children:(0,f.jsx)(`img`,{className:`mkt-nav-avatar`,src:c(e.address,e.avatar),alt:``,"aria-hidden":`true`})}):(0,f.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:d,children:p(`nav.getStarted`)})]})]})})}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{a as r}from"./i18n-Cqyi6NZb.js";import{a as i,r as a}from"./LanguageToggle-Cfh33R2h.js";var o=t(e(),1),s=n();function c(){let[e,t]=(0,o.useState)(!1),{t:n}=r();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)(a,{size:16}):(0,s.jsx)(i,{size:16})})}export{c as t};
|