mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-08 00:51:20 +00:00
refactor: Allow changing values for TLS settings
This commit is contained in:
parent
695b9e0f7c
commit
53e72504f7
|
@ -493,7 +493,7 @@
|
|||
"required": "Required",
|
||||
"already_exist": "Already exists",
|
||||
"invalid_format": "Invalid format",
|
||||
"invalid_format_password": "Must not contain empty characters",
|
||||
"invalid_format_password": "Password must not contain spaces",
|
||||
"invalid_format_ssh": "Must follow the SSH key format",
|
||||
"root_name": "Cannot be 'root'",
|
||||
"length_not_equal": "Length is [], should be {}",
|
||||
|
@ -507,10 +507,12 @@
|
|||
"subtitle": "These settings are for debugging only. Don't change them unless you know what you're doing.",
|
||||
"server_setup": "Server setup",
|
||||
"use_staging_acme": "Use staging ACME server",
|
||||
"use_staging_acme_description": "Rebuild your app to change this value.",
|
||||
"use_staging_acme_description": "Applies when setting up a new server.",
|
||||
"ignore_tls": "Do not verify TLS certificates",
|
||||
"ignore_tls_description": "App will not verify TLS certificates when connecting to the server.",
|
||||
"routing": "App routing",
|
||||
"reset_onboarding": "Reset onboarding switch",
|
||||
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
||||
"cubit_statuses": "Cubit loading statuses"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@
|
|||
"no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...",
|
||||
"dns_provider_bad_key_error": "API ключ неверен",
|
||||
"backblaze_bad_key_error": "Информация о Backblaze хранилище неверна",
|
||||
"connect_to_dns": "Подключите DNS провайдер",
|
||||
"connect_to_dns": "Подключите DNS провайдера",
|
||||
"connect_to_dns_provider_text": "С помощью API токена приложение SelfPrivacy настроит DNS записи",
|
||||
"manage_domain_dns": "Для управления DNS вашего домена",
|
||||
"use_this_domain": "Используем этот домен?",
|
||||
|
@ -472,10 +472,10 @@
|
|||
"required": "Обязательное поле",
|
||||
"already_exist": "Уже существует",
|
||||
"invalid_format": "Неверный формат",
|
||||
"invalid_format_password": "Должен не содержать пустые символы",
|
||||
"invalid_format_password": "Пароль не должен содержать пробелы",
|
||||
"invalid_format_ssh": "Должен следовать формату SSH ключей",
|
||||
"root_name": "Имя пользователя не может быть 'root'",
|
||||
"length_not_equal": "Длина строки [], должна быть равна {}",
|
||||
"length_longer": "Длина строки [], должна быть меньше либо равна {}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'dart:io';
|
|||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:http/io_client.dart';
|
||||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/tls_options.dart';
|
||||
import 'package:selfprivacy/logic/models/message.dart';
|
||||
|
||||
void _logToAppConsole<T>(final T objectToLog) {
|
||||
|
@ -56,7 +56,7 @@ class ResponseLoggingParser extends ResponseParser {
|
|||
abstract class ApiMap {
|
||||
Future<GraphQLClient> getClient() async {
|
||||
IOClient? ioClient;
|
||||
if (StagingOptions.stagingAcme || !StagingOptions.verifyCertificate) {
|
||||
if (TlsOptions.stagingAcme || !TlsOptions.verifyCertificate) {
|
||||
final HttpClient httpClient = HttpClient();
|
||||
httpClient.badCertificateCallback = (
|
||||
final cert,
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:dio/dio.dart';
|
|||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/tls_options.dart';
|
||||
import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||
import 'package:selfprivacy/logic/models/json/digital_ocean_server_info.dart';
|
||||
|
@ -314,7 +314,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
|||
required final String hostName,
|
||||
required final String serverType,
|
||||
}) async {
|
||||
final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false';
|
||||
final String stagingAcme = TlsOptions.stagingAcme ? 'true' : 'false';
|
||||
|
||||
int? dropletId;
|
||||
Response? serverCreateResponse;
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:dio/dio.dart';
|
|||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/volume_provider.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/tls_options.dart';
|
||||
import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||
import 'package:selfprivacy/logic/models/json/hetzner_server_info.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||
|
@ -355,7 +355,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
|||
required final int volumeId,
|
||||
required final String serverType,
|
||||
}) async {
|
||||
final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false';
|
||||
final String stagingAcme = TlsOptions.stagingAcme ? 'true' : 'false';
|
||||
Response? serverCreateResponse;
|
||||
HetznerServerInfo? serverInfo;
|
||||
DioError? hetznerError;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/// Controls staging environment for network
|
||||
class StagingOptions {
|
||||
class TlsOptions {
|
||||
/// Whether we request for staging temprorary certificates.
|
||||
/// Hardcode to 'true' in the middle of testing to not
|
||||
/// get your domain banned by constant certificate renewal
|
||||
///
|
||||
/// If set to 'true', the 'verifyCertificate' becomes useless
|
||||
static bool get stagingAcme => false;
|
||||
static bool stagingAcme = false;
|
||||
|
||||
/// Should we consider CERTIFICATE_VERIFY_FAILED code an error
|
||||
/// For now it's just a global variable and DNS API
|
|
@ -9,7 +9,7 @@ import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart';
|
|||
import 'package:selfprivacy/logic/models/launch_installation_data.dart';
|
||||
import 'package:selfprivacy/logic/providers/provider_settings.dart';
|
||||
import 'package:selfprivacy/logic/providers/providers_controller.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/tls_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';
|
||||
|
@ -407,7 +407,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
emit(TimerState(dataState: dataState, isLoading: true));
|
||||
|
||||
final bool isServerWorking = await repository.isHttpServerWorking();
|
||||
StagingOptions.verifyCertificate = true;
|
||||
TlsOptions.verifyCertificate = true;
|
||||
|
||||
if (isServerWorking) {
|
||||
bool dkimCreated = true;
|
||||
|
@ -757,7 +757,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
void clearAppConfig() {
|
||||
closeTimer();
|
||||
ProvidersController.clearProviders();
|
||||
StagingOptions.verifyCertificate = false;
|
||||
TlsOptions.verifyCertificate = false;
|
||||
repository.clearAppConfig();
|
||||
emit(const ServerInstallationEmpty());
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import 'package:selfprivacy/config/hive_config.dart';
|
|||
import 'package:selfprivacy/logic/models/json/dns_records.dart';
|
||||
import 'package:selfprivacy/logic/providers/provider_settings.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/tls_options.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
||||
|
@ -75,7 +75,7 @@ class ServerInstallationRepository {
|
|||
}
|
||||
|
||||
if (box.get(BNames.hasFinalChecked, defaultValue: false)) {
|
||||
StagingOptions.verifyCertificate = true;
|
||||
TlsOptions.verifyCertificate = true;
|
||||
return ServerInstallationFinished(
|
||||
installationDialoguePopUp: null,
|
||||
providerApiToken: providerApiToken!,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/staging_options.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/tls_options.dart';
|
||||
import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart';
|
||||
import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart';
|
||||
import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart';
|
||||
|
@ -37,8 +37,19 @@ class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
|
|||
title: Text('developer_settings.use_staging_acme'.tr()),
|
||||
subtitle:
|
||||
Text('developer_settings.use_staging_acme_description'.tr()),
|
||||
value: StagingOptions.stagingAcme,
|
||||
onChanged: null,
|
||||
value: TlsOptions.stagingAcme,
|
||||
onChanged: (final bool value) => setState(
|
||||
() => TlsOptions.stagingAcme = value,
|
||||
),
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text('developer_settings.ignore_tls'.tr()),
|
||||
subtitle:
|
||||
Text('developer_settings.ignore_tls_description'.tr()),
|
||||
value: TlsOptions.verifyCertificate,
|
||||
onChanged: (final bool value) => setState(
|
||||
() => TlsOptions.verifyCertificate = value,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
|
|
Loading…
Reference in a new issue