opt: get blockserver

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-30 20:52:43 +08:00
parent 9e50a195a4
commit 5940c4f032
4 changed files with 26 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ class LiveHttp {
'origin': 'https://live.bilibili.com',
'referer': 'https://live.bilibili.com/',
'user-agent': Request.headerUa(type: 'pc'),
if (gaiaVtoken == null) 'cookie': 'x-bili-gaia-vtoken=$gaiaVtoken'
if (gaiaVtoken != null) 'cookie': 'x-bili-gaia-vtoken=$gaiaVtoken'
},
),
);

View File

@@ -460,6 +460,7 @@ class VideoDetailController extends GetxController
Color _getColor(SegmentType segment) =>
_blockColor?[segment.index] ?? segment.color;
late RxString videoLabel = ''.obs;
late final blockServer = GStorage.blockServer;
Timer? skipTimer;
late final listKey = GlobalKey<AnimatedListState>();
@@ -467,7 +468,7 @@ class VideoDetailController extends GetxController
Future _vote(String uuid, int type) async {
Request().post(
'${GStorage.blockServer}/api/voteOnSponsorTime',
'$blockServer/api/voteOnSponsorTime',
queryParameters: {
'UUID': uuid,
'userID': GStorage.blockUserID,
@@ -493,7 +494,7 @@ class VideoDetailController extends GetxController
onTap: () {
Get.back();
Request().post(
'${GStorage.blockServer}/api/voteOnSponsorTime',
'$blockServer/api/voteOnSponsorTime',
queryParameters: {
'UUID': segment.UUID,
'userID': GStorage.blockUserID,
@@ -693,7 +694,7 @@ class VideoDetailController extends GetxController
segmentList.clear();
segmentProgressList = null;
final result = await Request().get(
'${GStorage.blockServer}/api/skipSegments',
'$blockServer/api/skipSegments',
queryParameters: {
'videoID': bvid,
'cid': cid.value,
@@ -936,7 +937,7 @@ class VideoDetailController extends GetxController
}
if (GStorage.blockTrack) {
Request().post(
'${GStorage.blockServer}/api/viewedVideoSponsorTime',
'$blockServer/api/viewedVideoSponsorTime',
queryParameters: {'UUID': item.UUID},
);
}

View File

@@ -535,9 +535,10 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
];
}
Future _onPost({String? url}) {
return Request().post(
url ?? '${GStorage.blockServer}/api/skipSegments',
void _onPost() {
Request()
.post(
'${widget.videoDetailController.blockServer}/api/skipSegments',
data: {
'videoID': videoDetailController.bvid,
'cid': videoDetailController.cid.value.toString(),
@@ -557,7 +558,14 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
)
.toList(),
},
options: Options(followRedirects: true),
options: Options(
followRedirects: true, // Defaults to true.
validateStatus: (int? status) {
return (status! >= 200 && status < 300) ||
const [400, 403, 429, 409] // reduce extra toast
.contains(status);
},
),
)
.then(
(res) {

View File

@@ -491,11 +491,14 @@ class RequestUtils {
token: captchaData.token,
validate: captchaData.validate,
);
if (res['status'] && res['data']?['is_valid'] == 1) {
// onSuccess(captchaData.token!);
final griskId = res['data']?['grisk_id'];
if (griskId != null) {
onSuccess(griskId);
if (res['status']) {
if (res['data']?['is_valid'] == 1) {
final griskId = res['data']?['grisk_id'];
if (griskId != null) {
onSuccess(griskId);
}
} else {
SmartDialog.showToast('invalid');
}
} else {
SmartDialog.showToast(res['msg']);