diff --git a/backend/__pycache__/jules_engine.cpython-312.pyc b/backend/__pycache__/jules_engine.cpython-312.pyc index e245657..65da142 100644 Binary files a/backend/__pycache__/jules_engine.cpython-312.pyc and b/backend/__pycache__/jules_engine.cpython-312.pyc differ diff --git a/backend/__pycache__/main.cpython-312.pyc b/backend/__pycache__/main.cpython-312.pyc index 326c467..e2682a0 100644 Binary files a/backend/__pycache__/main.cpython-312.pyc and b/backend/__pycache__/main.cpython-312.pyc differ diff --git a/backend/__pycache__/models.cpython-312.pyc b/backend/__pycache__/models.cpython-312.pyc index a1357dc..2a576a9 100644 Binary files a/backend/__pycache__/models.cpython-312.pyc and b/backend/__pycache__/models.cpython-312.pyc differ diff --git a/backend/main.py b/backend/main.py index fb88c85..d91a78e 100644 --- a/backend/main.py +++ b/backend/main.py @@ -28,13 +28,16 @@ # 🛡️ Configuración Maestra (abvetos.com) - Secrets moved to environment variables SECRET_KEY = os.getenv("LVT_SECRET_KEY", "DEVELOPMENT_SECRET_DO_NOT_USE_IN_PROD") +# Pre-encode secret key to bytes to save redundant encoding operations +SECRET_KEY_BYTES = SECRET_KEY.encode() PATENT = "PCT/EP2025/067317" def verify_auth(user_id: str, token: str) -> bool: try: ts, sig = token.split('.') if int(time.time()) - int(ts) > 600: return False # Ventana 10 min - expected = hmac.new(SECRET_KEY.encode(), f"{user_id}:{ts}".encode(), hashlib.sha256).hexdigest() + # Optimization: Use pre-encoded SECRET_KEY_BYTES + expected = hmac.new(SECRET_KEY_BYTES, f"{user_id}:{ts}".encode(), hashlib.sha256).hexdigest() return hmac.compare_digest(sig, expected) except: return False @@ -50,7 +53,7 @@ def calculate_fit(user_waist: float, item_id: str): return is_perfect, round(fit_index, 3), item @app.post("/api/recommend") -async def recommend_garment(scan: UserScan, garment_id: str = "BALMAIN_SS26_SLIM"): +def recommend_garment(scan: UserScan, garment_id: str = "BALMAIN_SS26_SLIM"): # 1. Seguridad y Handshake if not verify_auth(scan.user_id, scan.token): raise HTTPException(status_code=403, detail="Acceso restringido al búnker.") diff --git a/backend/tests/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc b/backend/tests/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc index 8ee3541..a36d1de 100644 Binary files a/backend/tests/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc and b/backend/tests/__pycache__/test_main.cpython-312-pytest-9.0.2.pyc differ diff --git a/js/main.js b/js/main.js index 56a1cb6..fbf12bc 100644 --- a/js/main.js +++ b/js/main.js @@ -35,6 +35,12 @@ class TryOnYouBunker { this.selectedGarmentId = "BALMAIN_SS26_SLIM"; this.version = "11.0.0"; this.biometricAnalyzer = new MediaPipeBiometricAnalyzer(); + // Performance: Cache frequently accessed DOM elements + this.dom = { + resultContainer: document.getElementById('jules-result'), + resultText: document.getElementById('recommendation-text'), + submitBtn: null // Assigned in handleDivineoExecution for contextual accuracy if needed + }; this.shopifyInventory = { "BALMAIN_SS26_SLIM": { "name": "Balmain Slim-Fit Jeans", @@ -111,9 +117,13 @@ class TryOnYouBunker { const formData = new FormData(event.target); const eventType = formData.get('event_type'); - const resultContainer = document.getElementById('jules-result'); - const resultText = document.getElementById('recommendation-text'); - const submitBtn = event.target.querySelector('button[type="submit"]'); + // Performance: Re-use cached DOM or cache it once + const resultContainer = this.dom.resultContainer; + const resultText = this.dom.resultText; + if (!this.dom.submitBtn) { + this.dom.submitBtn = event.target.querySelector('button[type="submit"]'); + } + const submitBtn = this.dom.submitBtn; try { submitBtn.innerHTML = ' EXECUTING DIVINEO TOTALITY...'; @@ -211,11 +221,13 @@ class TryOnYouBunker { } applyLuxuryTransitions() { - const observer = new IntersectionObserver((entries) => { + const observer = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.opacity = '1'; entry.target.style.transform = 'translateY(0)'; + // Performance: Unobserve after transition to save resources + observer.unobserve(entry.target); } }); }, { threshold: 0.1 });