feat: Remove certificate check during installation

This commit is contained in:
NaiJi 2023-05-16 16:55:26 -03:00
parent 232699bdb1
commit 4afcedebb7
4 changed files with 38 additions and 47 deletions

View file

@ -111,20 +111,22 @@ class DesecApi extends DnsProviderApi {
final List<dynamic> bulkRecords = []; final List<dynamic> bulkRecords = [];
for (final DnsRecord record in listDnsRecords) { for (final DnsRecord record in listDnsRecords) {
bulkRecords.add( bulkRecords.add(
record.name == null {
? { 'subname': record.name,
'type': record.type, 'type': record.type,
'ttl': record.ttl, 'ttl': record.ttl,
'records': [], 'records': [],
} },
: {
'subname': record.name,
'type': record.type,
'ttl': record.ttl,
'records': [],
},
); );
} }
bulkRecords.add(
{
'subname': 'selector._domainkey',
'type': 'TXT',
'ttl': 18000,
'records': [],
},
);
await client.put(url, data: bulkRecords); await client.put(url, data: bulkRecords);
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
} catch (e) { } catch (e) {
@ -192,18 +194,12 @@ class DesecApi extends DnsProviderApi {
final List<dynamic> bulkRecords = []; final List<dynamic> bulkRecords = [];
for (final DnsRecord record in listDnsRecords) { for (final DnsRecord record in listDnsRecords) {
bulkRecords.add( bulkRecords.add(
record.name == null {
? { 'subname': record.name,
'type': record.type, 'type': record.type,
'ttl': record.ttl, 'ttl': record.ttl,
'records': [extractContent(record)], 'records': [extractContent(record)],
} },
: {
'subname': record.name,
'type': record.type,
'ttl': record.ttl,
'records': [extractContent(record)],
},
); );
} }
await client.post( await client.post(
@ -295,18 +291,12 @@ class DesecApi extends DnsProviderApi {
try { try {
await client.post( await client.post(
url, url,
data: record.name == null data: {
? { 'subname': record.name,
'type': record.type, 'type': record.type,
'ttl': record.ttl, 'ttl': record.ttl,
'records': [extractContent(record)], 'records': [extractContent(record)],
} },
: {
'subname': record.name,
'type': record.type,
'ttl': record.ttl,
'records': [extractContent(record)],
},
); );
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
} catch (e) { } catch (e) {

View file

@ -394,7 +394,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
final String apiToken = StringGenerators.apiToken(); final String apiToken = StringGenerators.apiToken();
final String hostname = getHostnameFromDomain(domainName); final String hostname = getHostnameFromDomain(domainName);
const String infectBranch = 'testing/desec'; const String infectBranch = 'providers/hetzner';
final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false';
final String base64Password = final String base64Password =
base64.encode(utf8.encode(rootUser.password ?? 'PASS')); base64.encode(utf8.encode(rootUser.password ?? 'PASS'));

View file

@ -1,10 +1,7 @@
import 'package:cubit_form/cubit_form.dart'; import 'package:cubit_form/cubit_form.dart';
import 'package:selfprivacy/config/get_it_config.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart';
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
import 'package:selfprivacy/logic/get_it/api_config.dart';
import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart';
import 'package:selfprivacy/logic/models/json/dns_records.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart';
@ -28,13 +25,14 @@ class DnsRecordsCubit
emit( emit(
DnsRecordsState( DnsRecordsState(
dnsState: DnsRecordsStatus.refreshing, dnsState: DnsRecordsStatus.refreshing,
dnsRecords: ApiController.currentDnsProviderApiFactory! dnsRecords: ApiController.currentDnsProviderApiFactory
.getDnsProvider() ?.getDnsProvider()
.getDesiredDnsRecords( .getDesiredDnsRecords(
serverInstallationCubit.state.serverDomain?.domainName, serverInstallationCubit.state.serverDomain?.domainName,
'', '',
'', '',
), ) ??
[],
), ),
); );

View file

@ -10,6 +10,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart';
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart';
import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart';
import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart';
@ -436,6 +437,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
emit(TimerState(dataState: dataState, isLoading: true)); emit(TimerState(dataState: dataState, isLoading: true));
final bool isServerWorking = await repository.isHttpServerWorking(); final bool isServerWorking = await repository.isHttpServerWorking();
StagingOptions.verifyCertificate = true;
if (isServerWorking) { if (isServerWorking) {
bool dkimCreated = true; bool dkimCreated = true;
@ -758,6 +760,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
void clearAppConfig() { void clearAppConfig() {
closeTimer(); closeTimer();
ApiController.clearProviderApiFactories(); ApiController.clearProviderApiFactories();
StagingOptions.verifyCertificate = false;
repository.clearAppConfig(); repository.clearAppConfig();
emit(const ServerInstallationEmpty()); emit(const ServerInstallationEmpty());
} }