Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,14 +16,14 @@ from constants import (
|
|
| 16 |
from fastapi.middleware.cors import CORSMiddleware
|
| 17 |
from fastapi.staticfiles import StaticFiles
|
| 18 |
import os
|
| 19 |
-
|
| 20 |
|
| 21 |
GOOGLE_CLIENT_ID = OAUTH_GOOGLE_CLIENT_ID
|
| 22 |
GOOGLE_CLIENT_SECRET = OAUTH_GOOGLE_CLIENT_SECRET
|
| 23 |
GOOGLE_REDIRECT_URI = f"{CHAINLIT_URL}/auth/oauth/google/callback"
|
| 24 |
|
| 25 |
app = FastAPI()
|
| 26 |
-
|
| 27 |
app.add_middleware(
|
| 28 |
CORSMiddleware,
|
| 29 |
allow_origins=["*"], # Update with appropriate origins
|
|
@@ -179,7 +179,8 @@ async def post_signin(request: Request):
|
|
| 179 |
user_info = get_user_info_from_cookie(request)
|
| 180 |
if not user_info:
|
| 181 |
user_info = get_user_info(request)
|
| 182 |
-
if user_info and user_info.get("google_signed_in"):
|
|
|
|
| 183 |
username = user_info["email"]
|
| 184 |
role = get_user_role(username)
|
| 185 |
jwt_token = request.cookies.get("X-User-Info")
|
|
@@ -234,4 +235,4 @@ mount_chainlit(app=app, target="main.py", path=CHAINLIT_PATH)
|
|
| 234 |
if __name__ == "__main__":
|
| 235 |
import uvicorn
|
| 236 |
|
| 237 |
-
uvicorn.run(app, host="
|
|
|
|
| 16 |
from fastapi.middleware.cors import CORSMiddleware
|
| 17 |
from fastapi.staticfiles import StaticFiles
|
| 18 |
import os
|
| 19 |
+
|
| 20 |
|
| 21 |
GOOGLE_CLIENT_ID = OAUTH_GOOGLE_CLIENT_ID
|
| 22 |
GOOGLE_CLIENT_SECRET = OAUTH_GOOGLE_CLIENT_SECRET
|
| 23 |
GOOGLE_REDIRECT_URI = f"{CHAINLIT_URL}/auth/oauth/google/callback"
|
| 24 |
|
| 25 |
app = FastAPI()
|
| 26 |
+
app.mount("/public", StaticFiles(directory="public"), name="public")
|
| 27 |
app.add_middleware(
|
| 28 |
CORSMiddleware,
|
| 29 |
allow_origins=["*"], # Update with appropriate origins
|
|
|
|
| 179 |
user_info = get_user_info_from_cookie(request)
|
| 180 |
if not user_info:
|
| 181 |
user_info = get_user_info(request)
|
| 182 |
+
# if user_info and user_info.get("google_signed_in"):
|
| 183 |
+
if user_info:
|
| 184 |
username = user_info["email"]
|
| 185 |
role = get_user_role(username)
|
| 186 |
jwt_token = request.cookies.get("X-User-Info")
|
|
|
|
| 235 |
if __name__ == "__main__":
|
| 236 |
import uvicorn
|
| 237 |
|
| 238 |
+
uvicorn.run(app, host="127.0.0.1", port=7860)
|