Skip to content

Commit a56bb0f

Browse files
authored
Merge pull request #15 from Bubble-droid/main
Fix: Add OS check to avoid kernel download errors on old Linux systems.
2 parents 2f99954 + 3ba243f commit a56bb0f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

frontend/src/hooks/useCoreBranch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const useCoreBranch = (isAlpha = false) => {
7777
if (body.message) throw body.message
7878

7979
const { assets, name } = isAlpha ? body.find((v: any) => v.prerelease === true) : body
80-
const assetName = getKernelAssetFileName(name)
80+
const assetName = getKernelAssetFileName(name, isAlpha)
8181
const asset = assets.find((v: any) => v.name === assetName)
8282
if (!asset) throw 'Asset Not Found:' + assetName
8383
if (asset.uploader.type !== 'Bot') {

frontend/src/utils/helper.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,15 @@ export const getKernelFileName = (isAlpha = false) => {
507507
return `sing-box${latest}${fileSuffix}`
508508
}
509509

510-
export const getKernelAssetFileName = (version: string) => {
510+
export const getKernelAssetFileName = (version: string, isAlpha = false) => {
511511
const envStore = useEnvStore()
512512
const { os, arch } = envStore.env
513-
const legacy = arch === 'amd64' && envStore.env.x64Level < 3 ? '-legacy' : ''
513+
const legacy =
514+
(os === 'windows' || (os === 'darwin' && !isAlpha)) &&
515+
arch === 'amd64' &&
516+
envStore.env.x64Level < 3
517+
? '-legacy'
518+
: ''
514519
const suffix = { windows: '.zip', linux: '.tar.gz', darwin: '.tar.gz' }[os]
515520
return `sing-box-${version}-${os}-${arch}${legacy}${suffix}`
516521
}

0 commit comments

Comments
 (0)