From ec621bf55aefda6649ce49d7ece6065ab2c54368 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 8 Nov 2025 18:04:46 +0000 Subject: feat(mobile): add custom headers configuration in sign-in screen (#2103) * feat(mobile): add custom headers configuration in sign-in screen Add ability for mobile app users to configure custom HTTP headers that are sent with every API request. This enables users to add authentication headers, proxy headers, or other custom headers required by their server setup. Changes: - Add customHeaders field to mobile app settings schema - Create CustomHeadersModal component for managing headers - Update sign-in screen with link to configure custom headers - Modify tRPC provider to merge custom headers with Authorization header The custom headers are stored securely in the app settings and persist across sessions. * fix keyboard * add custom headers to other callsites --------- Co-authored-by: Claude --- apps/mobile/lib/utils.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'apps/mobile/lib/utils.ts') diff --git a/apps/mobile/lib/utils.ts b/apps/mobile/lib/utils.ts index bfb6c9ed..ce729826 100644 --- a/apps/mobile/lib/utils.ts +++ b/apps/mobile/lib/utils.ts @@ -42,3 +42,18 @@ export function condProps( return condition ? { ...acc, ...props } : acc; }, {}); } + +/** + * Build HTTP headers for API requests, merging Authorization and custom headers. + * This ensures all direct HTTP calls (uploads, downloads, health checks) respect + * the user's custom header configuration. + */ +export function buildApiHeaders( + apiKey: string | undefined, + customHeaders: Record = {}, +): Record { + return { + ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}), + ...customHeaders, + }; +} -- cgit v1.2.3-70-g09d2