|
|
@@ -707,12 +707,52 @@ async function getLoginScanJumpUrl(url){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+async function getAppConf(){
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let body = `version=2.0&appKey=cloud`;
|
|
|
+ let headers = {
|
|
|
+ "Accept": "*/*",
|
|
|
+ "Accept-Encoding": "gzip, deflate, br",
|
|
|
+ "Accept-Language": "zh-cn",
|
|
|
+ "Connection": "keep-alive",
|
|
|
+ "Content-Type": "application/x-www-form-urlencoded",
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
|
|
|
+ };
|
|
|
+ // headers.reqId = reqId;
|
|
|
+ // headers.lt = lt;
|
|
|
+ // headers.referer = toUrl;
|
|
|
+ let options = {
|
|
|
+ url: 'https://open.e.189.cn/api/logbox/oauth2/appConf.do',
|
|
|
+ headers: headers,
|
|
|
+ body: body
|
|
|
+ }
|
|
|
+ magicJS.http.post(options).then(resp => {
|
|
|
+ const htmlText = resp.body;
|
|
|
+ try {
|
|
|
+ magicJS.logger.info(`页面数据:${htmlText}`);
|
|
|
+ magicJS.logger.info(`响应头部:${JSON.stringify(resp.headers)}`);
|
|
|
+ let urlMatch = htmlText.match(/https?:\/\/[^\s'"]+/); // 正则表达式匹配
|
|
|
+ if(urlMatch){
|
|
|
+ resolve(urlMatch[0]);
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ resolve();
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ const msg = `获取页面数据异常\n${JSON.stringify(err)}`;
|
|
|
+ magicJS.logger.error(msg);
|
|
|
+ reject(msg);
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
async function scanLogin(){
|
|
|
let sInitUrl = 'https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html?returnURL=%2Fmain.action';
|
|
|
let jumpUrl = await getLoginScanUrl(sInitUrl);
|
|
|
if(jumpUrl){
|
|
|
await getLoginScanJumpUrl(jumpUrl);
|
|
|
}
|
|
|
+ await getAppConf();
|
|
|
return null;
|
|
|
}
|
|
|
|