diff --git a/lib/http/user.dart b/lib/http/user.dart index 0ad890199..eaf8d658f 100644 --- a/lib/http/user.dart +++ b/lib/http/user.dart @@ -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, diff --git a/lib/http/video.dart b/lib/http/video.dart index bce29380b..926fe2bfb 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -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, }, ); } diff --git a/lib/pages/article/controller.dart b/lib/pages/article/controller.dart index 997dd8fde..f072e29f3 100644 --- a/lib/pages/article/controller.dart +++ b/lib/pages/article/controller.dart @@ -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 { } if (isLoaded.value) { queryData(); - if (Accounts.get(AccountType.heartbeat).isLogin && !Pref.historyPause) { + if (Accounts.heartbeat.isLogin && !Pref.historyPause) { VideoHttp.historyReport(aid: commentId, type: 5); } } diff --git a/lib/pages/live_room/controller.dart b/lib/pages/live_room/controller.dart index 2eba97336..243fed7f7 100644 --- a/lib/pages/live_room/controller.dart +++ b/lib/pages/live_room/controller.dart @@ -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); } } diff --git a/lib/pages/mine/controller.dart b/lib/pages/mine/controller.dart index fbdbb5342..c3b46614f 100644 --- a/lib/pages/mine/controller.dart +++ b/lib/pages/mine/controller.dart @@ -31,9 +31,7 @@ class MineController Rx 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]; diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 993d4493d..c2150aef4 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -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; } diff --git a/lib/utils/accounts.dart b/lib/utils/accounts.dart index 0e224baca..37199f4f1 100644 --- a/lib/utils/accounts.dart +++ b/lib/utils/accounts.dart @@ -15,6 +15,7 @@ class Accounts { static late final Box account; static final Map 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 init() async { diff --git a/lib/utils/accounts/account_manager/account_mgr.dart b/lib/utils/accounts/account_manager/account_mgr.dart index 2dd59c2bc..bab796acc 100644 --- a/lib/utils/accounts/account_manager/account_mgr.dart +++ b/lib/utils/accounts/account_manager/account_mgr.dart @@ -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,