Initial commit

This commit is contained in:
2026-01-14 20:23:10 +06:00
commit 954dd473d1
57 changed files with 8854 additions and 0 deletions

25
frontend/src/config.js Normal file
View File

@@ -0,0 +1,25 @@
// Автоматически определяем API URL
const getApiUrl = () => {
// Если задана переменная окружения, используем её
if (import.meta.env.VITE_API_URL) {
return import.meta.env.VITE_API_URL;
}
// Иначе используем текущий хост с портом 8000
const protocol = window.location.protocol;
const hostname = window.location.hostname;
// Если localhost, используем localhost:8000
if (hostname === 'localhost' || hostname === '127.0.0.1') {
return `${protocol}//localhost:8000`;
}
// Для удаленного доступа используем IP:8000
return `${protocol}//${hostname}:8000`;
};
export const API_URL = getApiUrl();
export const WS_URL = API_URL.replace('http', 'ws');
console.log('API URL:', API_URL);
console.log('WS URL:', WS_URL);