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