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

View File

@@ -535,9 +535,10 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
]; ];
} }
Future _onPost({String? url}) { void _onPost() {
return Request().post( Request()
url ?? '${GStorage.blockServer}/api/skipSegments', .post(
'${widget.videoDetailController.blockServer}/api/skipSegments',
data: { data: {
'videoID': videoDetailController.bvid, 'videoID': videoDetailController.bvid,
'cid': videoDetailController.cid.value.toString(), 'cid': videoDetailController.cid.value.toString(),
@@ -557,7 +558,14 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
) )
.toList(), .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( .then(
(res) { (res) {

View File

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