Merge branch 'main' into feature-updateVideoDetailStructure
This commit is contained in:
@ -95,7 +95,7 @@ class PiliSchame {
|
||||
}
|
||||
}
|
||||
if (scheme == 'https') {
|
||||
_fullPathPush(value);
|
||||
fullPathPush(value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class PiliSchame {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> _fullPathPush(SchemeEntity value) async {
|
||||
static Future<void> fullPathPush(SchemeEntity value) async {
|
||||
// https://m.bilibili.com/bangumi/play/ss39708
|
||||
// https | m.bilibili.com | /bangumi/play/ss39708
|
||||
// final String scheme = value.scheme!;
|
||||
@ -135,8 +135,6 @@ class PiliSchame {
|
||||
Map<String, String>? query = value.query;
|
||||
RegExp regExp = RegExp(r'^((www\.)|(m\.))?bilibili\.com$');
|
||||
if (regExp.hasMatch(host)) {
|
||||
print('bilibili.com host: $host');
|
||||
print('bilibili.com path: $path');
|
||||
final String lastPathSegment = path!.split('/').last;
|
||||
if (path.startsWith('/video')) {
|
||||
Map matchRes = IdUtils.matchAvorBv(input: path);
|
||||
@ -236,6 +234,24 @@ class PiliSchame {
|
||||
print('个人空间');
|
||||
Get.toNamed('/member?mid=$area', arguments: {'face': ''});
|
||||
break;
|
||||
default:
|
||||
final Map<String, dynamic> map =
|
||||
IdUtils.matchAvorBv(input: area.split('?').first);
|
||||
if (map.containsKey('AV')) {
|
||||
_videoPush(map['AV']! as int, null);
|
||||
} else if (map.containsKey('BV')) {
|
||||
_videoPush(null, map['BV'] as String);
|
||||
} else {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': value.dataString ?? "",
|
||||
'type': 'url',
|
||||
'pageTitle': ''
|
||||
},
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ Future imageSaveDialog(context, videoItem, closeFn) {
|
||||
builder: (context) => Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Column(
|
||||
|
@ -2,12 +2,18 @@ import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/pages/dynamics/index.dart';
|
||||
import 'package:pilipala/pages/home/index.dart';
|
||||
import 'package:pilipala/pages/media/index.dart';
|
||||
import 'package:pilipala/pages/mine/index.dart';
|
||||
import 'package:pilipala/utils/cookie.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class LoginUtils {
|
||||
@ -57,4 +63,56 @@ class LoginUtils {
|
||||
String uuid = getUUID() + getUUID();
|
||||
return 'XY${uuid.substring(0, 35).toUpperCase()}';
|
||||
}
|
||||
|
||||
static confirmLogin(url, controller) async {
|
||||
var content = '';
|
||||
if (url != null) {
|
||||
content = '${content + url}; \n';
|
||||
}
|
||||
try {
|
||||
await SetCookie.onSet();
|
||||
final result = await UserHttp.userInfo();
|
||||
if (result['status'] && result['data'].isLogin) {
|
||||
SmartDialog.showToast('登录成功');
|
||||
try {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
if (!userInfoCache.isOpen) {
|
||||
userInfoCache = await Hive.openBox('userInfo');
|
||||
}
|
||||
await userInfoCache.put('userInfoCache', result['data']);
|
||||
|
||||
final HomeController homeCtr = Get.find<HomeController>();
|
||||
homeCtr.updateLoginStatus(true);
|
||||
homeCtr.userFace.value = result['data'].face;
|
||||
final MediaController mediaCtr = Get.find<MediaController>();
|
||||
mediaCtr.mid = result['data'].mid;
|
||||
await LoginUtils.refreshLoginStatus(true);
|
||||
} catch (err) {
|
||||
SmartDialog.show(builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('登录遇到问题'),
|
||||
content: Text(err.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: controller != null
|
||||
? () => controller.reload()
|
||||
: SmartDialog.dismiss,
|
||||
child: const Text('确认'),
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
Get.back();
|
||||
} else {
|
||||
// 获取用户信息失败
|
||||
SmartDialog.showToast(result['msg']);
|
||||
Clipboard.setData(ClipboardData(text: result['msg']));
|
||||
}
|
||||
} catch (e) {
|
||||
SmartDialog.showNotify(msg: e.toString(), notifyType: NotifyType.warning);
|
||||
content = content + e.toString();
|
||||
Clipboard.setData(ClipboardData(text: content));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class UrlUtils {
|
||||
final String bv = matchRes['BV'];
|
||||
final Map res = await SearchHttp.ab2cWithPic(bvid: bv);
|
||||
final int cid = res['cid'];
|
||||
final String pic = res['pic'];
|
||||
final String? pic = res['pic'];
|
||||
final String heroTag = Utils.makeHeroTag(bv);
|
||||
await Get.toNamed(
|
||||
'/video?bvid=$bv&cid=$cid',
|
||||
|
Reference in New Issue
Block a user