|
|
|
@ -256,20 +256,35 @@ function aliOpenPlayUrl(file_id, sharedata) { |
|
|
|
|
function getOpenToken(authorization) { |
|
|
|
|
headers['authorization'] = authorization; |
|
|
|
|
headers['x-canary'] = "client=web,app=adrive,version=v4.3.1"; |
|
|
|
|
//log(headers);
|
|
|
|
|
let data = { "authorize": 1, "scope": "user:base,file:all:read,file:all:write" }; |
|
|
|
|
let json = JSON.parse(request('https://open.aliyundrive.com/oauth/users/authorize?client_id=76917ccccd4441c39457a04f6084fb2f&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=', { headers: headers, body: data, method: 'POST', timeout: 8000 })); |
|
|
|
|
let code = json.redirectUri.split("code=")[1]; |
|
|
|
|
let data2 = { "code": code, "grant_type": "authorization_code" } |
|
|
|
|
let data = {}; |
|
|
|
|
if (aliOpenTokenObj.refresh_token_1) { |
|
|
|
|
data = { |
|
|
|
|
grant_type: "refresh_token", |
|
|
|
|
refresh_token: aliOpenTokenObj.refresh_token_1, |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
let json = JSON.parse(request('https://open.aliyundrive.com/oauth/users/authorize?client_id=76917ccccd4441c39457a04f6084fb2f&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=', { |
|
|
|
|
headers: headers, |
|
|
|
|
body: { |
|
|
|
|
"authorize": 1, |
|
|
|
|
"scope": "user:base,file:all:read,file:all:write" |
|
|
|
|
}, |
|
|
|
|
method: 'POST', |
|
|
|
|
timeout: 8000
|
|
|
|
|
})); |
|
|
|
|
let code = json.redirectUri.split("code=")[1]; |
|
|
|
|
data = { "code": code, "grant_type": "authorization_code" } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let json2; |
|
|
|
|
//log(data2);
|
|
|
|
|
//json2 = JSON.parse(request('https://aliyundrive-oauth.messense.me/oauth/access_token', { body: data2, method: 'POST', timeout: 8000 }));
|
|
|
|
|
//json2 = JSON.parse(request('https://aliyundrive-oauth.messense.me/oauth/access_token', { body: data, method: 'POST', timeout: 8000 }));
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
json2 = JSON.parse(request('https://api-cf.nn.ci/alist/ali_open/code', { body: data2, method: 'POST', timeout: 8000 })); |
|
|
|
|
json2 = JSON.parse(request('https://api-cf.nn.ci/alist/ali_open/code', { body: data, method: 'POST', timeout: 8000 })); |
|
|
|
|
} catch (e) { |
|
|
|
|
json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data2, method: 'POST', timeout: 8000 })); |
|
|
|
|
json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data, method: 'POST', timeout: 8000 })); |
|
|
|
|
} |
|
|
|
|
log(json2); |
|
|
|
|
aliOpenTokenObj.refresh_token_1 = json2.refresh_token; |
|
|
|
|
aliconfig.opentoken = aliOpenTokenObj; |
|
|
|
|
writeFile(alicfgfile, JSON.stringify(aliconfig)); |
|
|
|
@ -308,7 +323,7 @@ function aliOpenPlayUrl(file_id, sharedata) { |
|
|
|
|
} |
|
|
|
|
return json.file_id; |
|
|
|
|
} catch (e) { |
|
|
|
|
log("原画copy转存异常>"+e.message); |
|
|
|
|
log("原画copy转存异常>" + e.message); |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|