Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/allow userinfo anoymos #499

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion server/auth/cors_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ async def dispatch(self, request: Request, call_next: Callable[[Request], Awaita
def mutate_cors_headers(self, request: Request, response: Response):
requested_origin = request.headers.get('origin')
headers = response.headers

headers["Access-Control-Allow-Origin"] = requested_origin
return headers
5 changes: 3 additions & 2 deletions server/auth/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
]

ANONYMOUS_USER_ALLOW_LIST = [
"/api/auth/userinfo",
"/api/chat/qa",
"/api/chat/stream_qa",
]
Expand Down Expand Up @@ -52,8 +53,8 @@

async def dispatch(self, request: Request, call_next: Callable[[Request], Awaitable[Response]]) -> Response:
try:
if ENVRIMENT == "development":
return await call_next(request)
# if ENVRIMENT == "development":

Check warning on line 56 in server/auth/middleware.py

View check run for this annotation

Codecov / codecov/patch

server/auth/middleware.py#L56

Added line #L56 was not covered by tests
# return await call_next(request)

# Auth 相关的直接放过
if request.url.path.startswith("/api/auth"):
Expand Down