@@ -177,18 +177,17 @@ class HydroFetcher extends BasicFetcher {
177
177
}
178
178
const contest = body . tdoc ;
179
179
contest . freeze_time = contest . lockAt ;
180
- const old = this ?. contest ?. _id ;
180
+ const old = this ?. contest ?. id ;
181
181
this . contest = {
182
182
info : contest , id : contest . _id , name : contest . title , domainId,
183
183
} ;
184
- this . logger . info ( `Connected to ${ contest . name } (id=${ contest . id } )` ) ;
185
- return old = == this . contest . id ;
184
+ this . logger . info ( `Connected to ${ this . contest . name } (id=${ this . contest . id } )` ) ;
185
+ return old ! == this . contest . id ;
186
186
}
187
187
188
188
async getToken ( username , password ) {
189
- const res = await fetch ( '/login' , 'post' ) . send ( { uname : username , password, rememberme : 'on' } )
190
- . redirects ( 0 ) . ok ( ( i ) => i . status === 302 ) ;
191
- if ( ! res ) throw new Error ( 'Failed to get token' ) ;
189
+ const res = await fetch ( '/login' , 'post' ) . send ( { uname : username , password, rememberme : 'on' } ) . redirects ( 0 ) ;
190
+ if ( ! res || res . error ) throw new Error ( 'Failed to get token' ) ;
192
191
config . token = `Bearer ${ res . header [ 'set-cookie' ] [ 0 ] . split ( ';' ) [ 0 ] . split ( '=' ) [ 1 ] } ` ;
193
192
}
194
193
@@ -230,7 +229,7 @@ class HydroFetcher extends BasicFetcher {
230
229
contestproblem,
231
230
team : body . udict [ balloon . uid ] . displayName ,
232
231
teamid : balloon . uid ,
233
- location : body . udict [ balloon . uid ] . studentId ,
232
+ location : body . udict [ balloon . uid ] . uname ,
234
233
affiliation : body . udict [ balloon . uid ] . school ,
235
234
awards : balloon . first ? 'First of Problem' : (
236
235
this . contest . info . freeze_time && ( balloon . time * 1000 ) > this . contest . info . freeze_time
@@ -260,6 +259,6 @@ const fetcherList = {
260
259
} ;
261
260
262
261
export async function apply ( ctx : Context ) {
263
- if ( config . type !== 'server' ) ctx . logger ( 'fetcher' ) . info ( 'Fetch mode: ' , config . type ) ;
262
+ if ( config . type !== 'server' ) ctx . logger ( 'fetcher' ) . info ( 'Fetch mode:' , config . type ) ;
264
263
ctx . plugin ( fetcherList [ config . type ] ) ;
265
264
}
0 commit comments