deploy: update habadashi_login
Browse files
app.py
CHANGED
|
@@ -8,6 +8,16 @@ import os
|
|
| 8 |
import sys
|
| 9 |
import time
|
| 10 |
import traceback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
from pathlib import Path
|
| 12 |
from fastapi import FastAPI, Request, Depends, HTTPException
|
| 13 |
from fastapi.responses import RedirectResponse, JSONResponse
|
|
@@ -168,8 +178,6 @@ def get_current_user(request: Request):
|
|
| 168 |
"""Verify token from cookie and fetch user profile"""
|
| 169 |
token = request.cookies.get("sb_access_token")
|
| 170 |
|
| 171 |
-
print(f"[AUTH_CHECK] Token present: {bool(token)}")
|
| 172 |
-
|
| 173 |
if not token:
|
| 174 |
return None
|
| 175 |
|
|
@@ -192,7 +200,6 @@ def get_current_user(request: Request):
|
|
| 192 |
"org_name": (profile_data.get("organizations") or {}).get("name")
|
| 193 |
}
|
| 194 |
|
| 195 |
-
print(f"[AUTH_CHECK] Success: user={user_dict['email']} role={user_dict['role']}")
|
| 196 |
return user_dict
|
| 197 |
|
| 198 |
except Exception as e:
|
|
@@ -328,6 +335,4 @@ if __name__ == "__main__":
|
|
| 328 |
import uvicorn
|
| 329 |
port = int(os.environ.get("PORT", 7860))
|
| 330 |
print(f"[ENTRYPOINT] Starting uvicorn on 0.0.0.0:{port}")
|
| 331 |
-
|
| 332 |
-
log_config["loggers"]["uvicorn.access"]["level"] = "WARNING"
|
| 333 |
-
uvicorn.run(app, host="0.0.0.0", port=port, log_level="info", log_config=log_config)
|
|
|
|
| 8 |
import sys
|
| 9 |
import time
|
| 10 |
import traceback
|
| 11 |
+
import logging
|
| 12 |
+
|
| 13 |
+
class _SuppressGet200Filter(logging.Filter):
|
| 14 |
+
def filter(self, record):
|
| 15 |
+
msg = record.getMessage()
|
| 16 |
+
if '"GET ' in msg and '" 200' in msg:
|
| 17 |
+
return False
|
| 18 |
+
return True
|
| 19 |
+
|
| 20 |
+
logging.getLogger("uvicorn.access").addFilter(_SuppressGet200Filter())
|
| 21 |
from pathlib import Path
|
| 22 |
from fastapi import FastAPI, Request, Depends, HTTPException
|
| 23 |
from fastapi.responses import RedirectResponse, JSONResponse
|
|
|
|
| 178 |
"""Verify token from cookie and fetch user profile"""
|
| 179 |
token = request.cookies.get("sb_access_token")
|
| 180 |
|
|
|
|
|
|
|
| 181 |
if not token:
|
| 182 |
return None
|
| 183 |
|
|
|
|
| 200 |
"org_name": (profile_data.get("organizations") or {}).get("name")
|
| 201 |
}
|
| 202 |
|
|
|
|
| 203 |
return user_dict
|
| 204 |
|
| 205 |
except Exception as e:
|
|
|
|
| 335 |
import uvicorn
|
| 336 |
port = int(os.environ.get("PORT", 7860))
|
| 337 |
print(f"[ENTRYPOINT] Starting uvicorn on 0.0.0.0:{port}")
|
| 338 |
+
uvicorn.run(app, host="0.0.0.0", port=port, log_level="info")
|
|
|
|
|
|