feat: Remove certificate check during installation

This commit is contained in:
NaiJi 2023-05-16 16:55:26 -03:00 committed by Inex Code
parent 25eb82c131
commit 0e3e560485
4 changed files with 38 additions and 47 deletions

View file

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

View file

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

View file

@ -1,10 +1,7 @@
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_factory_settings.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/get_it/api_config.dart';
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
import 'package:selfprivacy/logic/models/json/dns_records.dart';
@ -28,13 +25,14 @@ class DnsRecordsCubit
emit(
DnsRecordsState(
dnsState: DnsRecordsStatus.refreshing,
dnsRecords: ApiController.currentDnsProviderApiFactory!
.getDnsProvider()
.getDesiredDnsRecords(
serverInstallationCubit.state.serverDomain?.domainName,
'',
'',
),
dnsRecords: ApiController.currentDnsProviderApiFactory
?.getDnsProvider()
.getDesiredDnsRecords(
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/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/staging_options.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_domain.dart';
@ -436,6 +437,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
emit(TimerState(dataState: dataState, isLoading: true));
final bool isServerWorking = await repository.isHttpServerWorking();
StagingOptions.verifyCertificate = true;
if (isServerWorking) {
bool dkimCreated = true;
@ -758,6 +760,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
void clearAppConfig() {
closeTimer();
ApiController.clearProviderApiFactories();
StagingOptions.verifyCertificate = false;
repository.clearAppConfig();
emit(const ServerInstallationEmpty());
}