From 4c56e372120c467f8c44a36c1c1c77486ed71d3c Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 4 Jan 2026 00:34:12 -0500 Subject: [PATCH] Fix CORS proxy for APK Builder API key requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use Shakespeare's built-in corsProxy config and proxyUrl function instead of hardcoded corsproxy.io which had an incorrect URL format. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/components/AddProviderDialog.tsx | 4 +++- src/lib/nip98.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/AddProviderDialog.tsx b/src/components/AddProviderDialog.tsx index a64228e9..6838cb98 100644 --- a/src/components/AddProviderDialog.tsx +++ b/src/components/AddProviderDialog.tsx @@ -20,6 +20,7 @@ import { import { ExternalFavicon } from '@/components/ExternalFavicon'; import { Link } from 'react-router-dom'; import { useCurrentUser } from '@/hooks/useCurrentUser'; +import { useAppContext } from '@/hooks/useAppContext'; import { requestBuildServerApiKey } from '@/lib/nip98'; interface PresetProvider { @@ -89,6 +90,7 @@ export function AddProviderDialog({ }: AddProviderDialogProps) { const { t } = useTranslation(); const { user } = useCurrentUser(); + const { config } = useAppContext(); const [apiKey, setApiKey] = useState(''); const [accountId, setAccountId] = useState(''); const [organizationId, setOrganizationId] = useState(''); @@ -124,7 +126,7 @@ export function AddProviderDialog({ const result = await requestBuildServerApiKey( user.signer, buildServerUrl.trim(), - preset.proxy ? 'https://corsproxy.io/?' : undefined + preset.proxy ? config.corsProxy : undefined ); setApiKey(result.apiKey); } catch (error) { diff --git a/src/lib/nip98.ts b/src/lib/nip98.ts index 6a9b26bb..cf72fc40 100644 --- a/src/lib/nip98.ts +++ b/src/lib/nip98.ts @@ -3,6 +3,7 @@ * Creates signed events for HTTP authentication */ import type { NostrSigner, NostrEvent } from '@nostrify/nostrify'; +import { proxyUrl } from './proxyUrl'; /** * Create a NIP-98 auth event for HTTP requests @@ -86,7 +87,7 @@ export async function requestBuildServerApiKey( // Make the request (use CORS proxy if provided) const targetUrl = corsProxy - ? `${corsProxy}/${authUrl.replace(/^https?:\/\//, '')}` + ? proxyUrl(corsProxy, authUrl) : authUrl; const response = await fetch(targetUrl, {