Skip to content

Commit

Permalink
fix🐛: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
moxun33 committed Sep 21, 2024
1 parent e9a37ba commit 8d5b12c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/pages/home/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ class HomeController extends GetxController with WindowListener {
return;
}
tip = '正在打开 ${item.name ?? ''}';
update();
playerConfig();

playerConfig();
update();
player.media = url;
player.state = PlaybackState.playing;
player.updateTexture();
Expand Down Expand Up @@ -241,7 +241,6 @@ class HomeController extends GetxController with WindowListener {
switch (e.category) {
case 'reader.buffering':
tip = value < 100 ? '缓冲 $value%' : '';

break;
case 'render.video':
if (value > 0) {
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/playlist/playlist_check_req.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class PlaylistCheckReq {
final res = {};

try {
if (!url.startsWith('http')) {
res['status'] = 400;
return res;
}
final uri = Uri.parse(url);
final pingRes =
await Ping(uri.host, count: 1, forceCodepage: true).stream.first;
Expand Down
20 changes: 19 additions & 1 deletion lib/utils/playlist/playlist_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,27 @@ class PlaylistUtil {
return groupBy(list, (e) => e.group ?? "未分组");
}

// realtime url
bool isRtUrl(String url) {
const protols = [
'rtmp',
'rtsp',
'rtp',
'rtmpt',
'rtmpt',
'rtmps',
'gopher',
'mms'
];
if (protols.contains(url.split('://')[0])) {
return true;
}
return false;
}

//检查是否为真实有效的url
bool validateUrl(String url) {
return Uri.tryParse(url)?.origin.isNotEmpty ?? false;
return Uri.tryParse(url)?.origin.isNotEmpty ?? isRtUrl(url);
}

Future<Map> checkUrlAccessible(String url, CancelToken cancelToken) async {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.8.3
version: 0.8.4

environment:
sdk: ">=2.17.0 <3.0.0"
Expand Down

0 comments on commit 8d5b12c

Please sign in to comment.