Spaces:
Running
Running
Implement One-Time Privacy Notice Modal for HF Spaces - Replace persistent banner with elegant popup that shows once per user
48b8905 | // API configuration with environment support | |
| export const getApiBase = () => { | |
| // In Docker development environment, use the environment variable if available | |
| if (import.meta.env.VITE_API_URL) { | |
| console.log("Using VITE_API_URL:", import.meta.env.VITE_API_URL); | |
| return import.meta.env.VITE_API_URL; | |
| } | |
| // Check if we're in a Docker environment by looking at hostname | |
| if ( | |
| typeof window !== "undefined" && | |
| window.location.hostname !== "localhost" && | |
| window.location.hostname !== "127.0.0.1" | |
| ) { | |
| const dockerApiUrl = `http://${window.location.hostname}:5280/api`; | |
| console.log("Using Docker API URL:", dockerApiUrl); | |
| // If accessing via Docker host IP, try to use the backend port directly | |
| return dockerApiUrl; | |
| } | |
| // Default to proxy for local development | |
| console.log("Using proxy API URL: /api"); | |
| return "/api"; | |
| }; | |
| export const API_BASE = getApiBase(); | |
| // Check if running on Hugging Face Spaces | |
| export const isHuggingFaceSpaces = () => { | |
| if (typeof window === "undefined") return false; | |
| return ( | |
| window.location.hostname.includes("huggingface.co") || | |
| window.location.hostname.includes("hf.space") || | |
| window.location.hostname.endsWith(".hf.space") | |
| ); | |
| }; | |
| export const IS_HF_SPACES = isHuggingFaceSpaces(); | |