feat: implement self-signed certificate support in API and UI

- Added support for self-signed TLS certificates in the ApiService, allowing configuration based on server settings.
- Introduced a toggle in the ServerConnectionPage to enable or disable trusting self-signed certificates.
- Updated localization files to include new strings for self-signed certificate settings in multiple languages.
- Enhanced the OptimizedStorageService to manage trusted servers based on user preferences for self-signed certificates.
- Improved error handling and logging throughout the affected services to ensure clarity and maintainability.
This commit is contained in:
cogwheel0
2025-10-09 01:49:56 +05:30
parent 10658d076a
commit 259fe3f9f0
27 changed files with 428 additions and 37 deletions

View File

@@ -259,6 +259,14 @@
"advancedSettings": "Erweiterte Einstellungen",
"customHeaders": "Benutzerdefinierte Header",
"customHeadersDescription": "Füge benutzerdefinierte HTTP-Header für Authentifizierung, API-Schlüssel oder spezielle Serveranforderungen hinzu.",
"allowSelfSignedCertificates": "Selbstsignierten Zertifikaten vertrauen",
"@allowSelfSignedCertificates": {
"description": "Schalterbeschriftung zum Zulassen selbstsignierter TLS-Zertifikate für den konfigurierten Server."
},
"allowSelfSignedCertificatesDescription": "Akzeptiere das TLS-Zertifikat dieses Servers auch dann, wenn es selbstsigniert ist. Aktiviere diese Option nur für Server, denen du vertraust.",
"@allowSelfSignedCertificatesDescription": {
"description": "Hilfetext, der die Risiken beim Aktivieren des Schalters für selbstsignierte Zertifikate erklärt."
},
"headerNameEmpty": "Header-Name darf nicht leer sein",
"headerNameTooLong": "Header-Name zu lang (max. 64 Zeichen)",
"headerNameInvalidChars": "Ungültiger Header-Name. Verwende nur Buchstaben, Zahlen und diese Zeichen: !#$&-^_`|~",

View File

@@ -550,6 +550,14 @@
"@customHeaders": {"description": "Section title for adding custom HTTP headers."},
"customHeadersDescription": "Add custom HTTP headers for authentication, API keys, or special server requirements.",
"@customHeadersDescription": {"description": "Helper text explaining use-cases for custom headers."},
"allowSelfSignedCertificates": "Trust self-signed certificates",
"@allowSelfSignedCertificates": {
"description": "Toggle label that allows trusting self-signed TLS certificates for the configured server."
},
"allowSelfSignedCertificatesDescription": "Accept this server's TLS certificate even if it is self-signed. Enable only for servers you trust.",
"@allowSelfSignedCertificatesDescription": {
"description": "Helper text clarifying the risks of enabling the self-signed certificate toggle."
},
"headerNameEmpty": "Header name cannot be empty",
"@headerNameEmpty": {"description": "Validation message for empty header name."},
"headerNameTooLong": "Header name too long (max 64 characters)",

View File

@@ -259,6 +259,14 @@
"advancedSettings": "Paramètres avancés",
"customHeaders": "En-têtes personnalisés",
"customHeadersDescription": "Ajoutez des en-têtes HTTP personnalisés pour l'authentification, les clés API ou des exigences spécifiques du serveur.",
"allowSelfSignedCertificates": "Faire confiance aux certificats auto-signés",
"@allowSelfSignedCertificates": {
"description": "Libellé du commutateur permettant d'autoriser les certificats TLS auto-signés pour le serveur configuré."
},
"allowSelfSignedCertificatesDescription": "Acceptez le certificat TLS de ce serveur même s'il est auto-signé. Activez cette option uniquement pour les serveurs auxquels vous faites confiance.",
"@allowSelfSignedCertificatesDescription": {
"description": "Texte d'aide expliquant les risques liés à l'activation de l'option de certificat auto-signé."
},
"headerNameEmpty": "Le nom de l'en-tête ne peut pas être vide",
"headerNameTooLong": "Nom d'en-tête trop long (max 64 caractères)",
"headerNameInvalidChars": "Nom d'en-tête invalide. Utilisez uniquement des lettres, des chiffres et ces symboles : !#$&-^_`|~",

View File

@@ -259,6 +259,14 @@
"advancedSettings": "Impostazioni avanzate",
"customHeaders": "Header personalizzati",
"customHeadersDescription": "Aggiungi header HTTP personalizzati per autenticazione, chiavi API o requisiti speciali del server.",
"allowSelfSignedCertificates": "Considera attendibili i certificati autofirmati",
"@allowSelfSignedCertificates": {
"description": "Etichetta dell'interruttore che consente i certificati TLS autofirmati per il server configurato."
},
"allowSelfSignedCertificatesDescription": "Accetta il certificato TLS di questo server anche se è autofirmato. Attiva questa opzione solo per server di cui ti fidi.",
"@allowSelfSignedCertificatesDescription": {
"description": "Testo di supporto che chiarisce i rischi dell'attivazione dell'opzione per certificati autofirmati."
},
"headerNameEmpty": "Il nome header non può essere vuoto",
"headerNameTooLong": "Nome header troppo lungo (max 64 caratteri)",
"headerNameInvalidChars": "Nome header non valido. Usa solo lettere, numeri e questi simboli: !#$&-^_`|~",

View File

@@ -1482,6 +1482,18 @@ abstract class AppLocalizations {
/// **'Add custom HTTP headers for authentication, API keys, or special server requirements.'**
String get customHeadersDescription;
/// Toggle label that allows trusting self-signed TLS certificates for the configured server.
///
/// In en, this message translates to:
/// **'Trust self-signed certificates'**
String get allowSelfSignedCertificates;
/// Helper text clarifying the risks of enabling the self-signed certificate toggle.
///
/// In en, this message translates to:
/// **'Accept this server\'s TLS certificate even if it is self-signed. Enable only for servers you trust.'**
String get allowSelfSignedCertificatesDescription;
/// Validation message for empty header name.
///
/// In en, this message translates to:

View File

@@ -760,6 +760,14 @@ class AppLocalizationsDe extends AppLocalizations {
String get customHeadersDescription =>
'Füge benutzerdefinierte HTTP-Header für Authentifizierung, API-Schlüssel oder spezielle Serveranforderungen hinzu.';
@override
String get allowSelfSignedCertificates =>
'Selbstsignierten Zertifikaten vertrauen';
@override
String get allowSelfSignedCertificatesDescription =>
'Akzeptiere das TLS-Zertifikat dieses Servers auch dann, wenn es selbstsigniert ist. Aktiviere diese Option nur für Server, denen du vertraust.';
@override
String get headerNameEmpty => 'Header-Name darf nicht leer sein';

View File

@@ -754,6 +754,13 @@ class AppLocalizationsEn extends AppLocalizations {
String get customHeadersDescription =>
'Add custom HTTP headers for authentication, API keys, or special server requirements.';
@override
String get allowSelfSignedCertificates => 'Trust self-signed certificates';
@override
String get allowSelfSignedCertificatesDescription =>
'Accept this server\'s TLS certificate even if it is self-signed. Enable only for servers you trust.';
@override
String get headerNameEmpty => 'Header name cannot be empty';

View File

@@ -765,6 +765,14 @@ class AppLocalizationsFr extends AppLocalizations {
String get customHeadersDescription =>
'Ajoutez des en-têtes HTTP personnalisés pour l\'authentification, les clés API ou des exigences spécifiques du serveur.';
@override
String get allowSelfSignedCertificates =>
'Faire confiance aux certificats auto-signés';
@override
String get allowSelfSignedCertificatesDescription =>
'Acceptez le certificat TLS de ce serveur même s\'il est auto-signé. Activez cette option uniquement pour les serveurs auxquels vous faites confiance.';
@override
String get headerNameEmpty => 'Le nom de l\'en-tête ne peut pas être vide';

View File

@@ -756,6 +756,14 @@ class AppLocalizationsIt extends AppLocalizations {
String get customHeadersDescription =>
'Aggiungi header HTTP personalizzati per autenticazione, chiavi API o requisiti speciali del server.';
@override
String get allowSelfSignedCertificates =>
'Considera attendibili i certificati autofirmati';
@override
String get allowSelfSignedCertificatesDescription =>
'Accetta il certificato TLS di questo server anche se è autofirmato. Attiva questa opzione solo per server di cui ti fidi.';
@override
String get headerNameEmpty => 'Il nome header non può essere vuoto';