fix heartbeat

Closes #929

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-04 12:08:04 +08:00
parent 3208661a52
commit d246462535
8 changed files with 28 additions and 16 deletions

View File

@@ -105,7 +105,7 @@ class UserHttp {
queryParameters: {
'switch': switchStatus,
'jsonp': 'jsonp',
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
);
return res;
@@ -127,7 +127,7 @@ class UserHttp {
Api.clearHistory,
queryParameters: {
'jsonp': 'jsonp',
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
);
return res;
@@ -210,7 +210,7 @@ class UserHttp {
data: {
'kid': kidList.join(','),
'jsonp': 'jsonp',
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,

View File

@@ -620,7 +620,7 @@ class VideoHttp {
await Request().post(
Api.roomEntryAction,
queryParameters: {
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
data: {
'room_id': roomId,
@@ -638,7 +638,7 @@ class VideoHttp {
queryParameters: {
'aid': ?aid,
'type': ?type,
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
);
}
@@ -665,7 +665,7 @@ class VideoHttp {
'type': videoType.type,
'sub_type': ?subType,
'played_time': progress,
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
);
}
@@ -681,7 +681,7 @@ class VideoHttp {
'desc': desc,
'oid': oid,
'upper_mid': upperMid,
'csrf': Accounts.main.csrf,
'csrf': Accounts.heartbeat.csrf,
},
);
}

View File

@@ -5,7 +5,6 @@ import 'package:PiliPlus/http/dynamics.dart';
import 'package:PiliPlus/http/fav.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/common/account_type.dart';
import 'package:PiliPlus/models/dynamics/article_content_model.dart'
show ArticleContentModel;
import 'package:PiliPlus/models/dynamics/result.dart';
@@ -165,7 +164,7 @@ class ArticleController extends CommonDynController<MainListReply> {
}
if (isLoaded.value) {
queryData();
if (Accounts.get(AccountType.heartbeat).isLogin && !Pref.historyPause) {
if (Accounts.heartbeat.isLogin && !Pref.historyPause) {
VideoHttp.historyReport(aid: commentId, type: 5);
}
}

View File

@@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/text_field/controller.dart';
import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/live.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/common/account_type.dart';
import 'package:PiliPlus/models/common/video/live_quality.dart';
import 'package:PiliPlus/models_new/live/live_dm_info/data.dart';
import 'package:PiliPlus/models_new/live/live_room_info_h5/data.dart';
@@ -63,7 +62,7 @@ class LiveRoomController extends GetxController {
super.onInit();
queryLiveUrl();
queryLiveInfoH5();
if (Accounts.get(AccountType.heartbeat).isLogin && !Pref.historyPause) {
if (Accounts.heartbeat.isLogin && !Pref.historyPause) {
VideoHttp.roomEntryAction(roomId: roomId);
}
}

View File

@@ -31,9 +31,7 @@ class MineController
Rx<ThemeType> themeType = ThemeType.system.obs;
static RxBool anonymity =
(Accounts.account.isNotEmpty &&
!Accounts.get(AccountType.heartbeat).isLogin)
.obs;
(Accounts.account.isNotEmpty && !Accounts.heartbeat.isLogin).obs;
ThemeType get nextThemeType =>
ThemeType.values[(themeType.value.index + 1) % ThemeType.values.length];

View File

@@ -478,7 +478,7 @@ class PlPlayerController {
// 添加一个私有构造函数
PlPlayerController._({bool isLive = false}) {
_isLive = isLive;
if (!Accounts.get(AccountType.heartbeat).isLogin || Pref.historyPause) {
if (!Accounts.heartbeat.isLogin || Pref.historyPause) {
enableHeart = false;
}

View File

@@ -15,6 +15,7 @@ class Accounts {
static late final Box<LoginAccount> account;
static final Map<AccountType, Account> accountMode = {};
static Account get main => accountMode[AccountType.main]!;
static Account get heartbeat => accountMode[AccountType.heartbeat]!;
// static set main(Account account) => set(AccountType.main, account);
static Future<void> init() async {

View File

@@ -24,9 +24,23 @@ class AccountManager extends Interceptor {
Api.videoIntro,
Api.replyList,
Api.replyReplyList,
// history
Api.heartBeat,
Api.ab2c,
Api.historyReport,
Api.roomEntryAction,
Api.historyList,
Api.pauseHistory,
Api.clearHistory,
Api.delHistory,
Api.searchHistory,
Api.historyStatus,
Api.mediaListHistory,
// progress
Api.pgcInfo,
Api.pugvInfo,
Api.ab2c,
Api.liveRoomInfo,
Api.liveRoomInfoH5,
Api.onlineTotal,
@@ -53,6 +67,7 @@ class AccountManager extends Interceptor {
Api.searchTrending,
Api.searchRecommend,
},
// progress
AccountType.video: {
Api.ugcUrl,
Api.pgcUrl,