fix domain connections

This commit is contained in:
2026-01-05 16:30:56 -03:00
parent 82fbc54349
commit db75d2964f
5 changed files with 22 additions and 8 deletions

View File

@@ -79,8 +79,8 @@ services:
- ./frontend:/app - ./frontend:/app
- /app/node_modules - /app/node_modules
environment: environment:
- VITE_API_URL=http://192.168.196.100:3000 - VITE_API_URL=
- VITE_ALPR_STREAM_URL=http://192.168.196.100:5001/video_feed - VITE_ALPR_STREAM_URL=
networks: networks:
backend-net: backend-net:
driver: bridge driver: bridge

View File

@@ -5,7 +5,7 @@ import { Users, CheckCircle, XCircle, Shield, Trash2, Camera, AlertCircle } from
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import LanguageSelector from '../components/LanguageSelector'; import LanguageSelector from '../components/LanguageSelector';
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; const API_URL = import.meta.env.VITE_API_URL || '';
const socket = io(API_URL); const socket = io(API_URL);
function AdminDashboard({ token }) { function AdminDashboard({ token }) {
@@ -268,7 +268,7 @@ function AdminDashboard({ token }) {
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6"> <div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div className="bg-black rounded-xl overflow-hidden aspect-video border border-slate-700 relative"> <div className="bg-black rounded-xl overflow-hidden aspect-video border border-slate-700 relative">
<img <img
src="http://192.168.196.100:5001/video_feed" src="/video_feed"
className="w-full h-full object-cover" className="w-full h-full object-cover"
onError={(e) => e.target.style.display = 'none'} onError={(e) => e.target.style.display = 'none'}
/> />

View File

@@ -4,7 +4,7 @@ import { Lock, User } from 'lucide-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import LanguageSelector from '../components/LanguageSelector'; import LanguageSelector from '../components/LanguageSelector';
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; const API_URL = import.meta.env.VITE_API_URL || '';
function Login({ setToken, setUserRole, setUsername }) { function Login({ setToken, setUserRole, setUsername }) {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -5,7 +5,7 @@ import io from 'socket.io-client';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import LanguageSelector from '../components/LanguageSelector'; import LanguageSelector from '../components/LanguageSelector';
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; const API_URL = import.meta.env.VITE_API_URL || '';
const socket = io(API_URL); const socket = io(API_URL);
function UserDashboard({ token, username }) { function UserDashboard({ token, username }) {
@@ -247,7 +247,7 @@ function UserDashboard({ token, username }) {
</div> </div>
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<span className={`px-2 py-1 rounded text-xs font-bold ${p.status === 'APPROVED' ? 'bg-green-900 text-green-300' : <span className={`px-2 py-1 rounded text-xs font-bold ${p.status === 'APPROVED' ? 'bg-green-900 text-green-300' :
p.status === 'DENIED' ? 'bg-red-900 text-red-300' : 'bg-yellow-900 text-yellow-300' p.status === 'DENIED' ? 'bg-red-900 text-red-300' : 'bg-yellow-900 text-yellow-300'
}`}> }`}>
{p.status === 'APPROVED' ? t('approved') : p.status === 'DENIED' ? t('denied') : t('pending')} {p.status === 'APPROVED' ? t('approved') : p.status === 'DENIED' ? t('denied') : t('pending')}
</span> </span>

View File

@@ -5,6 +5,20 @@ import react from '@vitejs/plugin-react'
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: { server: {
allowedHosts: ['demo.v1ru5.cl'] allowedHosts: ['demo.v1ru5.cl'],
proxy: {
'/api': {
target: 'http://backend:3000',
changeOrigin: true
},
'/socket.io': {
target: 'http://backend:3000',
ws: true
},
'/video_feed': {
target: 'http://alpr-service:5001',
changeOrigin: true
}
}
} }
}) })