Compare commits

..

1 Commits

Author SHA1 Message Date
35dc94014c mod: 直播mcdn链接替换 issues #568 2024-02-23 00:30:26 +08:00
7 changed files with 85 additions and 186 deletions

View File

@ -53,54 +53,29 @@ class _AboutPageState extends State<AboutPage> {
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 6),
Text(
'使用Flutter开发的哔哩哔哩第三方客户端',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
const SizedBox(height: 20),
Obx(
() => Badge(
isLabelVisible: _aboutController.isLoading.value
? false
: _aboutController.isUpdate.value,
label: const Text('New'),
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 30),
child: FilledButton.tonal(
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
onTap: () => _aboutController.githubRelease(),
title: const Text('Github下载'),
),
ListTile(
onTap: () => _aboutController.panDownload(),
title: const Text('网盘下载'),
),
ListTile(
onTap: () => _aboutController.webSiteUrl(),
title: const Text('官网下载'),
),
ListTile(
onTap: () => _aboutController.qimiao(),
title: const Text('奇妙应用'),
),
SizedBox(
height:
MediaQuery.of(context).padding.bottom +
20)
],
);
},
);
},
child: Text(
'V${_aboutController.currentVersion.value}',
style: subTitleStyle.copyWith(
color: Theme.of(context).primaryColor,
),
),
),
() => ListTile(
title: const Text('当前版本'),
trailing: Text(_aboutController.currentVersion.value,
style: subTitleStyle),
),
),
Obx(
() => ListTile(
onTap: () => _aboutController.onUpdate(),
title: const Text('最新版本'),
trailing: Text(
_aboutController.isLoading.value
? '正在获取'
: _aboutController.isUpdate.value
? '有新版本 ❤️${_aboutController.remoteVersion.value}'
: '当前已是最新版',
style: subTitleStyle,
),
),
),
@ -112,9 +87,14 @@ class _AboutPageState extends State<AboutPage> {
// size: 16,
// ),
// ),
Divider(
thickness: 1,
height: 30,
color: Theme.of(context).colorScheme.outlineVariant,
),
ListTile(
onTap: () => _aboutController.githubUrl(),
title: const Text('开源地址'),
title: const Text('Github'),
trailing: Text(
'github.com/guozhigq/pilipala',
style: subTitleStyle,
@ -149,43 +129,19 @@ class _AboutPageState extends State<AboutPage> {
),
),
ListTile(
onTap: () {
showModalBottomSheet(
context: context,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
onTap: () => _aboutController.qqChanel(),
title: const Text('QQ群'),
trailing: Text(
'616150809',
style: subTitleStyle,
),
),
ListTile(
onTap: () => _aboutController.tgChanel(),
title: const Text('TG频道'),
trailing: Text(
'https://t.me/+lm_oOVmF0RJiODk1',
style: subTitleStyle,
),
),
SizedBox(
height: MediaQuery.of(context).padding.bottom + 20)
],
);
},
);
},
title: const Text('交流社区'),
onTap: () => _aboutController.qqChanel(),
title: const Text('QQ群'),
trailing: Icon(
Icons.arrow_forward_ios,
size: 16,
color: outline,
),
),
ListTile(
onTap: () => _aboutController.tgChanel(),
title: const Text('TG频道'),
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
),
ListTile(
onTap: () => _aboutController.aPay(),
title: const Text('赞助'),
@ -207,7 +163,6 @@ class _AboutPageState extends State<AboutPage> {
subtitle: Text('图片及网络缓存 $cacheSize', style: subTitleStyle),
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
),
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
],
),
),
@ -275,26 +230,11 @@ class AboutController extends GetxController {
);
}
githubRelease() {
launchUrl(
Uri.parse('https://github.com/guozhigq/pilipala/release'),
mode: LaunchMode.externalApplication,
);
}
// 从网盘下载
panDownload() {
Clipboard.setData(
const ClipboardData(text: 'pili'),
);
SmartDialog.showToast(
'已复制提取码pili',
displayTime: const Duration(milliseconds: 500),
).then(
(value) => launchUrl(
Uri.parse('https://www.123pan.com/s/9sVqVv-flu0A.html'),
mode: LaunchMode.externalApplication,
),
launchUrl(
Uri.parse('https://www.123pan.com/s/9sVqVv-flu0A.html'),
mode: LaunchMode.externalApplication,
);
}
@ -310,7 +250,7 @@ class AboutController extends GetxController {
// qq频道
qqChanel() {
Clipboard.setData(
const ClipboardData(text: '616150809'),
const ClipboardData(text: '489981949'),
);
SmartDialog.showToast('已复制QQ群号');
}
@ -351,13 +291,6 @@ class AboutController extends GetxController {
);
}
qimiao() {
launchUrl(
Uri.parse('https://www.magicalapk.com/home'),
mode: LaunchMode.externalApplication,
);
}
// 日志
logs() {
Get.toNamed('/logs');

View File

@ -26,7 +26,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
late List defaultTabs;
late List<String> tabbarSort;
RxString defaultSearch = ''.obs;
late bool enableGradientBg;
@override
void onInit() {
@ -41,8 +40,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
if (setting.get(SettingBoxKey.enableSearchWord, defaultValue: true)) {
searchDefault();
}
enableGradientBg =
setting.get(SettingBoxKey.enableGradientBg, defaultValue: true);
}
void onRefresh() {

View File

@ -48,48 +48,38 @@ class _HomePageState extends State<HomePage>
super.build(context);
Brightness currentBrightness = MediaQuery.of(context).platformBrightness;
// 设置状态栏图标的亮度
if (_homeController.enableGradientBg) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarIconBrightness: currentBrightness == Brightness.light
? Brightness.dark
: Brightness.light,
));
}
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarIconBrightness: currentBrightness == Brightness.light
? Brightness.dark
: Brightness.light,
));
return Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
body: Stack(
children: [
// gradient background
if (_homeController.enableGradientBg) ...[
Align(
alignment: Alignment.topLeft,
child: Opacity(
opacity: 0.6,
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context)
.colorScheme
.primary
.withOpacity(0.9),
Theme.of(context)
.colorScheme
.primary
.withOpacity(0.5),
Theme.of(context).colorScheme.surface
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: const [0, 0.0034, 0.34]),
),
Align(
alignment: Alignment.topLeft,
child: Opacity(
opacity: 0.6,
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary.withOpacity(0.9),
Theme.of(context).colorScheme.primary.withOpacity(0.5),
Theme.of(context).colorScheme.surface
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: const [0, 0.0034, 0.34]),
),
),
),
],
),
Column(
children: [
CustomAppBar(
@ -100,37 +90,7 @@ class _HomePageState extends State<HomePage>
callback: showUserBottomSheet,
),
if (_homeController.tabs.length > 1) ...[
if (_homeController.enableGradientBg) ...[
const CustomTabs(),
] else ...[
const SizedBox(height: 4),
SizedBox(
width: double.infinity,
height: 42,
child: Align(
alignment: Alignment.center,
child: TabBar(
controller: _homeController.tabController,
tabs: [
for (var i in _homeController.tabs)
Tab(text: i['label'])
],
isScrollable: true,
dividerColor: Colors.transparent,
enableFeedback: true,
splashBorderRadius: BorderRadius.circular(10),
tabAlignment: TabAlignment.center,
onTap: (value) {
feedBack();
if (_homeController.initialIndex.value == value) {
_homeController.tabsCtrList[value]().animateToTop();
}
_homeController.initialIndex.value = value;
},
),
),
),
],
const CustomTabs(),
] else ...[
const SizedBox(height: 6),
],

View File

@ -4,6 +4,8 @@ import 'package:pilipala/http/live.dart';
import 'package:pilipala/models/live/room_info.dart';
import 'package:pilipala/plugin/pl_player/index.dart';
import '../../models/live/room_info_h5.dart';
import '../../utils/storage.dart';
import '../../utils/video_utils.dart';
class LiveRoomController extends GetxController {
String cover = '';
@ -16,6 +18,7 @@ class LiveRoomController extends GetxController {
PlPlayerController plPlayerController =
PlPlayerController.getInstance(videoType: 'live');
Rx<RoomInfoH5Model> roomInfoH5 = RoomInfoH5Model().obs;
late bool enableCDN;
@override
void onInit() {
@ -31,6 +34,8 @@ class LiveRoomController extends GetxController {
cover = liveItem.cover;
}
}
// CDN优化
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
}
playerInit(source) async {
@ -57,9 +62,11 @@ class LiveRoomController extends GetxController {
List<CodecItem> codec =
res['data'].playurlInfo.playurl.stream.first.format.first.codec;
CodecItem item = codec.first;
String videoUrl = (item.urlInfo?.first.host)! +
item.baseUrl! +
item.urlInfo!.first.extra!;
String videoUrl = enableCDN
? VideoUtils.getCdnUrl(item)
: (item.urlInfo?.first.host)! +
item.baseUrl! +
item.urlInfo!.first.extra!;
await playerInit(videoUrl);
return res;
}

View File

@ -102,12 +102,6 @@ class _StyleSettingState extends State<StyleSetting> {
defaultVal: true,
needReboot: true,
),
const SetSwitchItem(
title: '首页底栏背景渐变',
setKey: SettingBoxKey.enableGradientBg,
defaultVal: true,
needReboot: true,
),
ListTile(
onTap: () async {
int? result = await showDialog(

View File

@ -135,8 +135,7 @@ class SettingBoxKey {
hideSearchBar = 'hideSearchBar', // 收起顶栏
hideTabBar = 'hideTabBar', // 收起底栏
tabbarSort = 'tabbarSort', // 首页tabbar
dynamicBadgeMode = 'dynamicBadgeMode',
enableGradientBg = 'enableGradientBg';
dynamicBadgeMode = 'dynamicBadgeMode';
}
class LocalCacheKey {

View File

@ -1,5 +1,7 @@
import 'package:pilipala/models/video/play/url.dart';
import '../models/live/room_info.dart';
class VideoUtils {
static String getCdnUrl(dynamic item) {
var backupUrl = "";
@ -12,13 +14,20 @@ class VideoUtils {
} else if (item is AudioItem) {
backupUrl = item.backupUrl ?? "";
videoUrl = backupUrl.contains("http") ? backupUrl : (item.baseUrl ?? "");
} else if (item is CodecItem) {
backupUrl = (item.urlInfo?.first.host)! +
item.baseUrl! +
item.urlInfo!.first.extra!;
videoUrl = backupUrl.contains("http") ? backupUrl : (item.baseUrl ?? "");
} else {
return "";
}
/// issues #70
if (videoUrl.contains(".mcdn.bilivideo") ||
videoUrl.contains("/upgcxcode/")) {
if (videoUrl.contains(".mcdn.bilivideo")) {
videoUrl =
'https://proxy-tf-all-ws.bilivideo.com/?url=${Uri.encodeComponent(videoUrl)}';
} else if (videoUrl.contains("/upgcxcode/")) {
//CDN列表
var cdnList = {
'ali': 'upos-sz-mirrorali.bilivideo.com',