Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-09 20:31:13 +08:00
parent 1705724bf3
commit 87bb00e9c5
4 changed files with 54 additions and 61 deletions

View File

@@ -2,18 +2,15 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:PiliPlus/http/api.dart';
import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/retry_interceptor.dart'; import 'package:PiliPlus/http/retry_interceptor.dart';
import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/http/user.dart';
import 'package:PiliPlus/utils/accounts.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/accounts/account_manager/account_mgr.dart';
import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/global_data.dart';
import 'package:PiliPlus/utils/login_utils.dart'; import 'package:PiliPlus/utils/login_utils.dart';
import 'package:PiliPlus/utils/storage_pref.dart'; import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:archive/archive.dart'; import 'package:archive/archive.dart';
import 'package:brotli/brotli.dart'; import 'package:brotli/brotli.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
@@ -57,46 +54,46 @@ class Request {
} }
} }
static Future<void> buvidActive(Account account) async { // static Future<void> buvidActive(Account account) async {
// 这样线程不安全, 但仍按预期进行 // // 这样线程不安全, 但仍按预期进行
if (account.activated) return; // if (account.activated) return;
account.activated = true; // account.activated = true;
try { // try {
// final html = await Request().get(Api.dynamicSpmPrefix, // // final html = await Request().get(Api.dynamicSpmPrefix,
// options: Options(extra: {'account': account})); // // options: Options(extra: {'account': account}));
// final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!; // // final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!;
final String randPngEnd = base64.encode([ // final String randPngEnd = base64.encode([
...Iterable<int>.generate(32, (_) => Utils.random.nextInt(256)), // ...Iterable<int>.generate(32, (_) => Utils.random.nextInt(256)),
0, // 0,
0, // 0,
0, // 0,
0, // 0,
73, // 73,
69, // 69,
78, // 78,
68, // 68,
...Iterable<int>.generate(4, (_) => Utils.random.nextInt(256)), // ...Iterable<int>.generate(4, (_) => Utils.random.nextInt(256)),
]); // ]);
//
final jsonData = json.encode({ // final jsonData = json.encode({
'3064': 1, // '3064': 1,
'39c8': '333.1387.fp.risk', // '39c8': '333.1387.fp.risk',
'3c43': { // '3c43': {
'adca': 'Linux', // 'adca': 'Linux',
'bfe9': randPngEnd.substring(randPngEnd.length - 50), // 'bfe9': randPngEnd.substring(randPngEnd.length - 50),
}, // },
}); // });
//
await Request().post( // await Request().post(
Api.activateBuvidApi, // Api.activateBuvidApi,
data: {'payload': jsonData}, // data: {'payload': jsonData},
options: Options( // options: Options(
extra: {'account': account}, // extra: {'account': account},
contentType: Headers.jsonContentType, // contentType: Headers.jsonContentType,
), // ),
); // );
} catch (_) {} // } catch (_) {}
} // }
static Dio _cloneHttp11Dio() { static Dio _cloneHttp11Dio() {
final h11 = dio.clone( final h11 = dio.clone(

View File

@@ -245,7 +245,7 @@ Commit Hash: ${BuildConfig.commitHash}''',
(key, value) => MapEntry(key, LoginAccount.fromJson(value)), (key, value) => MapEntry(key, LoginAccount.fromJson(value)),
); );
await Accounts.account.putAll(res); await Accounts.account.putAll(res);
await Accounts.refresh(); Accounts.refresh();
MineController.anonymity.value = !Accounts.heartbeat.isLogin; MineController.anonymity.value = !Accounts.heartbeat.isLogin;
if (Accounts.main.isLogin) { if (Accounts.main.isLogin) {
await LoginUtils.onLoginMain(); await LoginUtils.onLoginMain();

View File

@@ -1052,16 +1052,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
final controlsUnlock = !plPlayerController.controlsLock.value; final controlsUnlock = !plPlayerController.controlsLock.value;
if (PlatformUtils.isMobile) { if (PlatformUtils.isMobile) {
_tapGestureRecognizer.addPointer(event); if (_isPositionAllowed(event.localPosition)) {
if (controlsUnlock) { _tapGestureRecognizer.addPointer(event);
final flag = _isPositionAllowed(event.localPosition); if (controlsUnlock) {
if (!plPlayerController.isLive) { if (!plPlayerController.isLive) {
_doubleTapGestureRecognizer.addPointer(event); _doubleTapGestureRecognizer.addPointer(event);
if (flag) {
longPressRecognizer.addPointer(event); longPressRecognizer.addPointer(event);
} }
}
if (flag) {
_scaleGestureRecognizer.addPointer(event); _scaleGestureRecognizer.addPointer(event);
} }
} }

View File

@@ -1,4 +1,3 @@
import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/models/common/account_type.dart'; import 'package:PiliPlus/models/common/account_type.dart';
import 'package:PiliPlus/pages/mine/controller.dart'; import 'package:PiliPlus/pages/mine/controller.dart';
import 'package:PiliPlus/utils/accounts/account.dart'; import 'package:PiliPlus/utils/accounts/account.dart';
@@ -72,17 +71,17 @@ abstract final class Accounts {
// } // }
// } // }
static Future<void> refresh() { static void refresh() {
for (final a in account.values) { for (final a in account.values) {
for (final t in a.type) { for (final t in a.type) {
accountMode[t.index] = a; accountMode[t.index] = a;
} }
} }
return Future.wait( // return Future.wait(
(accountMode.toSet()..removeWhere((i) => i.activated)).map( // (accountMode.toSet()..removeWhere((i) => i.activated)).map(
Request.buvidActive, // Request.buvidActive,
), // ),
); // );
} }
static Future<void> clear() async { static Future<void> clear() async {
@@ -91,7 +90,7 @@ abstract final class Accounts {
accountMode[i] = AnonymousAccount(); accountMode[i] = AnonymousAccount();
} }
await AnonymousAccount().delete(); await AnonymousAccount().delete();
Request.buvidActive(AnonymousAccount()); // Request.buvidActive(AnonymousAccount());
} }
static Future<void> deleteAll(Set<Account> accounts) async { static Future<void> deleteAll(Set<Account> accounts) async {
@@ -111,7 +110,7 @@ abstract final class Accounts {
final oldAccount = accountMode[key.index]..type.remove(key); final oldAccount = accountMode[key.index]..type.remove(key);
accountMode[key.index] = account..type.add(key); accountMode[key.index] = account..type.add(key);
await Future.wait([?account.onChange(), ?oldAccount.onChange()]); await Future.wait([?account.onChange(), ?oldAccount.onChange()]);
if (!account.activated) await Request.buvidActive(account); // if (!account.activated) await Request.buvidActive(account);
switch (key) { switch (key) {
case AccountType.main: case AccountType.main:
await (account.isLogin await (account.isLogin