Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-22 15:51:22 +08:00
parent 92e5fae29c
commit b9b54ce4f7
34 changed files with 627 additions and 665 deletions

View File

@@ -91,6 +91,17 @@ class _CdnSelectDialogState extends State<CdnSelectDialog> {
void initState() {
_cdnSpeedTest = Pref.cdnSpeedTest;
if (_cdnSpeedTest) {
_dio =
Dio(
BaseOptions(
connectTimeout: const Duration(seconds: 15),
receiveTimeout: const Duration(seconds: 15),
),
)
..options.headers = {
'user-agent': UaType.pc.ua,
'referer': HttpString.baseUrl,
};
final length = CDNService.values.length;
_cdnResList = List.generate(
length,
@@ -156,11 +167,7 @@ class _CdnSelectDialogState extends State<CdnSelectDialog> {
}
}
late final _dio = Dio()
..options.headers = {
'user-agent': UaType.pc.ua,
'referer': HttpString.baseUrl,
};
late final Dio _dio;
Future<void> _measureDownloadSpeed(String url, int index) async {
const maxSize = 8 * 1024 * 1024;