From 87bb00e9c55d582e4c7804fd9e6baecad80082ff Mon Sep 17 00:00:00 2001 From: dom Date: Sat, 9 May 2026 20:31:13 +0800 Subject: [PATCH] tweaks Signed-off-by: dom --- lib/http/init.dart | 83 ++++++++++++++--------------- lib/pages/about/view.dart | 2 +- lib/plugin/pl_player/view/view.dart | 13 ++--- lib/utils/accounts.dart | 17 +++--- 4 files changed, 54 insertions(+), 61 deletions(-) diff --git a/lib/http/init.dart b/lib/http/init.dart index e618dfdee..c556bccb3 100644 --- a/lib/http/init.dart +++ b/lib/http/init.dart @@ -2,18 +2,15 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/retry_interceptor.dart'; import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/utils/accounts.dart'; -import 'package:PiliPlus/utils/accounts/account.dart'; import 'package:PiliPlus/utils/accounts/account_manager/account_mgr.dart'; import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/login_utils.dart'; import 'package:PiliPlus/utils/storage_pref.dart'; -import 'package:PiliPlus/utils/utils.dart'; import 'package:archive/archive.dart'; import 'package:brotli/brotli.dart'; import 'package:dio/dio.dart'; @@ -57,46 +54,46 @@ class Request { } } - static Future buvidActive(Account account) async { - // 这样线程不安全, 但仍按预期进行 - if (account.activated) return; - account.activated = true; - try { - // final html = await Request().get(Api.dynamicSpmPrefix, - // options: Options(extra: {'account': account})); - // final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!; - final String randPngEnd = base64.encode([ - ...Iterable.generate(32, (_) => Utils.random.nextInt(256)), - 0, - 0, - 0, - 0, - 73, - 69, - 78, - 68, - ...Iterable.generate(4, (_) => Utils.random.nextInt(256)), - ]); - - final jsonData = json.encode({ - '3064': 1, - '39c8': '333.1387.fp.risk', - '3c43': { - 'adca': 'Linux', - 'bfe9': randPngEnd.substring(randPngEnd.length - 50), - }, - }); - - await Request().post( - Api.activateBuvidApi, - data: {'payload': jsonData}, - options: Options( - extra: {'account': account}, - contentType: Headers.jsonContentType, - ), - ); - } catch (_) {} - } + // static Future buvidActive(Account account) async { + // // 这样线程不安全, 但仍按预期进行 + // if (account.activated) return; + // account.activated = true; + // try { + // // final html = await Request().get(Api.dynamicSpmPrefix, + // // options: Options(extra: {'account': account})); + // // final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!; + // final String randPngEnd = base64.encode([ + // ...Iterable.generate(32, (_) => Utils.random.nextInt(256)), + // 0, + // 0, + // 0, + // 0, + // 73, + // 69, + // 78, + // 68, + // ...Iterable.generate(4, (_) => Utils.random.nextInt(256)), + // ]); + // + // final jsonData = json.encode({ + // '3064': 1, + // '39c8': '333.1387.fp.risk', + // '3c43': { + // 'adca': 'Linux', + // 'bfe9': randPngEnd.substring(randPngEnd.length - 50), + // }, + // }); + // + // await Request().post( + // Api.activateBuvidApi, + // data: {'payload': jsonData}, + // options: Options( + // extra: {'account': account}, + // contentType: Headers.jsonContentType, + // ), + // ); + // } catch (_) {} + // } static Dio _cloneHttp11Dio() { final h11 = dio.clone( diff --git a/lib/pages/about/view.dart b/lib/pages/about/view.dart index 81e750918..98e35784c 100644 --- a/lib/pages/about/view.dart +++ b/lib/pages/about/view.dart @@ -245,7 +245,7 @@ Commit Hash: ${BuildConfig.commitHash}''', (key, value) => MapEntry(key, LoginAccount.fromJson(value)), ); await Accounts.account.putAll(res); - await Accounts.refresh(); + Accounts.refresh(); MineController.anonymity.value = !Accounts.heartbeat.isLogin; if (Accounts.main.isLogin) { await LoginUtils.onLoginMain(); diff --git a/lib/plugin/pl_player/view/view.dart b/lib/plugin/pl_player/view/view.dart index 0778a410f..abd477dfc 100644 --- a/lib/plugin/pl_player/view/view.dart +++ b/lib/plugin/pl_player/view/view.dart @@ -1052,16 +1052,13 @@ class _PLVideoPlayerState extends State final controlsUnlock = !plPlayerController.controlsLock.value; if (PlatformUtils.isMobile) { - _tapGestureRecognizer.addPointer(event); - if (controlsUnlock) { - final flag = _isPositionAllowed(event.localPosition); - if (!plPlayerController.isLive) { - _doubleTapGestureRecognizer.addPointer(event); - if (flag) { + if (_isPositionAllowed(event.localPosition)) { + _tapGestureRecognizer.addPointer(event); + if (controlsUnlock) { + if (!plPlayerController.isLive) { + _doubleTapGestureRecognizer.addPointer(event); longPressRecognizer.addPointer(event); } - } - if (flag) { _scaleGestureRecognizer.addPointer(event); } } diff --git a/lib/utils/accounts.dart b/lib/utils/accounts.dart index a88f53149..1e6975be7 100644 --- a/lib/utils/accounts.dart +++ b/lib/utils/accounts.dart @@ -1,4 +1,3 @@ -import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/models/common/account_type.dart'; import 'package:PiliPlus/pages/mine/controller.dart'; import 'package:PiliPlus/utils/accounts/account.dart'; @@ -72,17 +71,17 @@ abstract final class Accounts { // } // } - static Future refresh() { + static void refresh() { for (final a in account.values) { for (final t in a.type) { accountMode[t.index] = a; } } - return Future.wait( - (accountMode.toSet()..removeWhere((i) => i.activated)).map( - Request.buvidActive, - ), - ); + // return Future.wait( + // (accountMode.toSet()..removeWhere((i) => i.activated)).map( + // Request.buvidActive, + // ), + // ); } static Future clear() async { @@ -91,7 +90,7 @@ abstract final class Accounts { accountMode[i] = AnonymousAccount(); } await AnonymousAccount().delete(); - Request.buvidActive(AnonymousAccount()); + // Request.buvidActive(AnonymousAccount()); } static Future deleteAll(Set accounts) async { @@ -111,7 +110,7 @@ abstract final class Accounts { final oldAccount = accountMode[key.index]..type.remove(key); accountMode[key.index] = account..type.add(key); await Future.wait([?account.onChange(), ?oldAccount.onChange()]); - if (!account.activated) await Request.buvidActive(account); + // if (!account.activated) await Request.buvidActive(account); switch (key) { case AccountType.main: await (account.isLogin