mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 08:46:18 +01:00
Now wait until self signed certs are loaded during init
This commit is contained in:
parent
e573837b7b
commit
c576b917e1
2 changed files with 12 additions and 9 deletions
|
@ -69,7 +69,7 @@ Future<void> init(InitIsolateType isolateType) async {
|
|||
await _initAccountPrefs();
|
||||
_initEquatable();
|
||||
if (features.isSupportSelfSignedCert) {
|
||||
_initSelfSignedCertManager();
|
||||
await _initSelfSignedCertManager();
|
||||
}
|
||||
await _initDiContainer(isolateType);
|
||||
_initVisibilityDetector();
|
||||
|
@ -134,8 +134,13 @@ void _initEquatable() {
|
|||
EquatableConfig.stringify = false;
|
||||
}
|
||||
|
||||
void _initSelfSignedCertManager() {
|
||||
SelfSignedCertManager().init();
|
||||
Future<void> _initSelfSignedCertManager() async {
|
||||
try {
|
||||
return SelfSignedCertManager().init();
|
||||
} catch (e, stackTrace) {
|
||||
_log.shout("[_initSelfSignedCertManager] Failed to load self signed certs",
|
||||
e, stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _initDiContainer(InitIsolateType isolateType) async {
|
||||
|
|
|
@ -16,14 +16,12 @@ part 'self_signed_cert_manager.g.dart';
|
|||
class SelfSignedCertManager {
|
||||
factory SelfSignedCertManager() => _inst;
|
||||
|
||||
SelfSignedCertManager._() {
|
||||
_readAllCerts().then((infos) {
|
||||
_whitelist = infos;
|
||||
});
|
||||
}
|
||||
SelfSignedCertManager._();
|
||||
|
||||
void init() {
|
||||
Future<void> init() async {
|
||||
HttpOverrides.global = _CustomHttpOverrides();
|
||||
final infos = await _readAllCerts();
|
||||
_whitelist = infos;
|
||||
}
|
||||
|
||||
/// Verify [cert] and return if it's registered in the whitelist for [host]
|
||||
|
|
Loading…
Reference in a new issue