fix: Server installation fixes

This commit is contained in:
Inex Code 2024-07-30 19:15:27 +03:00
parent efed52f3ec
commit acf2001c12
4 changed files with 13 additions and 9 deletions

View file

@ -21,7 +21,6 @@ class AddServerProviderToExistingServerFormCubit extends FormCubit {
@override
FutureOr<void> onSubmit() async {
// serverInstallationCubit.setServerProviderKey(apiKey.state.value);
setServerProviderKey(apiKey.state.value);
}

View file

@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:hive/hive.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:selfprivacy/config/get_it_config.dart';
@ -264,7 +263,7 @@ class ServerInstallationRepository {
if (result.success && result.data != null) {
server.copyWith(startTime: result.data);
} else {
getIt<NavigationService>().showSnackBar('jobs.reboot_failed'.tr());
// getIt<NavigationService>().showSnackBar('jobs.reboot_failed'.tr());
}
return server;

View file

@ -409,7 +409,9 @@ class DigitalOceanServerProvider extends ServerProvider {
final String location,
) async {
final bool apiInitialized = _adapter.api().isWithToken;
if (!apiInitialized) {
final String token = _adapter._api.token;
if (!apiInitialized || token.isEmpty) {
return GenericResult(
success: true,
data: false,
@ -417,10 +419,11 @@ class DigitalOceanServerProvider extends ServerProvider {
);
}
// _adapter = ApiAdapter(
// isWithToken: true,
// region: location,
// );
_adapter = ApiAdapter(
isWithToken: true,
region: location,
token: token,
);
return success;
}

View file

@ -428,7 +428,8 @@ class HetznerServerProvider extends ServerProvider {
final String location,
) async {
final bool apiInitialized = _adapter.api().isWithToken;
if (!apiInitialized) {
final String token = _adapter._api.token;
if (!apiInitialized || token.isEmpty) {
return GenericResult(
success: true,
data: false,
@ -439,7 +440,9 @@ class HetznerServerProvider extends ServerProvider {
_adapter = ApiAdapter(
isWithToken: true,
region: location,
token: token,
);
return success;
}