fix: danmaku block

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-26 18:10:30 +08:00
parent d3c7b3830f
commit 79da08b285
59 changed files with 207 additions and 303 deletions

View File

@@ -1,4 +1,3 @@
// ignore_for_file: avoid_print
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
@@ -9,8 +8,6 @@ import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:flutter/material.dart';
// import 'package:dio_http2_adapter/dio_http2_adapter.dart';
import 'package:hive/hive.dart';
import 'package:PiliPalaX/utils/id_utils.dart';
import '../utils/storage.dart';
import '../utils/utils.dart';
@@ -25,8 +22,6 @@ class Request {
static late CookieManager cookieManager;
static late final Dio dio;
factory Request() => _instance;
Box setting = GStorage.setting;
static Box localCache = GStorage.localCache;
late bool enableSystemProxy;
late String systemProxyHost;
late String systemProxyPort;
@@ -35,7 +30,6 @@ class Request {
/// 设置cookie
static setCookie() async {
Box userInfoCache = GStorage.userInfo;
final String cookiePath = await Utils.getCookiePath();
final PersistCookieJar cookieJar = PersistCookieJar(
ignoreExpires: true,
@@ -57,7 +51,7 @@ class Request {
isHttpOnly: item.httpOnly,
);
}
final userInfo = userInfoCache.get('userInfoCache');
final userInfo = GStorage.userInfo.get('userInfoCache');
if (userInfo != null && userInfo.mid != null) {
final List<Cookie> cookie2 = await cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.tUrl));
@@ -146,12 +140,12 @@ class Request {
headers: {},
);
enableSystemProxy = setting.get(SettingBoxKey.enableSystemProxy,
defaultValue: false) as bool;
enableSystemProxy = GStorage.setting
.get(SettingBoxKey.enableSystemProxy, defaultValue: false) as bool;
systemProxyHost =
setting.get(SettingBoxKey.systemProxyHost, defaultValue: '');
GStorage.setting.get(SettingBoxKey.systemProxyHost, defaultValue: '');
systemProxyPort =
setting.get(SettingBoxKey.systemProxyPort, defaultValue: '');
GStorage.setting.get(SettingBoxKey.systemProxyPort, defaultValue: '');
dio = Dio(options);

View File

@@ -27,8 +27,7 @@ class ApiInterceptor extends Interceptor {
// final String? accessKey = uri.queryParameters['access_key'];
// final String? mid = uri.queryParameters['mid'];
// try {
// Box localCache = GStorage.localCache;
// localCache.put(LocalCacheKey.accessKey,
// GStorage.localCache.put(LocalCacheKey.accessKey,
// <String, String?>{'mid': mid, 'value': accessKey});
// } catch (_) {}
// }

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:PiliPalaX/http/loading_state.dart';
import 'package:hive/hive.dart';
import '../models/bangumi/info.dart';
import '../models/common/search_type.dart';
import '../models/search/hot.dart';
@@ -12,7 +11,6 @@ import '../utils/storage.dart';
import 'index.dart';
class SearchHttp {
static Box localCache = GStorage.localCache;
static Future hotSearchList() async {
var res = await Request().get(Api.hotSearchList);
if (res.data is String) {

View File

@@ -5,7 +5,6 @@ import 'package:PiliPalaX/grpc/grpc_repo.dart';
import 'package:PiliPalaX/http/loading_state.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import '../common/constants.dart';
import '../models/common/reply_type.dart';
import '../models/home/rcmd/result.dart';
@@ -30,11 +29,8 @@ import 'login.dart';
/// 返回{'status': bool, 'data': List}
/// view层根据 status 判断渲染逻辑
class VideoHttp {
static Box localCache = GStorage.localCache;
static Box setting = GStorage.setting;
static bool enableRcmdDynamic =
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
static Box userInfoCache = GStorage.userInfo;
GStorage.setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
// 首页推荐视频
static Future<LoadingState> rcmdVideoList(
@@ -76,7 +72,7 @@ class VideoHttp {
{bool loginStatus = true, required int freshIdx}) async {
Map<String, String> data = {
'access_key': loginStatus
? (localCache
? (GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
'')
: '',
@@ -215,9 +211,9 @@ class VideoHttp {
}
// 免登录查看1080p
if ((userInfoCache.get('userInfoCache') == null ||
if ((GStorage.userInfo.get('userInfoCache') == null ||
MineController.anonymity) &&
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
GStorage.setting.get(SettingBoxKey.p1080, defaultValue: true)) {
data['try_look'] = 1;
}