Bug fixing and debugs (#5704)

Co-authored-by: ConnorYoh <[email protected]>
This commit is contained in:
Anthony Stirling
2026-02-11 18:43:29 +00:00
committed by GitHub
co-authored by ConnorYoh
parent 5df466266a
commit f9d2f36ab7
20 changed files with 385 additions and 54 deletions
@@ -91,7 +91,11 @@ export const DesktopOAuthButtons: React.FC<DesktopOAuthButtonsProps> = ({
(id as KnownProviderId) in providerConfig;
const GENERIC_PROVIDER_ICON = 'oidc.svg';
console.log('[DesktopOAuthButtons] Received providers:', providers);
console.log('[DesktopOAuthButtons] Mode:', mode, 'Server URL:', serverUrl);
if (providers.length === 0) {
console.warn('[DesktopOAuthButtons] No providers to display, returning null');
return null;
}
@@ -43,6 +43,14 @@ export const SelfHostedLoginScreen: React.FC<SelfHostedLoginScreenProps> = ({
// Check if username/password authentication is allowed
const isUserPassAllowed = loginMethod === 'all' || loginMethod === 'normal';
console.log('[SelfHostedLoginScreen] Props:', {
serverUrl,
enabledOAuthProviders,
loginMethod,
isUserPassAllowed,
shouldShowOAuth: !!(enabledOAuthProviders && enabledOAuthProviders.length > 0)
});
const handleSubmit = async () => {
// Validation
if (!username.trim()) {
@@ -116,9 +116,12 @@ export const ServerSelection: React.FC<ServerSelectionProps> = ({ onSelect, load
// Extract provider IDs from authorization URLs
// Example: "/oauth2/authorization/google" → "google"
const providerEntries = Object.entries(data.providerList || {});
console.log('[ServerSelection] providerList from API:', data.providerList);
providerEntries.forEach(([path, label]) => {
const id = path.split('/').pop();
console.log('[ServerSelection] Processing provider path:', path, '→ id:', id);
if (!id) {
console.warn('[ServerSelection] Skipping provider with empty id:', path);
return;
}
@@ -130,6 +133,7 @@ export const ServerSelection: React.FC<ServerSelectionProps> = ({ onSelect, load
});
console.log('[ServerSelection] ✅ Detected OAuth providers:', enabledProviders);
console.log('[ServerSelection] Login method:', loginMethod);
} catch (err) {
console.error('[ServerSelection] ❌ Failed to fetch login configuration:', err);
@@ -100,6 +100,9 @@ export const SetupWizard: React.FC<SetupWizardProps> = ({ onComplete }) => {
};
const handleServerSelection = (config: ServerConfig) => {
console.log('[SetupWizard] Server selected:', config);
console.log('[SetupWizard] OAuth providers:', config.enabledOAuthProviders);
console.log('[SetupWizard] Login method:', config.loginMethod);
setServerConfig(config);
setError(null);
setSelfHostedMfaCode('');
@@ -283,7 +286,44 @@ export const SetupWizard: React.FC<SetupWizardProps> = ({ onComplete }) => {
const currentConfig = await connectionModeService.getCurrentConfig();
if (currentConfig.lock_connection_mode && currentConfig.server_config?.url) {
setLockConnectionMode(true);
setServerConfig(currentConfig.server_config);
// Re-fetch OAuth providers for the saved server URL
const savedUrl = currentConfig.server_config.url.replace(/\/+$/, ''); // Remove trailing slashes
let updatedConfig = { ...currentConfig.server_config };
try {
console.log('[SetupWizard] Re-fetching OAuth providers for saved server:', savedUrl);
const response = await fetch(`${savedUrl}/api/v1/proprietary/ui-data/login`);
if (response.ok) {
const data = await response.json();
const enabledProviders: any[] = [];
const providerEntries = Object.entries(data.providerList || {});
providerEntries.forEach(([path, label]) => {
const id = path.split('/').pop();
if (id) {
enabledProviders.push({
id,
path,
label: typeof label === 'string' ? label : undefined,
});
}
});
updatedConfig = {
...updatedConfig,
enabledOAuthProviders: enabledProviders.length > 0 ? enabledProviders : undefined,
loginMethod: data.loginMethod || 'all',
};
console.log('[SetupWizard] Updated config with OAuth providers:', updatedConfig);
}
} catch (err) {
console.error('[SetupWizard] Failed to re-fetch OAuth providers:', err);
}
setServerConfig(updatedConfig);
setActiveStep(SetupStep.SelfHostedLogin);
}
};