fix: pve cert ignore (#317)

This commit is contained in:
lollipopkit
2024-04-09 08:54:00 +08:00
parent 991d91b636
commit fbc6f6e887
5 changed files with 39 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:computer/computer.dart';
import 'package:dio/dio.dart';
@@ -38,8 +39,16 @@ final class PveProvider extends ChangeNotifier {
late final _ignoreCert = spi.custom?.pveIgnoreCert ?? false;
late final session = Dio()
..httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
final client = HttpClient();
if (_ignoreCert) {
client.badCertificateCallback = (_, __, ___) => true;
}
return client;
},
validateCertificate: _ignoreCert ? (_, __, ___) => true : null,
);
final data = ValueNotifier<PveRes?>(null);
bool get onlyOneNode => data.value?.nodes.length == 1;
String? release;