mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix CORS proxy for APK Builder API key requests
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 <[email protected]>
This commit is contained in:
1 parent
fb6d2cac82
commit
4c56e37212
2 files changed
+5
-2
No files matched your search
@@ -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) {
|
||||
|
||||
+2
-1
@@ -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, {
|
||||
|
||||
Reference in new issue
Block a user