Merge branch 'design'
This commit is contained in:
@ -1,7 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/http/constants.dart';
|
||||||
import 'package:pilipala/utils/image_save.dart';
|
import 'package:pilipala/utils/image_save.dart';
|
||||||
|
import 'package:pilipala/utils/route_push.dart';
|
||||||
|
import 'package:pilipala/utils/url_utils.dart';
|
||||||
import '../../http/search.dart';
|
import '../../http/search.dart';
|
||||||
import '../../http/user.dart';
|
import '../../http/user.dart';
|
||||||
import '../../http/video.dart';
|
import '../../http/video.dart';
|
||||||
@ -52,6 +55,20 @@ class VideoCardH extends StatelessWidget {
|
|||||||
SmartDialog.showToast('课堂视频暂不支持播放');
|
SmartDialog.showToast('课堂视频暂不支持播放');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (showCharge && videoItem?.typeid == 33) {
|
||||||
|
final String redirectUrl = await UrlUtils.parseRedirectUrl(
|
||||||
|
'${HttpString.baseUrl}/video/$bvid/');
|
||||||
|
final String lastPathSegment = redirectUrl.split('/').last;
|
||||||
|
if (lastPathSegment.contains('ss')) {
|
||||||
|
RoutePush.bangumiPush(
|
||||||
|
Utils.matchNum(lastPathSegment).first, null);
|
||||||
|
}
|
||||||
|
if (lastPathSegment.contains('ep')) {
|
||||||
|
RoutePush.bangumiPush(
|
||||||
|
null, Utils.matchNum(lastPathSegment).first);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
final int cid =
|
final int cid =
|
||||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||||
|
|||||||
@ -50,13 +50,6 @@ class ChatItem extends StatelessWidget {
|
|||||||
this.e_infos,
|
this.e_infos,
|
||||||
});
|
});
|
||||||
|
|
||||||
static List<int> matchNum(String str) {
|
|
||||||
final RegExp regExp = RegExp(r'\d+');
|
|
||||||
final Iterable<Match> matches = regExp.allMatches(str);
|
|
||||||
|
|
||||||
return matches.map((Match match) => int.parse(match.group(0)!)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
bool isOwner =
|
bool isOwner =
|
||||||
@ -183,9 +176,9 @@ class ChatItem extends StatelessWidget {
|
|||||||
if (url != null) {
|
if (url != null) {
|
||||||
final String area = url.split('/').last;
|
final String area = url.split('/').last;
|
||||||
if (area.startsWith('ep')) {
|
if (area.startsWith('ep')) {
|
||||||
RoutePush.bangumiPush(null, matchNum(area).first);
|
RoutePush.bangumiPush(null, Utils.matchNum(area).first);
|
||||||
} else if (area.startsWith('ss')) {
|
} else if (area.startsWith('ss')) {
|
||||||
RoutePush.bangumiPush(matchNum(area).first, null);
|
RoutePush.bangumiPush(Utils.matchNum(area).first, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,15 +144,15 @@ class PiliSchame {
|
|||||||
_videoPush(null, lastPathSegment);
|
_videoPush(null, lastPathSegment);
|
||||||
}
|
}
|
||||||
if (lastPathSegment.contains('av')) {
|
if (lastPathSegment.contains('av')) {
|
||||||
_videoPush(matchNum(lastPathSegment)[0], null);
|
_videoPush(Utils.matchNum(lastPathSegment)[0], null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (path.startsWith('/bangumi')) {
|
if (path.startsWith('/bangumi')) {
|
||||||
if (lastPathSegment.contains('ss')) {
|
if (lastPathSegment.contains('ss')) {
|
||||||
RoutePush.bangumiPush(matchNum(lastPathSegment).first, null);
|
RoutePush.bangumiPush(Utils.matchNum(lastPathSegment).first, null);
|
||||||
}
|
}
|
||||||
if (lastPathSegment.contains('ep')) {
|
if (lastPathSegment.contains('ep')) {
|
||||||
RoutePush.bangumiPush(null, matchNum(lastPathSegment).first);
|
RoutePush.bangumiPush(null, Utils.matchNum(lastPathSegment).first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (host.contains('live')) {
|
} else if (host.contains('live')) {
|
||||||
@ -205,9 +205,9 @@ class PiliSchame {
|
|||||||
case 'bangumi':
|
case 'bangumi':
|
||||||
print('番剧');
|
print('番剧');
|
||||||
if (area.startsWith('ep')) {
|
if (area.startsWith('ep')) {
|
||||||
RoutePush.bangumiPush(null, matchNum(area).first);
|
RoutePush.bangumiPush(null, Utils.matchNum(area).first);
|
||||||
} else if (area.startsWith('ss')) {
|
} else if (area.startsWith('ss')) {
|
||||||
RoutePush.bangumiPush(matchNum(area).first, null);
|
RoutePush.bangumiPush(Utils.matchNum(area).first, null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
@ -223,7 +223,7 @@ class PiliSchame {
|
|||||||
break;
|
break;
|
||||||
case 'read':
|
case 'read':
|
||||||
print('专栏');
|
print('专栏');
|
||||||
String id = 'cv${matchNum(query!['id']!).first}';
|
String id = 'cv${Utils.matchNum(query!['id']!).first}';
|
||||||
Get.toNamed('/htmlRender', parameters: {
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
'url': value.dataString!,
|
'url': value.dataString!,
|
||||||
'title': '',
|
'title': '',
|
||||||
@ -239,21 +239,14 @@ class PiliSchame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<int> matchNum(String str) {
|
|
||||||
final RegExp regExp = RegExp(r'\d+');
|
|
||||||
final Iterable<Match> matches = regExp.allMatches(str);
|
|
||||||
|
|
||||||
return matches.map((Match match) => int.parse(match.group(0)!)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _handleEpisodePath(String lastPathSegment, String redirectUrl) {
|
static void _handleEpisodePath(String lastPathSegment, String redirectUrl) {
|
||||||
final String seasonId = _extractIdFromPath(lastPathSegment);
|
final String seasonId = _extractIdFromPath(lastPathSegment);
|
||||||
RoutePush.bangumiPush(null, matchNum(seasonId).first);
|
RoutePush.bangumiPush(null, Utils.matchNum(seasonId).first);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _handleSeasonPath(String lastPathSegment, String redirectUrl) {
|
static void _handleSeasonPath(String lastPathSegment, String redirectUrl) {
|
||||||
final String seasonId = _extractIdFromPath(lastPathSegment);
|
final String seasonId = _extractIdFromPath(lastPathSegment);
|
||||||
RoutePush.bangumiPush(matchNum(seasonId).first, null);
|
RoutePush.bangumiPush(Utils.matchNum(seasonId).first, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String _extractIdFromPath(String lastPathSegment) {
|
static String _extractIdFromPath(String lastPathSegment) {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class UrlUtils {
|
|||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
final response = await dio.get(url);
|
final response = await dio.get(url);
|
||||||
if (response.statusCode == 302) {
|
if (response.statusCode == 302 || response.statusCode == 301) {
|
||||||
redirectUrl = response.headers['location']?.first as String;
|
redirectUrl = response.headers['location']?.first as String;
|
||||||
if (redirectUrl.endsWith('/')) {
|
if (redirectUrl.endsWith('/')) {
|
||||||
redirectUrl = redirectUrl.substring(0, redirectUrl.length - 1);
|
redirectUrl = redirectUrl.substring(0, redirectUrl.length - 1);
|
||||||
|
|||||||
@ -383,4 +383,11 @@ class Utils {
|
|||||||
List<int> randomBytes = generateRandomBytes(minLength, maxLength);
|
List<int> randomBytes = generateRandomBytes(minLength, maxLength);
|
||||||
return base64.encode(randomBytes);
|
return base64.encode(randomBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static List<int> matchNum(String str) {
|
||||||
|
final RegExp regExp = RegExp(r'\d+');
|
||||||
|
final Iterable<Match> matches = regExp.allMatches(str);
|
||||||
|
|
||||||
|
return matches.map((Match match) => int.parse(match.group(0)!)).toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user