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 @@
import 'package:hive/hive.dart';
import 'package:PiliPalaX/http/user.dart';
import 'storage.dart';
@@ -9,14 +8,12 @@ class Data {
}
static Future historyStatus() async {
Box localCache = GStorage.localCache;
Box userInfoCache = GStorage.userInfo;
if (userInfoCache.get('userInfoCache') == null) {
if (GStorage.userInfo.get('userInfoCache') == null) {
return;
}
var res = await UserHttp.historyStatus();
if (res['status']) {
localCache.put(LocalCacheKey.historyPause, res['data']);
GStorage.localCache.put(LocalCacheKey.historyPause, res['data']);
}
}
}

View File

@@ -1,12 +1,10 @@
import 'package:flutter/services.dart';
import 'package:hive/hive.dart';
import 'storage.dart';
Box<dynamic> setting = GStorage.setting;
void feedBack() {
// 设置中是否开启
final bool enable =
setting.get(SettingBoxKey.feedBackEnable, defaultValue: false) as bool;
final bool enable = GStorage.setting
.get(SettingBoxKey.feedBackEnable, defaultValue: false) as bool;
if (enable) {
HapticFeedback.lightImpact();
}

View File

@@ -1,4 +1,4 @@
// import 'dart:math';
import 'package:hive/hive.dart';
import 'storage.dart';
@@ -9,12 +9,14 @@ class RecommendFilter {
static late bool exemptFilterForFollowed;
static late bool applyFilterToRelatedVideos;
static late String banWords;
RecommendFilter() {
update();
}
static Box get setting => GStorage.setting;
static void update() {
var setting = GStorage.setting;
// filterUnfollowedRatio =
// setting.get(SettingBoxKey.filterUnfollowedRatio, defaultValue: 0);
minDurationForRcmd =

View File

@@ -142,6 +142,9 @@ class GStorage {
static List<int> get blackMidsList => List<int>.from(GStorage.localCache
.get(LocalCacheKey.blackMidsList, defaultValue: <int>[]));
static List get danmakuFilterRule => GStorage.localCache
.get(LocalCacheKey.danmakuFilterRule, defaultValue: []);
static void setBlackMidsList(blackMidsList) {
if (blackMidsList is! List<int>) return;
GStorage.localCache.put(LocalCacheKey.blackMidsList, blackMidsList);

View File

@@ -9,7 +9,7 @@ import '../http/index.dart';
import 'storage.dart';
class WbiSign {
static Box<dynamic> localCache = GStorage.localCache;
static Box get localCache => GStorage.localCache;
final List<int> mixinKeyEncTab = <int>[
46,
47,
@@ -104,7 +104,7 @@ class WbiSign {
final String queryStr = query.join('&');
final String wbiSign =
md5.convert(utf8.encode(queryStr + mixinKey)).toString(); // 计算 w_rid
return {'w_rid': wbiSign,'wts': currTime.toString()};
return {'w_rid': wbiSign, 'wts': currTime.toString()};
}
// 获取最新的 img_key 和 sub_key 可以从缓存中获取