diff --git a/.env b/.env index c47e2e0..3cff513 100644 --- a/.env +++ b/.env @@ -15,7 +15,7 @@ DB_NAME=controlpatente JWT_SECRET=d95810e29f700cb99d3ed6a891ace603522875069ec655887a01629891a38ce8 # Admin password (optional - if not set, a random password will be generated on first run) -# ADMIN_PASSWORD= +# ADMIN_PASSWORD=HnXlU0BtE5-PtQ8n # Allowed origins for CORS (comma-separated) ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:5173,https://demo.v1ru5.cl diff --git a/alpr-service/main.py b/alpr-service/main.py index 6728744..41a4e23 100644 --- a/alpr-service/main.py +++ b/alpr-service/main.py @@ -143,8 +143,16 @@ def send_plate(plate_number): print(f"✗ Error sending plate: {e}") def validate_plate(text): - """Valida formato chileno""" - return bool(re.match(r'^[A-Z]{4}\d{2}$', text) or re.match(r'^[A-Z]{2}\d{4}$', text)) + """Valida formatos de patentes de Chile, Argentina y Brasil""" + # Chile formato nuevo: XXXX00 (4 letras, 2 números) + # Chile formato antiguo: XX0000 (2 letras, 4 números) + # Argentina Mercosur: AA000AA (2 letras, 3 números, 2 letras) + # Brasil Mercosur: AAA0A00 (3 letras, 1 número, 1 letra, 2 números) + chile_new = re.match(r'^[A-Z]{4}\d{2}$', text) + chile_old = re.match(r'^[A-Z]{2}\d{4}$', text) + argentina = re.match(r'^[A-Z]{2}\d{3}[A-Z]{2}$', text) + brasil = re.match(r'^[A-Z]{3}\d[A-Z]\d{2}$', text) + return bool(chile_new or chile_old or argentina or brasil) def ocr_worker(reader, worker_id): """Hilo dedicado para OCR - múltiples workers para mejor rendimiento"""