File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,19 @@ import type { ICredential } from "./types";
44import { parse_cookie } from "./utils" ;
55
66async function get_csrf ( ) {
7- const cookies_raw = ( await fetch ( BASE_URL_CN , {
7+ const res = await fetch ( `${ BASE_URL_CN } /graphql/` , {
8+ method : "POST" ,
89 headers : {
10+ "content-type" : "application/json" ,
911 "user-agent" : USER_AGENT ,
1012 } ,
11- } ) . then ( ( res ) => res . headers . get ( "set-cookie" ) ) ) as string ;
13+ body : JSON . stringify ( {
14+ operationName : "nojGlobalData" ,
15+ variables : { } ,
16+ query : "query nojGlobalData {\n siteRegion\n chinaHost\n websocketUrl\n}\n" ,
17+ } ) ,
18+ } ) ;
19+ const cookies_raw = res . headers . get ( "set-cookie" ) as string ;
1220
1321 const csrf_token = parse_cookie ( cookies_raw ) . csrftoken ;
1422 return csrf_token ;
You can’t perform that action at this time.
0 commit comments