File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed
views/SettingsView/components/components Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export const useCoreBranch = (isAlpha = false) => {
7070 const CoreFilePath = `${ CoreWorkingDirectory } /${ getKernelFileName ( isAlpha ) } `
7171 const CoreBakFilePath = `${ CoreFilePath } .bak`
7272
73- const downloadCore = async ( ) => {
73+ const downloadCore = async ( cpuLevel ?: 'v1' | 'v2' | 'v3' ) => {
7474 downloading . value = true
7575 try {
7676 const { body } = await HttpGet < Record < string , any > > ( releaseUrl , {
@@ -79,7 +79,7 @@ export const useCoreBranch = (isAlpha = false) => {
7979 if ( body . message ) throw body . message
8080
8181 const { assets, name } = body
82- const assetName = getKernelAssetFileName ( isAlpha ? remoteVersion . value : name )
82+ const assetName = getKernelAssetFileName ( isAlpha ? remoteVersion . value : name , cpuLevel )
8383 const asset = assets . find ( ( v : any ) => v . name === assetName )
8484 if ( ! asset ) throw 'Asset Not Found:' + assetName
8585 if ( asset . uploader . type !== 'Bot' ) {
Original file line number Diff line number Diff line change @@ -510,12 +510,12 @@ export const getKernelFileName = (isAlpha = false) => {
510510 return `mihomo${ alpha } ${ fileSuffix } `
511511}
512512
513- export const getKernelAssetFileName = ( version : string ) => {
513+ export const getKernelAssetFileName = ( version : string , cpuLevel : 'v1' | 'v2' | 'v3' = 'v3' ) => {
514514 const envStore = useEnvStore ( )
515515 const { os, arch } = envStore . env
516- const cpuLevel = arch === 'amd64' ? '-v3' : ''
516+ const cpuLevelFlag = arch === 'amd64' ? `- ${ cpuLevel } ` : ''
517517 const suffix = { windows : '.zip' , linux : '.gz' , darwin : '.gz' } [ os ]
518- return `mihomo-${ os } -${ arch } ${ cpuLevel } -${ version } ${ suffix } `
518+ return `mihomo-${ os } -${ arch } ${ cpuLevelFlag } -${ version } ${ suffix } `
519519}
520520
521521export const processMagicVariables = ( str : string ) => {
Original file line number Diff line number Diff line change @@ -99,15 +99,19 @@ const handleClearCoreCache = async () => {
9999 :
100100 {{ remoteVersionLoading ? 'Loading' : remoteVersion }}
101101 </Tag >
102- <Button
103- v-show =" !localVersionLoading && !remoteVersionLoading && updatable"
104- @click =" downloadCore"
105- :loading =" downloading"
106- size =" small"
107- type =" primary"
108- >
109- {{ t('kernel.update') }} : {{ remoteVersion }}
110- </Button >
102+ <Dropdown v-show =" !localVersionLoading && !remoteVersionLoading && updatable" >
103+ <Button @click =" downloadCore()" :loading =" downloading" size =" small" type =" primary" >
104+ {{ t('kernel.update') }} : {{ remoteVersion }}
105+ </Button >
106+ <template #overlay >
107+ <div v-if =" !downloading" class =" flex flex-col gap-4 min-w-64 p-4" >
108+ <Button @click =" downloadCore('v1')" type =" text" > v1 </Button >
109+ <Button @click =" downloadCore('v2')" type =" text" > v2 </Button >
110+ <Button @click =" downloadCore('v3')" type =" text" > v3(default) </Button >
111+ </div >
112+ </template >
113+ </Dropdown >
114+
111115 <Button
112116 v-show =" !localVersionLoading && !remoteVersionLoading && restartable"
113117 @click =" restartCore"
You can’t perform that action at this time.
0 commit comments