[GH-ISSUE #372] please modify get_notice function to support proxy as in other places. #191

Closed
opened 2026-10-27 21:14:32 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @Rocky0102 on GitHub (Jan 28, 2024).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/372

Here are the verified code:

@server.PromptServer.instance.routes.get("/manager/notice")
async def get_notice(request):
url = "github.com"
path = "/ltdrdata/ltdrdata.github.io/wiki/News"

# conn = http.client.HTTPSConnection(url)
# conn.request("GET", path)

# response = conn.getresponse()

# try:
async with aiohttp.ClientSession(trust_env=True, connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
    async with session.get(f"https://{url}{path}") as response:
        status = response.status  
    
        if response.status == 200:
            # html_content = response.read().decode('utf-8')
            html_content = await response.text()

            pattern = re.compile(r'<div class="markdown-body">([\s\S]*?)</div>')
            match = pattern.search(html_content)

            if match:
                markdown_content = match.group(1)
                markdown_content += f"<HR>ComfyUI: {comfy_ui_revision}[{comfy_ui_hash[:6]}]({comfy_ui_commit_date})"
                # markdown_content += f"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;()"
                markdown_content += f"<BR>Manager: {version_str}"

                try:
                    if required_comfyui_revision > int(comfy_ui_revision):
                        markdown_content = f'<P style="text-align: center; color:red; background-color:white; font-weight:bold">Your ComfyUI is too OUTDATED!!!</P>' + markdown_content
                except:
                    pass

                return web.Response(text=markdown_content, status=200)
            else:
                return web.Response(text="Unable to retrieve Notice", status=200)
        else:
            return web.Response(text="Unable to retrieve Notice", status=200)
# finally:
#     conn.close()
Originally created by @Rocky0102 on GitHub (Jan 28, 2024). Original GitHub issue: https://github.com/Comfy-Org/ComfyUI-Manager/issues/372 Here are the verified code: @server.PromptServer.instance.routes.get("/manager/notice") async def get_notice(request): url = "github.com" path = "/ltdrdata/ltdrdata.github.io/wiki/News" # conn = http.client.HTTPSConnection(url) # conn.request("GET", path) # response = conn.getresponse() # try: async with aiohttp.ClientSession(trust_env=True, connector=aiohttp.TCPConnector(verify_ssl=False)) as session: async with session.get(f"https://{url}{path}") as response: status = response.status if response.status == 200: # html_content = response.read().decode('utf-8') html_content = await response.text() pattern = re.compile(r'<div class="markdown-body">([\s\S]*?)</div>') match = pattern.search(html_content) if match: markdown_content = match.group(1) markdown_content += f"<HR>ComfyUI: {comfy_ui_revision}[{comfy_ui_hash[:6]}]({comfy_ui_commit_date})" # markdown_content += f"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;()" markdown_content += f"<BR>Manager: {version_str}" try: if required_comfyui_revision > int(comfy_ui_revision): markdown_content = f'<P style="text-align: center; color:red; background-color:white; font-weight:bold">Your ComfyUI is too OUTDATED!!!</P>' + markdown_content except: pass return web.Response(text=markdown_content, status=200) else: return web.Response(text="Unable to retrieve Notice", status=200) else: return web.Response(text="Unable to retrieve Notice", status=200) # finally: # conn.close()
Author
Owner

@ltdrdata commented on GitHub (Jan 28, 2024):

This patch is applied.

<!-- gh-comment-id:1913650718 --> @ltdrdata commented on GitHub (Jan 28, 2024): This patch is applied.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#191
No description provided.