@@ -131,28 +131,31 @@ export default function Description() {
131131 if ( ! resp ) {
132132 return ;
133133 }
134- let script :
135- | ( Script & { oldScript ?: Script } )
136- | ( Subscribe & { oldSubscribe ?: Subscribe } ) ;
134+ let prepare :
135+ | { script : Script ; oldScript ?: Script }
136+ | { subscribe : Subscribe ; oldSubscribe ?: Subscribe } ;
137+ let action : Script | Subscribe ;
137138 if ( resp . isSubscribe ) {
138139 setIsSub ( true ) ;
139- script = await prepareSubscribeByCode ( resp . code , resp . url ) ;
140- setOldScript ( script . oldSubscribe ) ;
141- delete script . oldSubscribe ;
140+ prepare = await prepareSubscribeByCode ( resp . code , resp . url ) ;
141+ action = prepare . subscribe ;
142+ setOldScript ( prepare . oldSubscribe ) ;
143+ delete prepare . oldSubscribe ;
142144 } else {
143145 if ( resp . isUpdate ) {
144- script = await prepareScriptByCode ( resp . code , resp . url , resp . uuid ) ;
146+ prepare = await prepareScriptByCode ( resp . code , resp . url , resp . uuid ) ;
145147 } else {
146- script = await prepareScriptByCode ( resp . code , resp . url ) ;
148+ prepare = await prepareScriptByCode ( resp . code , resp . url ) ;
147149 }
148- setOldScript ( script . oldScript ) ;
149- delete script . oldScript ;
150+ action = prepare . script ;
151+ setOldScript ( prepare . oldScript ) ;
152+ delete prepare . oldScript ;
150153 }
151- setEnable ( script . status === SUBSCRIBE_STATUS_ENABLE ) ;
154+ setEnable ( action . status === SUBSCRIBE_STATUS_ENABLE ) ;
152155 if ( resp . source === "system" ) {
153156 setCountdown ( 60 ) ;
154157 }
155- const meta = script . metadata ;
158+ const meta = action . metadata ;
156159 if ( ! meta ) {
157160 return ;
158161 }
@@ -177,8 +180,8 @@ export default function Description() {
177180 if ( meta . require ) {
178181 perm . push ( { label : t ( "script_requires" ) , value : meta . require } ) ;
179182 }
180- setUpsertScript ( script ) ;
181- if ( script . id !== 0 ) {
183+ setUpsertScript ( action ) ;
184+ if ( action . id !== 0 ) {
182185 setIsUpdate ( true ) ;
183186 }
184187 setPermission ( perm ) ;
@@ -224,7 +227,7 @@ export default function Description() {
224227 }
225228 // 修改网页显示title
226229 document . title = `${
227- script . id === 0 ? t ( "install_script" ) : t ( "update_script" )
230+ action . id === 0 ? t ( "install_script" ) : t ( "update_script" )
228231 } - ${ meta . name } - ScriptCat`;
229232 } ) ;
230233 } , [ ] ) ;
0 commit comments