mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 弹幕过滤规则与黑名单从Setting移至LocalCache
This commit is contained in:
@@ -262,14 +262,14 @@ class VideoPopupMenu extends StatelessWidget {
|
|||||||
act: 5,
|
act: 5,
|
||||||
reSrc: 11,
|
reSrc: 11,
|
||||||
);
|
);
|
||||||
List<int> blackMidsList = GStorage.setting
|
List<int> blackMidsList = GStorage.localCache
|
||||||
.get(SettingBoxKey.blackMidsList,
|
.get(LocalCacheKey.blackMidsList,
|
||||||
defaultValue: [-1])
|
defaultValue: [-1])
|
||||||
.map<int>((i) => i as int)
|
.map<int>((i) => i as int)
|
||||||
.toList();
|
.toList();
|
||||||
blackMidsList.insert(0, videoItem.owner.mid);
|
blackMidsList.insert(0, videoItem.owner.mid);
|
||||||
GStorage.setting
|
GStorage.localCache
|
||||||
.put(SettingBoxKey.blackMidsList, blackMidsList);
|
.put(LocalCacheKey.blackMidsList, blackMidsList);
|
||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.showToast(res['msg'] ?? '成功');
|
SmartDialog.showToast(res['msg'] ?? '成功');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import '../utils/storage.dart';
|
|||||||
import 'index.dart';
|
import 'index.dart';
|
||||||
|
|
||||||
class SearchHttp {
|
class SearchHttp {
|
||||||
static Box setting = GStorage.setting;
|
static Box localCache = GStorage.localCache;
|
||||||
static Future hotSearchList() async {
|
static Future hotSearchList() async {
|
||||||
var res = await Request().get(Api.hotSearchList);
|
var res = await Request().get(Api.hotSearchList);
|
||||||
if (res.data is String) {
|
if (res.data is String) {
|
||||||
@@ -89,8 +89,8 @@ class SearchHttp {
|
|||||||
try {
|
try {
|
||||||
switch (searchType) {
|
switch (searchType) {
|
||||||
case SearchType.video:
|
case SearchType.video:
|
||||||
List<int> blackMidsList = setting
|
List<int> blackMidsList = localCache
|
||||||
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
|
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
|
||||||
.map<int>((i) => i as int)
|
.map<int>((i) => i as int)
|
||||||
.toList();
|
.toList();
|
||||||
for (var i in res.data['data']['result']) {
|
for (var i in res.data['data']['result']) {
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ class VideoHttp {
|
|||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<RecVideoItemModel> list = [];
|
List<RecVideoItemModel> list = [];
|
||||||
List<int> blackMidsList = setting
|
List<int> blackMidsList = localCache
|
||||||
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
|
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
|
||||||
.map<int>((e) => e as int)
|
.map<int>((e) => e as int)
|
||||||
.toList();
|
.toList();
|
||||||
for (var i in res.data['data']['item']) {
|
for (var i in res.data['data']['item']) {
|
||||||
@@ -94,8 +94,8 @@ class VideoHttp {
|
|||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<RecVideoItemAppModel> list = [];
|
List<RecVideoItemAppModel> list = [];
|
||||||
List<int> blackMidsList = setting
|
List<int> blackMidsList = localCache
|
||||||
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
|
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
|
||||||
.map<int>((e) => e as int)
|
.map<int>((e) => e as int)
|
||||||
.toList();
|
.toList();
|
||||||
for (var i in res.data['data']['items']) {
|
for (var i in res.data['data']['items']) {
|
||||||
@@ -128,8 +128,8 @@ class VideoHttp {
|
|||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<HotVideoItemModel> list = [];
|
List<HotVideoItemModel> list = [];
|
||||||
List<int> blackMidsList = setting
|
List<int> blackMidsList = localCache
|
||||||
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
|
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
|
||||||
.map<int>((e) => e as int)
|
.map<int>((e) => e as int)
|
||||||
.toList();
|
.toList();
|
||||||
for (var i in res.data['data']['list']) {
|
for (var i in res.data['data']['list']) {
|
||||||
@@ -711,8 +711,8 @@ class VideoHttp {
|
|||||||
var res = await Request().get(rankApi);
|
var res = await Request().get(rankApi);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<HotVideoItemModel> list = [];
|
List<HotVideoItemModel> list = [];
|
||||||
List<int> blackMidsList = setting
|
List<int> blackMidsList = localCache
|
||||||
.get(SettingBoxKey.blackMidsList, defaultValue: [-1])
|
.get(LocalCacheKey.blackMidsList, defaultValue: [-1])
|
||||||
.map<int>((e) => e as int)
|
.map<int>((e) => e as int)
|
||||||
.toList();
|
.toList();
|
||||||
for (var i in res.data['data']['list']) {
|
for (var i in res.data['data']['list']) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
Future? _futureBuilderFuture;
|
Future? _futureBuilderFuture;
|
||||||
bool _isLoadingMore = false;
|
bool _isLoadingMore = false;
|
||||||
Box setting = GStorage.setting;
|
Box localCache = GStorage.localCache;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -46,7 +46,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
List<int> blackMidsList =
|
List<int> blackMidsList =
|
||||||
_blackListController.blackList.map<int>((e) => e.mid!).toList();
|
_blackListController.blackList.map<int>((e) => e.mid!).toList();
|
||||||
setting.put(SettingBoxKey.blackMidsList, blackMidsList);
|
localCache.put(LocalCacheKey.blackMidsList, blackMidsList);
|
||||||
scrollController.removeListener(() {});
|
scrollController.removeListener(() {});
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
|
|||||||
final DanmakuBlockController _danmakuBlockController =
|
final DanmakuBlockController _danmakuBlockController =
|
||||||
Get.put(DanmakuBlockController());
|
Get.put(DanmakuBlockController());
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
Box setting = GStorage.setting;
|
Box localCache = GStorage.localCache;
|
||||||
late PlPlayerController plPlayerController;
|
late PlPlayerController plPlayerController;
|
||||||
|
|
||||||
static const Map<int, String> ruleLabels = {
|
static const Map<int, String> ruleLabels = {
|
||||||
@@ -50,7 +50,7 @@ class _DanmakuBlockPageState extends State<DanmakuBlockPage> {
|
|||||||
return e.toMap();
|
return e.toMap();
|
||||||
}).toList();
|
}).toList();
|
||||||
print("simpleRuleList:$simpleRuleList");
|
print("simpleRuleList:$simpleRuleList");
|
||||||
setting.put(SettingBoxKey.danmakuFilterRule, simpleRuleList);
|
localCache.put(LocalCacheKey.danmakuFilterRule, simpleRuleList);
|
||||||
plPlayerController.danmakuFilterRule.value = simpleRuleList;
|
plPlayerController.danmakuFilterRule.value = simpleRuleList;
|
||||||
scrollController.removeListener(() {});
|
scrollController.removeListener(() {});
|
||||||
scrollController.dispose();
|
scrollController.dispose();
|
||||||
|
|||||||
@@ -87,45 +87,8 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
|||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
if (result == 'app') {
|
if (result == 'app') {
|
||||||
// app端推荐需要access_key
|
|
||||||
if (accessKeyInfo == null) {
|
if (accessKeyInfo == null) {
|
||||||
if (!userLogin) {
|
SmartDialog.showToast('尚未登录,无法收到个性化推荐');
|
||||||
SmartDialog.showToast('请先登录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 显示一个确认框,告知用户可能会导致账号被风控
|
|
||||||
if (!context.mounted) return;
|
|
||||||
await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('提示'),
|
|
||||||
content: const Text(
|
|
||||||
'使用app端推荐需获取access_key,有小概率触发风控导致账号退出(在官方版本app重新登录即可解除),是否继续?'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
result = null;
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: const Text('取消'),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
Get.back();
|
|
||||||
var res = await MemberHttp.cookieToKey();
|
|
||||||
if (res['status']) {
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
} else {
|
|
||||||
SmartDialog.showToast(
|
|
||||||
'获取access_key失败:${res['msg']}');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const Text('确定'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ class SettingBoxKey {
|
|||||||
continuePlayInBackground = 'continuePlayInBackground',
|
continuePlayInBackground = 'continuePlayInBackground',
|
||||||
|
|
||||||
/// 隐私
|
/// 隐私
|
||||||
blackMidsList = 'blackMidsList',
|
|
||||||
anonymity = 'anonymity',
|
anonymity = 'anonymity',
|
||||||
|
|
||||||
/// 推荐
|
/// 推荐
|
||||||
@@ -166,7 +165,6 @@ class SettingBoxKey {
|
|||||||
danmakuDuration = 'danmakuDuration',
|
danmakuDuration = 'danmakuDuration',
|
||||||
strokeWidth = 'strokeWidth',
|
strokeWidth = 'strokeWidth',
|
||||||
fontWeight = 'fontWeight',
|
fontWeight = 'fontWeight',
|
||||||
danmakuFilterRule = 'danmakuFilterRule',
|
|
||||||
|
|
||||||
// 代理host port
|
// 代理host port
|
||||||
systemProxyHost = 'systemProxyHost',
|
systemProxyHost = 'systemProxyHost',
|
||||||
@@ -198,6 +196,11 @@ class SettingBoxKey {
|
|||||||
class LocalCacheKey {
|
class LocalCacheKey {
|
||||||
// 历史记录暂停状态 默认false 记录
|
// 历史记录暂停状态 默认false 记录
|
||||||
static const String historyPause = 'historyPause',
|
static const String historyPause = 'historyPause',
|
||||||
|
|
||||||
|
// 隐私设置-黑名单管理
|
||||||
|
blackMidsList = 'blackMidsList',
|
||||||
|
// 弹幕屏蔽规则
|
||||||
|
danmakuFilterRule = 'danmakuFilterRule',
|
||||||
// access_key
|
// access_key
|
||||||
accessKey = 'accessKey',
|
accessKey = 'accessKey',
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user