mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -7,13 +7,13 @@ import 'package:PiliPlus/utils/accounts.dart';
|
||||
class BlackHttp {
|
||||
static Future<LoadingState<BlackListData>> blackList({
|
||||
required int pn,
|
||||
int? ps,
|
||||
int ps = 50,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.blackLst,
|
||||
queryParameters: {
|
||||
'pn': pn,
|
||||
'ps': ps ?? 50,
|
||||
'ps': ps,
|
||||
're_version': 0,
|
||||
'jsonp': 'jsonp',
|
||||
'csrf': Accounts.main.csrf,
|
||||
|
||||
@@ -7,7 +7,7 @@ class FanHttp {
|
||||
static Future<LoadingState<FansData>> fans({
|
||||
int? vmid,
|
||||
int? pn,
|
||||
int? ps,
|
||||
int ps = 20,
|
||||
String? orderType,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
|
||||
@@ -7,7 +7,7 @@ class FollowHttp {
|
||||
static Future<LoadingState<FollowData>> followings({
|
||||
int? vmid,
|
||||
int? pn,
|
||||
int? ps,
|
||||
int ps = 50,
|
||||
String orderType = '',
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
@@ -32,7 +32,7 @@ class FollowHttp {
|
||||
static Future<LoadingState<FollowData>> followingsNew({
|
||||
int? vmid,
|
||||
int? pn,
|
||||
int? ps,
|
||||
int ps = 20,
|
||||
String orderType = '', // ''=>最近关注,'attention'=>最常访问
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
|
||||
@@ -280,16 +280,6 @@ class Request {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 取消请求
|
||||
*
|
||||
* 同一个cancel token 可以用于多个请求,当一个cancel token取消时,所有使用该cancel token的请求都会被取消。
|
||||
* 所以参数可选
|
||||
*/
|
||||
void cancelRequests(CancelToken token) {
|
||||
token.cancel("cancelled");
|
||||
}
|
||||
|
||||
static String responseDecoder(
|
||||
List<int> responseBytes,
|
||||
RequestOptions options,
|
||||
|
||||
@@ -526,12 +526,12 @@ class MemberHttp {
|
||||
}
|
||||
|
||||
// 获取某分组下的up
|
||||
static Future<LoadingState<FollowData>> followUpGroup(
|
||||
static Future<LoadingState<FollowData>> followUpGroup({
|
||||
int? mid,
|
||||
int? tagid,
|
||||
int? pn,
|
||||
int? ps,
|
||||
) async {
|
||||
int ps = 20,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.followUpGroup,
|
||||
queryParameters: {
|
||||
|
||||
@@ -816,7 +816,7 @@ class VideoHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future vttSubtitles(String subtitleUrl) async {
|
||||
static Future<String?> vttSubtitles(String subtitleUrl) async {
|
||||
String subtitleTimecode(num seconds) {
|
||||
int h = seconds ~/ 3600;
|
||||
seconds %= 3600;
|
||||
@@ -842,8 +842,8 @@ class VideoHttp {
|
||||
|
||||
var res = await Request().get("https:$subtitleUrl");
|
||||
|
||||
if (res.data?['body'] is List) {
|
||||
return await compute(processList, res.data['body'] as List);
|
||||
if (res.data?['body'] case List list) {
|
||||
return compute<List, String>(processList, list);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -10,10 +10,8 @@ class ArticleOpus {
|
||||
opusid = json['opus_id'];
|
||||
opussource = json['opus_source'];
|
||||
title = json['title'];
|
||||
if (json['content']?['paragraphs'] is List) {
|
||||
content = (json['content']['paragraphs'] as List)
|
||||
.map((i) => ArticleContentModel.fromJson(i))
|
||||
.toList();
|
||||
if (json['content']?['paragraphs'] case List list) {
|
||||
content = list.map((i) => ArticleContentModel.fromJson(i)).toList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import 'package:get/get.dart';
|
||||
|
||||
class BlackListController
|
||||
extends CommonListController<BlackListData, BlackListItem> {
|
||||
int pageSize = 50;
|
||||
RxInt total = (-1).obs;
|
||||
|
||||
@override
|
||||
@@ -52,5 +51,5 @@ class BlackListController
|
||||
|
||||
@override
|
||||
Future<LoadingState<BlackListData>> customGetData() =>
|
||||
BlackHttp.blackList(pn: page, ps: pageSize);
|
||||
BlackHttp.blackList(pn: page);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ class DynamicsController extends GetxController
|
||||
var res = await FollowHttp.followings(
|
||||
vmid: accountService.mid,
|
||||
pn: allFollowedUpsPage,
|
||||
ps: 50,
|
||||
orderType: 'attention',
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
@@ -108,7 +107,6 @@ class DynamicsController extends GetxController
|
||||
final f2 = FollowHttp.followings(
|
||||
vmid: accountService.mid,
|
||||
pn: allFollowedUpsPage,
|
||||
ps: 50,
|
||||
orderType: 'attention',
|
||||
);
|
||||
final res0 = await f1;
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
class FansController extends CommonListController<FansData, FansItemModel> {
|
||||
FansController(this.mid);
|
||||
int ps = 20;
|
||||
int total = 0;
|
||||
int mid;
|
||||
|
||||
@@ -27,7 +26,6 @@ class FansController extends CommonListController<FansData, FansItemModel> {
|
||||
Future<LoadingState<FansData>> customGetData() => FanHttp.fans(
|
||||
vmid: mid,
|
||||
pn: page,
|
||||
ps: ps,
|
||||
orderType: 'attention',
|
||||
);
|
||||
|
||||
|
||||
@@ -48,13 +48,12 @@ class FollowChildController
|
||||
@override
|
||||
Future<LoadingState<FollowData>> customGetData() {
|
||||
if (tagid != null) {
|
||||
return MemberHttp.followUpGroup(mid, tagid, page, 20);
|
||||
return MemberHttp.followUpGroup(mid: mid, tagid: tagid, pn: page);
|
||||
}
|
||||
|
||||
return FollowHttp.followingsNew(
|
||||
vmid: mid,
|
||||
pn: page,
|
||||
ps: 20,
|
||||
orderType: orderType.value.type,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,13 +8,11 @@ class HotKeyword extends StatelessWidget {
|
||||
final double width;
|
||||
final List<SearchTrendingItemModel> hotSearchList;
|
||||
final Function? onClick;
|
||||
final bool showMore;
|
||||
const HotKeyword({
|
||||
super.key,
|
||||
required double width,
|
||||
required this.hotSearchList,
|
||||
this.onClick,
|
||||
this.showMore = true,
|
||||
}) : width = width / 2 - 4;
|
||||
|
||||
@override
|
||||
|
||||
@@ -42,42 +42,42 @@ class _SettingPageState extends State<SettingPage> {
|
||||
final RxBool _noAccount = Accounts.accountMode.isEmpty.obs;
|
||||
late bool _isPortrait;
|
||||
|
||||
final List<_SettingsModel> _items = [
|
||||
const _SettingsModel(
|
||||
final List<_SettingsModel> _items = const [
|
||||
_SettingsModel(
|
||||
type: SettingType.privacySetting,
|
||||
subtitle: '黑名单、无痕模式',
|
||||
icon: Icons.privacy_tip_outlined,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.recommendSetting,
|
||||
subtitle: '推荐来源(web/app)、刷新保留内容、过滤器',
|
||||
icon: Icons.explore_outlined,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.videoSetting,
|
||||
subtitle: '画质、音质、解码、缓冲、音频输出等',
|
||||
icon: Icons.video_settings_outlined,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.playSetting,
|
||||
subtitle: '双击/长按、全屏、后台播放、弹幕、字幕、底部进度条等',
|
||||
icon: Icons.touch_app_outlined,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.styleSetting,
|
||||
subtitle: '横屏适配(平板)、侧栏、列宽、首页、动态红点、主题、字号、图片、帧率等',
|
||||
icon: Icons.style_outlined,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.extraSetting,
|
||||
subtitle: '震动、搜索、收藏、ai、评论、动态、代理、更新检查等',
|
||||
icon: Icons.extension_outlined,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.webdavSetting,
|
||||
icon: MdiIcons.databaseCogOutline,
|
||||
),
|
||||
const _SettingsModel(
|
||||
_SettingsModel(
|
||||
type: SettingType.about,
|
||||
icon: Icons.info_outline,
|
||||
),
|
||||
|
||||
@@ -1435,7 +1435,7 @@ class VideoDetailController extends GetxController
|
||||
return;
|
||||
}
|
||||
|
||||
void setSub(subtitle) {
|
||||
void setSub(String subtitle) {
|
||||
plPlayerController.videoPlayerController?.setSubtitleTrack(
|
||||
SubtitleTrack.data(
|
||||
subtitle,
|
||||
|
||||
@@ -870,19 +870,17 @@ class HeaderControlState extends State<HeaderControl> {
|
||||
try {
|
||||
final res = await Dio().get(
|
||||
item.subtitleUrl!.http2https,
|
||||
options: Options(
|
||||
responseType: ResponseType.bytes,
|
||||
),
|
||||
options: Options(responseType: ResponseType.bytes),
|
||||
);
|
||||
if (res.statusCode == 200) {
|
||||
final name =
|
||||
'${videoIntroController.videoDetail.value.title}-${videoDetailCtr.bvid}-${videoDetailCtr.cid.value}-${item.lanDoc}';
|
||||
'${videoIntroController.videoDetail.value.title}-${videoDetailCtr.bvid}-${videoDetailCtr.cid.value}-${item.lanDoc}.json';
|
||||
try {
|
||||
DocumentFileSavePlusPlatform.instance
|
||||
.saveMultipleFiles(
|
||||
dataList: [res.data],
|
||||
fileNameList: [name],
|
||||
mimeTypeList: ['text/plain'],
|
||||
mimeTypeList: [Headers.jsonContentType],
|
||||
);
|
||||
if (Platform.isAndroid) {
|
||||
SmartDialog.showToast('已保存');
|
||||
@@ -894,7 +892,7 @@ class HeaderControlState extends State<HeaderControl> {
|
||||
XFile.fromData(
|
||||
res.data,
|
||||
name: name,
|
||||
mimeType: 'text/plain',
|
||||
mimeType: Headers.jsonContentType,
|
||||
),
|
||||
],
|
||||
sharePositionOrigin: await Utils.isIpad()
|
||||
|
||||
Reference in New Issue
Block a user