File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ export default class CASAuth {
263263 }
264264
265265 async loginHUBM ( ) {
266- const url = 'http ://hub.m.hust.edu.cn/hub_weix' ;
266+ const url = 'https ://hub.m.hust.edu.cn/hub_weix' ;
267267 const isLogin = await this . checkLoginStatus ( ) ;
268268
269269 if ( ! isLogin ) {
@@ -328,6 +328,7 @@ export default class CASAuth {
328328 return false ;
329329 }
330330 }
331+
331332 async loginPhysics ( ) {
332333 const url = 'http://empxk.hust.edu.cn/' ;
333334 const isLogin = await this . checkLoginStatus ( ) ;
@@ -369,6 +370,28 @@ export default class CASAuth {
369370 }
370371 }
371372
373+ async checkHUBM ( ) {
374+ const url = 'http://hub.m.hust.edu.cn/hub_weix/' ;
375+
376+ try {
377+ const response = await this . axios . get ( url ) ;
378+ return ! isNeedAuth ( response ) ;
379+ } catch ( e ) {
380+ return false ;
381+ }
382+ }
383+
384+ async checkMHUB ( ) {
385+ const url = 'https://mhub.hust.edu.cn/' ;
386+
387+ try {
388+ const response = await this . axios . get ( url ) ;
389+ return ! isNeedAuth ( response ) ;
390+ } catch ( e ) {
391+ return false ;
392+ }
393+ }
394+
372395 async checkONE ( ) {
373396 const url = 'https://one.hust.edu.cn/dcp/' ;
374397
Original file line number Diff line number Diff line change @@ -189,6 +189,13 @@ export default class HUST {
189189 switch ( client ) {
190190 case Client . news :
191191 return await this . auth . checkONE ( ) ;
192+ case Client . course :
193+ return ( await Promise . all ( [
194+ this . auth . checkPhysics ( ) ,
195+ this . auth . checkHUBM ( ) ,
196+ this . auth . checkMHUB ( ) ,
197+ this . auth . checkHUBS ( ) ,
198+ ] ) ) . every ( ( item ) => item ) ;
192199 default :
193200 throw new Error ( `Client ${ client } not supported` ) ;
194201 }
You can’t perform that action at this time.
0 commit comments