mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-08 00:51:20 +00:00
fix: Hetzner installation issues
- Replace serverType id with locaiton id - Replaces id accessing in volume from .id to [id]
This commit is contained in:
parent
4c2cfca4c4
commit
1e9f1f88a7
|
@ -10,7 +10,6 @@ import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart';
|
|||
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||
import 'package:selfprivacy/logic/models/price.dart';
|
||||
import 'package:selfprivacy/logic/models/server_provider_location.dart';
|
||||
import 'package:selfprivacy/utils/password_generator.dart';
|
||||
|
||||
class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||
|
|
|
@ -175,7 +175,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
await repository.saveServerType(serverType);
|
||||
|
||||
await ProvidersController.currentServerProvider!
|
||||
.trySetServerLocation(serverType.identifier);
|
||||
.trySetServerLocation(serverType.location.identifier);
|
||||
|
||||
emit(
|
||||
(state as ServerInstallationNotFinished).copyWith(
|
||||
|
|
|
@ -172,6 +172,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
return GenericResult(success: true, data: types);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GenericResult<List<ServerBasicInfo>>> getServers() async {
|
||||
final List<ServerBasicInfo> servers = [];
|
||||
final result = await _adapter.api().getServers();
|
||||
|
@ -434,7 +435,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
);
|
||||
}
|
||||
|
||||
final volume = volumeResult.data;
|
||||
final volume = volumeResult.data['volume'];
|
||||
final serverApiToken = StringGenerators.apiToken();
|
||||
final hostname = getHostnameFromDomain(installationData.domainName);
|
||||
|
||||
|
@ -446,7 +447,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
dnsProviderType:
|
||||
dnsProviderToInfectName(installationData.dnsProviderType),
|
||||
hostName: hostname,
|
||||
volumeId: volume.id,
|
||||
volumeId: volume['id'],
|
||||
base64Password: base64.encode(
|
||||
utf8.encode(installationData.rootUser.password ?? 'PASS'),
|
||||
),
|
||||
|
@ -455,7 +456,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
);
|
||||
|
||||
if (!serverResult.success || serverResult.data == null) {
|
||||
await _adapter.api().deleteVolume(volume.id);
|
||||
await _adapter.api().deleteVolume(volume['id']);
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
if (serverResult.message != null &&
|
||||
serverResult.message == 'uniqueness_error') {
|
||||
|
@ -549,7 +550,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
CallbackDialogueChoice(
|
||||
title: 'basis.try_again'.tr(),
|
||||
callback: () async {
|
||||
await _adapter.api().deleteVolume(volume.id);
|
||||
await _adapter.api().deleteVolume(volume['id']);
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
final deletion = await deleteServer(hostname);
|
||||
if (deletion.success) {
|
||||
|
|
Loading…
Reference in a new issue