@@ -11,15 +11,13 @@ export default defineComponent({
1111 setup ( ) {
1212 const showDone = ref ( false ) ;
1313 const { t } = useI18n ( ) ;
14- const installType = ref < 'builtin' | ' slow' | 'ci' | 'mumod' > ( 'slow' ) ;
14+ const installType = ref < 'slow' | 'ci' | 'mumod' > ( 'slow' ) ;
1515
1616 const { isLoading : installing , execute : doInstallAsync } = useAsyncState (
1717 async ( ) => {
1818 const type = installType . value ;
1919 if ( type === 'mumod' ) {
2020 await api . InstallMuMod ( ) ;
21- } else if ( type === 'builtin' ) {
22- await api . InstallAquaMai ( ) ;
2321 } else {
2422 const version = modUpdateInfo . value ?. find ( it => it . type === type ) ;
2523 if ( ! version ) throw new Error ( t ( 'mod.versionNotFound' ) ) ;
@@ -39,7 +37,7 @@ export default defineComponent({
3937 }
4038 ) ;
4139
42- const doInstall = ( type : 'builtin' | ' slow' | 'ci' | 'mumod' ) => {
40+ const doInstall = ( type : 'slow' | 'ci' | 'mumod' ) => {
4341 installType . value = type ;
4442 doInstallAsync ( 0 ) ;
4543 } ;
@@ -52,31 +50,32 @@ export default defineComponent({
5250 } ;
5351
5452 const installChannel = ( type : 'slow' | 'ci' ) => {
55- const hasOnlineVersion = modUpdateInfo . value ?. find ( it => it . type === type && it . url ) ;
56- if ( hasOnlineVersion ) {
57- doInstall ( type ) ;
58- } else {
59- doInstall ( 'builtin' ) ;
60- }
53+ doInstall ( type ) ;
6154 } ;
6255
63- const options = computed ( ( ) => [
64- {
65- label : t ( 'mod.stableChannel' ) ,
66- desc : formatVersionDesc ( 'slow' ) ,
67- action : ( ) => installChannel ( 'slow' ) ,
68- } ,
69- {
70- label : t ( 'mod.fastChannel' ) ,
71- desc : formatVersionDesc ( 'ci' ) ,
72- action : ( ) => installChannel ( 'ci' ) ,
73- } ,
74- {
56+ const options = computed ( ( ) => {
57+ const result = [ ] ;
58+ if ( modUpdateInfo . value ?. find ( it => it . type === 'slow' && it . url ) ) {
59+ result . push ( {
60+ label : t ( 'mod.stableChannel' ) ,
61+ desc : formatVersionDesc ( 'slow' ) ,
62+ action : ( ) => installChannel ( 'slow' ) ,
63+ } ) ;
64+ }
65+ if ( modUpdateInfo . value ?. find ( it => it . type === 'ci' && it . url ) ) {
66+ result . push ( {
67+ label : t ( 'mod.fastChannel' ) ,
68+ desc : formatVersionDesc ( 'ci' ) ,
69+ action : ( ) => installChannel ( 'ci' ) ,
70+ } ) ;
71+ }
72+ result . push ( {
7573 label : 'MuMod' ,
7674 desc : t ( 'mod.mumodDesc' ) ,
7775 action : ( ) => doInstall ( 'mumod' ) ,
78- } ,
79- ] ) ;
76+ } ) ;
77+ return result ;
78+ } ) ;
8079
8180 return ( ) => (
8281 < DropMenu options = { options . value } >
0 commit comments