Skip to content

Commit

Permalink
refact
Browse files Browse the repository at this point in the history
  • Loading branch information
ljleb committed Aug 16, 2023
1 parent d7082bb commit 0ba9f9d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib_comfyui/webui/reverse_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ async def reverse_proxy(request: Request):

async def async_iter_raw_patched(response, proxy_route):
proxy_route_bytes = bytes(proxy_route, "utf-8")
paths_to_replace = [b"/scripts/", b"/extensions/", b"/webui_scripts/"]
replacements = [
(b'/favicon', proxy_route_bytes + b'/favicon'),
*(
(b'from "' + path, b'from "' + proxy_route_bytes + path)
for path in paths_to_replace
),
]

async for chunk in response.aiter_raw():
paths_to_replace = [b"/scripts/", b"/extensions/", b"/webui_scripts/"]
replacements = [
(b'/favicon', proxy_route_bytes + b'/favicon'),
*(
(b'from "' + path, b'from "' + proxy_route_bytes + path)
for path in paths_to_replace
),
]
for substring, replacement in replacements:
chunk = chunk.replace(substring, replacement)
yield chunk
Expand Down

0 comments on commit 0ba9f9d

Please sign in to comment.