feat: 港澳台模式
This commit is contained in:
@ -27,11 +27,13 @@ class Request {
|
||||
late bool enableSystemProxy;
|
||||
late String systemProxyHost;
|
||||
late String systemProxyPort;
|
||||
static final RegExp spmPrefixExp = RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||
static final RegExp spmPrefixExp =
|
||||
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||
|
||||
/// 设置cookie
|
||||
static setCookie() async {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
Box setting = GStrorage.setting;
|
||||
final String cookiePath = await Utils.getCookiePath();
|
||||
final PersistCookieJar cookieJar = PersistCookieJar(
|
||||
ignoreExpires: true,
|
||||
@ -54,7 +56,11 @@ class Request {
|
||||
}
|
||||
}
|
||||
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
|
||||
|
||||
String baseUrlType = 'default';
|
||||
if (setting.get(SettingBoxKey.enableGATMode, defaultValue: false)) {
|
||||
baseUrlType = 'bangumi';
|
||||
}
|
||||
setBaseUrl(type: baseUrlType);
|
||||
try {
|
||||
await buvidActivate();
|
||||
} catch (e) {
|
||||
@ -98,8 +104,7 @@ class Request {
|
||||
List<int>.generate(32, (_) => rand.nextInt(256)) +
|
||||
List<int>.filled(4, 0) +
|
||||
[73, 69, 78, 68] +
|
||||
List<int>.generate(4, (_) => rand.nextInt(256))
|
||||
);
|
||||
List<int>.generate(4, (_) => rand.nextInt(256)));
|
||||
|
||||
String jsonData = json.encode({
|
||||
'3064': 1,
|
||||
@ -110,11 +115,9 @@ class Request {
|
||||
},
|
||||
});
|
||||
|
||||
await Request().post(
|
||||
Api.activateBuvidApi,
|
||||
await Request().post(Api.activateBuvidApi,
|
||||
data: {'payload': jsonData},
|
||||
options: Options(contentType: 'application/json')
|
||||
);
|
||||
options: Options(contentType: 'application/json'));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -303,4 +306,17 @@ class Request {
|
||||
}
|
||||
return headerUa;
|
||||
}
|
||||
|
||||
static setBaseUrl({String type = 'default'}) {
|
||||
switch (type) {
|
||||
case 'default':
|
||||
dio.options.baseUrl = HttpString.apiBaseUrl;
|
||||
break;
|
||||
case 'bangumi':
|
||||
dio.options.baseUrl = HttpString.bangumiBaseUrl;
|
||||
break;
|
||||
default:
|
||||
dio.options.baseUrl = HttpString.apiBaseUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/init.dart';
|
||||
import 'package:pilipala/models/video/play/ao_output.dart';
|
||||
import 'package:pilipala/models/video/play/quality.dart';
|
||||
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||
@ -163,6 +164,14 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
callFn: (bool val) {
|
||||
GlobalData().enablePlayerControlAnimation = val;
|
||||
}),
|
||||
SetSwitchItem(
|
||||
title: '港澳台模式',
|
||||
setKey: SettingBoxKey.enableGATMode,
|
||||
defaultVal: false,
|
||||
callFn: (bool val) {
|
||||
Request.setBaseUrl(type: val ? 'bangumi' : 'default');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认视频画质', style: titleStyle),
|
||||
|
@ -104,6 +104,8 @@ class SettingBoxKey {
|
||||
enablePlayerControlAnimation = 'enablePlayerControlAnimation',
|
||||
// 默认音频输出方式
|
||||
defaultAoOutput = 'defaultAoOutput',
|
||||
// 港澳台模式
|
||||
enableGATMode = 'enableGATMode',
|
||||
|
||||
// youtube 双击快进快退
|
||||
enableQuickDouble = 'enableQuickDouble',
|
||||
|
Reference in New Issue
Block a user