diff --git a/src/contexts/GitSettingsContext.ts b/src/contexts/GitSettingsContext.ts index ab446f63..92d178cb 100644 --- a/src/contexts/GitSettingsContext.ts +++ b/src/contexts/GitSettingsContext.ts @@ -6,6 +6,7 @@ export interface GitCredential { origin: string; // Full origin URL (e.g., "https://github.com") username: string; password: string; + proxy?: boolean; // Whether to use a proxy for this credential } export interface GitSettings { diff --git a/src/lib/configUtils.ts b/src/lib/configUtils.ts index 54d419c7..fba36e8b 100644 --- a/src/lib/configUtils.ts +++ b/src/lib/configUtils.ts @@ -64,6 +64,7 @@ const gitCredentialSchema = z.object({ origin: z.string(), username: z.string(), password: z.string(), + proxy: z.boolean().optional(), }); // Old format (map of origins to credentials) @@ -283,6 +284,13 @@ export async function readGitSettings(fs: JSRuntimeFS, configPath = '/config'): credentials = convertCredentialsToNewFormat(parsed.credentials); } + // Set default proxy settings if missing + for (const cred of credentials) { + if (!('proxy' in cred)) { + cred.proxy = ['https://github.com', 'https://gitlab.com'].includes(cred.origin); + } + } + return { ...parsed, credentials, diff --git a/src/pages/GitSettings.tsx b/src/pages/GitSettings.tsx index 9e1bb4fe..f09d8010 100644 --- a/src/pages/GitSettings.tsx +++ b/src/pages/GitSettings.tsx @@ -24,6 +24,7 @@ import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Badge } from '@/components/ui/badge'; +import { Checkbox } from '@/components/ui/checkbox'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; import { Card, CardContent } from '@/components/ui/card'; import { Switch } from '@/components/ui/switch'; @@ -48,6 +49,7 @@ interface PresetProvider { origin: string; username: string; tokenURL?: string; + proxy?: boolean; } const PRESET_PROVIDERS: PresetProvider[] = [ @@ -57,6 +59,7 @@ const PRESET_PROVIDERS: PresetProvider[] = [ origin: "https://github.com", username: "git", tokenURL: "https://github.com/settings/tokens", + proxy: true, }, { id: "gitlab", @@ -64,6 +67,7 @@ const PRESET_PROVIDERS: PresetProvider[] = [ origin: "https://gitlab.com", username: "git", tokenURL: "https://gitlab.com/-/user_settings/personal_access_tokens", + proxy: true, }, ]; @@ -173,6 +177,18 @@ function SortableCredentialItem({ credential, onUpdate, onRemove, showDragHandle onChange={(e) => updateCredential({ password: e.target.value })} /> +