diff --git a/SrcJyAliPublic.js b/SrcJyAliPublic.js index 3eccc2e..fa1e003 100644 --- a/SrcJyAliPublic.js +++ b/SrcJyAliPublic.js @@ -377,40 +377,33 @@ function getOpenToken(authorization) { } variable = 1; } else { - let res = post("http://api.extscreen.com/aliyundrive/qrcode", { - body: JSON.stringify({ + let sid = JSON.parse(request("http://api.extscreen.com/aliyundrive/qrcode", { + body: { "scopes": 'user:base,file:all:read,file:all:write', "width": 500, "height": 500, - }), - }); - - let data = JSON.parse(res).data; - let sid = data["sid"]; - function get_qrcode_code(sid) { - let res = fetch("https://openapi.aliyundrive.com/oauth/qrcode/" + sid + "/status"); - return JSON.parse(res).authCode; - } - log(get_qrcode_code(sid)); + }, + method: 'POST', + timeout: 8000 + })).data.sid; - let json = JSON.parse(request('http://api.extscreen.com/aliyundrive/token', { - body: get_qrcode_code(sid), + let json = JSON.parse(request('https://open.aliyundrive.com/oauth/users/qrcode/authorize?sid=' + sid, { + headers: headers, + body: { + "authorize": 1, + "scope": "user:base,file:all:read,file:all:write" + }, method: 'POST', timeout: 8000 })); - - log(json); - return json; - //let code = json.redirectUri.split("code=")[1]; - //data = { "code": code, "grant_type": "authorization_code" } + if(json.result){ + let code = JSON.parse(request("https://openapi.aliyundrive.com/oauth/qrcode/" + sid + "/status")).authCode; + data = { "code": code, "grant_type": "authorization_code" } + } variable = 0; } let json2 = {}; - try { - json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data, method: 'POST', timeout: 8000 })); - } catch (e) { - json2 = JSON.parse(request('https://api-cf.nn.ci/alist/ali_open/code', { body: data, method: 'POST', timeout: 8000 })); - } + json2 = JSON.parse(request('http://api.extscreen.com/aliyundrive/token', { body: data, method: 'POST', timeout: 8000 })).data; json2.variable = variable; return json2; }