mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +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();
|
await _initAccountPrefs();
|
||||||
_initEquatable();
|
_initEquatable();
|
||||||
if (features.isSupportSelfSignedCert) {
|
if (features.isSupportSelfSignedCert) {
|
||||||
_initSelfSignedCertManager();
|
await _initSelfSignedCertManager();
|
||||||
}
|
}
|
||||||
await _initDiContainer(isolateType);
|
await _initDiContainer(isolateType);
|
||||||
_initVisibilityDetector();
|
_initVisibilityDetector();
|
||||||
|
@ -134,8 +134,13 @@ void _initEquatable() {
|
||||||
EquatableConfig.stringify = false;
|
EquatableConfig.stringify = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initSelfSignedCertManager() {
|
Future<void> _initSelfSignedCertManager() async {
|
||||||
SelfSignedCertManager().init();
|
try {
|
||||||
|
return SelfSignedCertManager().init();
|
||||||
|
} catch (e, stackTrace) {
|
||||||
|
_log.shout("[_initSelfSignedCertManager] Failed to load self signed certs",
|
||||||
|
e, stackTrace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initDiContainer(InitIsolateType isolateType) async {
|
Future<void> _initDiContainer(InitIsolateType isolateType) async {
|
||||||
|
|
|
@ -16,14 +16,12 @@ part 'self_signed_cert_manager.g.dart';
|
||||||
class SelfSignedCertManager {
|
class SelfSignedCertManager {
|
||||||
factory SelfSignedCertManager() => _inst;
|
factory SelfSignedCertManager() => _inst;
|
||||||
|
|
||||||
SelfSignedCertManager._() {
|
SelfSignedCertManager._();
|
||||||
_readAllCerts().then((infos) {
|
|
||||||
_whitelist = infos;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void init() {
|
Future<void> init() async {
|
||||||
HttpOverrides.global = _CustomHttpOverrides();
|
HttpOverrides.global = _CustomHttpOverrides();
|
||||||
|
final infos = await _readAllCerts();
|
||||||
|
_whitelist = infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Verify [cert] and return if it's registered in the whitelist for [host]
|
/// Verify [cert] and return if it's registered in the whitelist for [host]
|
||||||
|
|
Loading…
Reference in a new issue