mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: lint
mod: tweaks opt: publish page Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'constants.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
|
||||
class Api {
|
||||
// 推荐视频
|
||||
|
||||
@@ -63,7 +63,7 @@ class DanmakuHttp {
|
||||
int? pool, // 弹幕池选择(0:普通池 1:字幕池 2:特殊池(代码/BAS弹幕)默认普通池,0)
|
||||
//int? rnd,// 当前时间戳*1000000(若无此项,则发送弹幕冷却时间限制为90s;若有此项,则发送弹幕冷却时间限制为5s)
|
||||
bool? colorful, //60001:专属渐变彩色(需要会员)
|
||||
int? checkbox_type, //是否带 UP 身份标识(0:普通;4:带有标识)
|
||||
int? checkboxType, //是否带 UP 身份标识(0:普通;4:带有标识)
|
||||
// String? csrf,//CSRF Token(位于 Cookie) Cookie 方式必要
|
||||
// String? access_key,// APP 登录 Token APP 方式必要
|
||||
}) async {
|
||||
@@ -84,7 +84,7 @@ class DanmakuHttp {
|
||||
'pool': pool,
|
||||
'rnd': DateTime.now().microsecondsSinceEpoch,
|
||||
'colorful': colorful == true ? 60001 : null,
|
||||
'checkbox_type': checkbox_type,
|
||||
'checkbox_type': checkboxType,
|
||||
'csrf': Accounts.main.csrf,
|
||||
// 'access_key': access_key,
|
||||
}..removeWhere((key, value) => value == null);
|
||||
|
||||
@@ -128,9 +128,10 @@ class Request {
|
||||
..autoUncompress = false; // Http2Adapter没有自动解压, 统一行为
|
||||
// 设置代理
|
||||
if (enableSystemProxy) {
|
||||
client.findProxy = (_) => 'PROXY $systemProxyHost:$systemProxyPort';
|
||||
client.badCertificateCallback =
|
||||
(X509Certificate cert, String host, int port) => true;
|
||||
client
|
||||
..findProxy = ((_) => 'PROXY $systemProxyHost:$systemProxyPort')
|
||||
..badCertificateCallback =
|
||||
(X509Certificate cert, String host, int port) => true;
|
||||
}
|
||||
return client;
|
||||
});
|
||||
|
||||
@@ -86,10 +86,10 @@ class LoginHttp {
|
||||
required String cid,
|
||||
required String tel,
|
||||
// String? deviceTouristId,
|
||||
String? gee_challenge,
|
||||
String? gee_seccode,
|
||||
String? gee_validate,
|
||||
String? recaptcha_token,
|
||||
String? geeChallenge,
|
||||
String? geeSeccode,
|
||||
String? geeValidate,
|
||||
String? recaptchaToken,
|
||||
}) async {
|
||||
int timestamp = DateTime.now().millisecondsSinceEpoch;
|
||||
var data = {
|
||||
@@ -100,16 +100,16 @@ class LoginHttp {
|
||||
'cid': cid,
|
||||
// if (deviceTouristId != null) 'device_tourist_id': deviceTouristId,
|
||||
'disable_rcmd': '0',
|
||||
if (gee_challenge != null) 'gee_challenge': gee_challenge,
|
||||
if (gee_seccode != null) 'gee_seccode': gee_seccode,
|
||||
if (gee_validate != null) 'gee_validate': gee_validate,
|
||||
if (geeChallenge != null) 'gee_challenge': geeChallenge,
|
||||
if (geeSeccode != null) 'gee_seccode': geeSeccode,
|
||||
if (geeValidate != null) 'gee_validate': geeValidate,
|
||||
'local_id': buvid,
|
||||
// https://chinggg.github.io/post/appre/
|
||||
'login_session_id':
|
||||
md5.convert(utf8.encode(buvid + timestamp.toString())).toString(),
|
||||
'mobi_app': 'android_hd',
|
||||
'platform': 'android',
|
||||
if (recaptcha_token != null) 'recaptcha_token': recaptcha_token,
|
||||
if (recaptchaToken != null) 'recaptcha_token': recaptchaToken,
|
||||
's_locale': 'zh_CN',
|
||||
'statistics': Constants.statistics,
|
||||
'tel': tel,
|
||||
@@ -183,10 +183,10 @@ class LoginHttp {
|
||||
required String password,
|
||||
required String key,
|
||||
required String salt,
|
||||
String? gee_challenge,
|
||||
String? gee_seccode,
|
||||
String? gee_validate,
|
||||
String? recaptcha_token,
|
||||
String? geeChallenge,
|
||||
String? geeSeccode,
|
||||
String? geeValidate,
|
||||
String? recaptchaToken,
|
||||
}) async {
|
||||
dynamic publicKey = RSAKeyParser().parse(key);
|
||||
String passwordEncrypted =
|
||||
@@ -209,15 +209,15 @@ class LoginHttp {
|
||||
.base64),
|
||||
'from_pv': 'main.homepage.avatar-nologin.all.click',
|
||||
'from_url': Uri.encodeComponent('bilibili://pegasus/promo'),
|
||||
if (gee_challenge != null) 'gee_challenge': gee_challenge,
|
||||
if (gee_seccode != null) 'gee_seccode': gee_seccode,
|
||||
if (gee_validate != null) 'gee_validate': gee_validate,
|
||||
if (geeChallenge != null) 'gee_challenge': geeChallenge,
|
||||
if (geeSeccode != null) 'gee_seccode': geeSeccode,
|
||||
if (geeValidate != null) 'gee_validate': geeValidate,
|
||||
'local_id': buvid, //LoginUtils.generateBuvid(),
|
||||
'mobi_app': 'android_hd',
|
||||
'password': passwordEncrypted,
|
||||
'permission': 'ALL',
|
||||
'platform': 'android',
|
||||
if (recaptcha_token != null) 'recaptcha_token': recaptcha_token,
|
||||
if (recaptchaToken != null) 'recaptcha_token': recaptchaToken,
|
||||
's_locale': 'zh_CN',
|
||||
'statistics': Constants.statistics,
|
||||
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
|
||||
|
||||
@@ -564,6 +564,6 @@ class MsgHttp {
|
||||
}
|
||||
|
||||
static String getDevId() {
|
||||
return Uuid().v4();
|
||||
return const Uuid().v4();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,9 @@ class RetryInterceptor extends Interceptor {
|
||||
}
|
||||
(options..path = redirectUrl).maxRedirects--;
|
||||
if (status == 303) {
|
||||
options.data = null;
|
||||
options.method = 'GET';
|
||||
options
|
||||
..data = null
|
||||
..method = 'GET';
|
||||
}
|
||||
Request.dio
|
||||
.fetch(options)
|
||||
|
||||
@@ -605,7 +605,7 @@ class UserHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static videoTags({required String bvid}) async {
|
||||
static Future<Map<String, dynamic>> videoTags({required String bvid}) async {
|
||||
var res =
|
||||
await Request().get(Api.videoTags, queryParameters: {'bvid': bvid});
|
||||
if (res.data['code'] == 0) {
|
||||
|
||||
@@ -950,11 +950,11 @@ class VideoHttp {
|
||||
}
|
||||
|
||||
String processList(List list) {
|
||||
final sb = StringBuffer('WEBVTT\n\n');
|
||||
sb.writeAll(
|
||||
list.map((item) =>
|
||||
'${item?['sid'] ?? 0}\n${subtitleTimecode(item['from'])} --> ${subtitleTimecode(item['to'])}\n${item['content'].trim()}'),
|
||||
'\n\n');
|
||||
final sb = StringBuffer('WEBVTT\n\n')
|
||||
..writeAll(
|
||||
list.map((item) =>
|
||||
'${item?['sid'] ?? 0}\n${subtitleTimecode(item['from'])} --> ${subtitleTimecode(item['to'])}\n${item['content'].trim()}'),
|
||||
'\n\n');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user