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