From b0b9eee5c825e84da348dbb7deaf2c2f215ee020 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Fri, 30 Jan 2026 16:49:59 +0000 Subject: [PATCH] selfisgned --- .../src-tauri/src/state/connection_state.rs | 2 ++ .../SetupWizard/ServerSelection.tsx | 22 +++++++++++++++++-- .../desktop/services/connectionModeService.ts | 5 ++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/frontend/src-tauri/src/state/connection_state.rs b/frontend/src-tauri/src/state/connection_state.rs index 61db28cbeb..116465f588 100644 --- a/frontend/src-tauri/src/state/connection_state.rs +++ b/frontend/src-tauri/src/state/connection_state.rs @@ -11,6 +11,8 @@ pub enum ConnectionMode { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ServerConfig { pub url: String, + #[serde(default)] + pub allow_invalid_certs: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx b/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx index 091c01d1e9..fff841a795 100644 --- a/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx +++ b/frontend/src/desktop/components/SetupWizard/ServerSelection.tsx @@ -69,11 +69,28 @@ export const ServerSelection: React.FC = ({ onSelect, load console.log('[ServerSelection] ✅ Connection test successful'); + // Check if the connection requires accepting invalid certificates + const allowInvalidCerts = testResult.requiresInvalidCertAcceptance || false; + if (allowInvalidCerts) { + console.warn('[ServerSelection] ⚠️ Server uses self-signed/invalid certificate - will accept for all requests'); + } + // Fetch OAuth providers and check if login is enabled const enabledProviders: SSOProviderConfig[] = []; try { console.log('[ServerSelection] Fetching login configuration...'); - const response = await fetch(`${url}/api/v1/proprietary/ui-data/login`); + + // Prepare fetch options with danger mode if needed + const fetchOptions: any = {}; + if (allowInvalidCerts) { + fetchOptions.danger = { + acceptInvalidCerts: true, + acceptInvalidHostnames: true, + }; + console.debug('[ServerSelection] Using danger mode for login config fetch'); + } + + const response = await fetch(`${url}/api/v1/proprietary/ui-data/login`, fetchOptions); // Check if security is disabled (status 403, 401, or 404 - endpoint doesn't exist) if (!response.ok) { @@ -147,11 +164,12 @@ export const ServerSelection: React.FC = ({ onSelect, load return; } - // Connection successful - pass URL and OAuth providers + // Connection successful - pass URL, OAuth providers, and cert settings console.log('[ServerSelection] ✅ Server selection complete, proceeding to login'); onSelect({ url, enabledOAuthProviders: enabledProviders.length > 0 ? enabledProviders : undefined, + allow_invalid_certs: allowInvalidCerts, }); } catch (error) { console.error('[ServerSelection] ❌ Unexpected error during connection test:', error); diff --git a/frontend/src/desktop/services/connectionModeService.ts b/frontend/src/desktop/services/connectionModeService.ts index 5f5101bd4e..7c72792ba7 100644 --- a/frontend/src/desktop/services/connectionModeService.ts +++ b/frontend/src/desktop/services/connectionModeService.ts @@ -12,6 +12,7 @@ export interface SSOProviderConfig { export interface ServerConfig { url: string; enabledOAuthProviders?: SSOProviderConfig[]; + allow_invalid_certs?: boolean; } export interface ConnectionConfig { @@ -31,6 +32,7 @@ export interface ConnectionTestResult { error?: string; errorCode?: string; diagnostics?: DiagnosticResult[]; + requiresInvalidCertAcceptance?: boolean; } export class ConnectionModeService { @@ -256,10 +258,11 @@ export class ConnectionModeService { console.log(`[ConnectionModeService] ✅ CONNECTION SUCCESSFUL (with certificate bypass)`); console.log(`[ConnectionModeService] Protocol: HTTPS with certificate validation disabled`); console.log(`[ConnectionModeService] Duration: ${stage2Result.duration}ms`); - console.log(`[ConnectionModeService] Note: Server has missing intermediate certificate or invalid cert`); + console.log(`[ConnectionModeService] Note: Server has self-signed or invalid certificate - allowing connection`); console.log(`[ConnectionModeService] ==================== DIAGNOSTIC SESSION END ====================`); return { success: true, + requiresInvalidCertAcceptance: true, diagnostics, }; }