fix: /manager/notice

https://github.com/ltdrdata/ComfyUI-Manager/issues/372
This commit is contained in:
Dr.Lt.Data 2024-01-29 01:22:41 +09:00
parent a972a74df5
commit d41b43fd12

View File

@ -29,7 +29,7 @@ except:
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.") print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
version = [2, 5, 1] version = [2, 5, 2]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
print(f"### Loading: ComfyUI-Manager ({version_str})") print(f"### Loading: ComfyUI-Manager ({version_str})")
@ -1833,14 +1833,11 @@ async def get_notice(request):
url = "github.com" url = "github.com"
path = "/ltdrdata/ltdrdata.github.io/wiki/News" path = "/ltdrdata/ltdrdata.github.io/wiki/News"
conn = http.client.HTTPSConnection(url) async with aiohttp.ClientSession(trust_env=True, connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
conn.request("GET", path) async with session.get(f"https://{url}{path}") as response:
response = conn.getresponse()
try:
if response.status == 200: if response.status == 200:
html_content = response.read().decode('utf-8') # html_content = response.read().decode('utf-8')
html_content = await response.text()
pattern = re.compile(r'<div class="markdown-body">([\s\S]*?)</div>') pattern = re.compile(r'<div class="markdown-body">([\s\S]*?)</div>')
match = pattern.search(html_content) match = pattern.search(html_content)
@ -1862,8 +1859,6 @@ async def get_notice(request):
return web.Response(text="Unable to retrieve Notice", status=200) return web.Response(text="Unable to retrieve Notice", status=200)
else: else:
return web.Response(text="Unable to retrieve Notice", status=200) return web.Response(text="Unable to retrieve Notice", status=200)
finally:
conn.close()
@server.PromptServer.instance.routes.get("/manager/reboot") @server.PromptServer.instance.routes.get("/manager/reboot")