mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -1,4 +1,3 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
@@ -405,15 +404,25 @@ class MemberHttp {
|
|||||||
'timezone_offset': '-480',
|
'timezone_offset': '-480',
|
||||||
'features': 'itemOpusStyle,listOnlyfans',
|
'features': 'itemOpusStyle,listOnlyfans',
|
||||||
'platform': 'web',
|
'platform': 'web',
|
||||||
'web_location': '333.999',
|
'web_location': '333.1387',
|
||||||
'dm_img_list': '[]',
|
'dm_img_list': '[]',
|
||||||
'dm_img_str': dmImgStr,
|
'dm_img_str': dmImgStr,
|
||||||
'dm_cover_img_str': dmCoverImgStr,
|
'dm_cover_img_str': dmCoverImgStr,
|
||||||
'dm_img_inter': '{"ds":[],"wh":[0,0,0],"of":[0,0,0]}',
|
'dm_img_inter': '{"ds":[],"wh":[0,0,0],"of":[0,0,0]}',
|
||||||
'x-bili-device-req-json': jsonEncode({"platform": "web", "device": "pc"}),
|
'x-bili-device-req-json':
|
||||||
'x-bili-web-req-json': jsonEncode({"spm_id": "333.999"}),
|
'{"platform":"web","device":"pc","spmid":"333.1387"}',
|
||||||
});
|
});
|
||||||
var res = await Request().get(Api.memberDynamic, queryParameters: params);
|
var res = await Request().get(
|
||||||
|
Api.memberDynamic,
|
||||||
|
queryParameters: params,
|
||||||
|
options: Options(
|
||||||
|
headers: {
|
||||||
|
'user-agent': UaType.pc.ua,
|
||||||
|
'origin': 'https://space.bilibili.com',
|
||||||
|
'referer': 'https://space.bilibili.com/$mid/dynamic',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
try {
|
try {
|
||||||
DynamicsDataModel data = DynamicsDataModel.fromJson(res.data['data']);
|
DynamicsDataModel data = DynamicsDataModel.fromJson(res.data['data']);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
|||||||
import 'package:PiliPlus/models_new/search/search_rcmd/data.dart';
|
import 'package:PiliPlus/models_new/search/search_rcmd/data.dart';
|
||||||
import 'package:PiliPlus/models_new/search/search_trending/data.dart';
|
import 'package:PiliPlus/models_new/search/search_trending/data.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
|
import 'package:PiliPlus/utils/request_utils.dart';
|
||||||
import 'package:PiliPlus/utils/wbi_sign.dart';
|
import 'package:PiliPlus/utils/wbi_sign.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -56,6 +57,8 @@ class SearchHttp {
|
|||||||
int? pubBegin,
|
int? pubBegin,
|
||||||
int? pubEnd,
|
int? pubEnd,
|
||||||
required String qvId,
|
required String qvId,
|
||||||
|
String? gaiaVtoken,
|
||||||
|
required ValueChanged<String> onSuccess,
|
||||||
}) async {
|
}) async {
|
||||||
var params = await WbiSign.makSign({
|
var params = await WbiSign.makSign({
|
||||||
'search_type': searchType.name,
|
'search_type': searchType.name,
|
||||||
@@ -78,15 +81,16 @@ class SearchHttp {
|
|||||||
'from_spmid': 333.337,
|
'from_spmid': 333.337,
|
||||||
'platform': 'pc',
|
'platform': 'pc',
|
||||||
'source_tag': 3,
|
'source_tag': 3,
|
||||||
'gaia_vtoken': '',
|
|
||||||
'qv_id': qvId,
|
'qv_id': qvId,
|
||||||
'web_location': 1430654,
|
'web_location': 1430654,
|
||||||
|
'gaia_vtoken': ?gaiaVtoken,
|
||||||
});
|
});
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.searchByType,
|
Api.searchByType,
|
||||||
queryParameters: params,
|
queryParameters: params,
|
||||||
options: Options(
|
options: Options(
|
||||||
headers: {
|
headers: {
|
||||||
|
if (gaiaVtoken != null) 'cookie': 'x-bili-gaia-vtoken=$gaiaVtoken',
|
||||||
'user-agent': UaType.pc.ua,
|
'user-agent': UaType.pc.ua,
|
||||||
'origin': 'https://search.bilibili.com',
|
'origin': 'https://search.bilibili.com',
|
||||||
'referer':
|
'referer':
|
||||||
@@ -98,7 +102,9 @@ class SearchHttp {
|
|||||||
if (resData is Map) {
|
if (resData is Map) {
|
||||||
if (resData['code'] == 0) {
|
if (resData['code'] == 0) {
|
||||||
final Map<String, dynamic> dataData = resData['data'];
|
final Map<String, dynamic> dataData = resData['data'];
|
||||||
if (dataData.containsKey('v_voucher')) {
|
final vVoucher = dataData['v_voucher'];
|
||||||
|
if (vVoucher != null) {
|
||||||
|
RequestUtils.validate(vVoucher, onSuccess);
|
||||||
return const Error('触发风控');
|
return const Error('触发风控');
|
||||||
}
|
}
|
||||||
dynamic data;
|
dynamic data;
|
||||||
|
|||||||
@@ -71,12 +71,22 @@ class SearchPanelController<R extends SearchNumData<T>, T>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<T>? getDataList(R response) {
|
List<T>? getDataList(R response) {
|
||||||
searchResultController?.count[searchType.index] = response.numResults ?? 0;
|
|
||||||
return response.list;
|
return response.list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool customHandleResponse(bool isRefresh, Success<R> response) {
|
||||||
|
if (isRefresh) {
|
||||||
|
searchResultController?.count[searchType.index] =
|
||||||
|
response.response.numResults ?? 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final qvId = Utils.generateRandomString(32);
|
final qvId = Utils.generateRandomString(32);
|
||||||
|
|
||||||
|
String? gaiaVtoken;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<LoadingState<R>> customGetData() => SearchHttp.searchByType<R>(
|
Future<LoadingState<R>> customGetData() => SearchHttp.searchByType<R>(
|
||||||
searchType: searchType,
|
searchType: searchType,
|
||||||
@@ -91,6 +101,11 @@ class SearchPanelController<R extends SearchNumData<T>, T>
|
|||||||
pubBegin: pubBegin,
|
pubBegin: pubBegin,
|
||||||
pubEnd: pubEnd,
|
pubEnd: pubEnd,
|
||||||
qvId: qvId,
|
qvId: qvId,
|
||||||
|
gaiaVtoken: gaiaVtoken,
|
||||||
|
onSuccess: (String gaiaVtoken) {
|
||||||
|
this.gaiaVtoken = gaiaVtoken;
|
||||||
|
queryData(page == 1);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import 'package:PiliPlus/pages/common/multi_select/multi_select_controller.dart'
|
|||||||
import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
|
import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
|
||||||
import 'package:PiliPlus/pages/group_panel/view.dart';
|
import 'package:PiliPlus/pages/group_panel/view.dart';
|
||||||
import 'package:PiliPlus/pages/later/controller.dart';
|
import 'package:PiliPlus/pages/later/controller.dart';
|
||||||
|
import 'package:PiliPlus/pages/login/geetest/geetest_webview_dialog.dart';
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
import 'package:PiliPlus/utils/context_ext.dart';
|
import 'package:PiliPlus/utils/context_ext.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
@@ -484,26 +485,32 @@ abstract class RequestUtils {
|
|||||||
String vVoucher,
|
String vVoucher,
|
||||||
ValueChanged<String> onSuccess,
|
ValueChanged<String> onSuccess,
|
||||||
) async {
|
) async {
|
||||||
|
if (Platform.isLinux) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final res = await ValidateHttp.gaiaVgateRegister(vVoucher);
|
final res = await ValidateHttp.gaiaVgateRegister(vVoucher);
|
||||||
if (!res['status']) {
|
if (!res['status']) {
|
||||||
SmartDialog.showToast("${res['msg']}");
|
SmartDialog.showToast("${res['msg']}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res['data'] == null) {
|
final resData = res['data'];
|
||||||
|
if (resData == null) {
|
||||||
SmartDialog.showToast("null data");
|
SmartDialog.showToast("null data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CaptchaDataModel captchaData = CaptchaDataModel();
|
CaptchaDataModel captchaData = CaptchaDataModel();
|
||||||
|
|
||||||
String? geeGt = res['data']?['geetest']?['gt'];
|
final geetest = resData?['geetest'];
|
||||||
String? geeChallenge = res['data']?['geetest']?['challenge'];
|
String? gt = geetest?['gt'];
|
||||||
captchaData.token = res['data']?['token'];
|
String? challenge = geetest?['challenge'];
|
||||||
|
captchaData.token = resData?['token'];
|
||||||
|
|
||||||
bool isGeeArgumentValid() {
|
bool isGeeArgumentValid() {
|
||||||
return geeGt?.isNotEmpty == true &&
|
return gt?.isNotEmpty == true &&
|
||||||
geeChallenge?.isNotEmpty == true &&
|
challenge?.isNotEmpty == true &&
|
||||||
captchaData.token?.isNotEmpty == true;
|
captchaData.token?.isNotEmpty == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,29 +519,9 @@ abstract class RequestUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var registerData = Gt3RegisterData(
|
Future<void> gaiaVgateValidate() async {
|
||||||
challenge: geeChallenge,
|
|
||||||
gt: geeGt,
|
|
||||||
success: true,
|
|
||||||
);
|
|
||||||
|
|
||||||
Gt3FlutterPlugin()
|
|
||||||
..addEventHandler(
|
|
||||||
onClose: (Map<String, dynamic> message) {
|
|
||||||
SmartDialog.showToast('关闭验证');
|
|
||||||
},
|
|
||||||
onResult: (Map<String, dynamic> message) async {
|
|
||||||
if (kDebugMode) debugPrint("Captcha result: $message");
|
|
||||||
String code = message["code"];
|
|
||||||
if (code == "1") {
|
|
||||||
// 发送 message["result"] 中的数据向 B 端的业务服务接口进行查询
|
|
||||||
SmartDialog.showToast('验证成功');
|
|
||||||
captchaData
|
|
||||||
..validate = message['result']?['geetest_validate']
|
|
||||||
..seccode = message['result']?['geetest_seccode'];
|
|
||||||
String? challenge = message['result']?['geetest_challenge'];
|
|
||||||
final res = await ValidateHttp.gaiaVgateValidate(
|
final res = await ValidateHttp.gaiaVgateValidate(
|
||||||
challenge: challenge,
|
challenge: captchaData.geetest?.challenge,
|
||||||
seccode: captchaData.seccode,
|
seccode: captchaData.seccode,
|
||||||
token: captchaData.token,
|
token: captchaData.token,
|
||||||
validate: captchaData.validate,
|
validate: captchaData.validate,
|
||||||
@@ -551,6 +538,51 @@ abstract class RequestUtils {
|
|||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utils.isDesktop) {
|
||||||
|
final json = await Get.dialog<Map<String, dynamic>>(
|
||||||
|
GeetestWebviewDialog(gt!, challenge!),
|
||||||
|
);
|
||||||
|
if (json != null) {
|
||||||
|
captchaData
|
||||||
|
..validate = json['geetest_validate']
|
||||||
|
..seccode = json['geetest_seccode']
|
||||||
|
..geetest = GeetestData(
|
||||||
|
challenge: json['geetest_challenge'],
|
||||||
|
gt: gt,
|
||||||
|
);
|
||||||
|
gaiaVgateValidate();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var registerData = Gt3RegisterData(
|
||||||
|
challenge: challenge,
|
||||||
|
gt: gt,
|
||||||
|
success: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
Gt3FlutterPlugin()
|
||||||
|
..addEventHandler(
|
||||||
|
onClose: (Map<String, dynamic> message) {
|
||||||
|
SmartDialog.showToast('关闭验证');
|
||||||
|
},
|
||||||
|
onResult: (Map<String, dynamic> message) async {
|
||||||
|
if (kDebugMode) debugPrint("Captcha result: $message");
|
||||||
|
String code = message["code"];
|
||||||
|
if (code == "1") {
|
||||||
|
// 发送 message["result"] 中的数据向 B 端的业务服务接口进行查询
|
||||||
|
SmartDialog.showToast('验证成功');
|
||||||
|
final result = message['result'];
|
||||||
|
captchaData
|
||||||
|
..validate = result?['geetest_validate']
|
||||||
|
..seccode = result?['geetest_seccode']
|
||||||
|
..geetest = GeetestData(
|
||||||
|
challenge: result?['geetest_challenge'],
|
||||||
|
gt: gt!,
|
||||||
|
);
|
||||||
|
gaiaVgateValidate();
|
||||||
} else {
|
} else {
|
||||||
// 终端用户完成验证失败,自动重试 If the verification fails, it will be automatically retried.
|
// 终端用户完成验证失败,自动重试 If the verification fails, it will be automatically retried.
|
||||||
if (kDebugMode) debugPrint("Captcha result code : $code");
|
if (kDebugMode) debugPrint("Captcha result code : $code");
|
||||||
|
|||||||
Reference in New Issue
Block a user