mod: login page: sync orz12/main

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-22 18:11:29 +08:00
parent 0ae2665c56
commit 0fde99dc68
5 changed files with 393 additions and 220 deletions

View File

@@ -587,6 +587,9 @@ class Api {
static const String safeCenterSmsVerify =
'${HttpString.passBaseUrl}/x/safecenter/login/tel/verify';
static const String oauth2AccessToken =
'${HttpString.passBaseUrl}/x/passport-login/oauth2/access_token';
/// 密码加密密钥
/// disable_rcmd
/// local_id

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:crypto/crypto.dart';
import 'package:dio/dio.dart';
import 'package:encrypt/encrypt.dart';
import 'package:flutter/material.dart';
import '../common/constants.dart';
import '../models/login/index.dart';
import '../utils/login.dart';
@@ -43,6 +42,7 @@ class LoginHttp {
);
var res = await Request()
.post(Api.getTVCode, queryParameters: {...params, 'sign': sign});
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -107,9 +107,10 @@ class LoginHttp {
int timestamp = DateTime.now().millisecondsSinceEpoch;
var data = {
'appkey': Constants.appKey,
'build': '1462100',
'build': '2001100',
'buvid': buvid,
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
'cid': cid,
// if (deviceTouristId != null) 'device_tourist_id': deviceTouristId,
'disable_rcmd': '0',
@@ -142,6 +143,7 @@ class LoginHttp {
headers: headers,
),
);
if (res.data['code'] == 0 && res.data['data']['recaptcha_url'] == "") {
return {'status': true, 'data': res.data['data']};
} else {
@@ -158,7 +160,7 @@ class LoginHttp {
// dynamic publicKey = RSAKeyParser().parse(key);
// var params = {
// 'appkey': Constants.appKey,
// 'build': '1462100',
// 'build': '2001100',
// 'buvid': buvid,
// 'c_locale': 'zh_CN',
// 'channel': 'yingyongbao',
@@ -185,7 +187,7 @@ class LoginHttp {
// contentType: Headers.formUrlEncodedContentType,
// headers: headers,
// ));
// debugPrint("getGuestId: $res");
// print("getGuestId: $res");
// if (res.data['code'] == 0) {
// return {'status': true, 'data': res.data['data']};
// } else {
@@ -211,7 +213,7 @@ class LoginHttp {
Map<String, String> data = {
'appkey': Constants.appKey,
'bili_local_id': deviceId,
'build': '1462100',
'build': '2001100',
'buvid': buvid,
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
@@ -247,7 +249,6 @@ class LoginHttp {
);
data['sign'] = sign;
data.map((key, value) {
debugPrint('$key: $value');
return MapEntry<String, dynamic>(key, value);
});
var res = await Request().post(
@@ -259,6 +260,7 @@ class LoginHttp {
//responseType: ResponseType.plain
),
);
if (res.data['code'] == 0) {
return {
'status': true,
@@ -287,7 +289,7 @@ class LoginHttp {
Map<String, String> data = {
'appkey': Constants.appKey,
'bili_local_id': deviceId,
'build': '1462100',
'build': '2001100',
'buvid': buvid,
'c_locale': 'zh_CN',
'captcha_key': captchaKey,
@@ -321,7 +323,6 @@ class LoginHttp {
);
data['sign'] = sign;
data.map((key, value) {
debugPrint('$key: $value');
return MapEntry<String, dynamic>(key, value);
});
var res = await Request().post(
@@ -333,6 +334,7 @@ class LoginHttp {
//responseType: ResponseType.plain
),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -349,9 +351,12 @@ class LoginHttp {
static Future safeCenterGetInfo({
required String tmpCode,
}) async {
var res = await Request().get(Api.safeCenterGetInfo, queryParameters: {
'tmp_code': tmpCode,
});
var res = await Request().get(
Api.safeCenterGetInfo,
queryParameters: {
'tmp_code': tmpCode,
},
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -364,9 +369,10 @@ class LoginHttp {
}
}
// 风控验证手机前的验证码
// 风控验证手机前的极验验证码
static Future preCapture() async {
var res = await Request().post(Api.preCapture);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -379,23 +385,40 @@ class LoginHttp {
}
}
// 风控验证手机
// 风控验证手机:发送短信验证码
static Future safeCenterSmsCode({
String? smsType,
required String tmpCode,
required String geeChallenge,
required String geeSeccode,
required String geeValidate,
required String recaptchaToken,
String? geeChallenge,
String? geeSeccode,
String? geeValidate,
String? recaptchaToken,
required String refererUrl,
}) async {
var res = await Request().post(Api.safeCenterSmsCode, data: {
Map<String, String> data = {
'disable_rcmd': '0',
'sms_type': smsType ?? 'loginTelCheck',
'tmp_code': tmpCode,
'gee_challenge': geeChallenge,
'gee_seccode': geeSeccode,
'gee_validate': geeValidate,
'recaptcha_token': recaptchaToken,
});
if (geeChallenge != null) 'gee_challenge': geeChallenge,
if (geeSeccode != null) 'gee_seccode': geeSeccode,
if (geeValidate != null) 'gee_validate': geeValidate,
if (recaptchaToken != null) 'recaptcha_token': recaptchaToken,
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
var res = await Request().post(
Api.safeCenterSmsCode,
data: data,
options:
Options(contentType: Headers.formUrlEncodedContentType, headers: {
"Referer": refererUrl,
}),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -408,21 +431,93 @@ class LoginHttp {
}
}
static Future safeCenterSmsVerify(
{String? type,
required String code,
required String tmpCode,
required String requestId,
required String source,
required String captchaKey}) async {
var res = await Request().post(Api.safeCenterSmsVerify, data: {
// 风控验证手机:提交短信验证码
static Future safeCenterSmsVerify({
String? type,
required String code,
required String tmpCode,
required String requestId,
required String source,
required String captchaKey,
required String refererUrl,
}) async {
Map<String, String> data = {
'type': type ?? 'loginTelCheck',
'code': code,
'tmp_code': tmpCode,
'request_id': requestId,
'source': source,
'captcha_key': captchaKey,
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
var res = await Request().post(
Api.safeCenterSmsVerify,
data: data,
options:
Options(contentType: Headers.formUrlEncodedContentType, headers: {
"Referer": refererUrl,
}),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {
'status': false,
'code': res.data['code'],
'msg': res.data['message'],
'data': res.data['data']
};
}
}
// 风控验证手机用oauthCode换回accessToken
static Future oauth2AccessToken({
required String code,
}) async {
Map<String, String> data = {
'appkey': Constants.appKey,
'build': '2001100',
'buvid': buvid,
// 'c_locale': 'zh_CN',
// 'channel': 'yingyongbao',
'code': code,
// 'device': 'phone',
// 'device_id': deviceId,
// 'device_name': 'vivo',
// 'device_platform': 'Android14vivo',
'disable_rcmd': '0',
'grant_type': 'authorization_code',
'local_id': buvid,
'mobi_app': 'android_hd',
'platform': 'android',
// 's_locale': 'zh_CN',
// 'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
data.map((key, value) {
return MapEntry<String, dynamic>(key, value);
});
var res = await Request().post(
Api.oauth2AccessToken,
data: data,
options: Options(
contentType: Headers.formUrlEncodedContentType,
headers: headers,
),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {