This commit is contained in:
2026-05-20 17:41:19 +05:30
parent b14975dd9b
commit c78b9a16e7

View File

@@ -2,14 +2,18 @@ import { useEffect, useRef, useState } from 'react'
import EndpointCard from './EndpointCard'
import { getTopicIcon } from '../lib/icons'
import { LEGACY_BASE_URL } from '../data/topics'
import { LEGACY_BASE_URL, REST_BASE_URL } from '../data/topics'
const ADMIN_SECRET = 'nearle-admin-secret'
function toProxyPath(fullUrl) {
// Always fetch the full URL directly.
// In dev, route REST through the Vite proxy (/live → jupiter.nearle.app)
// to bypass CORS restrictions on localhost.
if (import.meta.env.DEV && fullUrl.startsWith(REST_BASE_URL)) {
return fullUrl.slice(REST_BASE_URL.length)
}
// Legacy (api.workolik.com): CORS open, admin secret injected in headers.
// REST (jupiter.nearle.app): fetched directly, no proxy needed.
// REST in production: deployed origin is whitelisted by jupiter.nearle.app.
return fullUrl
}