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: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<void> 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<int>.generate(32, (_) => Utils.random.nextInt(256)),
0,
0,
0,
0,
73,
69,
78,
68,
...Iterable<int>.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<void> 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<int>.generate(32, (_) => Utils.random.nextInt(256)),
// 0,
// 0,
// 0,
// 0,
// 73,
// 69,
// 78,
// 68,
// ...Iterable<int>.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(

View File

@@ -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();

View File

@@ -1052,16 +1052,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
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);
}
}

View File

@@ -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<void> 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<void> clear() async {
@@ -91,7 +90,7 @@ abstract final class Accounts {
accountMode[i] = AnonymousAccount();
}
await AnonymousAccount().delete();
Request.buvidActive(AnonymousAccount());
// Request.buvidActive(AnonymousAccount());
}
static Future<void> deleteAll(Set<Account> 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