mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 17:16:29 +08:00
fix check reply
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -10,8 +10,8 @@ import 'package:PiliPlus/utils/storage.dart';
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
class ReplyHttp {
|
class ReplyHttp {
|
||||||
static Options get _options =>
|
static final Options _options =
|
||||||
Options(extra: {'account': AnonymousAccount()});
|
Options(extra: {'account': AnonymousAccount(), 'checkReply': true});
|
||||||
|
|
||||||
static RegExp replyRegExp =
|
static RegExp replyRegExp =
|
||||||
RegExp(GStorage.banWordForReply, caseSensitive: false);
|
RegExp(GStorage.banWordForReply, caseSensitive: false);
|
||||||
|
|||||||
@@ -126,6 +126,11 @@ class AccountManager extends Interceptor {
|
|||||||
}
|
}
|
||||||
return handler.next(options);
|
return handler.next(options);
|
||||||
} else {
|
} else {
|
||||||
|
if (account is AnonymousAccount && options.extra['checkReply'] == true) {
|
||||||
|
options.headers[HttpHeaders.cookieHeader] = '';
|
||||||
|
handler.next(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
account.cookieJar.loadForRequest(options.uri).then((cookies) {
|
account.cookieJar.loadForRequest(options.uri).then((cookies) {
|
||||||
final previousCookies =
|
final previousCookies =
|
||||||
options.headers[HttpHeaders.cookieHeader] as String?;
|
options.headers[HttpHeaders.cookieHeader] as String?;
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ class ReplyUtils {
|
|||||||
_checkReply(
|
_checkReply(
|
||||||
context: context,
|
context: context,
|
||||||
oid: replyInfo.oid.toInt(),
|
oid: replyInfo.oid.toInt(),
|
||||||
rpid: replyInfo.hasRoot() ? replyInfo.root.toInt() : null,
|
type: replyInfo.type.toInt(),
|
||||||
replyType: replyInfo.type.toInt(),
|
id: replyInfo.id.toInt(),
|
||||||
replyId: replyInfo.id.toInt(),
|
|
||||||
message: replyInfo.content.message,
|
message: replyInfo.content.message,
|
||||||
//
|
//
|
||||||
root: replyInfo.root.toInt(),
|
root: replyInfo.root.toInt(),
|
||||||
@@ -52,9 +51,8 @@ class ReplyUtils {
|
|||||||
static Future<void> _checkReply({
|
static Future<void> _checkReply({
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
required int oid,
|
required int oid,
|
||||||
required int? rpid,
|
required int type,
|
||||||
required int replyType,
|
required int id,
|
||||||
required int replyId,
|
|
||||||
required String message,
|
required String message,
|
||||||
dynamic root,
|
dynamic root,
|
||||||
dynamic parent,
|
dynamic parent,
|
||||||
@@ -78,8 +76,8 @@ class ReplyUtils {
|
|||||||
{
|
{
|
||||||
'action': 0,
|
'action': 0,
|
||||||
'oid': oid,
|
'oid': oid,
|
||||||
'type': replyType,
|
'type': type,
|
||||||
'rpid': replyId,
|
'rpid': id,
|
||||||
'root': root,
|
'root': root,
|
||||||
'parent': parent,
|
'parent': parent,
|
||||||
'ctime': ctime,
|
'ctime': ctime,
|
||||||
@@ -114,13 +112,13 @@ class ReplyUtils {
|
|||||||
|
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
// root reply
|
// root reply
|
||||||
if (rpid == null || rpid == 0) {
|
if (root == 0) {
|
||||||
// no cookie check
|
// no cookie check
|
||||||
var res = await ReplyHttp.replyList(
|
var res = await ReplyHttp.replyList(
|
||||||
isLogin: false,
|
isLogin: false,
|
||||||
oid: oid,
|
oid: oid,
|
||||||
nextOffset: '',
|
nextOffset: '',
|
||||||
type: replyType,
|
type: type,
|
||||||
sort: ReplySortType.time.index,
|
sort: ReplySortType.time.index,
|
||||||
page: 1,
|
page: 1,
|
||||||
enableFilter: false,
|
enableFilter: false,
|
||||||
@@ -133,7 +131,7 @@ class ReplyUtils {
|
|||||||
} else if (res.isSuccess) {
|
} else if (res.isSuccess) {
|
||||||
ReplyData replies = res.data;
|
ReplyData replies = res.data;
|
||||||
int index =
|
int index =
|
||||||
replies.replies?.indexWhere((item) => item.rpid == replyId) ?? -1;
|
replies.replies?.indexWhere((item) => item.rpid == id) ?? -1;
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
// found
|
// found
|
||||||
showReplyCheckResult('无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message');
|
showReplyCheckResult('无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message');
|
||||||
@@ -144,9 +142,9 @@ class ReplyUtils {
|
|||||||
final res1 = await ReplyHttp.replyReplyList(
|
final res1 = await ReplyHttp.replyReplyList(
|
||||||
isLogin: true,
|
isLogin: true,
|
||||||
oid: oid,
|
oid: oid,
|
||||||
root: rpid ?? replyId,
|
root: id,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
type: replyType,
|
type: type,
|
||||||
filterBanWord: false,
|
filterBanWord: false,
|
||||||
antiGoodsReply: false,
|
antiGoodsReply: false,
|
||||||
);
|
);
|
||||||
@@ -161,9 +159,9 @@ class ReplyUtils {
|
|||||||
final res2 = await ReplyHttp.replyReplyList(
|
final res2 = await ReplyHttp.replyReplyList(
|
||||||
isLogin: false,
|
isLogin: false,
|
||||||
oid: oid,
|
oid: oid,
|
||||||
root: rpid ?? replyId,
|
root: id,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
type: replyType,
|
type: type,
|
||||||
filterBanWord: false,
|
filterBanWord: false,
|
||||||
isCheck: true,
|
isCheck: true,
|
||||||
antiGoodsReply: false,
|
antiGoodsReply: false,
|
||||||
@@ -182,7 +180,7 @@ class ReplyUtils {
|
|||||||
? '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message'
|
? '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message'
|
||||||
: '''
|
: '''
|
||||||
你评论状态有点可疑,虽然无账号翻找评论区获取不到你的评论,但是无账号可通过
|
你评论状态有点可疑,虽然无账号翻找评论区获取不到你的评论,但是无账号可通过
|
||||||
https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? replyId}&type=$replyType
|
https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=$id&type=$type
|
||||||
获取你的评论,疑似评论区被戒严或者这是你的视频。
|
获取你的评论,疑似评论区被戒严或者这是你的视频。
|
||||||
|
|
||||||
你的评论:$message''');
|
你的评论:$message''');
|
||||||
@@ -196,9 +194,9 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep
|
|||||||
final res3 = await ReplyHttp.replyReplyList(
|
final res3 = await ReplyHttp.replyReplyList(
|
||||||
isLogin: false,
|
isLogin: false,
|
||||||
oid: oid,
|
oid: oid,
|
||||||
root: rpid,
|
root: root,
|
||||||
pageNum: i,
|
pageNum: i,
|
||||||
type: replyType,
|
type: type,
|
||||||
filterBanWord: false,
|
filterBanWord: false,
|
||||||
isCheck: true,
|
isCheck: true,
|
||||||
antiGoodsReply: false,
|
antiGoodsReply: false,
|
||||||
@@ -210,8 +208,7 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep
|
|||||||
if (data.replies.isNullOrEmpty) {
|
if (data.replies.isNullOrEmpty) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int index =
|
int index = data.replies?.indexWhere((item) => item.rpid == id) ?? -1;
|
||||||
data.replies?.indexWhere((item) => item.rpid == replyId) ?? -1;
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
// not found
|
// not found
|
||||||
} else {
|
} else {
|
||||||
@@ -227,9 +224,9 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep
|
|||||||
final res4 = await ReplyHttp.replyReplyList(
|
final res4 = await ReplyHttp.replyReplyList(
|
||||||
isLogin: true,
|
isLogin: true,
|
||||||
oid: oid,
|
oid: oid,
|
||||||
root: rpid,
|
root: root,
|
||||||
pageNum: i,
|
pageNum: i,
|
||||||
type: replyType,
|
type: type,
|
||||||
filterBanWord: false,
|
filterBanWord: false,
|
||||||
isCheck: true,
|
isCheck: true,
|
||||||
antiGoodsReply: false,
|
antiGoodsReply: false,
|
||||||
@@ -241,8 +238,7 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep
|
|||||||
if (data.replies.isNullOrEmpty) {
|
if (data.replies.isNullOrEmpty) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int index =
|
int index = data.replies?.indexWhere((item) => item.rpid == id) ?? -1;
|
||||||
data.replies?.indexWhere((item) => item.rpid == replyId) ?? -1;
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
// not found
|
// not found
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user