Wanderhalleylee commited on
Commit
eea150d
Β·
verified Β·
1 Parent(s): 6fc19ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -40,7 +40,6 @@ security = HTTPBearer()
40
  def verify_token(credentials: HTTPAuthorizationCredentials = Depends(security)):
41
  """Verifica se o token enviado Γ© vΓ‘lido."""
42
  if not API_TOKEN:
43
- # Se nΓ£o configurou token, aceita qualquer coisa (dev mode)
44
  return True
45
 
46
  if credentials.credentials != API_TOKEN:
@@ -188,7 +187,6 @@ class SessionManager:
188
  for sid in list(self.sessions.keys()):
189
  self.close_session(sid)
190
 
191
-
192
  # ─────────────────────────────────────────────
193
  # INICIALIZAÇÃO DO APP
194
  # ─────────────────────────────────────────────
@@ -258,9 +256,10 @@ class NavigateRequest(BaseModel):
258
 
259
 
260
  # ─────────────────────────────────────────────
261
- # ROTA PÚBLICA: STATUS (sem token)
262
  # ─────────────────────────────────────────────
263
  @app.get("/")
 
264
  async def root():
265
  """Status do servidor (pΓΊblica)."""
266
  return {
@@ -272,6 +271,7 @@ async def root():
272
 
273
 
274
  @app.get("/health")
 
275
  async def health():
276
  """Health check (pΓΊblica)."""
277
  return {"status": "healthy", "timestamp": time.time()}
@@ -460,7 +460,6 @@ async def check_errors(
460
  detail=f"Erro durante a verificaΓ§Γ£o: {str(e)}"
461
  )
462
 
463
-
464
  # ─────────────────────────────────────────────
465
  # ROTA: VERIFICAR ERROS β€” JSON (protegida)
466
  # ─────────────────────────────────────────────
 
40
  def verify_token(credentials: HTTPAuthorizationCredentials = Depends(security)):
41
  """Verifica se o token enviado Γ© vΓ‘lido."""
42
  if not API_TOKEN:
 
43
  return True
44
 
45
  if credentials.credentials != API_TOKEN:
 
187
  for sid in list(self.sessions.keys()):
188
  self.close_session(sid)
189
 
 
190
  # ─────────────────────────────────────────────
191
  # INICIALIZAÇÃO DO APP
192
  # ─────────────────────────────────────────────
 
256
 
257
 
258
  # ─────────────────────────────────────────────
259
+ # ROTAS PÚBLICAS: STATUS (sem token) β€” GET + HEAD
260
  # ─────────────────────────────────────────────
261
  @app.get("/")
262
+ @app.head("/")
263
  async def root():
264
  """Status do servidor (pΓΊblica)."""
265
  return {
 
271
 
272
 
273
  @app.get("/health")
274
+ @app.head("/health")
275
  async def health():
276
  """Health check (pΓΊblica)."""
277
  return {"status": "healthy", "timestamp": time.time()}
 
460
  detail=f"Erro durante a verificaΓ§Γ£o: {str(e)}"
461
  )
462
 
 
463
  # ─────────────────────────────────────────────
464
  # ROTA: VERIFICAR ERROS β€” JSON (protegida)
465
  # ─────────────────────────────────────────────