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